FIX payment not completed when using Paypal.
This commit is contained in:
parent
66b0f253b6
commit
940417efe2
@ -245,7 +245,7 @@ if (!empty($conf->paypal->enabled)) {
|
|||||||
$fulltag = $FULLTAG;
|
$fulltag = $FULLTAG;
|
||||||
$payerID = $PAYPALPAYERID;
|
$payerID = $PAYPALPAYERID;
|
||||||
// Set by newpayment.php
|
// Set by newpayment.php
|
||||||
$paymentType = $_SESSION['PaymentType'];
|
$paymentType = $_SESSION['PaymentType']; // Value can be 'Mark', 'Sole', 'Sale' for example
|
||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
// From env
|
// From env
|
||||||
@ -406,10 +406,19 @@ if ($ispaymentok) {
|
|||||||
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||||
}
|
}
|
||||||
if (empty($paymentTypeId)) {
|
if (empty($paymentTypeId)) {
|
||||||
|
dol_syslog("paymentType = ".$paymentType, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
if (empty($paymentType)) {
|
if (empty($paymentType)) {
|
||||||
$paymentType = 'CB';
|
$paymentType = 'CB';
|
||||||
}
|
}
|
||||||
|
// May return nothing when paymentType means nothing
|
||||||
|
// (for example when paymentType is 'Mark', 'Sole', 'Sale', for paypal)
|
||||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||||
|
|
||||||
|
// If previous line has returned nothing, we force to get the ID of payment of Credit Card (hard coded code 'CB').
|
||||||
|
if (empty($paymentTypeId) || $paymentTypeId < 0) {
|
||||||
|
$paymentTypeId = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment');
|
dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment');
|
||||||
@ -783,10 +792,19 @@ if ($ispaymentok) {
|
|||||||
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||||
}
|
}
|
||||||
if (empty($paymentTypeId)) {
|
if (empty($paymentTypeId)) {
|
||||||
|
dol_syslog("paymentType = ".$paymentType, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
if (empty($paymentType)) {
|
if (empty($paymentType)) {
|
||||||
$paymentType = 'CB';
|
$paymentType = 'CB';
|
||||||
}
|
}
|
||||||
|
// May return nothing when paymentType means nothing
|
||||||
|
// (for example when paymentType is 'Mark', 'Sole', 'Sale', for paypal)
|
||||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||||
|
|
||||||
|
// If previous line has returned nothing, we force to get the ID of payment of Credit Card (hard coded code 'CB').
|
||||||
|
if (empty($paymentTypeId) || $paymentTypeId < 0) {
|
||||||
|
$paymentTypeId = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||||
@ -876,12 +894,29 @@ if ($ispaymentok) {
|
|||||||
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
|
||||||
|
|
||||||
$paymentTypeId = 0;
|
$paymentTypeId = 0;
|
||||||
if ($paymentmethod == 'paybox') $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS;
|
if ($paymentmethod == 'paybox') {
|
||||||
if ($paymentmethod == 'paypal') $paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS;
|
$paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS;
|
||||||
if ($paymentmethod == 'stripe') $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
}
|
||||||
|
if ($paymentmethod == 'paypal') {
|
||||||
|
$paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS;
|
||||||
|
}
|
||||||
|
if ($paymentmethod == 'stripe') {
|
||||||
|
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||||
|
}
|
||||||
if (empty($paymentTypeId)) {
|
if (empty($paymentTypeId)) {
|
||||||
if (empty($paymentType)) $paymentType = 'CB';
|
dol_syslog("paymentType = ".$paymentType, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
|
if (empty($paymentType)) {
|
||||||
|
$paymentType = 'CB';
|
||||||
|
}
|
||||||
|
// May return nothing when paymentType means nothing
|
||||||
|
// (for example when paymentType is 'Mark', 'Sole', 'Sale', for paypal)
|
||||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||||
|
|
||||||
|
// If previous line has returned nothing, we force to get the ID of payment of Credit Card (hard coded code 'CB').
|
||||||
|
if (empty($paymentTypeId) || $paymentTypeId < 0) {
|
||||||
|
$paymentTypeId = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||||
@ -986,10 +1021,19 @@ if ($ispaymentok) {
|
|||||||
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||||
}
|
}
|
||||||
if (empty($paymentTypeId)) {
|
if (empty($paymentTypeId)) {
|
||||||
|
dol_syslog("paymentType = ".$paymentType, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
if (empty($paymentType)) {
|
if (empty($paymentType)) {
|
||||||
$paymentType = 'CB';
|
$paymentType = 'CB';
|
||||||
}
|
}
|
||||||
|
// May return nothing when paymentType means nothing
|
||||||
|
// (for example when paymentType is 'Mark', 'Sole', 'Sale', for paypal)
|
||||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||||
|
|
||||||
|
// If previous line has returned nothing, we force to get the ID of payment of Credit Card (hard coded code 'CB').
|
||||||
|
if (empty($paymentTypeId) || $paymentTypeId < 0) {
|
||||||
|
$paymentTypeId = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||||
@ -1091,10 +1135,19 @@ if ($ispaymentok) {
|
|||||||
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||||
}
|
}
|
||||||
if (empty($paymentTypeId)) {
|
if (empty($paymentTypeId)) {
|
||||||
|
dol_syslog("paymentType = ".$paymentType, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
if (empty($paymentType)) {
|
if (empty($paymentType)) {
|
||||||
$paymentType = 'CB';
|
$paymentType = 'CB';
|
||||||
}
|
}
|
||||||
|
// May return nothing when paymentType means nothing
|
||||||
|
// (for example when paymentType is 'Mark', 'Sole', 'Sale', for paypal)
|
||||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||||
|
|
||||||
|
// If previous line has returned nothing, we force to get the ID of payment of Credit Card (hard coded code 'CB').
|
||||||
|
if (empty($paymentTypeId) || $paymentTypeId < 0) {
|
||||||
|
$paymentTypeId = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||||
@ -1272,10 +1325,19 @@ if ($ispaymentok) {
|
|||||||
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS;
|
||||||
}
|
}
|
||||||
if (empty($paymentTypeId)) {
|
if (empty($paymentTypeId)) {
|
||||||
|
dol_syslog("paymentType = ".$paymentType, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
if (empty($paymentType)) {
|
if (empty($paymentType)) {
|
||||||
$paymentType = 'CB';
|
$paymentType = 'CB';
|
||||||
}
|
}
|
||||||
|
// May return nothing when paymentType means nothing
|
||||||
|
// (for example when paymentType is 'Mark', 'Sole', 'Sale', for paypal)
|
||||||
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
$paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
|
||||||
|
|
||||||
|
// If previous line has returned nothing, we force to get the ID of payment of Credit Card (hard coded code 'CB').
|
||||||
|
if (empty($paymentTypeId) || $paymentTypeId < 0) {
|
||||||
|
$paymentTypeId = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user