changeset d5b4ecf0099a in modules/account_payment_stripe:default
details: 
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset;node=d5b4ecf0099a
description:
        Allow to lock records for update

        issue8012
        review45901002
diffstat:

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

diffs (35 lines):

diff -r 7b62a95bbf5e -r d5b4ecf0099a payment.py
--- a/payment.py        Sat Jan 26 01:10:47 2019 +0100
+++ b/payment.py        Wed Jan 30 09:45:59 2019 +0100
@@ -368,6 +368,7 @@
                     or payment.journal.process_method != 'stripe'
                     or payment.state != 'processing'):
                 continue
+            payment.lock()
             try:
                 charge = stripe.Charge.create(**payment._charge_parameters())
             except (stripe.error.RateLimitError,
@@ -446,6 +447,7 @@
                     or payment.stripe_captured
                     or payment.state != 'processing'):
                 continue
+            payment.lock()
             try:
                 charge = stripe.Charge.retrieve(
                     payment.stripe_charge_id,
@@ -817,6 +819,7 @@
         for customer in customers:
             if customer.stripe_customer_id:
                 continue
+            customer.lock()
             try:
                 cu = stripe.Customer.create(
                     api_key=customer.stripe_account.secret_key,
@@ -856,6 +859,7 @@
                     ])
         for customer in customers:
             assert not customer.active
+            customer.lock()
             try:
                 cu = stripe.Customer.retrieve(
                     api_key=customer.stripe_account.secret_key,

Reply via email to