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
(grafted from 68c907791977a33d228077bcf2c0f1acbb4fcb3f)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2024-06-21 14:19:20 +02:00
1 parent e6ecc665af
commit dfe5ce3a4b
1 file changed
+2 -1
+2 -1
View File
@@ -1290,7 +1290,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])