Fix log
This commit is contained in:
parent
fde8d2865f
commit
4b7655b784
@ -356,7 +356,7 @@ $mesg = '';
|
||||
|
||||
// Action dopayment is called after clicking/choosing the payment mode
|
||||
if ($action == 'dopayment') {
|
||||
dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
if ($paymentmethod == 'paypal') {
|
||||
$PAYPAL_API_PRICE = price2num(GETPOST("newamount", 'alpha'), 'MT');
|
||||
@ -493,9 +493,9 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
$amountstripe = $amountstripe * 100;
|
||||
}
|
||||
|
||||
dol_syslog("--- newpayment.php Execute action = ".$action." STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION'), LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("GET=".var_export($_GET, true), LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("POST=".var_export($_POST, true), LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("--- newpayment.php Execute action = ".$action." STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION'), LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("GET=".var_export($_GET, true), LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("POST=".var_export($_POST, true), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$stripeToken = GETPOST("stripeToken", 'alpha');
|
||||
$email = GETPOST("email", 'alpha');
|
||||
@ -505,10 +505,10 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
$vatnumber = GETPOST('vatnumber', 'alpha');
|
||||
$savesource = GETPOSTISSET('savesource') ? GETPOST('savesource', 'int') : 1;
|
||||
|
||||
dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("POST thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("POST thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$error = 0;
|
||||
$errormessage = '';
|
||||
@ -529,7 +529,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
}
|
||||
|
||||
if ($thirdparty_id > 0) {
|
||||
dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
@ -548,7 +548,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
|
||||
if (empty($customer)) {
|
||||
$error++;
|
||||
dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERR, 0, '_stripe');
|
||||
dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERR, 0, '_payment');
|
||||
setEventMessages('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
@ -563,7 +563,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
|
||||
if (empty($card)) {
|
||||
$error++;
|
||||
dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog('Failed to create card record', LOG_WARNING, 0, '_payment');
|
||||
setEventMessages('Failed to create card record', null, 'errors');
|
||||
$action = '';
|
||||
} else {
|
||||
@ -577,7 +577,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
$metadata["dol_type"] = $dol_type;
|
||||
}
|
||||
|
||||
dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_payment');
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
'amount' => price2num($amountstripe, 'MU'),
|
||||
'currency' => $currency,
|
||||
@ -591,7 +591,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
|
||||
if (empty($charge)) {
|
||||
$error++;
|
||||
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_payment');
|
||||
setEventMessages('Failed to charge card', null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
@ -609,7 +609,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
if (empty($vatcleaned)) $taxinfo=null;
|
||||
*/
|
||||
|
||||
dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_payment');
|
||||
|
||||
$customer = \Stripe\Customer::create(array(
|
||||
'email' => $email,
|
||||
@ -646,7 +646,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
|
||||
// The customer was just created with a source, so we can make a charge
|
||||
// with no card defined, the source just used for customer creation will be used.
|
||||
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Create charge", LOG_DEBUG, 0, '_payment');
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
'customer' => $customer->id,
|
||||
'amount' => price2num($amountstripe, 'MU'),
|
||||
@ -659,7 +659,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
|
||||
if (empty($charge)) {
|
||||
$error++;
|
||||
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_payment');
|
||||
setEventMessages('Failed to charge card', null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
@ -678,21 +678,21 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
|
||||
$error++;
|
||||
$errormessage = "ErrorCard ".$e->getMessage()." err=".var_export($err, true);
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
} catch (\Stripe\Error\RateLimit $e) {
|
||||
// Too many requests made to the API too quickly
|
||||
$error++;
|
||||
$errormessage = "ErrorRateLimit ".$e->getMessage();
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
} catch (\Stripe\Error\InvalidRequest $e) {
|
||||
// Invalid parameters were supplied to Stripe's API
|
||||
$error++;
|
||||
$errormessage = "ErrorInvalidRequest ".$e->getMessage();
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
} catch (\Stripe\Error\Authentication $e) {
|
||||
@ -700,14 +700,14 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
// (maybe you changed API keys recently)
|
||||
$error++;
|
||||
$errormessage = "ErrorAuthentication ".$e->getMessage();
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
} catch (\Stripe\Error\ApiConnection $e) {
|
||||
// Network communication with Stripe failed
|
||||
$error++;
|
||||
$errormessage = "ErrorApiConnection ".$e->getMessage();
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
} catch (\Stripe\Error\Base $e) {
|
||||
@ -715,14 +715,14 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
// yourself an email
|
||||
$error++;
|
||||
$errormessage = "ErrorBase ".$e->getMessage();
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
} catch (Exception $e) {
|
||||
// Something else happened, completely unrelated to Stripe
|
||||
$error++;
|
||||
$errormessage = "ErrorException ".$e->getMessage();
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
@ -757,7 +757,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
} catch (Exception $e) {
|
||||
$error++;
|
||||
$errormessage = "CantRetrievePaymentIntent ".$e->getMessage();
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($e->getMessage(), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
@ -765,13 +765,13 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
if ($paymentintent->status != 'succeeded') {
|
||||
$error++;
|
||||
$errormessage = "StatusOfRetrievedIntent is not succeeded: ".$paymentintent->status;
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
|
||||
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
|
||||
setEventMessages($paymentintent->status, null, 'errors');
|
||||
$action = '';
|
||||
} else {
|
||||
// TODO We can also record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method
|
||||
// Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here.
|
||||
//dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe');
|
||||
//dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_payment');
|
||||
|
||||
// Get here amount and currency used for payment and force value into $amount and $currency so the real amount is saved into session instead
|
||||
// of the amount and currency retreived from the POST.
|
||||
@ -801,11 +801,11 @@ if ($action == 'charge' && isModEnabled('stripe')) {
|
||||
$_SESSION['TRANSACTIONID'] = (is_object($charge) ? $charge->id : (is_object($paymentintent) ? $paymentintent->id : ''));
|
||||
$_SESSION['errormessage'] = $errormessage;
|
||||
|
||||
dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("error=".$error." errormessage=".$errormessage, LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Now call the redirect to paymentok or paymentko, URL = ".($error ? $urlko : $urlok), LOG_DEBUG, 0, '_stripe');
|
||||
dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("error=".$error." errormessage=".$errormessage, LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("Now call the redirect to paymentok or paymentko, URL = ".($error ? $urlko : $urlok), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
if ($error) {
|
||||
header("Location: ".$urlko);
|
||||
@ -834,6 +834,8 @@ $conf->dol_hide_leftmenu = 1;
|
||||
$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
|
||||
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea);
|
||||
|
||||
dol_syslog("newpayment.php show page paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
// Check link validity
|
||||
if ($source && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', 'donation_ref', ''))) {
|
||||
$langs->load("errors");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user