[FIX] payment_stripe: don't show button when there is nothing to pay

When applying a coupon, the amount can be totally covered, with nothing
left to pay. Express Checkout buttons should not be shown in that case.

After this commit, Stripe's Express Checkout buttons will not be shown
if the amount is not defined.

opw-3427969

closes odoo/odoo#130450

X-original-commit: 87e24d16c3dde8ab03d7c966b532f75a8c40ac30
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
This commit is contained in:
Valentin Chevalier
2023-08-02 14:41:26 +02:00
parent 360915b3f0
commit 8d8637453e
@@ -50,7 +50,12 @@ paymentExpressCheckoutForm.include({
* @return {Promise}
*/
async _prepareExpressCheckoutForm(providerData) {
if (providerData.providerCode !== 'stripe') {
/*
* When applying a coupon, the amount can be totally covered, with nothing left to pay. In
* that case, the check is whether the variable is defined because the server doesn't send
* the value when it equals '0'.
*/
if (providerData.providerCode !== 'stripe' || !this.txContext.amount) {
return this._super(...arguments);
}