[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) <anv@odoo.com>
This commit is contained in:
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user