At the payment page on odoo 15. If i change delivery method to another one
Even the total amount in summary cart was already changed. But when i select a payment method (for example Stripe) and l click "pay now" it direct to Stripe payment gateway page and total amount was sent to Stripe incorrectly. It sent total amount that before i changed delivery method. If i make the payment, the sale order couldn't confirm.
Another scenario, after i change delivery method and then i refresh the payment page, and then select Stripe, click "pay now" the total amount is sent to Stripe correctly, and sale order can confirm.
I think after change delivery method, the txContext object hadn't update. When click "Pay Now" it still get old amount . This is code in odoo 15 prepare parameter before submit payment.
_prepareTransactionRouteParams: function (provider, paymentOptionId, flow) {
return {
'payment_option_id': paymentOptionId,
'reference_prefix': this.txContext.referencePrefix,
'amount': this.txContext.amount !== undefined
? parseFloat(this.txContext.amount) : null,
'currency_id': this.txContext.currencyId
? parseInt(this.txContext.currencyId) : null,
'partner_id': parseInt(this.txContext.partnerId),
'invoice_id': this.txContext.invoiceId
? parseInt(this.txContext.invoiceId) : null,
'flow': flow,
'tokenization_requested': this.txContext.tokenizationRequested,
'landing_route': this.txContext.landingRoute,
'is_validation': this.txContext.isValidation,
'access_token': this.txContext.accessToken
? this.txContext.accessToken : undefined,
'csrf_token': core.csrf_token,
};
},