changeset d56c352c29f7 in modules/account_payment_stripe:5.4
details: 
https://hg.tryton.org/modules/account_payment_stripe?cmd=changeset;node=d56c352c29f7
description:
        Always set error code

        and set param for all exception with param code.

        issue9119
        review278691005
        (grafted from 29eb5ed773e770c1cc0627e0d343fdc2da254763)
diffstat:

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

diffs (25 lines):

diff -r 92d724f1d07c -r d56c352c29f7 payment.py
--- a/payment.py        Mon Mar 09 18:35:06 2020 +0100
+++ b/payment.py        Tue Mar 17 23:19:20 2020 +0100
@@ -593,8 +593,8 @@
                     logger.warning(str(e))
                     continue
                 payment.stripe_error_message = str(e)
-                if isinstance(e, stripe.error.CardError):
-                    payment.stripe_error_code = e.code
+                payment.stripe_error_code = e.code
+                if isinstance(e, stripe.error.StripeErrorWithParamCode):
                     payment.stripe_error_param = e.param
                 payment.save()
                 cls.fail([payment])
@@ -1262,8 +1262,8 @@
                     logger.warning(str(e))
                     continue
                 customer.stripe_error_message = str(e)
-                if isinstance(e, stripe.error.CardError):
-                    customer.stripe_error_code = e.code
+                customer.stripe_error_code = e.code
+                if isinstance(e, stripe.error.StripeErrorWithParamCode):
                     customer.stripe_error_param = e.param
                 customer.stripe_token = None
             except Exception:

Reply via email to