Skip to content

Commit 99ff9d1

Browse files
committed
sdk v3
1 parent 16a4e1a commit 99ff9d1

File tree

12 files changed

+140
-213
lines changed

12 files changed

+140
-213
lines changed

method/method.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from method.resources.HealthCheck import PingResponse, HealthCheckResource
1111
from method.resources.Simulate import SimulateResource
1212
from method.resources.Events import EventResource
13+
from method.resources.CardProduct import CardProductResource
1314

1415
class Method:
1516
accounts: AccountResource
@@ -22,6 +23,7 @@ class Method:
2223
webhooks: WebhookResource
2324
healthcheck: HealthCheckResource
2425
simulate: SimulateResource
26+
card_products: CardProductResource
2527

2628
def __init__(self, opts: ConfigurationOpts = None, **kwargs: ConfigurationOpts):
2729
_opts: ConfigurationOpts = {**(opts or {}), **kwargs} # type: ignore
@@ -37,6 +39,7 @@ def __init__(self, opts: ConfigurationOpts = None, **kwargs: ConfigurationOpts):
3739
self.webhooks = WebhookResource(config)
3840
self.healthcheck = HealthCheckResource(config)
3941
self.simulate = SimulateResource(config)
40-
42+
self.card_products = CardProductResource(config)
43+
4144
def ping(self) -> MethodResponse[PingResponse]:
4245
return self.healthcheck.retrieve()

