Skip to content

Commit 8434d72

Browse files
feat(api): add set_verification_method to external_bank_accounts
1 parent 0f380a8 commit 8434d72

6 files changed

Lines changed: 251 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 189
1+
configured_endpoints: 190
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-28c9b43d3182bf0e1c9635f6100e4995a744724db1edd635cfd3fc7702ced68c.yml
33
openapi_spec_hash: aba00a65f877c5095499d9d1a66b5e5f
4-
config_hash: 5eca052bb23d273fa970eac3127dd919
4+
config_hash: ac8326134e692f3f3bdec82396bbec80

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ Methods:
577577
- <code title="get /v1/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>
578578
- <code title="post /v1/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_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account_retry_micro_deposits_response.py">ExternalBankAccountRetryMicroDepositsResponse</a></code>
579579
- <code title="post /v1/external_bank_accounts/{external_bank_account_token}/retry_prenote">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">retry_prenote</a>(external_bank_account_token, \*\*<a href="src/lithic/types/external_bank_account_retry_prenote_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account.py">ExternalBankAccount</a></code>
580+
- <code title="post /v1/external_bank_accounts/{external_bank_account_token}/set_verification_method">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">set_verification_method</a>(external_bank_account_token, \*\*<a href="src/lithic/types/external_bank_account_set_verification_method_params.py">params</a>) -> <a href="./src/lithic/types/external_bank_account.py">ExternalBankAccount</a></code>
580581
- <code title="post /v1/external_bank_accounts/{external_bank_account_token}/unpause">client.external_bank_accounts.<a href="./src/lithic/resources/external_bank_accounts/external_bank_accounts.py">unpause</a>(external_bank_account_token) -> <a href="./src/lithic/types/external_bank_account.py">ExternalBankAccount</a></code>
581582

582583
## MicroDeposits

src/lithic/resources/external_bank_accounts/external_bank_accounts.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
external_bank_account_update_params,
1818
external_bank_account_retry_prenote_params,
1919
external_bank_account_retry_micro_deposits_params,
20+
external_bank_account_set_verification_method_params,
2021
)
2122
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
2223
from ..._utils import path_template, required_args, maybe_transform, async_maybe_transform
@@ -644,6 +645,60 @@ def retry_prenote(
644645
cast_to=ExternalBankAccount,
645646
)
646647

