22
33from __future__ import annotations
44
5+ from typing_extensions import Literal
6+
57import httpx
68
79from ..._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
1517 async_to_streamed_response_wrapper ,
1618)
1719from ..._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
1921from ...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 )
0 commit comments