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
|
// A redirect is added if API call successfull
|
||||||
if ($source == 'conferencesubscription') {
|
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);
|
$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);
|
$urlko = preg_replace('/securekey=[^&]+/', '', $urlko);
|
||||||
|
|
||||||
if ($source == 'conferencesubscription') {
|
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 = '';
|
$mesg = '';
|
||||||
@ -742,7 +742,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) {
|
|||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
if ($source == 'conferencesubscription') {
|
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);
|
header("Location: ".$urlok);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -103,6 +103,7 @@ if (empty($FULLTAG)) {
|
|||||||
}
|
}
|
||||||
$source = GETPOST('s', 'alpha') ? GETPOST('s', 'alpha') : GETPOST('source', 'alpha');
|
$source = GETPOST('s', 'alpha') ? GETPOST('s', 'alpha') : GETPOST('source', 'alpha');
|
||||||
$ref = GETPOST('ref');
|
$ref = GETPOST('ref');
|
||||||
|
$invoiceref = GETPOST('invoice');
|
||||||
|
|
||||||
$suffix = GETPOST("suffix", 'aZ09');
|
$suffix = GETPOST("suffix", 'aZ09');
|
||||||
$membertypeid = GETPOST("membertypeid", 'int');
|
$membertypeid = GETPOST("membertypeid", 'int');
|
||||||
@ -112,8 +113,24 @@ $uncryptedconferencesubscription = dol_decode($conferencesubscription, $dolibarr
|
|||||||
$subscription = substr($uncryptedconferencesubscription, 0, strlen($uncryptedconferencesubscription)-strlen($ref));
|
$subscription = substr($uncryptedconferencesubscription, 0, strlen($uncryptedconferencesubscription)-strlen($ref));
|
||||||
$reffrompayment = substr($uncryptedconferencesubscription, -strlen($ref), 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) {
|
if ($subscription == 'subscriptionok' && $ref == $reffrompayment) {
|
||||||
|
// 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 {
|
||||||
|
// 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);
|
$attendeetovalidate = new ConferenceOrBoothAttendee($db);
|
||||||
$resultattendee = $attendeetovalidate->fetch($ref);
|
$resultattendee = $attendeetovalidate->fetch($ref);
|
||||||
if ($resultattendee < 0) {
|
if ($resultattendee < 0) {
|
||||||
@ -121,6 +138,10 @@ if ($subscription == 'subscriptionok' && $ref == $reffrompayment) {
|
|||||||
} else {
|
} else {
|
||||||
$attendeetovalidate->setStatut(1);
|
$attendeetovalidate->setStatut(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect $paymentmethod
|
// Detect $paymentmethod
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user