Skip to content

Commit 048e16f

Browse files
feat(api): api update
1 parent 2355663 commit 048e16f

File tree

6 files changed

+298
-5
lines changed

6 files changed

+298
-5
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 232
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-8bcd1f04377ee8ae354a1cb3b1c214232c8b448a93c98502ea92b696bf0757bf.yml
3-
openapi_spec_hash: c338b176720c2dc69dd3f7db351ea8a5
4-
config_hash: d15ecbf4dc8a7a0ef99397d11b557444
1+
configured_endpoints: 233
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-1ed184e346fa8c739f7de410b940df9f160681dd818eed4ec1e48b40451007d0.yml
3+
openapi_spec_hash: 0bc3978204acc7949c98e1d098bf5e1c
4+
config_hash: ca482105d83c23b2986f1c9c441c4343

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@ Methods:
993993

994994
Methods:
995995

996+
- <code title="post /simulations/check_deposits/{check_deposit_id}/adjustment">client.simulations.check_deposits.<a href="./src/increase/resources/simulations/check_deposits.py">adjustment</a>(check_deposit_id, \*\*<a href="src/increase/types/simulations/check_deposit_adjustment_params.py">params</a>) -> <a href="./src/increase/types/check_deposit.py">CheckDeposit</a></code>
996997
- <code title="post /simulations/check_deposits/{check_deposit_id}/reject">client.simulations.check_deposits.<a href="./src/increase/resources/simulations/check_deposits.py">reject</a>(check_deposit_id) -> <a href="./src/increase/types/check_deposit.py">CheckDeposit</a></code>
997998
- <code title="post /simulations/check_deposits/{check_deposit_id}/return">client.simulations.check*deposits.<a href="./src/increase/resources/simulations/check_deposits.py">return*</a>(check_deposit_id) -> <a href="./src/increase/types/check_deposit.py">CheckDeposit</a></code>
998999
- <code title="post /simulations/check_deposits/{check_deposit_id}/submit">client.simulations.check_deposits.<a href="./src/increase/resources/simulations/check_deposits.py">submit</a>(check_deposit_id, \*\*<a href="src/increase/types/simulations/check_deposit_submit_params.py">params</a>) -> <a href="./src/increase/types/check_deposit.py">CheckDeposit</a></code>

src/increase/resources/simulations/check_deposits.py

Lines changed: 163 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from typing_extensions import Literal
6+
57
import httpx
68

79
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
@@ -15,7 +17,7 @@
1517
async_to_streamed_response_wrapper,
1618
)
1719
from ..._base_client import make_request_options
18-
from ...types.simulations import check_deposit_submit_params
20+
from ...types.simulations import check_deposit_submit_params, check_deposit_adjustment_params
1921
from ...types.check_deposit import CheckDeposit
2022

