Skip to content

Commit

Permalink
feat(api): create financial account and retry microdeposits endpoints (
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and stainless-app[bot] committed Feb 21, 2024
1 parent fd78513 commit cdcef46
Show file tree
Hide file tree
Showing 16 changed files with 489 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 108
configured_endpoints: 110
3 changes: 3 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ from lithic.types import FinancialAccount, FinancialTransaction

Methods:

- <code title="post /financial_accounts">client.financial_accounts.<a href="./src/lithic/resources/financial_accounts/financial_accounts.py">create</a>(\*\*<a href="src/lithic/types/financial_account_create_params.py">params</a>) -> <a href="./src/lithic/types/financial_account.py">FinancialAccount</a></code>
- <code title="get /financial_accounts/{financial_account_token}">client.financial_accounts.<a href="./src/lithic/resources/financial_accounts/financial_accounts.py">retrieve</a>(financial_account_token) -> <a href="./src/lithic/types/financial_account.py">FinancialAccount</a></code>
- <code title="patch /financial_accounts/{financial_account_token}">client.financial_accounts.<a href="./src/lithic/resources/financial_accounts/financial_accounts.py">update</a>(financial_account_token, \*\*<a href="src/lithic/types/financial_account_update_params.py">params</a>) -> <a href="./src/lithic/types/financial_account.py">FinancialAccount</a></code>
- <code title="get /financial_accounts">client.financial_accounts.<a href="./src/lithic/resources/financial_accounts/financial_accounts.py">list</a>(\*\*<a href="src/lithic/types/financial_account_list_params.py">params</a>) -> <a href="./src/lithic/types/financial_account.py">SyncSinglePage[FinancialAccount]</a></code>
Expand Down Expand Up @@ -373,6 +374,7 @@ from lithic.types import (
ExternalBankAccountRetrieveResponse,
ExternalBankAccountUpdateResponse,
ExternalBankAccountListResponse,
ExternalBankAccountRetryMicroDepositsResponse,
)
```

Expand All @@ -382,6 +384,7 @@ Methods:
- <code title="get /external_bank_accounts/{external_bank_account_token}">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">retrieve</a>(external_bank_account_token) -> <a href="./src/lithic/types/external_bank_account_retrieve_response.py">ExternalBankAccountRetrieveResponse</a></code>
- <code title="patch /external_bank_accounts/{external_bank_account_token}">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">update</a>(external_bank_account_token, \*\*<a href="src/lithic/types/external_bank_account_update_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account_update_response.py">ExternalBankAccountUpdateResponse</a></code>
- <code title="get /external_bank_accounts">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">list</a>(\*\*<a href="src/lithic/types/external_bank_account_list_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account_list_response.py">SyncCursorPage[ExternalBankAccountListResponse]</a></code>
- <code title="post /external_bank_accounts/{external_bank_account_token}/retry_micro_deposits">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">retry_micro_deposits</a>(external_bank_account_token) -> <a href="./src/lithic/types/external_bank_account_retry_micro_deposits_response.py">ExternalBankAccountRetryMicroDepositsResponse</a></code>

## MicroDeposits

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ExternalBankAccountCreateResponse,
ExternalBankAccountUpdateResponse,
ExternalBankAccountRetrieveResponse,
ExternalBankAccountRetryMicroDepositsResponse,
external_bank_account_list_params,
external_bank_account_create_params,
external_bank_account_update_params,
Expand Down Expand Up @@ -320,7 +321,8 @@ def list(
page_size: int | NotGiven = NOT_GIVEN,
starting_after: str | NotGiven = NOT_GIVEN,
states: List[Literal["CLOSED", "ENABLED", "PAUSED"]] | NotGiven = NOT_GIVEN,
verification_states: List[Literal["ENABLED", "FAILED_VERIFICATION", "PENDING"]] | NotGiven = NOT_GIVEN,
verification_states: List[Literal["ENABLED", "FAILED_VERIFICATION", "INSUFFICIENT_FUNDS", "PENDING"]]
| NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -374,6 +376,41 @@ def list(
model=ExternalBankAccountListResponse,
)

def retry_micro_deposits(
self,
external_bank_account_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> ExternalBankAccountRetryMicroDepositsResponse:
"""
Retry external bank account micro deposit verification.
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not external_bank_account_token:
raise ValueError(
f"Expected a non-empty value for `external_bank_account_token` but received {external_bank_account_token!r}"
)
return self._post(
f"/external_bank_accounts/{external_bank_account_token}/retry_micro_deposits",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ExternalBankAccountRetryMicroDepositsResponse,
)


class AsyncExternalBankAccounts(AsyncAPIResource):
@cached_property
Expand Down Expand Up @@ -652,7 +689,8 @@ def list(
page_size: int | NotGiven = NOT_GIVEN,
starting_after: str | NotGiven = NOT_GIVEN,
states: List[Literal["CLOSED", "ENABLED", "PAUSED"]] | NotGiven = NOT_GIVEN,
verification_states: List[Literal["ENABLED", "FAILED_VERIFICATION", "PENDING"]] | NotGiven = NOT_GIVEN,
verification_states: List[Literal["ENABLED", "FAILED_VERIFICATION", "INSUFFICIENT_FUNDS", "PENDING"]]
| NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -706,6 +744,41 @@ def list(
model=ExternalBankAccountListResponse,
)

async def retry_micro_deposits(
self,
external_bank_account_token: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> ExternalBankAccountRetryMicroDepositsResponse:
"""
Retry external bank account micro deposit verification.
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not external_bank_account_token:
raise ValueError(
f"Expected a non-empty value for `external_bank_account_token` but received {external_bank_account_token!r}"
)
return await self._post(
f"/external_bank_accounts/{external_bank_account_token}/retry_micro_deposits",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ExternalBankAccountRetryMicroDepositsResponse,
)


class ExternalBankAccountsWithRawResponse:
def __init__(self, external_bank_accounts: ExternalBankAccounts) -> None:
Expand All @@ -723,6 +796,9 @@ def __init__(self, external_bank_accounts: ExternalBankAccounts) -> None:
self.list = _legacy_response.to_raw_response_wrapper(
external_bank_accounts.list,
)
self.retry_micro_deposits = _legacy_response.to_raw_response_wrapper(
external_bank_accounts.retry_micro_deposits,
)

@cached_property
def micro_deposits(self) -> MicroDepositsWithRawResponse:
Expand All @@ -745,6 +821,9 @@ def __init__(self, external_bank_accounts: AsyncExternalBankAccounts) -> None:
self.list = _legacy_response.async_to_raw_response_wrapper(
external_bank_accounts.list,
)
self.retry_micro_deposits = _legacy_response.async_to_raw_response_wrapper(
external_bank_accounts.retry_micro_deposits,
)

@cached_property
def micro_deposits(self) -> AsyncMicroDepositsWithRawResponse:
Expand All @@ -767,6 +846,9 @@ def __init__(self, external_bank_accounts: ExternalBankAccounts) -> None:
self.list = to_streamed_response_wrapper(
external_bank_accounts.list,
)
self.retry_micro_deposits = to_streamed_response_wrapper(
external_bank_accounts.retry_micro_deposits,
)

@cached_property
def micro_deposits(self) -> MicroDepositsWithStreamingResponse:
Expand All @@ -789,6 +871,9 @@ def __init__(self, external_bank_accounts: AsyncExternalBankAccounts) -> None:
self.list = async_to_streamed_response_wrapper(
external_bank_accounts.list,
)
self.retry_micro_deposits = async_to_streamed_response_wrapper(
external_bank_accounts.retry_micro_deposits,
)

@cached_property
def micro_deposits(self) -> AsyncMicroDepositsWithStreamingResponse:
Expand Down
101 changes: 100 additions & 1 deletion src/lithic/resources/financial_accounts/financial_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
import httpx

from ... import _legacy_response
from ...types import FinancialAccount, financial_account_list_params, financial_account_update_params
from ...types import (
FinancialAccount,
financial_account_list_params,
financial_account_create_params,
financial_account_update_params,
)
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import maybe_transform
from .balances import (
Expand Down Expand Up @@ -68,6 +73,47 @@ def with_raw_response(self) -> FinancialAccountsWithRawResponse:
def with_streaming_response(self) -> FinancialAccountsWithStreamingResponse:
return FinancialAccountsWithStreamingResponse(self)

def create(
self,
*,
nickname: str,
type: Literal["OPERATING"],
account_token: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> FinancialAccount:
"""
Create a new financial account
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
return self._post(
"/financial_accounts",
body=maybe_transform(
{
"nickname": nickname,
"type": type,
"account_token": account_token,
},
financial_account_create_params.FinancialAccountCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=FinancialAccount,
)

def retrieve(
self,
financial_account_token: str,
Expand Down Expand Up @@ -214,6 +260,47 @@ def with_raw_response(self) -> AsyncFinancialAccountsWithRawResponse:
def with_streaming_response(self) -> AsyncFinancialAccountsWithStreamingResponse:
return AsyncFinancialAccountsWithStreamingResponse(self)

async def create(
self,
*,
nickname: str,
type: Literal["OPERATING"],
account_token: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> FinancialAccount:
"""
Create a new financial account
Args:
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._post(
"/financial_accounts",
body=maybe_transform(
{
"nickname": nickname,
"type": type,
"account_token": account_token,
},
financial_account_create_params.FinancialAccountCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=FinancialAccount,
)

async def retrieve(
self,
financial_account_token: str,
Expand Down Expand Up @@ -343,6 +430,9 @@ class FinancialAccountsWithRawResponse:
def __init__(self, financial_accounts: FinancialAccounts) -> None:
self._financial_accounts = financial_accounts

self.create = _legacy_response.to_raw_response_wrapper(
financial_accounts.create,
)
self.retrieve = _legacy_response.to_raw_response_wrapper(
financial_accounts.retrieve,
)
Expand Down Expand Up @@ -370,6 +460,9 @@ class AsyncFinancialAccountsWithRawResponse:
def __init__(self, financial_accounts: AsyncFinancialAccounts) -> None:
self._financial_accounts = financial_accounts

self.create = _legacy_response.async_to_raw_response_wrapper(
financial_accounts.create,
)
self.retrieve = _legacy_response.async_to_raw_response_wrapper(
financial_accounts.retrieve,
)
Expand Down Expand Up @@ -397,6 +490,9 @@ class FinancialAccountsWithStreamingResponse:
def __init__(self, financial_accounts: FinancialAccounts) -> None:
self._financial_accounts = financial_accounts

self.create = to_streamed_response_wrapper(
financial_accounts.create,
)
self.retrieve = to_streamed_response_wrapper(
financial_accounts.retrieve,
)
Expand Down Expand Up @@ -424,6 +520,9 @@ class AsyncFinancialAccountsWithStreamingResponse:
def __init__(self, financial_accounts: AsyncFinancialAccounts) -> None:
self._financial_accounts = financial_accounts

self.create = async_to_streamed_response_wrapper(
financial_accounts.create,
)
self.retrieve = async_to_streamed_response_wrapper(
financial_accounts.retrieve,
)
Expand Down
4 changes: 4 additions & 0 deletions src/lithic/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
from .account_holder_update_response import AccountHolderUpdateResponse as AccountHolderUpdateResponse
from .payment_simulate_return_params import PaymentSimulateReturnParams as PaymentSimulateReturnParams
from .tokenization_simulate_response import TokenizationSimulateResponse as TokenizationSimulateResponse
from .financial_account_create_params import FinancialAccountCreateParams as FinancialAccountCreateParams
from .financial_account_update_params import FinancialAccountUpdateParams as FinancialAccountUpdateParams
from .payment_simulate_release_params import PaymentSimulateReleaseParams as PaymentSimulateReleaseParams
from .payment_simulate_return_response import PaymentSimulateReturnResponse as PaymentSimulateReturnResponse
Expand Down Expand Up @@ -152,3 +153,6 @@
from .transaction_simulate_credit_authorization_response import (
TransactionSimulateCreditAuthorizationResponse as TransactionSimulateCreditAuthorizationResponse,
)
from .external_bank_account_retry_micro_deposits_response import (
ExternalBankAccountRetryMicroDepositsResponse as ExternalBankAccountRetryMicroDepositsResponse,
)
4 changes: 2 additions & 2 deletions src/lithic/types/external_bank_account_create_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class ExternalBankAccountCreateResponse(BaseModel):
verification_attempts: int
"""The number of attempts at verification"""

verification_method: Literal["MANUAL", "MICRO_DEPOSIT", "PLAID"]
verification_method: Literal["MANUAL", "MICRO_DEPOSIT", "PLAID", "PRENOTE"]

verification_state: Literal["ENABLED", "FAILED_VERIFICATION", "PENDING"]
verification_state: Literal["ENABLED", "FAILED_VERIFICATION", "INSUFFICIENT_FUNDS", "PENDING"]

account_token: Optional[str] = None
"""Indicates which Lithic account the external account is associated with.
Expand Down
2 changes: 1 addition & 1 deletion src/lithic/types/external_bank_account_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ class ExternalBankAccountListParams(TypedDict, total=False):

states: List[Literal["CLOSED", "ENABLED", "PAUSED"]]

verification_states: List[Literal["ENABLED", "FAILED_VERIFICATION", "PENDING"]]
verification_states: List[Literal["ENABLED", "FAILED_VERIFICATION", "INSUFFICIENT_FUNDS", "PENDING"]]
4 changes: 2 additions & 2 deletions src/lithic/types/external_bank_account_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class ExternalBankAccountListResponse(BaseModel):
verification_attempts: int
"""The number of attempts at verification"""

verification_method: Literal["MANUAL", "MICRO_DEPOSIT", "PLAID"]
verification_method: Literal["MANUAL", "MICRO_DEPOSIT", "PLAID", "PRENOTE"]

verification_state: Literal["ENABLED", "FAILED_VERIFICATION", "PENDING"]
verification_state: Literal["ENABLED", "FAILED_VERIFICATION", "INSUFFICIENT_FUNDS", "PENDING"]

account_token: Optional[str] = None
"""Indicates which Lithic account the external account is associated with.
Expand Down
4 changes: 2 additions & 2 deletions src/lithic/types/external_bank_account_retrieve_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class ExternalBankAccountRetrieveResponse(BaseModel):
verification_attempts: int
"""The number of attempts at verification"""

verification_method: Literal["MANUAL", "MICRO_DEPOSIT", "PLAID"]
verification_method: Literal["MANUAL", "MICRO_DEPOSIT", "PLAID", "PRENOTE"]

verification_state: Literal["ENABLED", "FAILED_VERIFICATION", "PENDING"]
verification_state: Literal["ENABLED", "FAILED_VERIFICATION", "INSUFFICIENT_FUNDS", "PENDING"]

account_token: Optional[str] = None
"""Indicates which Lithic account the external account is associated with.
Expand Down
Loading

0 comments on commit cdcef46

Please sign in to comment.