From 4216dfdc7b05c4bcd429097626800136e073c3b2 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 --- 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 d39fe8d1f3..f7a60410c5 100644 --- a/modules/account_payment_stripe/payment.py +++ b/modules/account_payment_stripe/payment.py @@ -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])