Do not always update stripe amount with amount received on payment intent succeeded

The amount received is never updated once the payment intent has been created.
So we should update the payment amount only if the amount received is less
because the payment amount may have been already reduced by refunds.

#13355
This commit is contained in:
Cédric Krier committed 2024-06-21 14:19:20 +02:00
1 parent 0c5707f0fe
commit 4216dfdc7b
1 file changed
+2 -1
+2 -1
View File
@@ -1231,7 +1231,8 @@ class Account(ModelSQL, ModelView):
Payment.proceed([payment])
payment.stripe_captured = bool(
payment_intent['amount_received'])
payment.stripe_amount = payment_intent['amount_received']
if payment.stripe_amount > payment_intent['amount_received']:
payment.stripe_amount = payment_intent['amount_received']
payment.save()
if payment.amount:
Payment.succeed([payment])