Skip to content

Commit c2effd4

Browse files
committed
feat(api): add simulations.check_transfers.return_() method
1 parent 39ae4ea commit c2effd4

19 files changed

+168
-5
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 115
1+
configured_endpoints: 116

api.md

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

482482
- <code title="post /simulations/check_transfers/{check_transfer_id}/deposit">client.simulations.check_transfers.<a href="./src/increase/resources/simulations/check_transfers.py">deposit</a>(check_transfer_id) -> <a href="./src/increase/types/check_transfer.py">CheckTransfer</a></code>
483483
- <code title="post /simulations/check_transfers/{check_transfer_id}/mail">client.simulations.check_transfers.<a href="./src/increase/resources/simulations/check_transfers.py">mail</a>(check_transfer_id) -> <a href="./src/increase/types/check_transfer.py">CheckTransfer</a></code>
484+
- <code title="post /simulations/check_transfers/{check_transfer_id}/return">client.simulations.check*transfers.<a href="./src/increase/resources/simulations/check_transfers.py">return*</a>(check_transfer_id, \*\*<a href="src/increase/types/simulations/check_transfer_return_params.py">params</a>) -> <a href="./src/increase/types/check_transfer.py">CheckTransfer</a></code>
484485

485486
## Documents
486487

src/increase/_exceptions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@
5252
class InvalidParametersError(exceptions.BadRequestError):
5353
detail: Optional[str]
5454

55+
errors: List[object]
56+
"""All errors related to parsing the request parameters."""
57+
5558
status: Literal[400]
5659

5760
title: str
5861

5962
type: Literal["invalid_parameters_error"]
6063

61-
errors: Optional[List[object]]
62-
"""All errors related to parsing the request parameters."""
63-
6464
def __init__(self, message: str, *, body: object, request: httpx.Request, response: httpx.Response) -> None:
6565
data = cast(Mapping[str, object], body if is_mapping(body) else {})
6666
title = cast(Any, data.get("title"))

