now giving the invoice id to the payment validation page so it can validate the payment
This commit is contained in:
parent
0325f02368
commit
8a43dac46d
@ -363,7 +363,7 @@ if ($action == 'dopayment') {
|
||||
|
||||
// A redirect is added if API call successfull
|
||||
if ($source == 'conferencesubscription') {
|
||||
$PAYPAL_API_OK .= '&conferencesubscription='.dol_encode('subscriptionok'.$ref, $dolibarr_main_instance_unique_id);
|
||||
$PAYPAL_API_OK .= '&conferencesubscription='.dol_encode('subscriptionok'.$ref, $dolibarr_main_instance_unique_id).'&invoice='.dol_encode($invoice->id, $dolibarr_main_instance_unique_id);
|
||||
}
|
||||
$mesg = print_paypal_redirect($PAYPAL_API_PRICE, $PAYPAL_API_DEVISE, $PAYPAL_PAYMENT_TYPE, $PAYPAL_API_OK, $PAYPAL_API_KO, $FULLTAG);
|
||||
|
||||
@ -384,7 +384,7 @@ if ($action == 'dopayment') {
|
||||
$urlko = preg_replace('/securekey=[^&]+/', '', $urlko);
|
||||
|
||||
if ($source == 'conferencesubscription') {
|
||||
$urlok .= '&conferencesubscription='.dol_encode('subscriptionok'.$ref, $dolibarr_main_instance_unique_id);
|
||||
$urlok .= '&conferencesubscription='.dol_encode('subscriptionok'.$ref, $dolibarr_main_instance_unique_id).'&invoice='.dol_encode($invoice->id, $dolibarr_main_instance_unique_id);
|
||||
}
|
||||
|
||||
$mesg = '';
|
||||
@ -742,7 +742,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) {
|
||||
exit;
|
||||
} else {
|
||||
if ($source == 'conferencesubscription') {
|
||||
$urlok .= '&conferencesubscription='.dol_encode('subscriptionok'.$ref, $dolibarr_main_instance_unique_id);
|
||||
$urlok .= '&conferencesubscription='.dol_encode('subscriptionok'.$ref, $dolibarr_main_instance_unique_id).'&invoice='.dol_encode($invoice->id, $dolibarr_main_instance_unique_id);
|
||||
}
|
||||
header("Location: ".$urlok);
|
||||
exit;
|
||||
|
||||
@ -103,6 +103,7 @@ if (empty($FULLTAG)) {
|
||||
}
|
||||
$source = GETPOST('s', 'alpha') ? GETPOST('s', 'alpha') : GETPOST('source', 'alpha');
|
||||
$ref = GETPOST('ref');
|
||||
$invoiceref = GETPOST('invoice');
|
||||
|
||||
$suffix = GETPOST("suffix", 'aZ09');
|
||||
$membertypeid = GETPOST("membertypeid", 'int');
|
||||
@ -112,15 +113,35 @@ $uncryptedconferencesubscription = dol_decode($conferencesubscription, $dolibarr
|
||||
$subscription = substr($uncryptedconferencesubscription, 0, strlen($uncryptedconferencesubscription)-strlen($ref));
|
||||
$reffrompayment = substr($uncryptedconferencesubscription, -strlen($ref), strlen($ref));
|
||||
|
||||
// Validation of an attendee after his payment
|
||||
// After a conference attendee payment
|
||||
if ($subscription == 'subscriptionok' && $ref == $reffrompayment) {
|
||||
$attendeetovalidate = new ConferenceOrBoothAttendee($db);
|
||||
$resultattendee = $attendeetovalidate->fetch($ref);
|
||||
if ($resultattendee < 0) {
|
||||
setEventMessages(null, $attendeetovalidate->errors, "errors");
|
||||
// Looking for the invoice to which add a payment
|
||||
$paidinvoice = new Facture($db);
|
||||
$resultinvoice = $paidinvoice->fetch($invoiceref);
|
||||
if ($resultinvoice < 0) {
|
||||
setEventMessages(null, $paidinvoice->errors, "errors");
|
||||
} else {
|
||||
$attendeetovalidate->setStatut(1);
|
||||
// Creation of payment line
|
||||
$paiement = new Paiement($db);
|
||||
$paiement->datepaye = dol_now();
|
||||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
|
||||
$paiement->num_payment = GETPOST('num_paiement', 'alpha');
|
||||
$paiement->note_private = GETPOST('comment', 'alpha');
|
||||
|
||||
// Validating the attendee
|
||||
$attendeetovalidate = new ConferenceOrBoothAttendee($db);
|
||||
$resultattendee = $attendeetovalidate->fetch($ref);
|
||||
if ($resultattendee < 0) {
|
||||
setEventMessages(null, $attendeetovalidate->errors, "errors");
|
||||
} else {
|
||||
$attendeetovalidate->setStatut(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Detect $paymentmethod
|
||||
|
||||
Loading…
Reference in New Issue
Block a user