From 31fa8ffc25a6ecaf01cd88b316717b679db18598 Mon Sep 17 00:00:00 2001 From: "Louis (loti)" Date: Fri, 2 Feb 2024 10:01:59 +0100 Subject: [PATCH] [FIX] payment_stripe: fix express checkout total amount computation The total amount is computed by adding the order amount and the delivery amount. The order amount was provided as a string, and the computation didn't convert it to a number before adding it to the delivery amount. As a result, the amounts were concatenated instead of added, yielding an incorrect result. opw-3614909 opw-3664682 closes odoo/odoo#152416 Signed-off-by: Antoine Vandevenne (anv) --- .../payment_stripe/static/src/js/express_checkout_form.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/payment_stripe/static/src/js/express_checkout_form.js b/addons/payment_stripe/static/src/js/express_checkout_form.js index bd62412ae81..531981b4187 100644 --- a/addons/payment_stripe/static/src/js/express_checkout_form.js +++ b/addons/payment_stripe/static/src/js/express_checkout_form.js @@ -20,12 +20,11 @@ paymentExpressCheckoutForm.include({ */ _getOrderDetails(deliveryAmount) { const pending = this.paymentContext['shippingInfoRequired'] && deliveryAmount === undefined; - const amount = deliveryAmount ? parseInt(this.paymentContext['minorAmount'] + deliveryAmount) - : parseInt(this.paymentContext['minorAmount']); + const minorAmount = parseInt(this.paymentContext['minorAmount']) const displayItems = [ { label: _t("Your order"), - amount: parseInt(this.paymentContext['minorAmount']), + amount: minorAmount, }, ]; if (this.paymentContext['shippingInfoRequired'] && deliveryAmount !== undefined) { @@ -37,7 +36,7 @@ paymentExpressCheckoutForm.include({ return { total: { label: this.paymentContext['merchantName'], - amount: amount, + amount: minorAmount + (deliveryAmount ?? 0), // Delay the display of the amount until the shipping price is retrieved. pending: pending, },