Skip to content

Commit

Permalink
Merge pull request #11448 from ptibogxiv/patch-196
Browse files Browse the repository at this point in the history
Fix paymentmethod detach
  • Loading branch information
eldy committed Jul 4, 2019
2 parents 108c7aa + 03938e2 commit 1926d43
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions htdocs/societe/paymentmodes.php
Expand Up @@ -637,6 +637,16 @@
elseif ($action == 'deletecard' && $source)
{
try {
if (preg_match('/pm_/', $source))
{
$payment_method = \Stripe\PaymentMethod::retrieve($source, ["stripe_account" => $stripeacc]);
if ($payment_method)
{
$payment_method->detach();
}
}
else
{
$cu=$stripe->customerStripe($object, $stripeacc, $servicestatus);
$card=$cu->sources->retrieve("$source");
if ($card)
Expand All @@ -645,6 +655,7 @@
if (method_exists($card, 'detach')) $card->detach();
else $card->delete();
}
}

$url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id;
header('Location: '.$url);
Expand Down

0 comments on commit 1926d43

Please sign in to comment.