method/resource.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def finalize_response(self, request_start_time: Optional[int] = None, request_en
126126

127127
class RequestOpts(TypedDict):
128128
idempotency_key: Optional[str]
129+
prefer: Optional[str]
129130

130131

131132
class ResourceListOpts(TypedDict):
@@ -224,6 +225,8 @@ def _create(self, data: Dict, params: Optional[Dict] = None, request_opts: Optio
224225
headers = {}
225226
if request_opts and request_opts.get('idempotency_key'):
226227
headers['Idempotency-Key'] = request_opts.get('idempotency_key')
228+
if request_opts and request_opts.get('prefer'):
229+
headers['Prefer'] = request_opts.get('prefer')
227230
return self._make_request('POST', data=data, headers=headers, params=params)
228231

229232
@MethodError.catch

method/resources/Accounts/CardBrands.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66

77

88
class AccountCardBrandInfo(TypedDict):
9-
art_id: str
10-
url: str
11-
name: str
9+
id: str
10+
card_product_id: str
11+
description: str
12+
name: str
13+
issuer: str
14+
network: str
15+
type: Literal['specific', 'generic', 'in_review']
16+
url: str
1217

1318

1419
class AccountCardBrand(TypedDict):
1520
id: str
1621
account_id: str
17-
network: str
18-
issuer: str
19-
last4: str
2022
brands: List[AccountCardBrandInfo]
21-
status: Literal['completed', 'failed']
23+
status: Literal['completed', 'in_progress', 'failed']
2224
shared: bool
2325
source: Optional[Literal['method', 'network']]
2426
error: Optional[ResourceError]

method/resources/Accounts/Products.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414

1515
class AccountProduct(TypedDict):
16-
id: str
1716
name: str
1817
status: AccountProductTypeStatusLiterals
1918
status_error: Optional[ResourceError]
2019
latest_request_id: str
20+
latest_successful_request_id: Optional[str]
2121
is_subscribable: bool
2222
created_at: str
2323
updated_at: str
@@ -38,8 +38,5 @@ class AccountProductResource(Resource):
3838
def __init__(self, config: Configuration):
3939
super(AccountProductResource, self).__init__(config.add_path('products'))
4040

41-
def retrieve(self, prd_id: str) -> MethodResponse[AccountProduct]:
42-
return super(AccountProductResource, self)._get_with_id(prd_id)
43-
4441
def list(self) -> MethodResponse[AccountProductListResponse]:
4542
return super(AccountProductResource, self)._list()

method/resources/CardProduct.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from typing import TypedDict, Optional, List, Literal
2+
3+
from method.resource import MethodResponse, Resource
4+
from method.configuration import Configuration
5+
from method.errors import ResourceError
6+
7+
8+
CardProductTypeLiterals = Literal[
9+
'specific',
10+
'generic',
11+
'in_review',
12+
]
13+
14+
class CardProductBrand(TypedDict):
15+
id: str
16+
description: str
17+
network: str
18+
default_image: str
19+
20+
21+
class CardProduct(TypedDict):
22+
id: str
23+
name: str
24+
issuer: str
25+
type: CardProductTypeLiterals
26+
brands: List[CardProductBrand]
27+
error: Optional[ResourceError]
28+
created_at: str
29+
updated_at: str
30+
31+
32+
class CardProductResource(Resource):
33+
def __init__(self, config: Configuration):
34+
super(CardProduct, self).__init__(config.add_path('card_product'))
35+
36+
37+
def retrieve(self, prt_id: str) -> MethodResponse[CardProduct]:
38+
return super(CardProduct, self)._get_with_id(prt_id)
39+

method/resources/Entities/Connect.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import TypedDict, Optional, Literal, List
22

3-
from method.resource import MethodResponse, Resource, ResourceListOpts
3+
from method.resource import MethodResponse, RequestOpts, Resource, ResourceListOpts
44
from method.configuration import Configuration
55
from method.errors import ResourceError
66

@@ -40,6 +40,8 @@ class EntityConnect(TypedDict):
4040
id: str
4141
status: EntityConnectResponseStatusLiterals
4242
accounts: Optional[List[str]]
43+
requested_products: List[AccountProductsEligibleForAutomaticExecutionLiteral]
44+
requested_subscriptions: List[AccountSubscriptionsEligibleForAutomaticExecutionLiteral]
4345
error: Optional[ResourceError]
4446
created_at: str
4547
updated_at: str
@@ -74,7 +76,8 @@ def list(
7476
def create(
7577
self,
7678
opts: ConnectCreateOpts = {},
77-
params: Optional[ConnectExpandOpts] = None
79+
params: Optional[ConnectExpandOpts] = None,
80+
request_opts: Optional[RequestOpts] = None
7881
) -> MethodResponse[EntityConnect]:
79-
return super(EntityConnectResource, self)._create(data=opts, params=params)
82+
return super(EntityConnectResource, self)._create(data=opts, params=params, request_opts=request_opts)
8083

method/resources/Entities/Products.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414

1515
class EntityProduct(TypedDict):
16-
id: str
1716
name: str
1817
status: EntityProductTypeStatusLiterals
1918
status_error: Optional[ResourceError]
2019
latest_request_id: str
20+
latest_successful_request_id: Optional[str]
2121
is_subscribable: bool
2222
created_at: str
2323
updated_at: str
@@ -35,8 +35,5 @@ class EntityProductResource(Resource):
3535
def __init__(self, config: Configuration):
3636
super(EntityProductResource, self).__init__(config.add_path('products'))
3737

38-
def retrieve(self, prd_id: str) -> MethodResponse[EntityProduct]:
39-
return super(EntityProductResource, self)._get_with_id(prd_id)
40-
4138
def list(self) -> MethodResponse[EntityProductListResponse]:
4239
return super(EntityProductResource, self)._list()

method/resources/Webhook.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
'entity_verification_session.update',
3434
'connect.create',
3535
'connect.update',
36+
'connect.available',
3637
'balance.create',
3738
'balance.update',
3839
'identity.create',
@@ -41,6 +42,7 @@
4142
'account_verification_session.update',
4243
'card_brand.create',
4344
'card_brand.update',
45+
'card_brand.available',
4446
'sensitive.create',
4547
'sensitive.update',
4648
'update.create',
@@ -65,6 +67,8 @@
6567
'attribute.credit_health_payment_history.decreased',
6668
'attribute.credit_health_open_accounts.increased',
6769
'attribute.credit_health_open_accounts.decreased',
70+
'method_jwk.create',
71+
'method_jwk.update',
6872
]
6973

7074

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='1.2.5',
5+
version='2.0.0',
66
description='Python library for the Method API',
77
long_description='Python library for the Method API',
88
long_description_content_type='text/x-rst',

0 commit comments

Comments
 (0)