2123
__all__ = ["CheckDepositsResource", "AsyncCheckDepositsResource"]
@@ -41,6 +43,80 @@ def with_streaming_response(self) -> CheckDepositsResourceWithStreamingResponse:
4143
"""
4244
return CheckDepositsResourceWithStreamingResponse(self)
4345

46+
def adjustment(
47+
self,
48+
check_deposit_id: str,
49+
*,
50+
amount: int | Omit = omit,
51+
reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"]
52+
| Omit = omit,
53+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
54+
# The extra values given here take precedence over values defined on the client or passed to this method.
55+
extra_headers: Headers | None = None,
56+
extra_query: Query | None = None,
57+
extra_body: Body | None = None,
58+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
59+
idempotency_key: str | None = None,
60+
) -> CheckDeposit:
61+
"""
62+
Simulates the creation of a
63+
[Check Deposit Adjustment](#check-deposit-adjustments) on a
64+
[Check Deposit](#check-deposits). This Check Deposit must first have a `status`
65+
of `submitted`.
66+
67+
Args:
68+
check_deposit_id: The identifier of the Check Deposit you wish to adjust.
69+
70+
amount: The adjustment amount in the minor unit of the Check Deposit's currency (e.g.,
71+
cents). A negative amount means that the funds are being clawed back by the
72+
other bank and is a debit to your account. Defaults to the negative of the Check
73+
Deposit amount.
74+
75+
reason: The reason for the adjustment. Defaults to `non_conforming_item`, which is often
76+
used for a low quality image that the recipient wasn't able to handle.
77+
78+
- `late_return` - The return was initiated too late and the receiving
79+
institution has responded with a Late Return Claim.
80+
- `wrong_payee_credit` - The check was deposited to the wrong payee and the
81+
depositing institution has reimbursed the funds with a Wrong Payee Credit.
82+
- `adjusted_amount` - The check was deposited with a different amount than what
83+
was written on the check.
84+
- `non_conforming_item` - The recipient was not able to process the check. This
85+
usually happens for e.g., low quality images.
86+
- `paid` - The check has already been deposited elsewhere and so this is a
87+
duplicate.
88+
89+
extra_headers: Send extra headers
90+
91+
extra_query: Add additional query parameters to the request
92+
93+
extra_body: Add additional JSON properties to the request
94+
95+
timeout: Override the client-level default timeout for this request, in seconds
96+
97+
idempotency_key: Specify a custom idempotency key for this request
98+
"""
99+
if not check_deposit_id:
100+
raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}")
101+
return self._post(
102+
f"/simulations/check_deposits/{check_deposit_id}/adjustment",
103+
body=maybe_transform(
104+
{
105+
"amount": amount,
106+
"reason": reason,
107+
},
108+
check_deposit_adjustment_params.CheckDepositAdjustmentParams,
109+
),
110+
options=make_request_options(
111+
extra_headers=extra_headers,
112+
extra_query=extra_query,
113+
extra_body=extra_body,
114+
timeout=timeout,
115+
idempotency_key=idempotency_key,
116+
),
117+
cast_to=CheckDeposit,
118+
)
119+
44120
def reject(
45121
self,
46122
check_deposit_id: str,
@@ -197,6 +273,80 @@ def with_streaming_response(self) -> AsyncCheckDepositsResourceWithStreamingResp
197273
"""
198274
return AsyncCheckDepositsResourceWithStreamingResponse(self)
199275

276+
async def adjustment(
277+
self,
278+
check_deposit_id: str,
279+
*,
280+
amount: int | Omit = omit,
281+
reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"]
282+
| Omit = omit,
283+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
284+
# The extra values given here take precedence over values defined on the client or passed to this method.
285+
extra_headers: Headers | None = None,
286+
extra_query: Query | None = None,
287+
extra_body: Body | None = None,
288+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
289+
idempotency_key: str | None = None,
290+
) -> CheckDeposit:
291+
"""
292+
Simulates the creation of a
293+
[Check Deposit Adjustment](#check-deposit-adjustments) on a
294+
[Check Deposit](#check-deposits). This Check Deposit must first have a `status`
295+
of `submitted`.
296+
297+
Args:
298+
check_deposit_id: The identifier of the Check Deposit you wish to adjust.
299+
300+
amount: The adjustment amount in the minor unit of the Check Deposit's currency (e.g.,
301+
cents). A negative amount means that the funds are being clawed back by the
302+
other bank and is a debit to your account. Defaults to the negative of the Check
303+
Deposit amount.
304+
305+
reason: The reason for the adjustment. Defaults to `non_conforming_item`, which is often
306+
used for a low quality image that the recipient wasn't able to handle.
307+
308+
- `late_return` - The return was initiated too late and the receiving
309+
institution has responded with a Late Return Claim.
310+
- `wrong_payee_credit` - The check was deposited to the wrong payee and the
311+
depositing institution has reimbursed the funds with a Wrong Payee Credit.
312+
- `adjusted_amount` - The check was deposited with a different amount than what
313+
was written on the check.
314+
- `non_conforming_item` - The recipient was not able to process the check. This
315+
usually happens for e.g., low quality images.
316+
- `paid` - The check has already been deposited elsewhere and so this is a
317+
duplicate.
318+
319+
extra_headers: Send extra headers
320+
321+
extra_query: Add additional query parameters to the request
322+
323+
extra_body: Add additional JSON properties to the request
324+
325+
timeout: Override the client-level default timeout for this request, in seconds
326+
327+
idempotency_key: Specify a custom idempotency key for this request
328+
"""
329+
if not check_deposit_id:
330+
raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}")
331+
return await self._post(
332+
f"/simulations/check_deposits/{check_deposit_id}/adjustment",
333+
body=await async_maybe_transform(
334+
{
335+
"amount": amount,
336+
"reason": reason,
337+
},
338+
check_deposit_adjustment_params.CheckDepositAdjustmentParams,
339+
),
340+
options=make_request_options(
341+
extra_headers=extra_headers,
342+
extra_query=extra_query,
343+
extra_body=extra_body,
344+
timeout=timeout,
345+
idempotency_key=idempotency_key,
346+
),
347+
cast_to=CheckDeposit,
348+
)
349+
200350
async def reject(
201351
self,
202352
check_deposit_id: str,
@@ -337,6 +487,9 @@ class CheckDepositsResourceWithRawResponse:
337487
def __init__(self, check_deposits: CheckDepositsResource) -> None:
338488
self._check_deposits = check_deposits
339489

490+
self.adjustment = to_raw_response_wrapper(
491+
check_deposits.adjustment,
492+
)
340493
self.reject = to_raw_response_wrapper(
341494
check_deposits.reject,
342495
)
@@ -352,6 +505,9 @@ class AsyncCheckDepositsResourceWithRawResponse:
352505
def __init__(self, check_deposits: AsyncCheckDepositsResource) -> None:
353506
self._check_deposits = check_deposits
354507

508+
self.adjustment = async_to_raw_response_wrapper(
509+
check_deposits.adjustment,
510+
)
355511
self.reject = async_to_raw_response_wrapper(
356512
check_deposits.reject,
357513
)
@@ -367,6 +523,9 @@ class CheckDepositsResourceWithStreamingResponse:
367523
def __init__(self, check_deposits: CheckDepositsResource) -> None:
368524
self._check_deposits = check_deposits
369525

526+
self.adjustment = to_streamed_response_wrapper(
527+
check_deposits.adjustment,
528+
)
370529
self.reject = to_streamed_response_wrapper(
371530
check_deposits.reject,
372531
)
@@ -382,6 +541,9 @@ class AsyncCheckDepositsResourceWithStreamingResponse:
382541
def __init__(self, check_deposits: AsyncCheckDepositsResource) -> None:
383542
self._check_deposits = check_deposits
384543

544+
self.adjustment = async_to_streamed_response_wrapper(
545+
check_deposits.adjustment,
546+
)
385547
self.reject = async_to_streamed_response_wrapper(
386548
check_deposits.reject,
387549
)

src/increase/types/simulations/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .card_settlement_create_params import CardSettlementCreateParams as CardSettlementCreateParams
1717
from .interest_payment_create_params import InterestPaymentCreateParams as InterestPaymentCreateParams
1818
from .account_statement_create_params import AccountStatementCreateParams as AccountStatementCreateParams
19+
from .check_deposit_adjustment_params import CheckDepositAdjustmentParams as CheckDepositAdjustmentParams
1920
from .inbound_mail_item_create_params import InboundMailItemCreateParams as InboundMailItemCreateParams
2021
from .card_authorization_create_params import CardAuthorizationCreateParams as CardAuthorizationCreateParams
2122
from .card_authentication_create_params import CardAuthenticationCreateParams as CardAuthenticationCreateParams
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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, TypedDict
6+
7+
__all__ = ["CheckDepositAdjustmentParams"]
8+
9+
10+
class CheckDepositAdjustmentParams(TypedDict, total=False):
11+
amount: int
12+
"""
13+
The adjustment amount in the minor unit of the Check Deposit's currency (e.g.,
14+
cents). A negative amount means that the funds are being clawed back by the
15+
other bank and is a debit to your account. Defaults to the negative of the Check
16+
Deposit amount.
17+
"""
18+
19+
reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"]
20+
"""The reason for the adjustment.
21+
22+
Defaults to `non_conforming_item`, which is often used for a low quality image
23+
that the recipient wasn't able to handle.
24+
25+
- `late_return` - The return was initiated too late and the receiving
26+
institution has responded with a Late Return Claim.
27+
- `wrong_payee_credit` - The check was deposited to the wrong payee and the
28+
depositing institution has reimbursed the funds with a Wrong Payee Credit.
29+
- `adjusted_amount` - The check was deposited with a different amount than what
30+
was written on the check.
31+
- `non_conforming_item` - The recipient was not able to process the check. This
32+
usually happens for e.g., low quality images.
33+
- `paid` - The check has already been deposited elsewhere and so this is a
34+
duplicate.
35+
"""

tests/api_resources/simulations/test_check_deposits.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,53 @@
1717
class TestCheckDeposits:
1818
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
1919

20+
@parametrize
21+
def test_method_adjustment(self, client: Increase) -> None:
22+
check_deposit = client.simulations.check_deposits.adjustment(
23+
check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1",
24+
)
25+
assert_matches_type(CheckDeposit, check_deposit, path=["response"])
26+
27+
@parametrize
28+
def test_method_adjustment_with_all_params(self, client: Increase) -> None:
29+
check_deposit = client.simulations.check_deposits.adjustment(
30+
check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1",
31+
amount=-1000000000,
32+
reason="late_return",
33+
)
34+
assert_matches_type(CheckDeposit, check_deposit, path=["response"])
35+
36+
@parametrize
37+
def test_raw_response_adjustment(self, client: Increase) -> None:
38+
response = client.simulations.check_deposits.with_raw_response.adjustment(
39+
check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1",
40+
)
41+
42+
assert response.is_closed is True
43+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
44+
check_deposit = response.parse()
45+
assert_matches_type(CheckDeposit, check_deposit, path=["response"])
46+
47+
@parametrize
48+
def test_streaming_response_adjustment(self, client: Increase) -> None:
49+
with client.simulations.check_deposits.with_streaming_response.adjustment(
50+
check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1",
51+
) as response:
52+
assert not response.is_closed
53+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
54+
55+
check_deposit = response.parse()
56+
assert_matches_type(CheckDeposit, check_deposit, path=["response"])
57+
58+
assert cast(Any, response.is_closed) is True
59+
60+
@parametrize
61+
def test_path_params_adjustment(self, client: Increase) -> None:
62+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_deposit_id` but received ''"):
63+
client.simulations.check_deposits.with_raw_response.adjustment(
64+
check_deposit_id="",
65+
)
66+
2067
@parametrize
2168
def test_method_reject(self, client: Increase) -> None:
2269
check_deposit = client.simulations.check_deposits.reject(
@@ -149,6 +196,53 @@ class TestAsyncCheckDeposits:
149196
"async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"]
150197
)
151198

199+
@parametrize
200+
async def test_method_adjustment(self, async_client: AsyncIncrease) -> None:
201+
check_deposit = await async_client.simulations.check_deposits.adjustment(
202+
check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1",
203+
)
204+
assert_matches_type(CheckDeposit, check_deposit, path=["response"])
205+
206+
@parametrize
207+
async def test_method_adjustment_with_all_params(self, async_client: AsyncIncrease) -> None:
208+
check_deposit = await async_client.simulations.check_deposits.adjustment(
209+
check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1",
210+
amount=-1000000000,
211+
reason="late_return",
212+
)
213+
assert_matches_type(CheckDeposit, check_deposit, path=["response"])
214+
215+
@parametrize
216+
async def test_raw_response_adjustment(self, async_client: AsyncIncrease) -> None:
217+
response = await async_client.simulations.check_deposits.with_raw_response.adjustment(
218+
check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1",
219+
)
220+
221+
assert response.is_closed is True
222+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
223+
check_deposit = await response.parse()
224+
assert_matches_type(CheckDeposit, check_deposit, path=["response"])
225+
226+
@parametrize
227+
async def test_streaming_response_adjustment(self, async_client: AsyncIncrease) -> None:
228+
async with async_client.simulations.check_deposits.with_streaming_response.adjustment(
229+
check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1",
230+
) as response:
231+
assert not response.is_closed
232+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
233+
234+
check_deposit = await response.parse()
235+
assert_matches_type(CheckDeposit, check_deposit, path=["response"])
236+
237+
assert cast(Any, response.is_closed) is True
238+
239+
@parametrize
240+
async def test_path_params_adjustment(self, async_client: AsyncIncrease) -> None:
241+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_deposit_id` but received ''"):
242+
await async_client.simulations.check_deposits.with_raw_response.adjustment(
243+
check_deposit_id="",
244+
)
245+
152246
@parametrize
153247
async def test_method_reject(self, async_client: AsyncIncrease) -> None:
154248
check_deposit = await async_client.simulations.check_deposits.reject(

0 commit comments

Comments
 (0)