src/increase/resources/accounts.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def create(
2626
name: str,
2727
entity_id: str | NotGiven = NOT_GIVEN,
2828
informational_entity_id: str | NotGiven = NOT_GIVEN,
29+
program_id: str | NotGiven = NOT_GIVEN,
2930
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
3031
# The extra values given here take precedence over values defined on the client or passed to this method.
3132
extra_headers: Headers | None = None,
@@ -44,6 +45,8 @@ def create(
4445
informational_entity_id: The identifier of an Entity that, while not owning the Account, is associated
4546
with its activity. Its relationship to your group must be `informational`.
4647
48+
program_id: The identifier for the Program that this Account falls under.
49+
4750
extra_headers: Send extra headers
4851
4952
extra_query: Add additional query parameters to the request
@@ -57,6 +60,7 @@ def create(
5760
body=maybe_transform(
5861
{
5962
"entity_id": entity_id,
63+
"program_id": program_id,
6064
"informational_entity_id": informational_entity_id,
6165
"name": name,
6266
},
@@ -209,6 +213,7 @@ async def create(
209213
name: str,
210214
entity_id: str | NotGiven = NOT_GIVEN,
211215
informational_entity_id: str | NotGiven = NOT_GIVEN,
216+
program_id: str | NotGiven = NOT_GIVEN,
212217
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
213218
# The extra values given here take precedence over values defined on the client or passed to this method.
214219
extra_headers: Headers | None = None,
@@ -227,6 +232,8 @@ async def create(
227232
informational_entity_id: The identifier of an Entity that, while not owning the Account, is associated
228233
with its activity. Its relationship to your group must be `informational`.
229234
235+
program_id: The identifier for the Program that this Account falls under.
236+
230237
extra_headers: Send extra headers
231238
232239
extra_query: Add additional query parameters to the request
@@ -240,6 +247,7 @@ async def create(
240247
body=maybe_transform(
241248
{
242249
"entity_id": entity_id,
250+
"program_id": program_id,
243251
"informational_entity_id": informational_entity_id,
244252
"name": name,
245253
},

src/increase/resources/simulations/check_transfers.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
from __future__ import annotations
44

5+
from typing_extensions import Literal
6+
57
from ...types import CheckTransfer
68
from ..._types import Body, Query, Headers
9+
from ..._utils import maybe_transform
710
from ..._resource import SyncAPIResource, AsyncAPIResource
811
from ..._base_client import make_request_options
12+
from ...types.simulations import check_transfer_return_params
913

1014
__all__ = ["CheckTransfers", "AsyncCheckTransfers"]
1115

@@ -65,6 +69,45 @@ def mail(
6569
cast_to=CheckTransfer,
6670
)
6771

72+
def return_(
73+
self,
74+
check_transfer_id: str,
75+
*,
76+
reason: Literal["mail_delivery_failure", "refused_by_recipient"],
77+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
78+
# The extra values given here take precedence over values defined on the client or passed to this method.
79+
extra_headers: Headers | None = None,
80+
extra_query: Query | None = None,
81+
extra_body: Body | None = None,
82+
idempotency_key: str | None = None,
83+
) -> CheckTransfer:
84+
"""
85+
Simulates a [Check Transfer](#check-transfers) being returned via USPS to
86+
Increase. This transfer must first have a `status` of `mailed`.
87+
88+
Args:
89+
reason: The reason why the Check Transfer was returned to Increase.
90+
91+
extra_headers: Send extra headers
92+
93+
extra_query: Add additional query parameters to the request
94+
95+
extra_body: Add additional JSON properties to the request
96+
97+
idempotency_key: Specify a custom idempotency key for this request
98+
"""
99+
return self._post(
100+
f"/simulations/check_transfers/{check_transfer_id}/return",
101+
body=maybe_transform({"reason": reason}, check_transfer_return_params.CheckTransferReturnParams),
102+
options=make_request_options(
103+
extra_headers=extra_headers,
104+
extra_query=extra_query,
105+
extra_body=extra_body,
106+
idempotency_key=idempotency_key,
107+
),
108+
cast_to=CheckTransfer,
109+
)
110+
68111

69112
class AsyncCheckTransfers(AsyncAPIResource):
70113
async def deposit(
@@ -120,3 +163,42 @@ async def mail(
120163
),
121164
cast_to=CheckTransfer,
122165
)
166+
167+
async def return_(
168+
self,
169+
check_transfer_id: str,
170+
*,
171+
reason: Literal["mail_delivery_failure", "refused_by_recipient"],
172+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
173+
# The extra values given here take precedence over values defined on the client or passed to this method.
174+
extra_headers: Headers | None = None,
175+
extra_query: Query | None = None,
176+
extra_body: Body | None = None,
177+
idempotency_key: str | None = None,
178+
) -> CheckTransfer:
179+
"""
180+
Simulates a [Check Transfer](#check-transfers) being returned via USPS to
181+
Increase. This transfer must first have a `status` of `mailed`.
182+
183+
Args:
184+
reason: The reason why the Check Transfer was returned to Increase.
185+
186+
extra_headers: Send extra headers
187+
188+
extra_query: Add additional query parameters to the request
189+
190+
extra_body: Add additional JSON properties to the request
191+
192+
idempotency_key: Specify a custom idempotency key for this request
193+
"""
194+
return await self._post(
195+
f"/simulations/check_transfers/{check_transfer_id}/return",
196+
body=maybe_transform({"reason": reason}, check_transfer_return_params.CheckTransferReturnParams),
197+
options=make_request_options(
198+
extra_headers=extra_headers,
199+
extra_query=extra_query,
200+
extra_body=extra_body,
201+
idempotency_key=idempotency_key,
202+
),
203+
cast_to=CheckTransfer,
204+
)

src/increase/types/account_create_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ class AccountCreateParams(TypedDict, total=False):
1919
The identifier of an Entity that, while not owning the Account, is associated
2020
with its activity. Its relationship to your group must be `informational`.
2121
"""
22+
23+
program_id: str
24+
"""The identifier for the Program that this Account falls under."""

src/increase/types/check_transfer.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from .._models import BaseModel
88

9-
__all__ = ["CheckTransfer", "ReturnAddress", "Submission", "StopPaymentRequest", "Deposit"]
9+
__all__ = ["CheckTransfer", "ReturnAddress", "Submission", "StopPaymentRequest", "Deposit", "ReturnDetails"]
1010

1111

1212
class ReturnAddress(BaseModel):
@@ -65,6 +65,17 @@ class Deposit(BaseModel):
6565
"""
6666

6767

68+
class ReturnDetails(BaseModel):
69+
file_id: Optional[str]
70+
"""If available, a document with additional information about the return."""
71+
72+
reason: Literal["mail_delivery_failure", "refused_by_recipient"]
73+
"""The reason why the check was returned."""
74+
75+
transfer_id: str
76+
"""The identifier of the returned Check Transfer."""
77+
78+
6879
class CheckTransfer(BaseModel):
6980
account_id: str
7081
"""The identifier of the Account from which funds will be transferred."""
@@ -123,6 +134,13 @@ class CheckTransfer(BaseModel):
123134
return_address: Optional[ReturnAddress]
124135
"""The return address to be printed on the check."""
125136

137+
return_details: Optional[ReturnDetails]
138+
"""After a check transfer is returned, this will contain supplemental details.
139+
140+
A check transfer is returned when the receiver mails a never deposited check
141+
back to the bank printed on the check.
142+
"""
143+
126144
status: Literal[
127145
"pending_approval",
128146
"pending_submission",

src/increase/types/declined_transaction.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class SourceCardDecline(BaseModel):
155155
"webhook_declined",
156156
"webhook_timed_out",
157157
"declined_by_stand_in_processing",
158+
"invalid_physical_card",
158159
]
159160
"""Why the transaction was declined."""
160161

src/increase/types/file.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class File(BaseModel):
4343
"digital_wallet_artwork",
4444
"digital_wallet_app_icon",
4545
"entity_supplemental_document",
46+
"export",
4647
]
4748
"""What the File will be used for.
4849

src/increase/types/file_list_params.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class CreatedAt(TypedDict, total=False):
5353
"digital_wallet_artwork",
5454
"digital_wallet_app_icon",
5555
"entity_supplemental_document",
56+
"export",
5657
]
5758
],
5859
},

0 commit comments

Comments
 (0)