Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions method/resources/Accounts/Balances.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, Literal
from typing import List, TypedDict, Optional, Literal

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError

Expand Down Expand Up @@ -28,6 +28,9 @@ def __init__(self, config: Configuration):

def retrieve(self, bal_id: str) -> MethodResponse[AccountBalance]:
return super(AccountBalancesResource, self)._get_with_id(bal_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[AccountBalance]]:
return super(AccountBalancesResource, self)._list(params)

def create(self) -> MethodResponse[AccountBalance]:
return super(AccountBalancesResource, self)._create({})
5 changes: 4 additions & 1 deletion method/resources/Accounts/CardBrands.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, Literal, List

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError

Expand Down Expand Up @@ -32,5 +32,8 @@ def __init__(self, config: Configuration):
def retrieve(self, crbd_id: str) -> MethodResponse[AccountCardBrand]:
return super(AccountCardBrandsResource, self)._get_with_id(crbd_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[AccountCardBrand]]:
return super(AccountCardBrandsResource, self)._list(params)

def create(self) -> MethodResponse[AccountCardBrand]:
return super(AccountCardBrandsResource, self)._create({})
7 changes: 5 additions & 2 deletions method/resources/Accounts/Payoffs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, Literal
from typing import List, TypedDict, Optional, Literal

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError

Expand Down Expand Up @@ -32,5 +32,8 @@ def __init__(self, config: Configuration):
def retrieve(self, pyf_id: str) -> MethodResponse[AccountPayoff]:
return super(AccountPayoffsResource, self)._get_with_id(pyf_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[AccountPayoff]]:
return super(AccountPayoffsResource, self)._list(params)

def create(self) -> MethodResponse[AccountPayoff]:
return super(AccountPayoffsResource, self)._create({})
5 changes: 4 additions & 1 deletion method/resources/Accounts/Sensitive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, Literal, List

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError

Expand Down Expand Up @@ -52,6 +52,9 @@ def __init__(self, config: Configuration):

def retrieve(self, astv_id: str) -> MethodResponse[AccountSensitive]:
return super(AccountSensitiveResource, self)._get_with_id(astv_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[AccountSensitive]]:
return super(AccountSensitiveResource, self)._list(params)

