Fix paymentmethod detach

This commit is contained in:
ptibogxiv 2019-07-02 21:46:00 +02:00 committed by GitHub
parent d9560dbb61
commit 126479b5a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -637,6 +637,16 @@ if (empty($reshook))
elseif ($action == 'deletecard' && $source)
{
try {
if (preg_match('/pm_/', $source))
{
$payment_method = \Stripe\PaymentMethod::retrieve($source);
if ($payment_method)
{
$payment_method->detach();
}
}
else
{
$cu=$stripe->customerStripe($object, $stripeacc, $servicestatus);
$card=$cu->sources->retrieve("$source");
if ($card)
@ -645,6 +655,7 @@ if (empty($reshook))
if (method_exists($card, 'detach')) $card->detach();
else $card->delete();
}
}
$url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id;
header('Location: '.$url);