changeset 5eca43eb9210 in modules/account_payment_stripe:5.0
details: 
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset;node=5eca43eb9210
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 133bab6ea595 -r 5eca43eb9210 payment.py
--- a/payment.py        Mon Jun 10 19:12:08 2019 +0200
+++ b/payment.py        Mon Jul 08 21:18:18 2019 +0200
@@ -370,6 +370,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())
@@ -429,6 +431,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'):
@@ -818,6 +822,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(
@@ -857,6 +863,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