Skip to content

Commit

Permalink
Fix stripe error management
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 28, 2019
1 parent a63a6a5 commit 9ca4d65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions htdocs/public/payment/newpayment.php
Expand Up @@ -430,7 +430,7 @@
'dol_version' => DOL_VERSION,
'dol_entity' => $conf->entity,
'dol_company' => $mysoc->name, // Usefull when using multicompany
'dol_tax_num' => $taxinfo,
'dol_tax_num' => $vatnumber,
'ipaddress'=> getUserRemoteIP()
);

Expand All @@ -455,7 +455,13 @@
include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
$stripe = new Stripe($db);
$stripeacc = $stripe->getStripeAccount($service);
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
$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_ERROR, 0, '_stripe');
setEventMessages('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, null, 'errors');
}

// Create Stripe card from Token
if ($savesource) {
Expand Down
1 change: 1 addition & 0 deletions htdocs/stripe/class/stripe.class.php
Expand Up @@ -177,6 +177,7 @@ public function customerStripe(Societe $object, $key = '', $status = 0, $createi
}
catch(Exception $e)
{
// For exemple, we may have error: 'No such customer: cus_XXXXX; a similar object exists in live mode, but a test mode key was used to make this request.'
$this->error = $e->getMessage();
}
}
Expand Down

0 comments on commit 9ca4d65

Please sign in to comment.