|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
| 5 | +from typing_extensions import Literal |
| 6 | + |
5 | 7 | from ...types import CheckTransfer |
6 | 8 | from ..._types import Body, Query, Headers |
| 9 | +from ..._utils import maybe_transform |
7 | 10 | from ..._resource import SyncAPIResource, AsyncAPIResource |
8 | 11 | from ..._base_client import make_request_options |
| 12 | +from ...types.simulations import check_transfer_return_params |
9 | 13 |
|
10 | 14 | __all__ = ["CheckTransfers", "AsyncCheckTransfers"] |
11 | 15 |
|
@@ -65,6 +69,45 @@ def mail( |
65 | 69 | cast_to=CheckTransfer, |
66 | 70 | ) |
67 | 71 |
|
| 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 | + |
68 | 111 |
|
69 | 112 | class AsyncCheckTransfers(AsyncAPIResource): |
70 | 113 | async def deposit( |
@@ -120,3 +163,42 @@ async def mail( |
120 | 163 | ), |
121 | 164 | cast_to=CheckTransfer, |
122 | 165 | ) |
| 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 | + ) |
0 commit comments