Skip to content

Commit 078b217

Browse files
authored
Update type definitions (#3)
1 parent 2d4818f commit 078b217

File tree

6 files changed

+18
-3
lines changed

6 files changed

+18
-3
lines changed

method/errors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,10 @@ class MethodInvalidRequestError(MethodError):
6060

6161
class MethodAuthorizationError(MethodError):
6262
pass
63+
64+
65+
class ResourceError(TypedDict):
66+
type: str
67+
sub_type: str
68+
message: str
69+
code: str

method/resources/Account.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from method.resource import Resource, RequestOpts
44
from method.configuration import Configuration
5+
from method.errors import ResourceError
56
from method.resources.Verification import VerificationResource
67

78

@@ -60,6 +61,7 @@ class Account(TypedDict):
6061
liability: Optional[AccountLiability]
6162
clearing: Optional[AccountClearing]
6263
capabilities: List[AccountCapabilitiesLiterals]
64+
error: Optional[ResourceError]
6365
created_at: str
6466
updated_at: str
6567
metadata: Optional[Dict[str, Any]]

method/resources/Entity.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from method.resource import Resource, RequestOpts
44
from method.configuration import Configuration
5+
from method.errors import ResourceError
56

67

78
EntityTypesLiterals = Literal[
@@ -76,6 +77,7 @@ class Entity(TypedDict):
7677
capabilities: List[EntityCapabilitiesLiterals]
7778
address: EntityAddress
7879
status: EntityStatusesLiterals
80+
error: Optional[ResourceError]
7981
metadata: Optional[Dict[str, Any]]
8082
created_at: str
8183
updated_at: str

method/resources/Payment.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from method.resource import Resource, RequestOpts
44
from method.configuration import Configuration
5+
from method.errors import ResourceError
56

67

78
PaymentStatusesLiterals = Literal[
@@ -18,7 +19,8 @@
1819
'hold',
1920
'pending',
2021
'requested',
21-
'received',
22+
'clearing',
23+
'failed',
2224
'sent',
2325
'unknown'
2426
]
@@ -37,7 +39,7 @@ class Payment(TypedDict):
3739
description: str
3840
status: PaymentStatusesLiterals
3941
fund_status: PaymentFundStatusesLiterals
40-
error: Optional[str]
42+
error: Optional[ResourceError]
4143
metadata: Optional[Dict[str, Any]]
4244
estimated_completion_date: Optional[str]
4345
type: PaymentTypesLiterals

method/resources/Verification.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from method.resource import Resource
44
from method.configuration import Configuration
5+
from method.errors import ResourceError
56

67

78
VerificationStatusesLiterals = Literal[
@@ -25,6 +26,7 @@ class Verification(TypedDict):
2526
id: str
2627
status: VerificationStatusesLiterals
2728
type: VerificationTypesLiterals
29+
error: Optional[ResourceError]
2830
initiated_at: str
2931
pending_at: str
3032
verified_at: str

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='method-python',
5-
version='0.0.13',
5+
version='0.0.14',
66
description='Python library for the Method API',
77
author='Marco del Carmen',
88
author_email='marco@mdelcarmen.me',

0 commit comments

Comments
 (0)