Add try catch
This commit is contained in:
parent
c0c413b219
commit
f8c15a14cf
@ -471,8 +471,9 @@ if ($ispaymentok)
|
|||||||
|
|
||||||
if (! $customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link
|
if (! $customer && $TRANSACTIONID) // Not linked to a stripe customer, we make the link
|
||||||
{
|
{
|
||||||
dol_syslog("No stripe profile found, so we add it", LOG_DEBUG, 0, '_payment');
|
dol_syslog("No stripe profile found, so we add it for TRANSACTIONID = ".$TRANSACTIONID, LOG_DEBUG, 0, '_payment');
|
||||||
|
|
||||||
|
try {
|
||||||
$ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id
|
$ch = \Stripe\Charge::retrieve($TRANSACTIONID); // contains the charge id
|
||||||
$stripecu = $ch->customer; // value 'cus_....'
|
$stripecu = $ch->customer; // value 'cus_....'
|
||||||
|
|
||||||
@ -487,6 +488,13 @@ if ($ispaymentok)
|
|||||||
$ispostactionok = -1;
|
$ispostactionok = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(Exception $e) {
|
||||||
|
$error++;
|
||||||
|
$errmsg='Failed to save customer stripe id in database ; '.$e->getMessage();
|
||||||
|
$postactionmessages[] = $errmsg;
|
||||||
|
$ispostactionok = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user