Do not create payment intent if it already exists

issue8778
review268281002
This commit is contained in:
Cédric Krier
2019-11-01 22:54:50 +01:00
parent 2f837bb4ec
commit 4f0ffbdc2e
3 changed files with 6 additions and 0 deletions
+1
View File
@@ -571,6 +571,7 @@ class Payment(CheckoutMixin, metaclass=PoolMeta):
# Use clear cache after a commit
payment = cls(payment.id)
if (payment.stripe_charge_id
or payment.stripe_payment_intent_id
or payment.journal.process_method != 'stripe'
or payment.state != 'processing'):
continue
@@ -106,6 +106,7 @@ Checkout the payment::
>>> Payment.write([payment.id], {
... 'stripe_token': token.id,
... 'stripe_chargeable': True,
... 'stripe_payment_intent_id': None, # Remove intent from checkout
... }, config.context)
Process the payment::
@@ -145,6 +146,7 @@ Create failing payment::
... )
>>> Payment.write([payment.id], {
... 'stripe_token': token.id,
... 'stripe_payment_intent_id': None, # Remove intent from checkout
... }, config.context)
>>> process_payment = Wizard('account.payment.process', [payment])
>>> process_payment.execute('process')
@@ -93,6 +93,7 @@ Create fully disputed 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])
@@ -184,6 +185,7 @@ Create partial disputed 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])
@@ -253,6 +255,7 @@ Create won disputed 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])