From 736a6f19a5c5c59bdf29e42ce98e38dfe3268a5e Mon Sep 17 00:00:00 2001 From: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:19:28 +0100 Subject: [PATCH] resolve the issue with changes of payment method (#3976) Signed-off-by: Cy Okeke --- .../Implementations/StripePaymentService.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Core/Services/Implementations/StripePaymentService.cs b/src/Core/Services/Implementations/StripePaymentService.cs index 2fd1d72373..a0ab2378be 100644 --- a/src/Core/Services/Implementations/StripePaymentService.cs +++ b/src/Core/Services/Implementations/StripePaymentService.cs @@ -845,16 +845,20 @@ public class StripePaymentService : IPaymentService { try { - if (chargeNow) + if (!isPm5864DollarThresholdEnabled && !invoiceNow) { - paymentIntentClientSecret = await PayInvoiceAfterSubscriptionChangeAsync(subscriber, invoice); - } - else - { - invoice = await _stripeAdapter.InvoiceFinalizeInvoiceAsync(subResponse.LatestInvoiceId, - new InvoiceFinalizeOptions { AutoAdvance = false, }); - await _stripeAdapter.InvoiceSendInvoiceAsync(invoice.Id, new InvoiceSendOptions()); - paymentIntentClientSecret = null; + if (chargeNow) + { + paymentIntentClientSecret = + await PayInvoiceAfterSubscriptionChangeAsync(subscriber, invoice); + } + else + { + invoice = await _stripeAdapter.InvoiceFinalizeInvoiceAsync(subResponse.LatestInvoiceId, + new InvoiceFinalizeOptions { AutoAdvance = false, }); + await _stripeAdapter.InvoiceSendInvoiceAsync(invoice.Id, new InvoiceSendOptions()); + paymentIntentClientSecret = null; + } } } catch