def create(self, data: AccountSensitiveCreateOpts) -> MethodResponse[AccountSensitive]:
return super(AccountSensitiveResource, self)._create(data)
5 changes: 4 additions & 1 deletion method/resources/Accounts/VerificationSessions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, List, Literal, Union

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError
from method.resources.Accounts.ExternalTypes import PlaidBalance, PlaidTransaction, MXAccount, MXTransaction, TellerBalance, TellerTransaction
Expand Down Expand Up @@ -157,6 +157,9 @@ def create(self, opts: AccountVerificationSessionCreateOpts) -> MethodResponse[A

def retrieve(self, avs_id: str) -> MethodResponse[AccountVerificationSession]:
return super(AccountVerificationSessionResource, self)._get_with_id(avs_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[AccountVerificationSession]]:
return super(AccountVerificationSessionResource, self)._list(params)

def update(self, avs_id: str, opts: AccountVerificationSessionUpdateOpts) -> MethodResponse[AccountVerificationSession]:
return super(AccountVerificationSessionResource, self)._update_with_id(avs_id, opts)
5 changes: 4 additions & 1 deletion method/resources/Entities/Attributes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, Literal, List

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError

Expand Down Expand Up @@ -51,6 +51,9 @@ def __init__(self, config: Configuration):

def retrieve(self, attr_id: str) -> MethodResponse[EntityAttributes]:
return super(EntityAttributesResource, self)._get_with_id(attr_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[EntityAttributes]]:
return super(EntityAttributesResource, self)._list(params)

def create(self) -> MethodResponse[EntityAttributes]:
return super(EntityAttributesResource, self)._create({})
5 changes: 4 additions & 1 deletion method/resources/Entities/Connect.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, Literal, List

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError

Expand Down Expand Up @@ -28,6 +28,9 @@ def __init__(self, config: Configuration):

def retrieve(self, cxn_id: str) -> MethodResponse[EntityConnect]:
return super(EntityConnectResource, self)._get_with_id(cxn_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[EntityConnect]]:
return super(EntityConnectResource, self)._list(params)

def create(self) -> MethodResponse[EntityConnect]:
return super(EntityConnectResource, self)._create({})
5 changes: 4 additions & 1 deletion method/resources/Entities/CreditScores.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, List, Literal

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError
from method.resources.Entities.Types import EntityStatusesLiterals, CreditReportBureausLiterals
Expand Down Expand Up @@ -42,6 +42,9 @@ def __init__(self, config: Configuration):

def retrieve(self, crs_id: str) -> MethodResponse[EntityCreditScores]:
return super(EntityCreditScoresResource, self)._get_with_id(crs_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[EntityCreditScores]]:
return super(EntityCreditScoresResource, self)._list(params)

def create(self) -> MethodResponse[EntityCreditScores]:
return super(EntityCreditScoresResource, self)._create({})
5 changes: 4 additions & 1 deletion method/resources/Entities/Identities.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, Literal, List

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError
from method.resources.Entities.Types import EntityIdentityType
Expand Down Expand Up @@ -29,6 +29,9 @@ def __init__(self, config: Configuration):

def retrieve(self, identity_id: str) -> MethodResponse[EntityIdentity]:
return super(EntityIdentityResource, self)._get_with_id(identity_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[EntityIdentity]]:
return super(EntityIdentityResource, self)._list(params)

def create(self, opts: Optional[EntityIdentityType] = {}) -> MethodResponse[EntityIdentity]: # pylint: disable=dangerous-default-value
return super(EntityIdentityResource, self)._create(opts)
5 changes: 4 additions & 1 deletion method/resources/Entities/Sensitive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, List

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration

from method.resources.Entities.Types import EntityKYCAddressRecordData, EntityIdentityType
Expand All @@ -27,3 +27,6 @@ def __init__(self, config: Configuration):

def retrieve(self) -> MethodResponse[EntitySensitive]:
return super(EntitySensitiveResource, self)._get()

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[EntitySensitive]]:
return super(EntitySensitiveResource, self)._list(params)
5 changes: 4 additions & 1 deletion method/resources/Entities/VerificationSessions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TypedDict, Optional, List, Literal

from method.resource import MethodResponse, Resource
from method.resource import MethodResponse, Resource, ResourceListOpts
from method.configuration import Configuration
from method.errors import ResourceError

Expand Down Expand Up @@ -109,6 +109,9 @@ def __init__(self, config: Configuration):
def retrieve(self, verification_session_id: str) -> MethodResponse[EntityVerificationSession]:
return super(EntityVerificationSessionResource, self)._get_with_id(verification_session_id)

def list(self, params: Optional[ResourceListOpts] = None) -> MethodResponse[List[EntityVerificationSession]]:
return super(EntityVerificationSessionResource, self)._list(params)

def create(self, opts: Optional[EntityVerificationSessionCreateOpts] = {}) -> MethodResponse[EntityVerificationSession]: # pylint: disable=dangerous-default-value
return super(EntityVerificationSessionResource, self)._create(opts)

Expand Down
2 changes: 2 additions & 0 deletions method/resources/Webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class Webhook(TypedDict):
created_at: str
updated_at: str
expand_event: bool
status: str
error: Optional[object]


class WebhookCreateOpts(TypedDict):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='method-python',
version='1.1.2',
version='1.1.3',
description='Python library for the Method API',
long_description='Python library for the Method API',
long_description_content_type='text/x-rst',
Expand Down
112 changes: 112 additions & 0 deletions test/resources/Account_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from typing import List
import pytest
from method import Method
from dotenv import load_dotenv
Expand Down Expand Up @@ -256,6 +257,24 @@ def get_account_balances():
assert balances_retrieve_response == expect_results


@pytest.mark.asyncio
async def test_list_balances(setup):
test_credit_card_account = setup['test_credit_card_account']

balances_list_response = method.accounts(test_credit_card_account['id']).balances.list()

expect_results: AccountBalance = {
'id': balances_create_response['id'],
'account_id': test_credit_card_account['id'],
'status': 'completed',
'amount': 1866688,
'error': None,
'created_at': balances_list_response[0]['created_at'],
'updated_at': balances_list_response[0]['updated_at'],
}

