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

        and set param for all exception with param code.

        issue9119
        review278691005
diffstat:

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

diffs (25 lines):

diff -r 83da9a0ba4f2 -r 29eb5ed773e7 payment.py
--- a/payment.py        Sun Mar 01 16:12:38 2020 +0100
+++ b/payment.py        Tue Mar 17 23:19:20 2020 +0100
@@ -584,8 +584,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])
@@ -1253,8 +1253,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