648+
def set_verification_method(
649+
self,
650+
external_bank_account_token: str,
651+
*,
652+
verification_method: Literal["MICRO_DEPOSIT", "PRENOTE", "EXTERNALLY_VERIFIED"],
653+
financial_account_token: str | Omit = omit,
654+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
655+
# The extra values given here take precedence over values defined on the client or passed to this method.
656+
extra_headers: Headers | None = None,
657+
extra_query: Query | None = None,
658+
extra_body: Body | None = None,
659+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
660+
) -> ExternalBankAccount:
661+
"""Update the verification method for an external bank account.
662+
663+
Verification method
664+
can only be updated if the `verification_state` is `PENDING`.
665+
666+
Args:
667+
verification_method: The verification method to set for the external bank account
668+
669+
financial_account_token: The financial account token of the operating account to fund the micro deposits.
670+
Required when verification_method is MICRO_DEPOSIT or PRENOTE.
671+
672+
extra_headers: Send extra headers
673+
674+
extra_query: Add additional query parameters to the request
675+
676+
extra_body: Add additional JSON properties to the request
677+
678+
timeout: Override the client-level default timeout for this request, in seconds
679+
"""
680+
if not external_bank_account_token:
681+
raise ValueError(
682+
f"Expected a non-empty value for `external_bank_account_token` but received {external_bank_account_token!r}"
683+
)
684+
return self._post(
685+
path_template(
686+
"/v1/external_bank_accounts/{external_bank_account_token}/set_verification_method",
687+
external_bank_account_token=external_bank_account_token,
688+
),
689+
body=maybe_transform(
690+
{
691+
"verification_method": verification_method,
692+
"financial_account_token": financial_account_token,
693+
},
694+
external_bank_account_set_verification_method_params.ExternalBankAccountSetVerificationMethodParams,
695+
),
696+
options=make_request_options(
697+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
698+
),
699+
cast_to=ExternalBankAccount,
700+
)
701+
647702
def unpause(
648703
self,
649704
external_bank_account_token: str,
@@ -1281,6 +1336,60 @@ async def retry_prenote(
12811336
cast_to=ExternalBankAccount,
12821337
)
12831338

1339+
async def set_verification_method(
1340+
self,
1341+
external_bank_account_token: str,
1342+
*,
1343+
verification_method: Literal["MICRO_DEPOSIT", "PRENOTE", "EXTERNALLY_VERIFIED"],
1344+
financial_account_token: str | Omit = omit,
1345+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1346+
# The extra values given here take precedence over values defined on the client or passed to this method.
1347+
extra_headers: Headers | None = None,
1348+
extra_query: Query | None = None,
1349+
extra_body: Body | None = None,
1350+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1351+
) -> ExternalBankAccount:
1352+
"""Update the verification method for an external bank account.
1353+
1354+
Verification method
1355+
can only be updated if the `verification_state` is `PENDING`.
1356+
1357+
Args:
1358+
verification_method: The verification method to set for the external bank account
1359+
1360+
financial_account_token: The financial account token of the operating account to fund the micro deposits.
1361+
Required when verification_method is MICRO_DEPOSIT or PRENOTE.
1362+
1363+
extra_headers: Send extra headers
1364+
1365+
extra_query: Add additional query parameters to the request
1366+
1367+
extra_body: Add additional JSON properties to the request
1368+
1369+
timeout: Override the client-level default timeout for this request, in seconds
1370+
"""
1371+
if not external_bank_account_token:
1372+
raise ValueError(
1373+
f"Expected a non-empty value for `external_bank_account_token` but received {external_bank_account_token!r}"
1374+
)
1375+
return await self._post(
1376+
path_template(
1377+
"/v1/external_bank_accounts/{external_bank_account_token}/set_verification_method",
1378+
external_bank_account_token=external_bank_account_token,
1379+
),
1380+
body=await async_maybe_transform(
1381+
{
1382+
"verification_method": verification_method,
1383+
"financial_account_token": financial_account_token,
1384+
},
1385+
external_bank_account_set_verification_method_params.ExternalBankAccountSetVerificationMethodParams,
1386+
),
1387+
options=make_request_options(
1388+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1389+
),
1390+
cast_to=ExternalBankAccount,
1391+
)
1392+
12841393
async def unpause(
12851394
self,
12861395
external_bank_account_token: str,
@@ -1342,6 +1451,9 @@ def __init__(self, external_bank_accounts: ExternalBankAccounts) -> None:
13421451
self.retry_prenote = _legacy_response.to_raw_response_wrapper(
13431452
external_bank_accounts.retry_prenote,
13441453
)
1454+
self.set_verification_method = _legacy_response.to_raw_response_wrapper(
1455+
external_bank_accounts.set_verification_method,
1456+
)
13451457
self.unpause = _legacy_response.to_raw_response_wrapper(
13461458
external_bank_accounts.unpause,
13471459
)
@@ -1373,6 +1485,9 @@ def __init__(self, external_bank_accounts: AsyncExternalBankAccounts) -> None:
13731485
self.retry_prenote = _legacy_response.async_to_raw_response_wrapper(
13741486
external_bank_accounts.retry_prenote,
13751487
)
1488+
self.set_verification_method = _legacy_response.async_to_raw_response_wrapper(
1489+
external_bank_accounts.set_verification_method,
1490+
)
13761491
self.unpause = _legacy_response.async_to_raw_response_wrapper(
13771492
external_bank_accounts.unpause,
13781493
)
@@ -1404,6 +1519,9 @@ def __init__(self, external_bank_accounts: ExternalBankAccounts) -> None:
14041519
self.retry_prenote = to_streamed_response_wrapper(
14051520
external_bank_accounts.retry_prenote,
14061521
)
1522+
self.set_verification_method = to_streamed_response_wrapper(
1523+
external_bank_accounts.set_verification_method,
1524+
)
14071525
self.unpause = to_streamed_response_wrapper(
14081526
external_bank_accounts.unpause,
14091527
)
@@ -1435,6 +1553,9 @@ def __init__(self, external_bank_accounts: AsyncExternalBankAccounts) -> None:
14351553
self.retry_prenote = async_to_streamed_response_wrapper(
14361554
external_bank_accounts.retry_prenote,
14371555
)
1556+
self.set_verification_method = async_to_streamed_response_wrapper(
1557+
external_bank_accounts.set_verification_method,
1558+
)
14381559
self.unpause = async_to_streamed_response_wrapper(
14391560
external_bank_accounts.unpause,
14401561
)

src/lithic/types/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@
366366
from .card_transaction_enhanced_data_updated_webhook_event import (
367367
CardTransactionEnhancedDataUpdatedWebhookEvent as CardTransactionEnhancedDataUpdatedWebhookEvent,
368368
)
369+
from .external_bank_account_set_verification_method_params import (
370+
ExternalBankAccountSetVerificationMethodParams as ExternalBankAccountSetVerificationMethodParams,
371+
)
369372
from .three_ds_authentication_approval_request_webhook_event import (
370373
ThreeDSAuthenticationApprovalRequestWebhookEvent as ThreeDSAuthenticationApprovalRequestWebhookEvent,
371374
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, Required, TypedDict
6+
7+
__all__ = ["ExternalBankAccountSetVerificationMethodParams"]
8+
9+
10+
class ExternalBankAccountSetVerificationMethodParams(TypedDict, total=False):
11+
verification_method: Required[Literal["MICRO_DEPOSIT", "PRENOTE", "EXTERNALLY_VERIFIED"]]
12+
"""The verification method to set for the external bank account"""
13+
14+
financial_account_token: str
15+
"""The financial account token of the operating account to fund the micro deposits.
16+
17+
Required when verification_method is MICRO_DEPOSIT or PRENOTE.
18+
"""

tests/api_resources/test_external_bank_accounts.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,59 @@ def test_path_params_retry_prenote(self, client: Lithic) -> None:
512512
external_bank_account_token="",
513513
)
514514

515+
@parametrize
516+
def test_method_set_verification_method(self, client: Lithic) -> None:
517+
external_bank_account = client.external_bank_accounts.set_verification_method(
518+
external_bank_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
519+
verification_method="MICRO_DEPOSIT",
520+
)
521+
assert_matches_type(ExternalBankAccount, external_bank_account, path=["response"])
522+
523+
@parametrize
524+
def test_method_set_verification_method_with_all_params(self, client: Lithic) -> None:
525+
external_bank_account = client.external_bank_accounts.set_verification_method(
526+
external_bank_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
527+
verification_method="MICRO_DEPOSIT",
528+
financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
529+
)
530+
assert_matches_type(ExternalBankAccount, external_bank_account, path=["response"])
531+
532+
@parametrize
533+
def test_raw_response_set_verification_method(self, client: Lithic) -> None:
534+
response = client.external_bank_accounts.with_raw_response.set_verification_method(
535+
external_bank_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
536+
verification_method="MICRO_DEPOSIT",
537+
)
538+
539+
assert response.is_closed is True
540+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
541+
external_bank_account = response.parse()
542+
assert_matches_type(ExternalBankAccount, external_bank_account, path=["response"])
543+
544+
@parametrize
545+
def test_streaming_response_set_verification_method(self, client: Lithic) -> None:
546+
with client.external_bank_accounts.with_streaming_response.set_verification_method(
547+
external_bank_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
548+
verification_method="MICRO_DEPOSIT",
549+
) as response:
550+
assert not response.is_closed
551+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
552+
553+
external_bank_account = response.parse()
554+
assert_matches_type(ExternalBankAccount, external_bank_account, path=["response"])
555+
556+
assert cast(Any, response.is_closed) is True
557+
558+
@parametrize
559+
def test_path_params_set_verification_method(self, client: Lithic) -> None:
560+
with pytest.raises(
561+
ValueError, match=r"Expected a non-empty value for `external_bank_account_token` but received ''"
562+
):
563+
client.external_bank_accounts.with_raw_response.set_verification_method(
564+
external_bank_account_token="",
565+
verification_method="MICRO_DEPOSIT",
566+
)
567+
515568
@parametrize
516569
def test_method_unpause(self, client: Lithic) -> None:
517570
external_bank_account = client.external_bank_accounts.unpause(
@@ -1044,6 +1097,59 @@ async def test_path_params_retry_prenote(self, async_client: AsyncLithic) -> Non
10441097
external_bank_account_token="",
10451098
)
10461099

1100+
@parametrize
1101+
async def test_method_set_verification_method(self, async_client: AsyncLithic) -> None:
1102+
external_bank_account = await async_client.external_bank_accounts.set_verification_method(
1103+
external_bank_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1104+
verification_method="MICRO_DEPOSIT",
1105+
)
1106+
assert_matches_type(ExternalBankAccount, external_bank_account, path=["response"])
1107+
1108+
@parametrize
1109+
async def test_method_set_verification_method_with_all_params(self, async_client: AsyncLithic) -> None:
1110+
external_bank_account = await async_client.external_bank_accounts.set_verification_method(
1111+
external_bank_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1112+
verification_method="MICRO_DEPOSIT",
1113+
financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1114+
)
1115+
assert_matches_type(ExternalBankAccount, external_bank_account, path=["response"])
1116+
1117+
@parametrize
1118+
async def test_raw_response_set_verification_method(self, async_client: AsyncLithic) -> None:
1119+
response = await async_client.external_bank_accounts.with_raw_response.set_verification_method(
1120+
external_bank_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1121+
verification_method="MICRO_DEPOSIT",
1122+
)
1123+
1124+
assert response.is_closed is True
1125+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
1126+
external_bank_account = response.parse()
1127+
assert_matches_type(ExternalBankAccount, external_bank_account, path=["response"])
1128+
1129+
@parametrize
1130+
async def test_streaming_response_set_verification_method(self, async_client: AsyncLithic) -> None:
1131+
async with async_client.external_bank_accounts.with_streaming_response.set_verification_method(
1132+
external_bank_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1133+
verification_method="MICRO_DEPOSIT",
1134+
) as response:
1135+
assert not response.is_closed
1136+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
1137+
1138+
external_bank_account = await response.parse()
1139+
assert_matches_type(ExternalBankAccount, external_bank_account, path=["response"])
1140+
1141+
assert cast(Any, response.is_closed) is True
1142+
1143+
@parametrize
1144+
async def test_path_params_set_verification_method(self, async_client: AsyncLithic) -> None:
1145+
with pytest.raises(
1146+
ValueError, match=r"Expected a non-empty value for `external_bank_account_token` but received ''"
1147+
):
1148+
await async_client.external_bank_accounts.with_raw_response.set_verification_method(
1149+
external_bank_account_token="",
1150+
verification_method="MICRO_DEPOSIT",
1151+
)
1152+
10471153
@parametrize
10481154
async def test_method_unpause(self, async_client: AsyncLithic) -> None:
10491155
external_bank_account = await async_client.external_bank_accounts.unpause(

0 commit comments

Comments
 (0)