diff --git a/.stats.yml b/.stats.yml index b1d0d6491..a789b2a49 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 186 +configured_endpoints: 187 diff --git a/api.md b/api.md index 8d8910595..3d1d5d33a 100644 --- a/api.md +++ b/api.md @@ -853,3 +853,4 @@ Methods: - client.inbound_check_deposits.retrieve(inbound_check_deposit_id) -> InboundCheckDeposit - client.inbound_check_deposits.list(\*\*params) -> SyncPage[InboundCheckDeposit] +- client.inbound_check_deposits.decline(inbound_check_deposit_id) -> InboundCheckDeposit diff --git a/src/increase/resources/inbound_check_deposits.py b/src/increase/resources/inbound_check_deposits.py index ad1862689..f59dec8b8 100644 --- a/src/increase/resources/inbound_check_deposits.py +++ b/src/increase/resources/inbound_check_deposits.py @@ -120,6 +120,50 @@ def list( model=InboundCheckDeposit, ) + def decline( + self, + inbound_check_deposit_id: 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, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """ + Decline an Inbound Check Deposit + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to decline. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return self._post( + f"/inbound_check_deposits/{inbound_check_deposit_id}/decline", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + class AsyncInboundCheckDeposits(AsyncAPIResource): @cached_property @@ -221,6 +265,50 @@ def list( model=InboundCheckDeposit, ) + async def decline( + self, + inbound_check_deposit_id: 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, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """ + Decline an Inbound Check Deposit + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to decline. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return await self._post( + f"/inbound_check_deposits/{inbound_check_deposit_id}/decline", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + class InboundCheckDepositsWithRawResponse: def __init__(self, inbound_check_deposits: InboundCheckDeposits) -> None: @@ -232,6 +320,9 @@ def __init__(self, inbound_check_deposits: InboundCheckDeposits) -> None: self.list = _legacy_response.to_raw_response_wrapper( inbound_check_deposits.list, ) + self.decline = _legacy_response.to_raw_response_wrapper( + inbound_check_deposits.decline, + ) class AsyncInboundCheckDepositsWithRawResponse: @@ -244,6 +335,9 @@ def __init__(self, inbound_check_deposits: AsyncInboundCheckDeposits) -> None: self.list = _legacy_response.async_to_raw_response_wrapper( inbound_check_deposits.list, ) + self.decline = _legacy_response.async_to_raw_response_wrapper( + inbound_check_deposits.decline, + ) class InboundCheckDepositsWithStreamingResponse: @@ -256,6 +350,9 @@ def __init__(self, inbound_check_deposits: InboundCheckDeposits) -> None: self.list = to_streamed_response_wrapper( inbound_check_deposits.list, ) + self.decline = to_streamed_response_wrapper( + inbound_check_deposits.decline, + ) class AsyncInboundCheckDepositsWithStreamingResponse: @@ -268,3 +365,6 @@ def __init__(self, inbound_check_deposits: AsyncInboundCheckDeposits) -> None: self.list = async_to_streamed_response_wrapper( inbound_check_deposits.list, ) + self.decline = async_to_streamed_response_wrapper( + inbound_check_deposits.decline, + ) diff --git a/src/increase/types/declined_transaction.py b/src/increase/types/declined_transaction.py index bc3d6c438..1f40bcab3 100644 --- a/src/increase/types/declined_transaction.py +++ b/src/increase/types/declined_transaction.py @@ -87,7 +87,7 @@ class SourceACHDecline(BaseModel): transfer to be returned. - `transaction_not_allowed` - The transaction is not allowed per Increase's terms. - - `user_initiated` - The user initiated the decline. + - `user_initiated` - Your integration declined this transfer via the API. """ receiver_id_number: Optional[str] = None @@ -491,6 +491,7 @@ class SourceCheckDecline(BaseModel): "no_account_number_found", "refer_to_image", "unable_to_process", + "user_initiated", ] """Why the check was declined. @@ -513,6 +514,7 @@ class SourceCheckDecline(BaseModel): - `refer_to_image` - The check is not readable. Please refer to the image. - `unable_to_process` - The check cannot be processed. This is rare: please contact support. + - `user_initiated` - Your integration declined this check via the API. """ diff --git a/src/increase/types/inbound_ach_transfer.py b/src/increase/types/inbound_ach_transfer.py index f4bba8747..3bd6b820f 100644 --- a/src/increase/types/inbound_ach_transfer.py +++ b/src/increase/types/inbound_ach_transfer.py @@ -92,7 +92,7 @@ class Decline(BaseModel): transfer to be returned. - `transaction_not_allowed` - The transaction is not allowed per Increase's terms. - - `user_initiated` - The user initiated the decline. + - `user_initiated` - Your integration declined this transfer via the API. """ diff --git a/src/increase/types/simulations/card_authorization_simulation.py b/src/increase/types/simulations/card_authorization_simulation.py index 99d7f0827..0353e5fec 100644 --- a/src/increase/types/simulations/card_authorization_simulation.py +++ b/src/increase/types/simulations/card_authorization_simulation.py @@ -104,7 +104,7 @@ class DeclinedTransactionSourceACHDecline(BaseModel): transfer to be returned. - `transaction_not_allowed` - The transaction is not allowed per Increase's terms. - - `user_initiated` - The user initiated the decline. + - `user_initiated` - Your integration declined this transfer via the API. """ receiver_id_number: Optional[str] = None @@ -508,6 +508,7 @@ class DeclinedTransactionSourceCheckDecline(BaseModel): "no_account_number_found", "refer_to_image", "unable_to_process", + "user_initiated", ] """Why the check was declined. @@ -530,6 +531,7 @@ class DeclinedTransactionSourceCheckDecline(BaseModel): - `refer_to_image` - The check is not readable. Please refer to the image. - `unable_to_process` - The check cannot be processed. This is rare: please contact support. + - `user_initiated` - Your integration declined this check via the API. """ diff --git a/src/increase/types/simulations/inbound_real_time_payments_transfer_simulation_result.py b/src/increase/types/simulations/inbound_real_time_payments_transfer_simulation_result.py index ffdd5f9a6..214d9818f 100644 --- a/src/increase/types/simulations/inbound_real_time_payments_transfer_simulation_result.py +++ b/src/increase/types/simulations/inbound_real_time_payments_transfer_simulation_result.py @@ -136,7 +136,7 @@ class DeclinedTransactionSourceACHDecline(BaseModel): transfer to be returned. - `transaction_not_allowed` - The transaction is not allowed per Increase's terms. - - `user_initiated` - The user initiated the decline. + - `user_initiated` - Your integration declined this transfer via the API. """ receiver_id_number: Optional[str] = None @@ -540,6 +540,7 @@ class DeclinedTransactionSourceCheckDecline(BaseModel): "no_account_number_found", "refer_to_image", "unable_to_process", + "user_initiated", ] """Why the check was declined. @@ -562,6 +563,7 @@ class DeclinedTransactionSourceCheckDecline(BaseModel): - `refer_to_image` - The check is not readable. Please refer to the image. - `unable_to_process` - The check cannot be processed. This is rare: please contact support. + - `user_initiated` - Your integration declined this check via the API. """ diff --git a/tests/api_resources/test_inbound_check_deposits.py b/tests/api_resources/test_inbound_check_deposits.py index a77e3c9a0..92d46b2e1 100644 --- a/tests/api_resources/test_inbound_check_deposits.py +++ b/tests/api_resources/test_inbound_check_deposits.py @@ -99,6 +99,46 @@ def test_streaming_response_list(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_decline(self, client: Increase) -> None: + inbound_check_deposit = client.inbound_check_deposits.decline( + "string", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_raw_response_decline(self, client: Increase) -> None: + response = client.inbound_check_deposits.with_raw_response.decline( + "string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_streaming_response_decline(self, client: Increase) -> None: + with client.inbound_check_deposits.with_streaming_response.decline( + "string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_decline(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + client.inbound_check_deposits.with_raw_response.decline( + "", + ) + class TestAsyncInboundCheckDeposits: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -182,3 +222,43 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert_matches_type(AsyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_decline(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.inbound_check_deposits.decline( + "string", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_raw_response_decline(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_check_deposits.with_raw_response.decline( + "string", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_streaming_response_decline(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_check_deposits.with_streaming_response.decline( + "string", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_decline(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + await async_client.inbound_check_deposits.with_raw_response.decline( + "", + )