Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/stripe/api_resources/error_object.py: 73%
11 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1from __future__ import absolute_import, division, print_function
3from stripe.util import merge_dicts
4from stripe.stripe_object import StripeObject
7class ErrorObject(StripeObject):
8 def refresh_from(
9 self,
10 values,
11 api_key=None,
12 partial=False,
13 stripe_version=None,
14 stripe_account=None,
15 last_response=None,
16 ):
17 # Unlike most other API resources, the API will omit attributes in
18 # error objects when they have a null value. We manually set default
19 # values here to facilitate generic error handling.
20 values = merge_dicts(
21 {
22 "charge": None,
23 "code": None,
24 "decline_code": None,
25 "doc_url": None,
26 "message": None,
27 "param": None,
28 "payment_intent": None,
29 "payment_method": None,
30 "setup_intent": None,
31 "source": None,
32 "type": None,
33 },
34 values,
35 )
36 return super(ErrorObject, self).refresh_from(
37 values,
38 api_key,
39 partial,
40 stripe_version,
41 stripe_account,
42 last_response,
43 )
46class OAuthErrorObject(StripeObject):
47 def refresh_from(
48 self,
49 values,
50 api_key=None,
51 partial=False,
52 stripe_version=None,
53 stripe_account=None,
54 last_response=None,
55 ):
56 # Unlike most other API resources, the API will omit attributes in
57 # error objects when they have a null value. We manually set default
58 # values here to facilitate generic error handling.
59 values = merge_dicts(
60 {"error": None, "error_description": None}, values
61 )
62 return super(OAuthErrorObject, self).refresh_from(
63 values,
64 api_key,
65 partial,
66 stripe_version,
67 stripe_account,
68 last_response,
69 )