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
6 changes: 5 additions & 1 deletion method/resources/Accounts/Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from method.resources.Accounts.VerificationSessions import AccountVerificationSession, AccountVerificationSessionResource
from method.resources.Accounts.Products import AccountProduct, AccountProductResource
from method.resources.Accounts.Attributes import AccountAttributes, AccountAttributesResource
from method.resources.Accounts.PaymentInstruments import AccountPaymentInstrument, AccountPaymentInstrumentsResource

class AccountCreateOpts(TypedDict):
holder_id: str
metadata: Optional[Dict[str, Any]]
Expand Down Expand Up @@ -67,6 +69,7 @@ class Account(TypedDict):
card_brand: Optional[Union[str, AccountCardBrand]]
payoff: Optional[Union[str, AccountPayoff]]
transaction: Optional[Union[str, AccountTransaction]]
payment_instrument: Optional[Union[str, AccountPaymentInstrument]]
update: Optional[Union[str, AccountUpdate]]
latest_verification_session: Optional[Union[str, AccountVerificationSession]]
error: Optional[ResourceError]
Expand Down Expand Up @@ -94,7 +97,7 @@ class AccountSubResources:
verification_sessions: AccountVerificationSessionResource
products: AccountProductResource
attributes: AccountAttributesResource

payment_instruments: AccountPaymentInstrumentsResource

def __init__(self, _id: str, config: Configuration):
self.balances = AccountBalancesResource(config.add_path(_id))
Expand All @@ -103,6 +106,7 @@ def __init__(self, _id: str, config: Configuration):
self.sensitive = AccountSensitiveResource(config.add_path(_id))
self.subscriptions = AccountSubscriptionsResource(config.add_path(_id))
self.transactions = AccountTransactionsResource(config.add_path(_id))
self.payment_instruments = AccountPaymentInstrumentsResource(config.add_path(_id))
self.updates = AccountUpdatesResource(config.add_path(_id))
self.verification_sessions = AccountVerificationSessionResource(config.add_path(_id))
self.products = AccountProductResource(config.add_path(_id))
Expand Down
54 changes: 54 additions & 0 deletions method/resources/Accounts/PaymentInstruments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from typing import TypedDict, Optional, Literal, List, Any

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

AccountPaymentInstrumentTypesLiterals = Literal[
'card',
'network_token'
]

class AccountPaymentInstrumentCreateOpts(TypedDict):
type: AccountPaymentInstrumentTypesLiterals

class AccountPaymentInstrumentNetworkToken(TypedDict):
token: str

class AccountPaymentInstrumentCard(TypedDict):
number: str
exp_month: int
exp_year: int

AccountPaymentInstrumentStatusesLiterals = Literal[
'completed',
'in_progress',
'pending',
'failed'
]

class AccountPaymentInstrument(TypedDict):
id: str
account_id: str
type: AccountPaymentInstrumentTypesLiterals
network_token: Optional[AccountPaymentInstrumentNetworkToken]
card: Optional[AccountPaymentInstrumentCard]
chargeable: bool
status: AccountPaymentInstrumentStatusesLiterals
error: Optional[ResourceError]
created_at: str
updated_at: str


class AccountPaymentInstrumentsResource(Resource):
def __init__(self, config: Configuration):
super(AccountPaymentInstrumentsResource, self).__init__(config.add_path('payment_instruments'))

def retrieve(self, pmt_inst_id: str) -> MethodResponse[AccountPaymentInstrument]:
return super(AccountPaymentInstrumentsResource, self)._get_with_id(pmt_inst_id)

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

def create(self, data: AccountPaymentInstrumentCreateOpts) -> MethodResponse[AccountPaymentInstrument]:
return super(AccountPaymentInstrumentsResource, self)._create(data)
1 change: 1 addition & 0 deletions method/resources/Accounts/Products.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class AccountProductListResponse(TypedDict):
transactions: Optional[AccountProduct]
payoff: Optional[AccountProduct]
card_brand: Optional[AccountProduct]
payment_instruments: Optional[AccountProduct]