assert balances_list_response[0] == expect_results

def test_create_card_brands(setup):
global card_brand_create_response
test_credit_card_account = setup['test_credit_card_account']
Expand Down Expand Up @@ -299,6 +318,27 @@ def test_retrieve_card_brands(setup):

assert card_retrieve_response == expect_results

@pytest.mark.asyncio
async def test_list_card_brands(setup):
test_credit_card_account = setup['test_credit_card_account']

card_brands_list_response = method.accounts(test_credit_card_account['id']).card_brands.list()

expect_results: AccountCardBrand = {
'id': card_brand_create_response['id'],
'account_id': test_credit_card_account['id'],
'network': 'visa',
'status': 'completed',
'issuer': card_brand_create_response['issuer'],
'last4': '1580',
'brands': card_brand_create_response['brands'],
'shared': False,
'error': None,
'created_at': card_brands_list_response[0]['created_at'],
'updated_at': card_brands_list_response[0]['updated_at'],
}

assert card_brands_list_response[0] == expect_results

def test_create_payoffs(setup):
global payoff_create_response
Expand Down Expand Up @@ -343,6 +383,25 @@ def get_payoff():

assert payoff_retrieve_response == expect_results

@pytest.mark.asyncio
async def test_list_payoffs(setup):
test_auto_loan_account = setup['test_auto_loan_account']

payoff_list_response = method.accounts(test_auto_loan_account['id']).payoffs.list()

expect_results: AccountPayoff = {
'id': payoff_create_response['id'],
'account_id': test_auto_loan_account['id'],
'amount': 6083988,
'per_diem_amount': None,
'term': 15,
'status': 'completed',
'error': None,
'created_at': payoff_list_response[0]['created_at'],
'updated_at': payoff_list_response[0]['updated_at'],
}

assert payoff_list_response[0] == expect_results

def test_create_account_verification_sessions(setup):
global verification_session_create
Expand Down Expand Up @@ -445,6 +504,34 @@ def get_verification_session():

assert verification_session_retrieve_response == expect_results

@pytest.mark.asyncio
async def test_list_account_verification_sessions(setup):
test_credit_card_account = setup['test_credit_card_account']

verification_sessions_list_response = method.accounts(test_credit_card_account['id']).verification_sessions.list()

expect_results: AccountVerificationSession = {
'id': verification_session_create['id'],
'account_id': test_credit_card_account['id'],
'status': 'verified',
'type': 'pre_auth',
'error': None,
'pre_auth': {
'billing_zip_code': 'xxxxx',
'billing_zip_code_check': 'pass',
'cvv': 'xxx',
'cvv_check': 'pass',
'exp_check': 'pass',
'exp_month': 'xx',
'exp_year': 'xxxx',
'number': 'xxxxxxxxxxxxxxxx',
'pre_auth_check': 'pass',
},
'created_at': verification_sessions_list_response[0]['created_at'],
'updated_at': verification_sessions_list_response[0]['updated_at'],
}

assert verification_sessions_list_response[0] == expect_results

def test_create_account_sensitive(setup):
global sensitive_data_response
Expand Down Expand Up @@ -478,6 +565,31 @@ def test_create_account_sensitive(setup):
assert sensitive_data_response == expect_results


@pytest.mark.asyncio
async def test_list_account_sensitive(setup):
test_credit_card_account = setup['test_credit_card_account']

sensitive_list_response = method.accounts(test_credit_card_account['id']).sensitive.list()

expect_results: AccountSensitive = {
'id': sensitive_data_response['id'],
'account_id': test_credit_card_account['id'],
'type': 'credit_card',
'credit_card': {
'billing_zip_code': None,
'number': '5555555555551580',
'exp_month': '03',
'exp_year': '2028',
'cvv': None
},
'status': 'completed',
'error': None,
'created_at': sensitive_list_response[0]['created_at'],
'updated_at': sensitive_list_response[0]['updated_at']
}

assert sensitive_list_response[0] == expect_results

def test_create_transaction_subscription(setup):
global create_txn_subscriptions_response
test_credit_card_account = setup['test_credit_card_account']
Expand Down
Loading
Loading