This commit is contained in:
Laurent Destailleur 2023-01-24 23:26:17 +01:00
parent 58043c5d5e
commit 373c8d83df
2 changed files with 7 additions and 5 deletions

View File

@ -1079,10 +1079,12 @@ abstract class CommonInvoice extends CommonObject
if ($companypaymentmode->type == 'ban') {
$sepaMode = true;
// Check into societe_rib if a payment mode for Stripe and ban payment exists
// To make a Stripe SEPA payment request, we must have the payment mode source already saved into societe_rib and retreived with ->sepaStripe
// The payment mode source is created when we create the bank account on Stripe with paymentmodes.php?action=create
$stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
}
if ($stripecard) { // Can be src_... (for sepa). Note that card_... (old card mode) or pm_... (new card mode) should not happen here.
if ($stripecard) { // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here.
$FULLTAG = 'INV=' . $this->id . '-CUS=' . $thirdparty->id;
$description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' ref=' . $this->ref;
@ -1097,7 +1099,7 @@ abstract class CommonInvoice extends CommonObject
$paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1);
$charge = new stdClass();
//erics add processing sepa is like success ?
if ($paymentintent->status === 'succeeded' || $paymentintent->status === 'processing') {
$charge->status = 'ok';
$charge->id = $paymentintent->id;
@ -1185,7 +1187,7 @@ abstract class CommonInvoice extends CommonObject
$description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG;
// TODO Save request to status pending. Done should be set with a webhook.
// @TODO LMR Save request to status pending instead of done. Done should be set with a webhook.
$db = $this->db;

View File

@ -1013,8 +1013,8 @@ class Stripe extends CommonObject
$s = new \Stripe\StripeClient($stripeacc);
// TODO Deprecated with the new Stripe API and SCA.
// TODO Replace ->create() and ->createSource() and replace with ->getSetupIntent() to get a Payment mode with $payment_method = \Stripe\PaymentMethod::retrieve($setupintent->payment_method); ?
// TODO LMR Deprecated with the new Stripe API and SCA.
// TODO LMR Replace ->create() and ->createSource() and replace with ->getSetupIntent() to then, get the Payment mode with $payment_method = \Stripe\PaymentMethod::retrieve($setupintent->payment_method); ?
$sepa = $s->sources->create($dataforcard);
if (!$sepa) {
$this->error = 'Creation of sepa_debit on Stripe has failed';