More log to debug payment errors

This commit is contained in:
Laurent Destailleur 2021-01-21 11:50:15 +01:00
parent 79308b332b
commit d1af419d02
3 changed files with 8 additions and 5 deletions

View File

@ -105,7 +105,7 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType,
$landingPage = 'Billing';
}
dol_syslog("expresscheckout redirect with callSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum");
dol_syslog("print_paypal_redirect expresscheckout redirect with callSetExpressCheckout $paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum");
$resArray = callSetExpressCheckout(
$paymentAmount,
$currencyCodeType,
@ -127,6 +127,8 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType,
$desc
);
dol_syslog("print_paypal_redirect resArray=".var_export($resArray, true), LOG_DEBUG);
$ack = strtoupper($resArray["ACK"]);
if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING")
{
@ -134,6 +136,7 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType,
// Redirect to paypal.com here
$payPalURL = $API_Url.$token;
dol_syslog("Redirect to ".$payPalURL, LOG_INFO);
header("Location: ".$payPalURL);
exit;
} else {
@ -282,7 +285,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType,
$_SESSION["FinalPaymentAmt"] = $paymentAmount;
$_SESSION["currencyCodeType"] = $currencyCodeType;
$_SESSION["PaymentType"] = $paymentType; // 'Mark', 'Sole'
$_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; // Payer ip
$_SESSION['ipaddress'] = getUserRemoteIP(); // Payer ip
//'---------------------------------------------------------------------------------------------------------------
//' Make the API call to PayPal
@ -433,7 +436,7 @@ function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCar
$nvpstr = $nvpstr . "&CITY=" . urlencode($city);
$nvpstr = $nvpstr . "&STATE=" . urlencode($state);
$nvpstr = $nvpstr . "&COUNTRYCODE=" . urlencode($countryCode);
$nvpstr = $nvpstr . "&IPADDRESS=" . $_SERVER['REMOTE_ADDR'];
$nvpstr = $nvpstr . "&IPADDRESS=" . getUserRemotIP();
$nvpstr = $nvpstr . "&INVNUM=" . urlencode($tag);
$resArray=hash_call("DoDirectPayment", $nvpstr);

View File

@ -31,7 +31,7 @@ if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined
if (!defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1');
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// Do not use GETPOST here, function is not defined and this test must be done before including main.inc.php
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
$entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1));
if (is_numeric($entity)) define("DOLENTITY", $entity);

View File

@ -409,7 +409,7 @@ if ($ispaymentok)
$postactionmessages[] = $errmsg;
$ispostactionok = -1;
} else {
$postactionmessages[] = 'Subscription created';
$postactionmessages[] = 'Subscription created (id='.$crowid.')';
$ispostactionok = 1;
}
}