diff --git a/method/errors.py b/method/errors.py index 62611e8..9e10c68 100644 --- a/method/errors.py +++ b/method/errors.py @@ -60,3 +60,10 @@ class MethodInvalidRequestError(MethodError): class MethodAuthorizationError(MethodError): pass + + +class ResourceError(TypedDict): + type: str + sub_type: str + message: str + code: str diff --git a/method/resources/Account.py b/method/resources/Account.py index 27400b3..e57357c 100644 --- a/method/resources/Account.py +++ b/method/resources/Account.py @@ -2,6 +2,7 @@ from method.resource import Resource, RequestOpts from method.configuration import Configuration +from method.errors import ResourceError from method.resources.Verification import VerificationResource @@ -60,6 +61,7 @@ class Account(TypedDict): liability: Optional[AccountLiability] clearing: Optional[AccountClearing] capabilities: List[AccountCapabilitiesLiterals] + error: Optional[ResourceError] created_at: str updated_at: str metadata: Optional[Dict[str, Any]] diff --git a/method/resources/Entity.py b/method/resources/Entity.py index 0f322d1..b1758a0 100644 --- a/method/resources/Entity.py +++ b/method/resources/Entity.py @@ -2,6 +2,7 @@ from method.resource import Resource, RequestOpts from method.configuration import Configuration +from method.errors import ResourceError EntityTypesLiterals = Literal[ @@ -76,6 +77,7 @@ class Entity(TypedDict): capabilities: List[EntityCapabilitiesLiterals] address: EntityAddress status: EntityStatusesLiterals + error: Optional[ResourceError] metadata: Optional[Dict[str, Any]] created_at: str updated_at: str diff --git a/method/resources/Payment.py b/method/resources/Payment.py index 1d17e81..cb751bc 100644 --- a/method/resources/Payment.py +++ b/method/resources/Payment.py @@ -2,6 +2,7 @@ from method.resource import Resource, RequestOpts from method.configuration import Configuration +from method.errors import ResourceError PaymentStatusesLiterals = Literal[ @@ -18,7 +19,8 @@ 'hold', 'pending', 'requested', - 'received', + 'clearing', + 'failed', 'sent', 'unknown' ] @@ -37,7 +39,7 @@ class Payment(TypedDict): description: str status: PaymentStatusesLiterals fund_status: PaymentFundStatusesLiterals - error: Optional[str] + error: Optional[ResourceError] metadata: Optional[Dict[str, Any]] estimated_completion_date: Optional[str] type: PaymentTypesLiterals diff --git a/method/resources/Verification.py b/method/resources/Verification.py index c70a93b..04c9681 100644 --- a/method/resources/Verification.py +++ b/method/resources/Verification.py @@ -2,6 +2,7 @@ from method.resource import Resource from method.configuration import Configuration +from method.errors import ResourceError VerificationStatusesLiterals = Literal[ @@ -25,6 +26,7 @@ class Verification(TypedDict): id: str status: VerificationStatusesLiterals type: VerificationTypesLiterals + error: Optional[ResourceError] initiated_at: str pending_at: str verified_at: str diff --git a/setup.py b/setup.py index 6caf701..326508e 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='method-python', - version='0.0.13', + version='0.0.14', description='Python library for the Method API', author='Marco del Carmen', author_email='marco@mdelcarmen.me',