diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 886a058d..ae449647 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.86.2" + ".": "0.87.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 79805432..8b01dc8a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 154 +configured_endpoints: 155 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0aa7bfda..abc88383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.87.0 (2025-03-18) + +Full Changelog: [v0.86.2...v0.87.0](https://github.com/lithic-com/lithic-python/compare/v0.86.2...v0.87.0) + +### Features + +* **api:** updates to 2 `FinancialAccounts` endpoints and new `ExpireAuthorization` endpoint ([#717](https://github.com/lithic-com/lithic-python/issues/717)) ([bc684e0](https://github.com/lithic-com/lithic-python/commit/bc684e0c336e7b243c371ad14b8cfdde619414c3)) + ## 0.86.2 (2025-03-17) Full Changelog: [v0.86.1...v0.86.2](https://github.com/lithic-com/lithic-python/compare/v0.86.1...v0.86.2) diff --git a/api.md b/api.md index 012baac7..786f11ad 100644 --- a/api.md +++ b/api.md @@ -329,7 +329,7 @@ Methods: - client.financial_accounts.retrieve(financial_account_token) -> FinancialAccount - client.financial_accounts.update(financial_account_token, \*\*params) -> FinancialAccount - client.financial_accounts.list(\*\*params) -> SyncSinglePage[FinancialAccount] -- client.financial_accounts.charge_off(financial_account_token, \*\*params) -> FinancialAccountCreditConfig +- client.financial_accounts.update_status(financial_account_token, \*\*params) -> FinancialAccount ## Balances @@ -422,6 +422,7 @@ Methods: - client.transactions.retrieve(transaction_token) -> Transaction - client.transactions.list(\*\*params) -> SyncCursorPage[Transaction] +- client.transactions.expire_authorization(transaction_token) -> None - client.transactions.simulate_authorization(\*\*params) -> TransactionSimulateAuthorizationResponse - client.transactions.simulate_authorization_advice(\*\*params) -> TransactionSimulateAuthorizationAdviceResponse - client.transactions.simulate_clearing(\*\*params) -> TransactionSimulateClearingResponse diff --git a/pyproject.toml b/pyproject.toml index 6dbe5948..4d419520 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "lithic" -version = "0.86.2" +version = "0.87.0" description = "The official Python library for the lithic API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/lithic/_version.py b/src/lithic/_version.py index f002ee8d..6322682d 100644 --- a/src/lithic/_version.py +++ b/src/lithic/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "lithic" -__version__ = "0.86.2" # x-release-please-version +__version__ = "0.87.0" # x-release-please-version diff --git a/src/lithic/resources/financial_accounts/financial_accounts.py b/src/lithic/resources/financial_accounts/financial_accounts.py index 72306937..4aaebb08 100644 --- a/src/lithic/resources/financial_accounts/financial_accounts.py +++ b/src/lithic/resources/financial_accounts/financial_accounts.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal import httpx @@ -11,7 +12,7 @@ financial_account_list_params, financial_account_create_params, financial_account_update_params, - financial_account_charge_off_params, + financial_account_update_status_params, ) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( @@ -64,7 +65,6 @@ AsyncFinancialTransactionsWithStreamingResponse, ) from ...types.financial_account import FinancialAccount -from ...types.financial_accounts.financial_account_credit_config import FinancialAccountCreditConfig __all__ = ["FinancialAccounts", "AsyncFinancialAccounts"] @@ -276,23 +276,28 @@ def list( model=FinancialAccount, ) - def charge_off( + def update_status( self, financial_account_token: str, *, - reason: Literal["DELINQUENT", "FRAUD"], + status: Literal["OPEN", "CLOSED", "SUSPENDED", "PENDING"], + status_change_reason: Optional[ + Literal["CHARGED_OFF_FRAUD", "END_USER_REQUEST", "BANK_REQUEST", "CHARGED_OFF_DELINQUENT"] + ], # 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, - ) -> FinancialAccountCreditConfig: + ) -> FinancialAccount: """ - Update issuing account state to charged off + Update financial account status Args: - reason: Reason for the financial account being marked as Charged Off + status: Status of the financial account + + status_change_reason: Reason for the financial account status change extra_headers: Send extra headers @@ -307,14 +312,18 @@ def charge_off( f"Expected a non-empty value for `financial_account_token` but received {financial_account_token!r}" ) return self._post( - f"/v1/financial_accounts/{financial_account_token}/charge_off", + f"/v1/financial_accounts/{financial_account_token}/update_status", body=maybe_transform( - {"reason": reason}, financial_account_charge_off_params.FinancialAccountChargeOffParams + { + "status": status, + "status_change_reason": status_change_reason, + }, + financial_account_update_status_params.FinancialAccountUpdateStatusParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FinancialAccountCreditConfig, + cast_to=FinancialAccount, ) @@ -527,23 +536,28 @@ def list( model=FinancialAccount, ) - async def charge_off( + async def update_status( self, financial_account_token: str, *, - reason: Literal["DELINQUENT", "FRAUD"], + status: Literal["OPEN", "CLOSED", "SUSPENDED", "PENDING"], + status_change_reason: Optional[ + Literal["CHARGED_OFF_FRAUD", "END_USER_REQUEST", "BANK_REQUEST", "CHARGED_OFF_DELINQUENT"] + ], # 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, - ) -> FinancialAccountCreditConfig: + ) -> FinancialAccount: """ - Update issuing account state to charged off + Update financial account status Args: - reason: Reason for the financial account being marked as Charged Off + status: Status of the financial account + + status_change_reason: Reason for the financial account status change extra_headers: Send extra headers @@ -558,14 +572,18 @@ async def charge_off( f"Expected a non-empty value for `financial_account_token` but received {financial_account_token!r}" ) return await self._post( - f"/v1/financial_accounts/{financial_account_token}/charge_off", + f"/v1/financial_accounts/{financial_account_token}/update_status", body=await async_maybe_transform( - {"reason": reason}, financial_account_charge_off_params.FinancialAccountChargeOffParams + { + "status": status, + "status_change_reason": status_change_reason, + }, + financial_account_update_status_params.FinancialAccountUpdateStatusParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=FinancialAccountCreditConfig, + cast_to=FinancialAccount, ) @@ -585,8 +603,8 @@ def __init__(self, financial_accounts: FinancialAccounts) -> None: self.list = _legacy_response.to_raw_response_wrapper( financial_accounts.list, ) - self.charge_off = _legacy_response.to_raw_response_wrapper( - financial_accounts.charge_off, + self.update_status = _legacy_response.to_raw_response_wrapper( + financial_accounts.update_status, ) @cached_property @@ -626,8 +644,8 @@ def __init__(self, financial_accounts: AsyncFinancialAccounts) -> None: self.list = _legacy_response.async_to_raw_response_wrapper( financial_accounts.list, ) - self.charge_off = _legacy_response.async_to_raw_response_wrapper( - financial_accounts.charge_off, + self.update_status = _legacy_response.async_to_raw_response_wrapper( + financial_accounts.update_status, ) @cached_property @@ -667,8 +685,8 @@ def __init__(self, financial_accounts: FinancialAccounts) -> None: self.list = to_streamed_response_wrapper( financial_accounts.list, ) - self.charge_off = to_streamed_response_wrapper( - financial_accounts.charge_off, + self.update_status = to_streamed_response_wrapper( + financial_accounts.update_status, ) @cached_property @@ -708,8 +726,8 @@ def __init__(self, financial_accounts: AsyncFinancialAccounts) -> None: self.list = async_to_streamed_response_wrapper( financial_accounts.list, ) - self.charge_off = async_to_streamed_response_wrapper( - financial_accounts.charge_off, + self.update_status = async_to_streamed_response_wrapper( + financial_accounts.update_status, ) @cached_property diff --git a/src/lithic/resources/management_operations.py b/src/lithic/resources/management_operations.py index 50ab4a78..f40679a6 100644 --- a/src/lithic/resources/management_operations.py +++ b/src/lithic/resources/management_operations.py @@ -63,6 +63,7 @@ def create( "LATE_PAYMENT", "BILLING_ERROR", "PROVISIONAL_CREDIT", + "LOSS_WRITE_OFF", "CASH_BACK_REVERSAL", "CURRENCY_CONVERSION_REVERSAL", "INTEREST_REVERSAL", @@ -313,6 +314,7 @@ async def create( "LATE_PAYMENT", "BILLING_ERROR", "PROVISIONAL_CREDIT", + "LOSS_WRITE_OFF", "CASH_BACK_REVERSAL", "CURRENCY_CONVERSION_REVERSAL", "INTEREST_REVERSAL", diff --git a/src/lithic/resources/transactions/transactions.py b/src/lithic/resources/transactions/transactions.py index 10b65157..ea6bf8fc 100644 --- a/src/lithic/resources/transactions/transactions.py +++ b/src/lithic/resources/transactions/transactions.py @@ -19,7 +19,7 @@ transaction_simulate_authorization_advice_params, transaction_simulate_credit_authorization_params, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ..._utils import ( maybe_transform, async_maybe_transform, @@ -202,6 +202,39 @@ def list( model=Transaction, ) + def expire_authorization( + self, + transaction_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, + ) -> None: + """ + Expire authorization + + 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 transaction_token: + raise ValueError(f"Expected a non-empty value for `transaction_token` but received {transaction_token!r}") + return self._post( + f"/v1/transactions/{transaction_token}/expire_authorization", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + def simulate_authorization( self, *, @@ -771,6 +804,39 @@ def list( model=Transaction, ) + async def expire_authorization( + self, + transaction_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, + ) -> None: + """ + Expire authorization + + 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 transaction_token: + raise ValueError(f"Expected a non-empty value for `transaction_token` but received {transaction_token!r}") + return await self._post( + f"/v1/transactions/{transaction_token}/expire_authorization", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + async def simulate_authorization( self, *, @@ -1205,6 +1271,9 @@ def __init__(self, transactions: Transactions) -> None: self.list = _legacy_response.to_raw_response_wrapper( transactions.list, ) + self.expire_authorization = _legacy_response.to_raw_response_wrapper( + transactions.expire_authorization, + ) self.simulate_authorization = _legacy_response.to_raw_response_wrapper( transactions.simulate_authorization, ) @@ -1246,6 +1315,9 @@ def __init__(self, transactions: AsyncTransactions) -> None: self.list = _legacy_response.async_to_raw_response_wrapper( transactions.list, ) + self.expire_authorization = _legacy_response.async_to_raw_response_wrapper( + transactions.expire_authorization, + ) self.simulate_authorization = _legacy_response.async_to_raw_response_wrapper( transactions.simulate_authorization, ) @@ -1287,6 +1359,9 @@ def __init__(self, transactions: Transactions) -> None: self.list = to_streamed_response_wrapper( transactions.list, ) + self.expire_authorization = to_streamed_response_wrapper( + transactions.expire_authorization, + ) self.simulate_authorization = to_streamed_response_wrapper( transactions.simulate_authorization, ) @@ -1328,6 +1403,9 @@ def __init__(self, transactions: AsyncTransactions) -> None: self.list = async_to_streamed_response_wrapper( transactions.list, ) + self.expire_authorization = async_to_streamed_response_wrapper( + transactions.expire_authorization, + ) self.simulate_authorization = async_to_streamed_response_wrapper( transactions.simulate_authorization, ) diff --git a/src/lithic/types/__init__.py b/src/lithic/types/__init__.py index 8acc90ba..1e468619 100644 --- a/src/lithic/types/__init__.py +++ b/src/lithic/types/__init__.py @@ -123,7 +123,6 @@ from .external_bank_account_create_params import ExternalBankAccountCreateParams as ExternalBankAccountCreateParams from .external_bank_account_list_response import ExternalBankAccountListResponse as ExternalBankAccountListResponse from .external_bank_account_update_params import ExternalBankAccountUpdateParams as ExternalBankAccountUpdateParams -from .financial_account_charge_off_params import FinancialAccountChargeOffParams as FinancialAccountChargeOffParams from .management_operation_reverse_params import ManagementOperationReverseParams as ManagementOperationReverseParams from .transaction_simulate_clearing_params import TransactionSimulateClearingParams as TransactionSimulateClearingParams from .transaction_simulate_return_response import TransactionSimulateReturnResponse as TransactionSimulateReturnResponse @@ -139,6 +138,9 @@ from .account_holder_list_documents_response import ( AccountHolderListDocumentsResponse as AccountHolderListDocumentsResponse, ) +from .financial_account_update_status_params import ( + FinancialAccountUpdateStatusParams as FinancialAccountUpdateStatusParams, +) from .responder_endpoint_check_status_params import ( ResponderEndpointCheckStatusParams as ResponderEndpointCheckStatusParams, ) diff --git a/src/lithic/types/financial_account.py b/src/lithic/types/financial_account.py index 84ec654d..e83dc895 100644 --- a/src/lithic/types/financial_account.py +++ b/src/lithic/types/financial_account.py @@ -47,7 +47,9 @@ class FinancialAccount(BaseModel): status: Literal["OPEN", "CLOSED", "SUSPENDED", "PENDING"] """Status of the financial account""" - type: Literal["ISSUING", "RESERVE", "OPERATING"] + type: Literal[ + "ISSUING", "RESERVE", "OPERATING", "CHARGED_OFF_FEES", "CHARGED_OFF_INTEREST", "CHARGED_OFF_PRINCIPAL" + ] updated: datetime diff --git a/src/lithic/types/financial_account_charge_off_params.py b/src/lithic/types/financial_account_charge_off_params.py deleted file mode 100644 index 76655d6b..00000000 --- a/src/lithic/types/financial_account_charge_off_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["FinancialAccountChargeOffParams"] - - -class FinancialAccountChargeOffParams(TypedDict, total=False): - reason: Required[Literal["DELINQUENT", "FRAUD"]] - """Reason for the financial account being marked as Charged Off""" diff --git a/src/lithic/types/financial_account_update_status_params.py b/src/lithic/types/financial_account_update_status_params.py new file mode 100644 index 00000000..550151d2 --- /dev/null +++ b/src/lithic/types/financial_account_update_status_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["FinancialAccountUpdateStatusParams"] + + +class FinancialAccountUpdateStatusParams(TypedDict, total=False): + status: Required[Literal["OPEN", "CLOSED", "SUSPENDED", "PENDING"]] + """Status of the financial account""" + + status_change_reason: Required[ + Optional[Literal["CHARGED_OFF_FRAUD", "END_USER_REQUEST", "BANK_REQUEST", "CHARGED_OFF_DELINQUENT"]] + ] + """Reason for the financial account status change""" diff --git a/src/lithic/types/financial_accounts/statement.py b/src/lithic/types/financial_accounts/statement.py index d94b86ef..a377f7f1 100644 --- a/src/lithic/types/financial_accounts/statement.py +++ b/src/lithic/types/financial_accounts/statement.py @@ -178,7 +178,7 @@ class Statement(BaseModel): financial_account_token: str """Globally unique identifier for a financial account""" - payment_due_date: date + payment_due_date: Optional[date] = None """Date when the payment is due""" period_totals: PeriodTotals @@ -192,7 +192,7 @@ class Statement(BaseModel): statement_start_date: date """Date when the billing period began""" - statement_type: Literal["INITIAL", "PERIOD_END"] + statement_type: Literal["INITIAL", "PERIOD_END", "FINAL"] updated: datetime """Timestamp of when the statement was updated""" diff --git a/src/lithic/types/management_operation_create_params.py b/src/lithic/types/management_operation_create_params.py index 575788bf..d8e8b559 100644 --- a/src/lithic/types/management_operation_create_params.py +++ b/src/lithic/types/management_operation_create_params.py @@ -28,6 +28,7 @@ class ManagementOperationCreateParams(TypedDict, total=False): "LATE_PAYMENT", "BILLING_ERROR", "PROVISIONAL_CREDIT", + "LOSS_WRITE_OFF", "CASH_BACK_REVERSAL", "CURRENCY_CONVERSION_REVERSAL", "INTEREST_REVERSAL", diff --git a/src/lithic/types/management_operation_transaction.py b/src/lithic/types/management_operation_transaction.py index bf8c061c..df533665 100644 --- a/src/lithic/types/management_operation_transaction.py +++ b/src/lithic/types/management_operation_transaction.py @@ -31,6 +31,7 @@ class Event(BaseModel): "LATE_PAYMENT", "BILLING_ERROR", "PROVISIONAL_CREDIT", + "LOSS_WRITE_OFF", "CASH_BACK_REVERSAL", "CURRENCY_CONVERSION_REVERSAL", "INTEREST_REVERSAL", diff --git a/src/lithic/types/shared/instance_financial_account_type.py b/src/lithic/types/shared/instance_financial_account_type.py index 5bf43a97..912d719c 100644 --- a/src/lithic/types/shared/instance_financial_account_type.py +++ b/src/lithic/types/shared/instance_financial_account_type.py @@ -4,4 +4,6 @@ __all__ = ["InstanceFinancialAccountType"] -InstanceFinancialAccountType: TypeAlias = Literal["ISSUING", "RESERVE", "OPERATING"] +InstanceFinancialAccountType: TypeAlias = Literal[ + "ISSUING", "RESERVE", "OPERATING", "CHARGED_OFF_FEES", "CHARGED_OFF_INTEREST", "CHARGED_OFF_PRINCIPAL" +] diff --git a/tests/api_resources/test_financial_accounts.py b/tests/api_resources/test_financial_accounts.py index 8dde1218..09158c5c 100644 --- a/tests/api_resources/test_financial_accounts.py +++ b/tests/api_resources/test_financial_accounts.py @@ -13,7 +13,6 @@ FinancialAccount, ) from lithic.pagination import SyncSinglePage, AsyncSinglePage -from lithic.types.financial_accounts import FinancialAccountCreditConfig base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -188,47 +187,51 @@ def test_streaming_response_list(self, client: Lithic) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_charge_off(self, client: Lithic) -> None: - financial_account = client.financial_accounts.charge_off( + def test_method_update_status(self, client: Lithic) -> None: + financial_account = client.financial_accounts.update_status( financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - reason="DELINQUENT", + status="OPEN", + status_change_reason="CHARGED_OFF_FRAUD", ) - assert_matches_type(FinancialAccountCreditConfig, financial_account, path=["response"]) + assert_matches_type(FinancialAccount, financial_account, path=["response"]) @parametrize - def test_raw_response_charge_off(self, client: Lithic) -> None: - response = client.financial_accounts.with_raw_response.charge_off( + def test_raw_response_update_status(self, client: Lithic) -> None: + response = client.financial_accounts.with_raw_response.update_status( financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - reason="DELINQUENT", + status="OPEN", + status_change_reason="CHARGED_OFF_FRAUD", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" financial_account = response.parse() - assert_matches_type(FinancialAccountCreditConfig, financial_account, path=["response"]) + assert_matches_type(FinancialAccount, financial_account, path=["response"]) @parametrize - def test_streaming_response_charge_off(self, client: Lithic) -> None: - with client.financial_accounts.with_streaming_response.charge_off( + def test_streaming_response_update_status(self, client: Lithic) -> None: + with client.financial_accounts.with_streaming_response.update_status( financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - reason="DELINQUENT", + status="OPEN", + status_change_reason="CHARGED_OFF_FRAUD", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" financial_account = response.parse() - assert_matches_type(FinancialAccountCreditConfig, financial_account, path=["response"]) + assert_matches_type(FinancialAccount, financial_account, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_charge_off(self, client: Lithic) -> None: + def test_path_params_update_status(self, client: Lithic) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `financial_account_token` but received ''" ): - client.financial_accounts.with_raw_response.charge_off( + client.financial_accounts.with_raw_response.update_status( financial_account_token="", - reason="DELINQUENT", + status="OPEN", + status_change_reason="CHARGED_OFF_FRAUD", ) @@ -402,45 +405,49 @@ async def test_streaming_response_list(self, async_client: AsyncLithic) -> None: assert cast(Any, response.is_closed) is True @parametrize - async def test_method_charge_off(self, async_client: AsyncLithic) -> None: - financial_account = await async_client.financial_accounts.charge_off( + async def test_method_update_status(self, async_client: AsyncLithic) -> None: + financial_account = await async_client.financial_accounts.update_status( financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - reason="DELINQUENT", + status="OPEN", + status_change_reason="CHARGED_OFF_FRAUD", ) - assert_matches_type(FinancialAccountCreditConfig, financial_account, path=["response"]) + assert_matches_type(FinancialAccount, financial_account, path=["response"]) @parametrize - async def test_raw_response_charge_off(self, async_client: AsyncLithic) -> None: - response = await async_client.financial_accounts.with_raw_response.charge_off( + async def test_raw_response_update_status(self, async_client: AsyncLithic) -> None: + response = await async_client.financial_accounts.with_raw_response.update_status( financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - reason="DELINQUENT", + status="OPEN", + status_change_reason="CHARGED_OFF_FRAUD", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" financial_account = response.parse() - assert_matches_type(FinancialAccountCreditConfig, financial_account, path=["response"]) + assert_matches_type(FinancialAccount, financial_account, path=["response"]) @parametrize - async def test_streaming_response_charge_off(self, async_client: AsyncLithic) -> None: - async with async_client.financial_accounts.with_streaming_response.charge_off( + async def test_streaming_response_update_status(self, async_client: AsyncLithic) -> None: + async with async_client.financial_accounts.with_streaming_response.update_status( financial_account_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - reason="DELINQUENT", + status="OPEN", + status_change_reason="CHARGED_OFF_FRAUD", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" financial_account = await response.parse() - assert_matches_type(FinancialAccountCreditConfig, financial_account, path=["response"]) + assert_matches_type(FinancialAccount, financial_account, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_charge_off(self, async_client: AsyncLithic) -> None: + async def test_path_params_update_status(self, async_client: AsyncLithic) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `financial_account_token` but received ''" ): - await async_client.financial_accounts.with_raw_response.charge_off( + await async_client.financial_accounts.with_raw_response.update_status( financial_account_token="", - reason="DELINQUENT", + status="OPEN", + status_change_reason="CHARGED_OFF_FRAUD", ) diff --git a/tests/api_resources/test_transactions.py b/tests/api_resources/test_transactions.py index 7c3e30b1..b0f32521 100644 --- a/tests/api_resources/test_transactions.py +++ b/tests/api_resources/test_transactions.py @@ -106,6 +106,44 @@ def test_streaming_response_list(self, client: Lithic) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_expire_authorization(self, client: Lithic) -> None: + transaction = client.transactions.expire_authorization( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert transaction is None + + @parametrize + def test_raw_response_expire_authorization(self, client: Lithic) -> None: + response = client.transactions.with_raw_response.expire_authorization( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + transaction = response.parse() + assert transaction is None + + @parametrize + def test_streaming_response_expire_authorization(self, client: Lithic) -> None: + with client.transactions.with_streaming_response.expire_authorization( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + transaction = response.parse() + assert transaction is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_expire_authorization(self, client: Lithic) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `transaction_token` but received ''"): + client.transactions.with_raw_response.expire_authorization( + "", + ) + @parametrize def test_method_simulate_authorization(self, client: Lithic) -> None: transaction = client.transactions.simulate_authorization( @@ -470,6 +508,44 @@ async def test_streaming_response_list(self, async_client: AsyncLithic) -> None: assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_expire_authorization(self, async_client: AsyncLithic) -> None: + transaction = await async_client.transactions.expire_authorization( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert transaction is None + + @parametrize + async def test_raw_response_expire_authorization(self, async_client: AsyncLithic) -> None: + response = await async_client.transactions.with_raw_response.expire_authorization( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + transaction = response.parse() + assert transaction is None + + @parametrize + async def test_streaming_response_expire_authorization(self, async_client: AsyncLithic) -> None: + async with async_client.transactions.with_streaming_response.expire_authorization( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + transaction = await response.parse() + assert transaction is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_expire_authorization(self, async_client: AsyncLithic) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `transaction_token` but received ''"): + await async_client.transactions.with_raw_response.expire_authorization( + "", + ) + @parametrize async def test_method_simulate_authorization(self, async_client: AsyncLithic) -> None: transaction = await async_client.transactions.simulate_authorization(