Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 186
configured_endpoints: 187
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -853,3 +853,4 @@ Methods:

- <code title="get /inbound_check_deposits/{inbound_check_deposit_id}">client.inbound_check_deposits.<a href="./src/increase/resources/inbound_check_deposits.py">retrieve</a>(inbound_check_deposit_id) -> <a href="./src/increase/types/inbound_check_deposit.py">InboundCheckDeposit</a></code>
- <code title="get /inbound_check_deposits">client.inbound_check_deposits.<a href="./src/increase/resources/inbound_check_deposits.py">list</a>(\*\*<a href="src/increase/types/inbound_check_deposit_list_params.py">params</a>) -> <a href="./src/increase/types/inbound_check_deposit.py">SyncPage[InboundCheckDeposit]</a></code>
- <code title="post /inbound_check_deposits/{inbound_check_deposit_id}/decline">client.inbound_check_deposits.<a href="./src/increase/resources/inbound_check_deposits.py">decline</a>(inbound_check_deposit_id) -> <a href="./src/increase/types/inbound_check_deposit.py">InboundCheckDeposit</a></code>
100 changes: 100 additions & 0 deletions src/increase/resources/inbound_check_deposits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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,
)
4 changes: 3 additions & 1 deletion src/increase/types/declined_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -491,6 +491,7 @@ class SourceCheckDecline(BaseModel):
"no_account_number_found",
"refer_to_image",
"unable_to_process",
"user_initiated",
]
"""Why the check was declined.

Expand All @@ -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.
"""


Expand Down
2 changes: 1 addition & 1 deletion src/increase/types/inbound_ach_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -508,6 +508,7 @@ class DeclinedTransactionSourceCheckDecline(BaseModel):
"no_account_number_found",
"refer_to_image",
"unable_to_process",
"user_initiated",
]
"""Why the check was declined.

Expand All @@ -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.
"""


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -540,6 +540,7 @@ class DeclinedTransactionSourceCheckDecline(BaseModel):
"no_account_number_found",
"refer_to_image",
"unable_to_process",
"user_initiated",
]
"""Why the check was declined.

Expand All @@ -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.
"""


Expand Down
80 changes: 80 additions & 0 deletions tests/api_resources/test_inbound_check_deposits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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(
"",
)