From 3715b5cee82d9a7dd5efe8f9da91f3be04488328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 1 Nov 2019 23:00:05 +0100 Subject: [PATCH] Create charge with token only if chargeable issue8777 review288331002 --- payment.py | 3 ++- tests/scenario_account_payment_stripe.rst | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/payment.py b/payment.py index 7dc3ce3099..7c9c1174db 100644 --- a/payment.py +++ b/payment.py @@ -577,7 +577,8 @@ class Payment(CheckoutMixin, metaclass=PoolMeta): continue payment.lock() try: - if payment.stripe_token or payment.stripe_customer_source: + if ((payment.stripe_token and payment.stripe_chargeable) + or payment.stripe_customer_source): create_charge(payment) elif payment.stripe_customer_payment_method: create_payment_intent(payment) diff --git a/tests/scenario_account_payment_stripe.rst b/tests/scenario_account_payment_stripe.rst index 63d202568c..d54c0fde76 100644 --- a/tests/scenario_account_payment_stripe.rst +++ b/tests/scenario_account_payment_stripe.rst @@ -146,6 +146,7 @@ Create failing payment:: ... ) >>> Payment.write([payment.id], { ... 'stripe_token': token.id, + ... 'stripe_chargeable': True, ... 'stripe_payment_intent_id': None, # Remove intent from checkout ... }, config.context) >>> process_payment = Wizard('account.payment.process', [payment])