Create charge with token only if chargeable

issue8777
review288331002
This commit is contained in:
Cédric Krier
2019-11-01 23:00:05 +01:00
parent 4f0ffbdc2e
commit 3715b5cee8
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -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)
@@ -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])