changeset 46cd580b3806 in modules/account_payment_stripe:4.8
details:
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset;node=46cd580b3806
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 e27dd9d35694 -r 46cd580b3806 payment.py
--- a/payment.py Mon Jun 10 19:12:30 2019 +0200
+++ b/payment.py Mon Jul 08 21:18:18 2019 +0200
@@ -375,6 +375,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())
@@ -434,6 +436,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'):
@@ -823,6 +827,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(
@@ -862,6 +868,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(