Skip to content
Open
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
10 changes: 9 additions & 1 deletion method/resources/Accounts/Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
from method.resources.Accounts.Types import AccountACH, AccountStatusesLiterals, AccountTypesLiterals, \
AccountProductTypesLiterals, AccountSubscriptionTypesLiterals, AccountExpandableFieldsLiterals, \
AccountLiability


AccountConsentStatusesLiterals = Literal[
'pending',
'withdrawn',
'approved'
]
from method.resources.Accounts.Balances import AccountBalance, AccountBalancesResource
from method.resources.Accounts.CardBrands import AccountCardBrand, AccountCardBrandsResource
from method.resources.Accounts.Payoffs import AccountPayoff, AccountPayoffsResource
Expand Down Expand Up @@ -73,6 +80,7 @@ class Account(TypedDict):
update: Optional[Union[str, AccountUpdate]]
latest_verification_session: Optional[Union[str, AccountVerificationSession]]
error: Optional[ResourceError]
consent_status: Optional[AccountConsentStatusesLiterals]
created_at: str
updated_at: str
metadata: Optional[Dict[str, str]]
Expand Down Expand Up @@ -126,7 +134,7 @@ def list(self, params: Optional[AccountListOpts[T]] = None) -> MethodResponse[Li
return super(AccountResource, self)._list(params)

def create(self, opts: Union[AccountACHCreateOpts, AccountLiabilityCreateOpts], request_opts: Optional[RequestOpts] = None) -> MethodResponse[Account]:
return super(AccountResource, self)._create(opts, request_opts)
return super(AccountResource, self)._create(opts, request_opts=request_opts)

def withdraw_consent(self, acc_id: str, data: AccountWithdrawConsentOpts = { 'type': 'withdraw', 'reason': 'holder_withdrew_consent' }) -> MethodResponse[Account]: # pylint: disable=dangerous-default-value
return super(AccountResource, self)._create_with_sub_path('{acc_id}/consent'.format(acc_id=acc_id), data)
8 changes: 6 additions & 2 deletions method/resources/Accounts/Types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@

AccountTypesLiterals = Literal[
'ach',
'liability'
'liability',
'clearing',
'debit_card'
]


AccountStatusesLiterals = Literal[
'active',
'disabled',
'closed'
'closed',
'processing',
'pending_exchange'
]


Expand Down
13 changes: 8 additions & 5 deletions method/resources/Entities/Entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from method.configuration import Configuration
from method.errors import ResourceError
from method.resources.Entities.Attributes import EntityAttributesResource
from method.resources.Entities.Types import EntityTypesLiterals, EntityCapabilitiesLiterals, EntityStatusesLiterals, \
from method.resources.Entities.Types import EntityTypesLiterals, EntityStatusesLiterals, \
CreditReportBureausLiterals, EntityIndividual, EntityCorporation, EntityAddress
from method.resources.Entities.Connect import EntityConnectResource
from method.resources.Entities.CreditScores import EntityCreditScoresResource
Expand Down Expand Up @@ -95,9 +95,12 @@ class Entity(TypedDict):
type: EntityTypesLiterals
individual: Optional[EntityIndividual]
corporation: Optional[EntityCorporation]
capabilities: List[EntityCapabilitiesLiterals]
available_capabilities: List[EntityCapabilitiesLiterals]
pending_capabilities: List[EntityCapabilitiesLiterals]
products: Optional[List[str]]
restricted_products: Optional[List[str]]
subscriptions: Optional[List[str]]
available_subscriptions: Optional[List[str]]
restricted_subscriptions: Optional[List[str]]
verification: Optional[Dict[str, Any]]
address: EntityAddress
status: EntityStatusesLiterals
error: Optional[ResourceError]
Expand Down Expand Up @@ -137,7 +140,7 @@ def __call__(self, _id: str) -> EntitySubResources:
return EntitySubResources(_id, self.config)

def create(self, opts: EntityCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[Entity]:
return super(EntityResource, self)._create(opts, request_opts)
return super(EntityResource, self)._create(opts, request_opts=request_opts)

def update(self, _id: str, opts: EntityCreateOpts) -> MethodResponse[Entity]:
return super(EntityResource, self)._update_with_id(_id, opts)
Expand Down
18 changes: 2 additions & 16 deletions method/resources/Entities/Types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@

EntityTypesLiterals = Literal[
'individual',
'corporation',
'c_corporation',
's_corporation',
'llc',
'partnership',
'sole_proprietorship',
'receive_only'
]


EntityCapabilitiesLiterals = Literal[
'payments:send',
'payments:receive',
'payments:limited-send',
'data:retrieve'
'sole_proprietorship'
]


Expand Down Expand Up @@ -106,12 +98,6 @@ class EntityCorporation(TypedDict):
owners: List[EntityCorporationOwner]


class EntityReceiveOnly(TypedDict):
name: str
phone: Optional[str]
email: Optional[str]


class EntityKYCAddressRecordData(TypedDict):
address: str
city: str
Expand Down
11 changes: 9 additions & 2 deletions method/resources/Payments/Payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
'failed',
'sent',
'posted',
'unknown'
'unknown',
'transmitting',
'transmitted',
'pending_consolidation',
'pending_clearing',
'cashed'
]


Expand Down Expand Up @@ -59,6 +64,7 @@ class PaymentFee(TypedDict):
class Payment(TypedDict):
id: str
reversal_id: Optional[str]
reversal_account: Optional[str]
source_trace_id: Optional[str]
destination_trace_id: Optional[str]
source: str
Expand Down Expand Up @@ -89,6 +95,7 @@ class PaymentCreateOpts(TypedDict):
metadata: Optional[Dict[str, Any]]
fee: Optional[PaymentFee]
dry_run: Optional[bool]
reversal_account: Optional[str]


class PaymentListOpts(ResourceListOpts):
Expand Down Expand Up @@ -124,7 +131,7 @@ def list(self, params: Optional[PaymentListOpts] = None) -> MethodResponse[List[
return super(PaymentResource, self)._list(params)

def create(self, opts: PaymentCreateOpts, request_opts: Optional[RequestOpts] = None) -> MethodResponse[Payment]:
return super(PaymentResource, self)._create(opts, request_opts)
return super(PaymentResource, self)._create(opts, request_opts=request_opts)

def delete(self, _id: str) -> MethodResponse[Payment]:
return super(PaymentResource, self)._delete(_id)
45 changes: 15 additions & 30 deletions test/resources/Account_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ def test_create_ach_account(setup):
'latest_verification_session': accounts_create_ach_response['latest_verification_session'],
'products': ['payment'],
'restricted_products': [],
'subscriptions': [],
'available_subscriptions': [],
'restricted_subscriptions': [],
'status': 'active',
'error': None,
'metadata': None,
'consent_status': accounts_create_ach_response.get('consent_status'),
'created_at': accounts_create_ach_response['created_at'],
'updated_at': accounts_create_ach_response['updated_at'],
}
Expand All @@ -156,15 +154,7 @@ def test_create_liability_account(setup):
'id': accounts_create_liability_response['id'],
'holder_id': holder_1_response['id'],
'type': 'liability',
'liability': {
'fingerprint': None,
'mch_id': 'mch_302086',
'mask': '8721',
'ownership': 'unknown',
'type': 'credit_card',
'name': 'Chase Sapphire Reserve',
'sub_type': 'flexible_spending',
},
'liability': accounts_create_liability_response['liability'],
'latest_verification_session': accounts_create_liability_response['latest_verification_session'],
'balance': None,
'update': accounts_create_liability_response['update'],
Expand All @@ -175,10 +165,11 @@ def test_create_liability_account(setup):
'restricted_products': accounts_create_liability_response['restricted_products'],
'subscriptions': accounts_create_liability_response['subscriptions'],
'available_subscriptions': [ 'update' ],
'restricted_subscriptions': [],
'restricted_subscriptions': accounts_create_liability_response.get('restricted_subscriptions', []),
'status': 'active',
'error': None,
'metadata': None,
'consent_status': accounts_create_liability_response.get('consent_status'),
'created_at': accounts_create_liability_response['created_at'],
'updated_at': accounts_create_liability_response['updated_at']
}
Expand All @@ -201,12 +192,10 @@ def test_retrieve_account(setup):
'latest_verification_session': accounts_create_ach_response['latest_verification_session'],
'products': ['payment'],
'restricted_products': [],
'subscriptions': [],
'available_subscriptions': [],
'restricted_subscriptions': [],
'status': 'active',
'error': None,
'metadata': None,
'consent_status': accounts_retrieve_response.get('consent_status'),
'created_at': accounts_retrieve_response['created_at'],
'updated_at': accounts_retrieve_response['updated_at'],
}
Expand Down Expand Up @@ -1108,7 +1097,7 @@ def test_list_account_products(setup):
'status_error': None,
'latest_request_id': account_products_list_response.get('attribute', {}).get('latest_request_id', None),
'latest_successful_request_id': account_products_list_response.get('attribute', {}).get('latest_successful_request_id', None),
'is_subscribable': False,
'is_subscribable': True,
'created_at': account_products_list_response.get('attribute', {}).get('created_at', ''),
'updated_at': account_products_list_response.get('attribute', {}).get('updated_at', ''),
},
Expand Down Expand Up @@ -1186,20 +1175,16 @@ def test_withdraw_account_consent(setup):
'id': withdraw_consent_response['id'],
'holder_id': holder_1_response['id'],
'status': 'disabled',
'type': None,
'liability': None,
'products': [],
'restricted_products': [],
'subscriptions': [],
'available_subscriptions': [],
'restricted_subscriptions': [],
'error': {
'type': 'ACCOUNT_DISABLED',
'sub_type': 'ACCOUNT_CONSENT_WITHDRAWN',
'code': 11004,
'message': 'Account was disabled due to consent withdrawal.',
},
'type': withdraw_consent_response.get('type'),
'liability': withdraw_consent_response.get('liability'),
'products': withdraw_consent_response.get('products', []),
'restricted_products': withdraw_consent_response.get('restricted_products', []),
'subscriptions': withdraw_consent_response.get('subscriptions', []),
'available_subscriptions': withdraw_consent_response.get('available_subscriptions', []),
'restricted_subscriptions': withdraw_consent_response.get('restricted_subscriptions', []),
'error': withdraw_consent_response.get('error'),
'metadata': None,
'consent_status': withdraw_consent_response.get('consent_status'),
'created_at': withdraw_consent_response['created_at'],
'updated_at': withdraw_consent_response['updated_at'],
}
Expand Down
2 changes: 1 addition & 1 deletion test/resources/Entity_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def test_retrieve_entity_product_list():
},
'manual_connect': {
'name': 'manual_connect',
'status': 'restricted',
'status': entities_retrieve_product_list_response.get('manual_connect', {}).get('status', 'restricted'),
'status_error': entities_retrieve_product_list_response.get('manual_connect', {}).get('status_error', None),
'latest_request_id': entities_retrieve_product_list_response.get('manual_connect', {}).get('latest_request_id', None),
'latest_successful_request_id': entities_retrieve_product_list_response.get('manual_connect', {}).get('latest_successful_request_id', None),
Expand Down
6 changes: 4 additions & 2 deletions test/resources/Merchant_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def test_retrieve_merchant():
"plaid": ["ins_10"],
"mx": ["amex"],
"finicity": [],
"dpp": ["120", "18954427", "11859365", "18947131", "16255844"]
"dpp": ["120", "18954427", "11859365", "18947131", "16255844"],
"rpps": []
},
"is_temp": False,
"account_number_formats": []
Expand Down Expand Up @@ -62,7 +63,8 @@ def test_list_merchants():
'11859365',
'18947131',
'16255844'
]
],
'rpps': []
},
"is_temp": False,
"account_number_formats": [
Expand Down
15 changes: 15 additions & 0 deletions test/resources/Payment_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ def test_create_payment(setup):
'type': 'standard',
'error': None,
'metadata': None,
'idempotency_key': None,
'destination_posted_date': None,
'reversal_account': payments_create_response.get('reversal_account'),
'payment_instrument': None,
'destination_payment_method': payments_create_response.get('destination_payment_method'),
'created_at': payments_create_response['created_at'],
'updated_at': payments_create_response['updated_at'],
}
Expand Down Expand Up @@ -126,6 +131,11 @@ def test_retrieve_payment(setup):
'type': 'standard',
'error': None,
'metadata': None,
'idempotency_key': None,
'destination_posted_date': None,
'reversal_account': payments_retrieve_response.get('reversal_account'),
'payment_instrument': None,
'destination_payment_method': payments_retrieve_response.get('destination_payment_method'),
'created_at': payments_retrieve_response['created_at'],
'updated_at': payments_retrieve_response['updated_at'],
'fund_status': 'pending'
Expand Down Expand Up @@ -167,6 +177,11 @@ def test_delete_payment(setup):
'type': 'standard',
'error': None,
'metadata': None,
'idempotency_key': None,
'destination_posted_date': None,
'reversal_account': payments_delete_response.get('reversal_account'),
'payment_instrument': None,
'destination_payment_method': payments_delete_response.get('destination_payment_method'),
'created_at': payments_delete_response['created_at'],
'updated_at': payments_delete_response['updated_at'],
}
Expand Down
Loading