class AccountProductResource(Resource):
def __init__(self, config: Configuration):
Expand Down
4 changes: 2 additions & 2 deletions method/resources/Accounts/Subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


AccountSubscriptionTypesLiterals = Literal[
'transactions',
'transaction',
'update',
'update.snapshot'
]
Expand All @@ -21,7 +21,7 @@ class AccountSubscription(TypedDict):


AccountSubscriptionsResponse = TypedDict('AccountSubscriptionsResponse', {
'transactions': Optional[AccountSubscription],
'transaction': Optional[AccountSubscription],
'update': Optional[AccountSubscription],
'update.snapshot': Optional[AccountSubscription]
})
Expand Down
52 changes: 16 additions & 36 deletions method/resources/Accounts/Transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,33 @@

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


AccountCurrencyTypesLiterals = Literal[
'USD'
]


AccountTransactionStatusLiterals = Literal[
'cleared',
'auth',
'refund',
'unknown'
'pending',
'posted',
'voided',
]


class AccountTransactionMerchant(TypedDict):
name: str
category_code: str
city: str
state: str
country: str
acquirer_bin: str
acquirer_card_acceptor_id: str


class AccountTransactionNetworkData(TypedDict):
visa_merchant_id: Optional[str]
visa_merchant_name: Optional[str]
visa_store_id: Optional[str]
visa_store_name: Optional[str]


class AccountTransaction(TypedDict):
id: str
account_id: str
merchant: AccountTransactionMerchant
network: str
network_data: AccountTransactionNetworkData
descriptor: str
amount: int
currency: AccountCurrencyTypesLiterals
billing_amount: int
billing_currency: AccountCurrencyTypesLiterals
auth_amount: int
currency_code: str
transaction_amount: int
transaction_auth_amount: int
transaction_currency_code: str
merchant_category_code: str
status: AccountTransactionStatusLiterals
error: Optional[ResourceError]
transacted_at: str
posted_at: Optional[str]
voided_at: Optional[str]
original_txn_id: Optional[str]
created_at: str
updated_at: str




class AccountTransactionsResource(Resource):
Expand Down
3 changes: 2 additions & 1 deletion method/resources/Accounts/Types.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
'payoff',
'update',
'attribute',
'transactions'
'transactions',
'payment_instruments'
]


Expand Down
18 changes: 16 additions & 2 deletions method/resources/Accounts/VerificationSessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
'teller',
'standard',
'instant',
'pre_auth'
'pre_auth',
'network'
]


Expand Down Expand Up @@ -85,6 +86,13 @@ class AccountVerificationSessionPreAuth(AccountVerificationSessionInstant):
pre_auth_check: Optional[AccountVerificationPassFailLiterals]


class AccountVerificationSessionNetwork(AccountVerificationSessionInstant):
cvv: str
cvv_check: Optional[AccountVerificationPassFailLiterals]
billing_zip_code: str
billing_zip_code_check: Optional[AccountVerificationPassFailLiterals]
network_check: Optional[AccountVerificationPassFailLiterals]

class AccountVerificationSessionCreateOpts(TypedDict):
type: AccountVerificationSessionTypesLiterals

Expand Down Expand Up @@ -117,14 +125,19 @@ class AccountVerificationSessionPreAuthUpdateOpts(TypedDict):
pre_auth: AccountVerificationSessionPreAuth


class AccountVerificationSessionNetworkUpdateOpts(TypedDict):
network: AccountVerificationSessionNetwork


AccountVerificationSessionUpdateOpts = Union[
AccountVerificationSessionMicroDepositsUpdateOpts,
AccountVerificationSessionPlaidUpdateOpts,
AccountVerificationSessionMXUpdateOpts,
AccountVerificationSessionTellerUpdateOpts,
AccountVerificationSessionStandardUpdateOpts,
AccountVerificationSessionInstantUpdateOpts,
AccountVerificationSessionPreAuthUpdateOpts
AccountVerificationSessionPreAuthUpdateOpts,
AccountVerificationSessionNetworkUpdateOpts
]


