Create charge with token only if chargeable
issue8777 review288331002
This commit is contained in:
+2
-1
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user