Skip to content

Commit a1c35bc

Browse files
feat(api): updates to 2 FinancialAccounts endpoints and new ExpireAuthorization endpoint (#717)
- removes deprecated `FinancialAccounts.chargeOff()` endpoint - adds `UpdateStatus` endpoint to `FinancialAccounts` - adds `ExpireAuthorization` endpoint to `Transactions` - adds 3 new `Instance Financial Account Types` - adds 1 new `Management Operation Event Type` - adds new `Statement` type: `FINAL`
1 parent 2098f62 commit a1c35bc

15 files changed

+273
-77
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 154
1+
configured_endpoints: 155

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Methods:
329329
- <code title="get /v1/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>
330330
- <code title="patch /v1/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>
331331
- <code title="get /v1/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>
332-
- <code title="post /v1/financial_accounts/{financial_account_token}/charge_off">client.financial_accounts.<a href="./src/lithic/resources/financial_accounts/financial_accounts.py">charge_off</a>(financial_account_token, \*\*<a href="src/lithic/types/financial_account_charge_off_params.py">params</a>) -> <a href="./src/lithic/types/financial_accounts/financial_account_credit_config.py">FinancialAccountCreditConfig</a></code>
332+
- <code title="post /v1/financial_accounts/{financial_account_token}/update_status">client.financial_accounts.<a href="./src/lithic/resources/financial_accounts/financial_accounts.py">update_status</a>(financial_account_token, \*\*<a href="src/lithic/types/financial_account_update_status_params.py">params</a>) -> <a href="./src/lithic/types/financial_account.py">FinancialAccount</a></code>
333333

334334
## Balances
335335

@@ -422,6 +422,7 @@ Methods:
422422

423423
- <code title="get /v1/transactions/{transaction_token}">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">retrieve</a>(transaction_token) -> <a href="./src/lithic/types/transaction.py">Transaction</a></code>
424424
- <code title="get /v1/transactions">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">list</a>(\*\*<a href="src/lithic/types/transaction_list_params.py">params</a>) -> <a href="./src/lithic/types/transaction.py">SyncCursorPage[Transaction]</a></code>
425+
- <code title="post /v1/transactions/{transaction_token}/expire_authorization">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">expire_authorization</a>(transaction_token) -> None</code>
425426
- <code title="post /v1/simulate/authorize">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_authorization</a>(\*\*<a href="src/lithic/types/transaction_simulate_authorization_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_authorization_response.py">TransactionSimulateAuthorizationResponse</a></code>
426427
- <code title="post /v1/simulate/authorization_advice">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_authorization_advice</a>(\*\*<a href="src/lithic/types/transaction_simulate_authorization_advice_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_authorization_advice_response.py">TransactionSimulateAuthorizationAdviceResponse</a></code>
427428
- <code title="post /v1/simulate/clearing">client.transactions.<a href="./src/lithic/resources/transactions/transactions.py">simulate_clearing</a>(\*\*<a href="src/lithic/types/transaction_simulate_clearing_params.py">params</a>) -> <a href="./src/lithic/types/transaction_simulate_clearing_response.py">TransactionSimulateClearingResponse</a></code>

src/lithic/resources/financial_accounts/financial_accounts.py

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from typing import Optional
56
from typing_extensions import Literal
67

78
import httpx
@@ -11,7 +12,7 @@
1112
financial_account_list_params,
1213
financial_account_create_params,
1314
financial_account_update_params,
14-
financial_account_charge_off_params,
15+
financial_account_update_status_params,
1516
)
1617
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1718
from ..._utils import (
@@ -64,7 +65,6 @@
6465
AsyncFinancialTransactionsWithStreamingResponse,
6566
)
6667
from ...types.financial_account import FinancialAccount
67-
from ...types.financial_accounts.financial_account_credit_config import FinancialAccountCreditConfig
6868

6969
__all__ = ["FinancialAccounts", "AsyncFinancialAccounts"]
7070

@@ -276,23 +276,28 @@ def list(
276276
model=FinancialAccount,
277277
)
278278

279-
def charge_off(
279+
def update_status(
280280
self,
281281
financial_account_token: str,
282282
*,
283-
reason: Literal["DELINQUENT", "FRAUD"],
283+
status: Literal["OPEN", "CLOSED", "SUSPENDED", "PENDING"],
284+
status_change_reason: Optional[
285+
Literal["CHARGED_OFF_FRAUD", "END_USER_REQUEST", "BANK_REQUEST", "CHARGED_OFF_DELINQUENT"]
286+
],
284287
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
285288
# The extra values given here take precedence over values defined on the client or passed to this method.
286289
extra_headers: Headers | None = None,
287290
extra_query: Query | None = None,
288291
extra_body: Body | None = None,
289292
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
290-
) -> FinancialAccountCreditConfig:
293+
) -> FinancialAccount:
291294
"""
292-
Update issuing account state to charged off
295+
Update financial account status
293296
294297
Args:
295-
reason: Reason for the financial account being marked as Charged Off
298+
status: Status of the financial account
299+
300+
status_change_reason: Reason for the financial account status change
296301
297302
extra_headers: Send extra headers
298303
@@ -307,14 +312,18 @@ def charge_off(
307312
f"Expected a non-empty value for `financial_account_token` but received {financial_account_token!r}"
308313
)
309314
return self._post(
310-
f"/v1/financial_accounts/{financial_account_token}/charge_off",
315+
f"/v1/financial_accounts/{financial_account_token}/update_status",
311316
body=maybe_transform(
312-
{"reason": reason}, financial_account_charge_off_params.FinancialAccountChargeOffParams
317+
{
318+
"status": status,
319+
"status_change_reason": status_change_reason,
320+
},
321+
financial_account_update_status_params.FinancialAccountUpdateStatusParams,
313322
),
314323
options=make_request_options(
315324
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
316325
),
317-
cast_to=FinancialAccountCreditConfig,
326+
cast_to=FinancialAccount,
318327
)
319328

320329

@@ -527,23 +536,28 @@ def list(
527536
model=FinancialAccount,
528537
)
529538

530-
async def charge_off(
539+
async def update_status(
531540
self,
532541
financial_account_token: str,
533542
*,
534-
reason: Literal["DELINQUENT", "FRAUD"],
543+
status: Literal["OPEN", "CLOSED", "SUSPENDED", "PENDING"],
544+
status_change_reason: Optional[
545+
Literal["CHARGED_OFF_FRAUD", "END_USER_REQUEST", "BANK_REQUEST", "CHARGED_OFF_DELINQUENT"]
546+
],
535547
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
536548
# The extra values given here take precedence over values defined on the client or passed to this method.
537549
extra_headers: Headers | None = None,
538550
extra_query: Query | None = None,
539551
extra_body: Body | None = None,
540552
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
541-
) -> FinancialAccountCreditConfig:
553+
) -> FinancialAccount:
542554
"""
543-
Update issuing account state to charged off
555+
Update financial account status
544556
545557
Args:
546-
reason: Reason for the financial account being marked as Charged Off
558+
status: Status of the financial account
559+
560+
status_change_reason: Reason for the financial account status change
547561
548562
extra_headers: Send extra headers
549563
@@ -558,14 +572,18 @@ async def charge_off(
558572
f"Expected a non-empty value for `financial_account_token` but received {financial_account_token!r}"
559573
)
560574
return await self._post(
561-
f"/v1/financial_accounts/{financial_account_token}/charge_off",
575+
f"/v1/financial_accounts/{financial_account_token}/update_status",
562576
body=await async_maybe_transform(
563-
{"reason": reason}, financial_account_charge_off_params.FinancialAccountChargeOffParams
577+
{
578+
"status": status,
579+
"status_change_reason": status_change_reason,
580+
},
581+
financial_account_update_status_params.FinancialAccountUpdateStatusParams,
564582
),
565583
options=make_request_options(
566584
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
567585
),
568-
cast_to=FinancialAccountCreditConfig,
586+
cast_to=FinancialAccount,
569587
)
570588

571589

@@ -585,8 +603,8 @@ def __init__(self, financial_accounts: FinancialAccounts) -> None:
585603
self.list = _legacy_response.to_raw_response_wrapper(
586604
financial_accounts.list,
587605
)
588-
self.charge_off = _legacy_response.to_raw_response_wrapper(
589-
financial_accounts.charge_off,
606+
self.update_status = _legacy_response.to_raw_response_wrapper(
607+
financial_accounts.update_status,
590608
)
591609

592610
@cached_property
@@ -626,8 +644,8 @@ def __init__(self, financial_accounts: AsyncFinancialAccounts) -> None:
626644
self.list = _legacy_response.async_to_raw_response_wrapper(
627645
financial_accounts.list,
628646
)
629-
self.charge_off = _legacy_response.async_to_raw_response_wrapper(
630-
financial_accounts.charge_off,
647+
self.update_status = _legacy_response.async_to_raw_response_wrapper(
648+
financial_accounts.update_status,
631649
)
632650

633651
@cached_property
@@ -667,8 +685,8 @@ def __init__(self, financial_accounts: FinancialAccounts) -> None:
667685
self.list = to_streamed_response_wrapper(
668686
financial_accounts.list,
669687
)
670-
self.charge_off = to_streamed_response_wrapper(
671-
financial_accounts.charge_off,
688+
self.update_status = to_streamed_response_wrapper(
689+
financial_accounts.update_status,
672690
)
673691

674692
@cached_property
@@ -708,8 +726,8 @@ def __init__(self, financial_accounts: AsyncFinancialAccounts) -> None:
708726
self.list = async_to_streamed_response_wrapper(
709727
financial_accounts.list,
710728
)
711-
self.charge_off = async_to_streamed_response_wrapper(
712-
financial_accounts.charge_off,
729+
self.update_status = async_to_streamed_response_wrapper(
730+
financial_accounts.update_status,
713731
)
714732

715733
@cached_property

src/lithic/resources/management_operations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def create(
6363
"LATE_PAYMENT",
6464
"BILLING_ERROR",
6565
"PROVISIONAL_CREDIT",
66+
"LOSS_WRITE_OFF",
6667
"CASH_BACK_REVERSAL",
6768
"CURRENCY_CONVERSION_REVERSAL",
6869
"INTEREST_REVERSAL",
@@ -313,6 +314,7 @@ async def create(
313314
"LATE_PAYMENT",
314315
"BILLING_ERROR",
315316
"PROVISIONAL_CREDIT",
317+
"LOSS_WRITE_OFF",
316318
"CASH_BACK_REVERSAL",
317319
"CURRENCY_CONVERSION_REVERSAL",
318320
"INTEREST_REVERSAL",

src/lithic/resources/transactions/transactions.py

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
transaction_simulate_authorization_advice_params,
2020
transaction_simulate_credit_authorization_params,
2121
)
22-
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
22+
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
2323
from ..._utils import (
2424
maybe_transform,
2525
async_maybe_transform,
@@ -202,6 +202,39 @@ def list(
202202
model=Transaction,
203203
)
204204

205+
def expire_authorization(
206+
self,
207+
transaction_token: str,
208+
*,
209+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
210+
# The extra values given here take precedence over values defined on the client or passed to this method.
211+
extra_headers: Headers | None = None,
212+
extra_query: Query | None = None,
213+
extra_body: Body | None = None,
214+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
215+
) -> None:
216+
"""
217+
Expire authorization
218+
219+
Args:
220+
extra_headers: Send extra headers
221+
222+
extra_query: Add additional query parameters to the request
223+
224+
extra_body: Add additional JSON properties to the request
225+
226+
timeout: Override the client-level default timeout for this request, in seconds
227+
"""
228+
if not transaction_token:
229+
raise ValueError(f"Expected a non-empty value for `transaction_token` but received {transaction_token!r}")
230+
return self._post(
231+
f"/v1/transactions/{transaction_token}/expire_authorization",
232+
options=make_request_options(
233+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
234+
),
235+
cast_to=NoneType,
236+
)
237+
205238
def simulate_authorization(
206239
self,
207240
*,
@@ -771,6 +804,39 @@ def list(
771804
model=Transaction,
772805
)
773806

807+
async def expire_authorization(
808+
self,
809+
transaction_token: str,
810+
*,
811+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
812+
# The extra values given here take precedence over values defined on the client or passed to this method.
813+
extra_headers: Headers | None = None,
814+
extra_query: Query | None = None,
815+
extra_body: Body | None = None,
816+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
817+
) -> None:
818+
"""
819+
Expire authorization
820+
821+
Args:
822+
extra_headers: Send extra headers
823+
824+
extra_query: Add additional query parameters to the request
825+
826+
extra_body: Add additional JSON properties to the request
827+
828+
timeout: Override the client-level default timeout for this request, in seconds
829+
"""
830+
if not transaction_token:
831+
raise ValueError(f"Expected a non-empty value for `transaction_token` but received {transaction_token!r}")
832+
return await self._post(
833+
f"/v1/transactions/{transaction_token}/expire_authorization",
834+
options=make_request_options(
835+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
836+
),
837+
cast_to=NoneType,
838+
)
839+
774840
async def simulate_authorization(
775841
self,
776842
*,
@@ -1205,6 +1271,9 @@ def __init__(self, transactions: Transactions) -> None:
12051271
self.list = _legacy_response.to_raw_response_wrapper(
12061272
transactions.list,
12071273
)
1274+
self.expire_authorization = _legacy_response.to_raw_response_wrapper(
1275+
transactions.expire_authorization,
1276+
)
12081277
self.simulate_authorization = _legacy_response.to_raw_response_wrapper(
12091278
transactions.simulate_authorization,
12101279
)
@@ -1246,6 +1315,9 @@ def __init__(self, transactions: AsyncTransactions) -> None:
12461315
self.list = _legacy_response.async_to_raw_response_wrapper(
12471316
transactions.list,
12481317
)
1318+
self.expire_authorization = _legacy_response.async_to_raw_response_wrapper(
1319+
transactions.expire_authorization,
1320+
)
12491321
self.simulate_authorization = _legacy_response.async_to_raw_response_wrapper(
12501322
transactions.simulate_authorization,
12511323
)
@@ -1287,6 +1359,9 @@ def __init__(self, transactions: Transactions) -> None:
12871359
self.list = to_streamed_response_wrapper(
12881360
transactions.list,
12891361
)
1362+
self.expire_authorization = to_streamed_response_wrapper(
1363+
transactions.expire_authorization,
1364+
)
12901365
self.simulate_authorization = to_streamed_response_wrapper(
12911366
transactions.simulate_authorization,
12921367
)
@@ -1328,6 +1403,9 @@ def __init__(self, transactions: AsyncTransactions) -> None:
13281403
self.list = async_to_streamed_response_wrapper(
13291404
transactions.list,
13301405
)
1406+
self.expire_authorization = async_to_streamed_response_wrapper(
1407+
transactions.expire_authorization,
1408+
)
13311409
self.simulate_authorization = async_to_streamed_response_wrapper(
13321410
transactions.simulate_authorization,
13331411
)

src/lithic/types/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
from .external_bank_account_create_params import ExternalBankAccountCreateParams as ExternalBankAccountCreateParams
124124
from .external_bank_account_list_response import ExternalBankAccountListResponse as ExternalBankAccountListResponse
125125
from .external_bank_account_update_params import ExternalBankAccountUpdateParams as ExternalBankAccountUpdateParams
126-
from .financial_account_charge_off_params import FinancialAccountChargeOffParams as FinancialAccountChargeOffParams
127126
from .management_operation_reverse_params import ManagementOperationReverseParams as ManagementOperationReverseParams
128127
from .transaction_simulate_clearing_params import TransactionSimulateClearingParams as TransactionSimulateClearingParams
129128
from .transaction_simulate_return_response import TransactionSimulateReturnResponse as TransactionSimulateReturnResponse
@@ -139,6 +138,9 @@
139138
from .account_holder_list_documents_response import (
140139
AccountHolderListDocumentsResponse as AccountHolderListDocumentsResponse,
141140
)
141+
from .financial_account_update_status_params import (
142+
FinancialAccountUpdateStatusParams as FinancialAccountUpdateStatusParams,
143+
)
142144
from .responder_endpoint_check_status_params import (
143145
ResponderEndpointCheckStatusParams as ResponderEndpointCheckStatusParams,
144146
)

src/lithic/types/financial_account.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ class FinancialAccount(BaseModel):
4747
status: Literal["OPEN", "CLOSED", "SUSPENDED", "PENDING"]
4848
"""Status of the financial account"""
4949

50-
type: Literal["ISSUING", "RESERVE", "OPERATING"]
50+
type: Literal[
51+
"ISSUING", "RESERVE", "OPERATING", "CHARGED_OFF_FEES", "CHARGED_OFF_INTEREST", "CHARGED_OFF_PRINCIPAL"
52+
]
5153

5254
updated: datetime
5355

src/lithic/types/financial_account_charge_off_params.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)