changeset ee0f10c7d6ea in modules/account_payment_stripe:4.6
details: 
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset;node=ee0f10c7d6ea
description:
        Use clear cache after a commit

        issue8449
        review251651002
        (grafted from 3678b90342290281f4fd42ad78af7b9a5ea17c66)
diffstat:

 payment.py |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (39 lines):

diff -r 542aae6142dc -r ee0f10c7d6ea payment.py
--- a/payment.py        Mon Jun 10 19:12:49 2019 +0200
+++ b/payment.py        Mon Jul 08 21:18:18 2019 +0200
@@ -313,6 +313,8 @@
                     ('stripe_charge_id', '=', None),
                     ])
         for payment in payments:
+            # Use clear cache after a commit
+            payment = cls(payment.id)
             cls.__lock([payment])
             try:
                 charge = stripe.Charge.create(**payment._charge_parameters())
@@ -369,6 +371,8 @@
         The transaction is committed after each payment capture.
         """
         for payment in payments:
+            # Use clear cache after a commit
+            payment = cls(payment.id)
             if (not payment.stripe_charge_id
                     or payment.stripe_captured
                     or payment.state != 'processing'):
@@ -686,6 +690,8 @@
                         ],
                     ])
         for customer in customers:
+            # Use clear cache after a commit
+            customer = cls(customer.id)
             assert not customer.stripe_customer_id
             try:
                 cu = stripe.Customer.create(
@@ -725,6 +731,8 @@
                     ('stripe_customer_id', '!=', None),
                     ])
         for customer in customers:
+            # Use clear cache after a commit
+            customer = cls(customer.id)
             assert not customer.active
             try:
                 cu = stripe.Customer.retrieve(

Reply via email to