From dfe5ce3a4b5f243d56964c79e7f94f8b9af6d89e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 21 Jun 2024 14:19:20 +0200 Subject: [PATCH] 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 --- modules/account_payment_stripe/payment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/account_payment_stripe/payment.py b/modules/account_payment_stripe/payment.py index a1a097d498..f6615933a4 100644 --- a/modules/account_payment_stripe/payment.py +++ b/modules/account_payment_stripe/payment.py @@ -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])