Expand All @@ -144,6 +157,7 @@ class AccountVerificationSession(TypedDict):
pre_auth: Optional[AccountVerificationSessionPreAuth]
three_ds: Optional[AccountVerificationSessionThreeDS]
issuer: Optional[AccountVerificationSessionIssuer]
network: Optional[AccountVerificationSessionNetwork]
created_at: str
updated_at: str

Expand Down
20 changes: 20 additions & 0 deletions method/resources/Simulate/CreditScores.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from method.resource import MethodResponse, Resource
from method.configuration import Configuration
from typing import List, Dict, Any
from method.resources.Entities.CreditScores import EntityCreditScoresType, EntityCreditScores


class SimulateCreditScoresInstance(Resource):
def __init__(self, crs_id: str, config: Configuration):
super(SimulateCreditScoresInstance, self).__init__(config.add_path(crs_id))

def create(self, scores: List[EntityCreditScoresType]) -> MethodResponse[EntityCreditScores]:
return super(SimulateCreditScoresInstance, self)._create({"scores": scores})


class SimulateCreditScoresResource(Resource):
def __init__(self, config: Configuration):
super(SimulateCreditScoresResource, self).__init__(config.add_path('credit_scores'))

def __call__(self, crs_id: str) -> SimulateCreditScoresInstance:
return SimulateCreditScoresInstance(crs_id, self.config)
18 changes: 18 additions & 0 deletions method/resources/Simulate/Entities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from method.resource import Resource
from method.configuration import Configuration
from method.resources.Simulate.CreditScores import SimulateCreditScoresResource


class SimulateEntitySubResources:
credit_scores: SimulateCreditScoresResource

def __init__(self, _id: str, config: Configuration):
self.credit_scores = SimulateCreditScoresResource(config.add_path(_id))


class SimulateEntityResource(Resource):
def __init__(self, config: Configuration):
super(SimulateEntityResource, self).__init__(config.add_path('entities'))

def __call__(self, ent_id) -> SimulateEntitySubResources:
return SimulateEntitySubResources(ent_id, self.config)
4 changes: 4 additions & 0 deletions method/resources/Simulate/Simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
from method.resources.Simulate.Payments import SimulatePaymentResource
from method.resources.Simulate.Accounts import SimulateAccountResource
from method.resources.Simulate.Events import SimulateEventsResource
from method.resources.Simulate.Entities import SimulateEntityResource

class SimulateResource(Resource):
payments: SimulatePaymentResource
accounts: SimulateAccountResource
events: SimulateEventsResource
entities: SimulateEntityResource

def __init__(self, config: Configuration):
_config = config.add_path('simulate')
super(SimulateResource, self).__init__(_config)
self.payments = SimulatePaymentResource(_config)
self.accounts = SimulateAccountResource(_config)
self.events = SimulateEventsResource(_config)
self.entities = SimulateEntityResource(_config)

3 changes: 3 additions & 0 deletions method/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from method.resources.Simulate.Simulate import SimulateResource
from method.resources.Simulate.Transactions import SimulateTransactionsResource
from method.resources.Simulate.Payments import SimulatePaymentResource
from method.resources.Simulate.Entities import SimulateEntityResource
from method.resources.Simulate.Accounts import SimulateAccountResource
from method.resources.Simulate.CreditScores import SimulateCreditScoresResource
from method.resources.HealthCheck import PingResponse, HealthCheckResource
from method.resources.Merchant import Merchant, MerchantProviderIds, MerchantResource
from method.resources.Report import Report, ReportCreateOpts, ReportResource
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.10',
version='1.1.11',
description='Python library for the Method API',
long_description='Python library for the Method API',
long_description_content_type='text/x-rst',
Expand Down
Loading