| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._createable_api_resource import CreateableAPIResource |
| 4 |
from stripe._expandable_field import ExpandableField |
| 5 |
from stripe._list_object import ListObject |
| 6 |
from stripe._listable_api_resource import ListableAPIResource |
| 7 |
from stripe._stripe_object import StripeObject |
| 8 |
from stripe._test_helpers import APIResourceTestHelpers |
| 9 |
from stripe._util import class_method_variant, sanitize_id |
| 10 |
from typing import ClassVar, Dict, Optional, cast, overload |
| 11 |
from typing_extensions import Literal, Type, Unpack, TYPE_CHECKING |
| 12 |
|
| 13 |
if TYPE_CHECKING: |
| 14 |
from stripe._mandate import Mandate |
| 15 |
from stripe.params.treasury._inbound_transfer_cancel_params import ( |
| 16 |
InboundTransferCancelParams, |
| 17 |
) |
| 18 |
from stripe.params.treasury._inbound_transfer_create_params import ( |
| 19 |
InboundTransferCreateParams, |
| 20 |
) |
| 21 |
from stripe.params.treasury._inbound_transfer_fail_params import ( |
| 22 |
InboundTransferFailParams, |
| 23 |
) |
| 24 |
from stripe.params.treasury._inbound_transfer_list_params import ( |
| 25 |
InboundTransferListParams, |
| 26 |
) |
| 27 |
from stripe.params.treasury._inbound_transfer_retrieve_params import ( |
| 28 |
InboundTransferRetrieveParams, |
| 29 |
) |
| 30 |
from stripe.params.treasury._inbound_transfer_return_inbound_transfer_params import ( |
| 31 |
InboundTransferReturnInboundTransferParams, |
| 32 |
) |
| 33 |
from stripe.params.treasury._inbound_transfer_succeed_params import ( |
| 34 |
InboundTransferSucceedParams, |
| 35 |
) |
| 36 |
from stripe.treasury._transaction import Transaction |
| 37 |
|
| 38 |
|
| 39 |
class InboundTransfer( |
| 40 |
CreateableAPIResource["InboundTransfer"], |
| 41 |
ListableAPIResource["InboundTransfer"], |
| 42 |
): |
| 43 |
""" |
| 44 |
Use [InboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://api.stripe.com#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. |
| 45 |
|
| 46 |
Related guide: [Moving money with Treasury using InboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) |
| 47 |
""" |
| 48 |
|
| 49 |
OBJECT_NAME: ClassVar[Literal["treasury.inbound_transfer"]] = ( |
| 50 |
"treasury.inbound_transfer" |
| 51 |
) |
| 52 |
|
| 53 |
class FailureDetails(StripeObject): |
| 54 |
code: Literal[ |
| 55 |
"account_closed", |
| 56 |
"account_frozen", |
| 57 |
"bank_account_restricted", |
| 58 |
"bank_ownership_changed", |
| 59 |
"debit_not_authorized", |
| 60 |
"incorrect_account_holder_address", |
| 61 |
"incorrect_account_holder_name", |
| 62 |
"incorrect_account_holder_tax_id", |
| 63 |
"insufficient_funds", |
| 64 |
"invalid_account_number", |
| 65 |
"invalid_currency", |
| 66 |
"no_account", |
| 67 |
"other", |
| 68 |
] |
| 69 |
""" |
| 70 |
Reason for the failure. |
| 71 |
""" |
| 72 |
|
| 73 |
class LinkedFlows(StripeObject): |
| 74 |
received_debit: Optional[str] |
| 75 |
""" |
| 76 |
If funds for this flow were returned after the flow went to the `succeeded` state, this field contains a reference to the ReceivedDebit return. |
| 77 |
""" |
| 78 |
|
| 79 |
class OriginPaymentMethodDetails(StripeObject): |
| 80 |
class BillingDetails(StripeObject): |
| 81 |
class Address(StripeObject): |
| 82 |
city: Optional[str] |
| 83 |
""" |
| 84 |
City, district, suburb, town, or village. |
| 85 |
""" |
| 86 |
country: Optional[str] |
| 87 |
""" |
| 88 |
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). |
| 89 |
""" |
| 90 |
line1: Optional[str] |
| 91 |
""" |
| 92 |
Address line 1, such as the street, PO Box, or company name. |
| 93 |
""" |
| 94 |
line2: Optional[str] |
| 95 |
""" |
| 96 |
Address line 2, such as the apartment, suite, unit, or building. |
| 97 |
""" |
| 98 |
postal_code: Optional[str] |
| 99 |
""" |
| 100 |
ZIP or postal code. |
| 101 |
""" |
| 102 |
state: Optional[str] |
| 103 |
""" |
| 104 |
State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). |
| 105 |
""" |
| 106 |
|
| 107 |
address: Address |
| 108 |
email: Optional[str] |
| 109 |
""" |
| 110 |
Email address. |
| 111 |
""" |
| 112 |
name: Optional[str] |
| 113 |
""" |
| 114 |
Full name. |
| 115 |
""" |
| 116 |
_inner_class_types = {"address": Address} |
| 117 |
|
| 118 |
class UsBankAccount(StripeObject): |
| 119 |
account_holder_type: Optional[Literal["company", "individual"]] |
| 120 |
""" |
| 121 |
Account holder type: individual or company. |
| 122 |
""" |
| 123 |
account_type: Optional[Literal["checking", "savings"]] |
| 124 |
""" |
| 125 |
Account type: checkings or savings. Defaults to checking if omitted. |
| 126 |
""" |
| 127 |
bank_name: Optional[str] |
| 128 |
""" |
| 129 |
Name of the bank associated with the bank account. |
| 130 |
""" |
| 131 |
fingerprint: Optional[str] |
| 132 |
""" |
| 133 |
Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. |
| 134 |
""" |
| 135 |
last4: Optional[str] |
| 136 |
""" |
| 137 |
Last four digits of the bank account number. |
| 138 |
""" |
| 139 |
mandate: Optional[ExpandableField["Mandate"]] |
| 140 |
""" |
| 141 |
ID of the mandate used to make this payment. |
| 142 |
""" |
| 143 |
network: Literal["ach"] |
| 144 |
""" |
| 145 |
The network rails used. See the [docs](https://docs.stripe.com/treasury/money-movement/timelines) to learn more about money movement timelines for each network type. |
| 146 |
""" |
| 147 |
routing_number: Optional[str] |
| 148 |
""" |
| 149 |
Routing number of the bank account. |
| 150 |
""" |
| 151 |
|
| 152 |
billing_details: BillingDetails |
| 153 |
type: Literal["us_bank_account"] |
| 154 |
""" |
| 155 |
The type of the payment method used in the InboundTransfer. |
| 156 |
""" |
| 157 |
us_bank_account: Optional[UsBankAccount] |
| 158 |
_inner_class_types = { |
| 159 |
"billing_details": BillingDetails, |
| 160 |
"us_bank_account": UsBankAccount, |
| 161 |
} |
| 162 |
|
| 163 |
class StatusTransitions(StripeObject): |
| 164 |
canceled_at: Optional[int] |
| 165 |
""" |
| 166 |
Timestamp describing when an InboundTransfer changed status to `canceled`. |
| 167 |
""" |
| 168 |
failed_at: Optional[int] |
| 169 |
""" |
| 170 |
Timestamp describing when an InboundTransfer changed status to `failed`. |
| 171 |
""" |
| 172 |
succeeded_at: Optional[int] |
| 173 |
""" |
| 174 |
Timestamp describing when an InboundTransfer changed status to `succeeded`. |
| 175 |
""" |
| 176 |
|
| 177 |
amount: int |
| 178 |
""" |
| 179 |
Amount (in cents) transferred. |
| 180 |
""" |
| 181 |
cancelable: bool |
| 182 |
""" |
| 183 |
Returns `true` if the InboundTransfer is able to be canceled. |
| 184 |
""" |
| 185 |
created: int |
| 186 |
""" |
| 187 |
Time at which the object was created. Measured in seconds since the Unix epoch. |
| 188 |
""" |
| 189 |
currency: str |
| 190 |
""" |
| 191 |
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). |
| 192 |
""" |
| 193 |
description: Optional[str] |
| 194 |
""" |
| 195 |
An arbitrary string attached to the object. Often useful for displaying to users. |
| 196 |
""" |
| 197 |
failure_details: Optional[FailureDetails] |
| 198 |
""" |
| 199 |
Details about this InboundTransfer's failure. Only set when status is `failed`. |
| 200 |
""" |
| 201 |
financial_account: str |
| 202 |
""" |
| 203 |
The FinancialAccount that received the funds. |
| 204 |
""" |
| 205 |
hosted_regulatory_receipt_url: Optional[str] |
| 206 |
""" |
| 207 |
A [hosted transaction receipt](https://docs.stripe.com/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. |
| 208 |
""" |
| 209 |
id: str |
| 210 |
""" |
| 211 |
Unique identifier for the object. |
| 212 |
""" |
| 213 |
linked_flows: LinkedFlows |
| 214 |
livemode: bool |
| 215 |
""" |
| 216 |
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. |
| 217 |
""" |
| 218 |
metadata: Dict[str, str] |
| 219 |
""" |
| 220 |
Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
| 221 |
""" |
| 222 |
object: Literal["treasury.inbound_transfer"] |
| 223 |
""" |
| 224 |
String representing the object's type. Objects of the same type share the same value. |
| 225 |
""" |
| 226 |
origin_payment_method: Optional[str] |
| 227 |
""" |
| 228 |
The origin payment method to be debited for an InboundTransfer. |
| 229 |
""" |
| 230 |
origin_payment_method_details: Optional[OriginPaymentMethodDetails] |
| 231 |
""" |
| 232 |
Details about the PaymentMethod for an InboundTransfer. |
| 233 |
""" |
| 234 |
returned: Optional[bool] |
| 235 |
""" |
| 236 |
Returns `true` if the funds for an InboundTransfer were returned after the InboundTransfer went to the `succeeded` state. |
| 237 |
""" |
| 238 |
statement_descriptor: str |
| 239 |
""" |
| 240 |
Statement descriptor shown when funds are debited from the source. Not all payment networks support `statement_descriptor`. |
| 241 |
""" |
| 242 |
status: Literal["canceled", "failed", "processing", "succeeded"] |
| 243 |
""" |
| 244 |
Status of the InboundTransfer: `processing`, `succeeded`, `failed`, and `canceled`. An InboundTransfer is `processing` if it is created and pending. The status changes to `succeeded` once the funds have been "confirmed" and a `transaction` is created and posted. The status changes to `failed` if the transfer fails. |
| 245 |
""" |
| 246 |
status_transitions: StatusTransitions |
| 247 |
transaction: Optional[ExpandableField["Transaction"]] |
| 248 |
""" |
| 249 |
The Transaction associated with this object. |
| 250 |
""" |
| 251 |
|
| 252 |
@classmethod |
| 253 |
def _cls_cancel( |
| 254 |
cls, |
| 255 |
inbound_transfer: str, |
| 256 |
**params: Unpack["InboundTransferCancelParams"], |
| 257 |
) -> "InboundTransfer": |
| 258 |
""" |
| 259 |
Cancels an InboundTransfer. |
| 260 |
""" |
| 261 |
return cast( |
| 262 |
"InboundTransfer", |
| 263 |
cls._static_request( |
| 264 |
"post", |
| 265 |
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format( |
| 266 |
inbound_transfer=sanitize_id(inbound_transfer) |
| 267 |
), |
| 268 |
params=params, |
| 269 |
), |
| 270 |
) |
| 271 |
|
| 272 |
@overload |
| 273 |
@staticmethod |
| 274 |
def cancel( |
| 275 |
inbound_transfer: str, **params: Unpack["InboundTransferCancelParams"] |
| 276 |
) -> "InboundTransfer": |
| 277 |
""" |
| 278 |
Cancels an InboundTransfer. |
| 279 |
""" |
| 280 |
... |
| 281 |
|
| 282 |
@overload |
| 283 |
def cancel( |
| 284 |
self, **params: Unpack["InboundTransferCancelParams"] |
| 285 |
) -> "InboundTransfer": |
| 286 |
""" |
| 287 |
Cancels an InboundTransfer. |
| 288 |
""" |
| 289 |
... |
| 290 |
|
| 291 |
@class_method_variant("_cls_cancel") |
| 292 |
def cancel( # pyright: ignore[reportGeneralTypeIssues] |
| 293 |
self, **params: Unpack["InboundTransferCancelParams"] |
| 294 |
) -> "InboundTransfer": |
| 295 |
""" |
| 296 |
Cancels an InboundTransfer. |
| 297 |
""" |
| 298 |
return cast( |
| 299 |
"InboundTransfer", |
| 300 |
self._request( |
| 301 |
"post", |
| 302 |
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format( |
| 303 |
inbound_transfer=sanitize_id(self.get("id")) |
| 304 |
), |
| 305 |
params=params, |
| 306 |
), |
| 307 |
) |
| 308 |
|
| 309 |
@classmethod |
| 310 |
async def _cls_cancel_async( |
| 311 |
cls, |
| 312 |
inbound_transfer: str, |
| 313 |
**params: Unpack["InboundTransferCancelParams"], |
| 314 |
) -> "InboundTransfer": |
| 315 |
""" |
| 316 |
Cancels an InboundTransfer. |
| 317 |
""" |
| 318 |
return cast( |
| 319 |
"InboundTransfer", |
| 320 |
await cls._static_request_async( |
| 321 |
"post", |
| 322 |
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format( |
| 323 |
inbound_transfer=sanitize_id(inbound_transfer) |
| 324 |
), |
| 325 |
params=params, |
| 326 |
), |
| 327 |
) |
| 328 |
|
| 329 |
@overload |
| 330 |
@staticmethod |
| 331 |
async def cancel_async( |
| 332 |
inbound_transfer: str, **params: Unpack["InboundTransferCancelParams"] |
| 333 |
) -> "InboundTransfer": |
| 334 |
""" |
| 335 |
Cancels an InboundTransfer. |
| 336 |
""" |
| 337 |
... |
| 338 |
|
| 339 |
@overload |
| 340 |
async def cancel_async( |
| 341 |
self, **params: Unpack["InboundTransferCancelParams"] |
| 342 |
) -> "InboundTransfer": |
| 343 |
""" |
| 344 |
Cancels an InboundTransfer. |
| 345 |
""" |
| 346 |
... |
| 347 |
|
| 348 |
@class_method_variant("_cls_cancel_async") |
| 349 |
async def cancel_async( # pyright: ignore[reportGeneralTypeIssues] |
| 350 |
self, **params: Unpack["InboundTransferCancelParams"] |
| 351 |
) -> "InboundTransfer": |
| 352 |
""" |
| 353 |
Cancels an InboundTransfer. |
| 354 |
""" |
| 355 |
return cast( |
| 356 |
"InboundTransfer", |
| 357 |
await self._request_async( |
| 358 |
"post", |
| 359 |
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format( |
| 360 |
inbound_transfer=sanitize_id(self.get("id")) |
| 361 |
), |
| 362 |
params=params, |
| 363 |
), |
| 364 |
) |
| 365 |
|
| 366 |
@classmethod |
| 367 |
def create( |
| 368 |
cls, **params: Unpack["InboundTransferCreateParams"] |
| 369 |
) -> "InboundTransfer": |
| 370 |
""" |
| 371 |
Creates an InboundTransfer. |
| 372 |
""" |
| 373 |
return cast( |
| 374 |
"InboundTransfer", |
| 375 |
cls._static_request( |
| 376 |
"post", |
| 377 |
cls.class_url(), |
| 378 |
params=params, |
| 379 |
), |
| 380 |
) |
| 381 |
|
| 382 |
@classmethod |
| 383 |
async def create_async( |
| 384 |
cls, **params: Unpack["InboundTransferCreateParams"] |
| 385 |
) -> "InboundTransfer": |
| 386 |
""" |
| 387 |
Creates an InboundTransfer. |
| 388 |
""" |
| 389 |
return cast( |
| 390 |
"InboundTransfer", |
| 391 |
await cls._static_request_async( |
| 392 |
"post", |
| 393 |
cls.class_url(), |
| 394 |
params=params, |
| 395 |
), |
| 396 |
) |
| 397 |
|
| 398 |
@classmethod |
| 399 |
def list( |
| 400 |
cls, **params: Unpack["InboundTransferListParams"] |
| 401 |
) -> ListObject["InboundTransfer"]: |
| 402 |
""" |
| 403 |
Returns a list of InboundTransfers sent from the specified FinancialAccount. |
| 404 |
""" |
| 405 |
result = cls._static_request( |
| 406 |
"get", |
| 407 |
cls.class_url(), |
| 408 |
params=params, |
| 409 |
) |
| 410 |
if not isinstance(result, ListObject): |
| 411 |
raise TypeError( |
| 412 |
"Expected list object from API, got %s" |
| 413 |
% (type(result).__name__) |
| 414 |
) |
| 415 |
|
| 416 |
return result |
| 417 |
|
| 418 |
@classmethod |
| 419 |
async def list_async( |
| 420 |
cls, **params: Unpack["InboundTransferListParams"] |
| 421 |
) -> ListObject["InboundTransfer"]: |
| 422 |
""" |
| 423 |
Returns a list of InboundTransfers sent from the specified FinancialAccount. |
| 424 |
""" |
| 425 |
result = await cls._static_request_async( |
| 426 |
"get", |
| 427 |
cls.class_url(), |
| 428 |
params=params, |
| 429 |
) |
| 430 |
if not isinstance(result, ListObject): |
| 431 |
raise TypeError( |
| 432 |
"Expected list object from API, got %s" |
| 433 |
% (type(result).__name__) |
| 434 |
) |
| 435 |
|
| 436 |
return result |
| 437 |
|
| 438 |
@classmethod |
| 439 |
def retrieve( |
| 440 |
cls, id: str, **params: Unpack["InboundTransferRetrieveParams"] |
| 441 |
) -> "InboundTransfer": |
| 442 |
""" |
| 443 |
Retrieves the details of an existing InboundTransfer. |
| 444 |
""" |
| 445 |
instance = cls(id, **params) |
| 446 |
instance.refresh() |
| 447 |
return instance |
| 448 |
|
| 449 |
@classmethod |
| 450 |
async def retrieve_async( |
| 451 |
cls, id: str, **params: Unpack["InboundTransferRetrieveParams"] |
| 452 |
) -> "InboundTransfer": |
| 453 |
""" |
| 454 |
Retrieves the details of an existing InboundTransfer. |
| 455 |
""" |
| 456 |
instance = cls(id, **params) |
| 457 |
await instance.refresh_async() |
| 458 |
return instance |
| 459 |
|
| 460 |
class TestHelpers(APIResourceTestHelpers["InboundTransfer"]): |
| 461 |
_resource_cls: Type["InboundTransfer"] |
| 462 |
|
| 463 |
@classmethod |
| 464 |
def _cls_fail( |
| 465 |
cls, id: str, **params: Unpack["InboundTransferFailParams"] |
| 466 |
) -> "InboundTransfer": |
| 467 |
""" |
| 468 |
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. |
| 469 |
""" |
| 470 |
return cast( |
| 471 |
"InboundTransfer", |
| 472 |
cls._static_request( |
| 473 |
"post", |
| 474 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format( |
| 475 |
id=sanitize_id(id) |
| 476 |
), |
| 477 |
params=params, |
| 478 |
), |
| 479 |
) |
| 480 |
|
| 481 |
@overload |
| 482 |
@staticmethod |
| 483 |
def fail( |
| 484 |
id: str, **params: Unpack["InboundTransferFailParams"] |
| 485 |
) -> "InboundTransfer": |
| 486 |
""" |
| 487 |
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. |
| 488 |
""" |
| 489 |
... |
| 490 |
|
| 491 |
@overload |
| 492 |
def fail( |
| 493 |
self, **params: Unpack["InboundTransferFailParams"] |
| 494 |
) -> "InboundTransfer": |
| 495 |
""" |
| 496 |
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. |
| 497 |
""" |
| 498 |
... |
| 499 |
|
| 500 |
@class_method_variant("_cls_fail") |
| 501 |
def fail( # pyright: ignore[reportGeneralTypeIssues] |
| 502 |
self, **params: Unpack["InboundTransferFailParams"] |
| 503 |
) -> "InboundTransfer": |
| 504 |
""" |
| 505 |
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. |
| 506 |
""" |
| 507 |
return cast( |
| 508 |
"InboundTransfer", |
| 509 |
self.resource._request( |
| 510 |
"post", |
| 511 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format( |
| 512 |
id=sanitize_id(self.resource.get("id")) |
| 513 |
), |
| 514 |
params=params, |
| 515 |
), |
| 516 |
) |
| 517 |
|
| 518 |
@classmethod |
| 519 |
async def _cls_fail_async( |
| 520 |
cls, id: str, **params: Unpack["InboundTransferFailParams"] |
| 521 |
) -> "InboundTransfer": |
| 522 |
""" |
| 523 |
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. |
| 524 |
""" |
| 525 |
return cast( |
| 526 |
"InboundTransfer", |
| 527 |
await cls._static_request_async( |
| 528 |
"post", |
| 529 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format( |
| 530 |
id=sanitize_id(id) |
| 531 |
), |
| 532 |
params=params, |
| 533 |
), |
| 534 |
) |
| 535 |
|
| 536 |
@overload |
| 537 |
@staticmethod |
| 538 |
async def fail_async( |
| 539 |
id: str, **params: Unpack["InboundTransferFailParams"] |
| 540 |
) -> "InboundTransfer": |
| 541 |
""" |
| 542 |
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. |
| 543 |
""" |
| 544 |
... |
| 545 |
|
| 546 |
@overload |
| 547 |
async def fail_async( |
| 548 |
self, **params: Unpack["InboundTransferFailParams"] |
| 549 |
) -> "InboundTransfer": |
| 550 |
""" |
| 551 |
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. |
| 552 |
""" |
| 553 |
... |
| 554 |
|
| 555 |
@class_method_variant("_cls_fail_async") |
| 556 |
async def fail_async( # pyright: ignore[reportGeneralTypeIssues] |
| 557 |
self, **params: Unpack["InboundTransferFailParams"] |
| 558 |
) -> "InboundTransfer": |
| 559 |
""" |
| 560 |
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. |
| 561 |
""" |
| 562 |
return cast( |
| 563 |
"InboundTransfer", |
| 564 |
await self.resource._request_async( |
| 565 |
"post", |
| 566 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format( |
| 567 |
id=sanitize_id(self.resource.get("id")) |
| 568 |
), |
| 569 |
params=params, |
| 570 |
), |
| 571 |
) |
| 572 |
|
| 573 |
@classmethod |
| 574 |
def _cls_return_inbound_transfer( |
| 575 |
cls, |
| 576 |
id: str, |
| 577 |
**params: Unpack["InboundTransferReturnInboundTransferParams"], |
| 578 |
) -> "InboundTransfer": |
| 579 |
""" |
| 580 |
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. |
| 581 |
""" |
| 582 |
return cast( |
| 583 |
"InboundTransfer", |
| 584 |
cls._static_request( |
| 585 |
"post", |
| 586 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format( |
| 587 |
id=sanitize_id(id) |
| 588 |
), |
| 589 |
params=params, |
| 590 |
), |
| 591 |
) |
| 592 |
|
| 593 |
@overload |
| 594 |
@staticmethod |
| 595 |
def return_inbound_transfer( |
| 596 |
id: str, |
| 597 |
**params: Unpack["InboundTransferReturnInboundTransferParams"], |
| 598 |
) -> "InboundTransfer": |
| 599 |
""" |
| 600 |
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. |
| 601 |
""" |
| 602 |
... |
| 603 |
|
| 604 |
@overload |
| 605 |
def return_inbound_transfer( |
| 606 |
self, |
| 607 |
**params: Unpack["InboundTransferReturnInboundTransferParams"], |
| 608 |
) -> "InboundTransfer": |
| 609 |
""" |
| 610 |
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. |
| 611 |
""" |
| 612 |
... |
| 613 |
|
| 614 |
@class_method_variant("_cls_return_inbound_transfer") |
| 615 |
def return_inbound_transfer( # pyright: ignore[reportGeneralTypeIssues] |
| 616 |
self, |
| 617 |
**params: Unpack["InboundTransferReturnInboundTransferParams"], |
| 618 |
) -> "InboundTransfer": |
| 619 |
""" |
| 620 |
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. |
| 621 |
""" |
| 622 |
return cast( |
| 623 |
"InboundTransfer", |
| 624 |
self.resource._request( |
| 625 |
"post", |
| 626 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format( |
| 627 |
id=sanitize_id(self.resource.get("id")) |
| 628 |
), |
| 629 |
params=params, |
| 630 |
), |
| 631 |
) |
| 632 |
|
| 633 |
@classmethod |
| 634 |
async def _cls_return_inbound_transfer_async( |
| 635 |
cls, |
| 636 |
id: str, |
| 637 |
**params: Unpack["InboundTransferReturnInboundTransferParams"], |
| 638 |
) -> "InboundTransfer": |
| 639 |
""" |
| 640 |
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. |
| 641 |
""" |
| 642 |
return cast( |
| 643 |
"InboundTransfer", |
| 644 |
await cls._static_request_async( |
| 645 |
"post", |
| 646 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format( |
| 647 |
id=sanitize_id(id) |
| 648 |
), |
| 649 |
params=params, |
| 650 |
), |
| 651 |
) |
| 652 |
|
| 653 |
@overload |
| 654 |
@staticmethod |
| 655 |
async def return_inbound_transfer_async( |
| 656 |
id: str, |
| 657 |
**params: Unpack["InboundTransferReturnInboundTransferParams"], |
| 658 |
) -> "InboundTransfer": |
| 659 |
""" |
| 660 |
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. |
| 661 |
""" |
| 662 |
... |
| 663 |
|
| 664 |
@overload |
| 665 |
async def return_inbound_transfer_async( |
| 666 |
self, |
| 667 |
**params: Unpack["InboundTransferReturnInboundTransferParams"], |
| 668 |
) -> "InboundTransfer": |
| 669 |
""" |
| 670 |
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. |
| 671 |
""" |
| 672 |
... |
| 673 |
|
| 674 |
@class_method_variant("_cls_return_inbound_transfer_async") |
| 675 |
async def return_inbound_transfer_async( # pyright: ignore[reportGeneralTypeIssues] |
| 676 |
self, |
| 677 |
**params: Unpack["InboundTransferReturnInboundTransferParams"], |
| 678 |
) -> "InboundTransfer": |
| 679 |
""" |
| 680 |
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. |
| 681 |
""" |
| 682 |
return cast( |
| 683 |
"InboundTransfer", |
| 684 |
await self.resource._request_async( |
| 685 |
"post", |
| 686 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format( |
| 687 |
id=sanitize_id(self.resource.get("id")) |
| 688 |
), |
| 689 |
params=params, |
| 690 |
), |
| 691 |
) |
| 692 |
|
| 693 |
@classmethod |
| 694 |
def _cls_succeed( |
| 695 |
cls, id: str, **params: Unpack["InboundTransferSucceedParams"] |
| 696 |
) -> "InboundTransfer": |
| 697 |
""" |
| 698 |
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. |
| 699 |
""" |
| 700 |
return cast( |
| 701 |
"InboundTransfer", |
| 702 |
cls._static_request( |
| 703 |
"post", |
| 704 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format( |
| 705 |
id=sanitize_id(id) |
| 706 |
), |
| 707 |
params=params, |
| 708 |
), |
| 709 |
) |
| 710 |
|
| 711 |
@overload |
| 712 |
@staticmethod |
| 713 |
def succeed( |
| 714 |
id: str, **params: Unpack["InboundTransferSucceedParams"] |
| 715 |
) -> "InboundTransfer": |
| 716 |
""" |
| 717 |
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. |
| 718 |
""" |
| 719 |
... |
| 720 |
|
| 721 |
@overload |
| 722 |
def succeed( |
| 723 |
self, **params: Unpack["InboundTransferSucceedParams"] |
| 724 |
) -> "InboundTransfer": |
| 725 |
""" |
| 726 |
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. |
| 727 |
""" |
| 728 |
... |
| 729 |
|
| 730 |
@class_method_variant("_cls_succeed") |
| 731 |
def succeed( # pyright: ignore[reportGeneralTypeIssues] |
| 732 |
self, **params: Unpack["InboundTransferSucceedParams"] |
| 733 |
) -> "InboundTransfer": |
| 734 |
""" |
| 735 |
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. |
| 736 |
""" |
| 737 |
return cast( |
| 738 |
"InboundTransfer", |
| 739 |
self.resource._request( |
| 740 |
"post", |
| 741 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format( |
| 742 |
id=sanitize_id(self.resource.get("id")) |
| 743 |
), |
| 744 |
params=params, |
| 745 |
), |
| 746 |
) |
| 747 |
|
| 748 |
@classmethod |
| 749 |
async def _cls_succeed_async( |
| 750 |
cls, id: str, **params: Unpack["InboundTransferSucceedParams"] |
| 751 |
) -> "InboundTransfer": |
| 752 |
""" |
| 753 |
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. |
| 754 |
""" |
| 755 |
return cast( |
| 756 |
"InboundTransfer", |
| 757 |
await cls._static_request_async( |
| 758 |
"post", |
| 759 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format( |
| 760 |
id=sanitize_id(id) |
| 761 |
), |
| 762 |
params=params, |
| 763 |
), |
| 764 |
) |
| 765 |
|
| 766 |
@overload |
| 767 |
@staticmethod |
| 768 |
async def succeed_async( |
| 769 |
id: str, **params: Unpack["InboundTransferSucceedParams"] |
| 770 |
) -> "InboundTransfer": |
| 771 |
""" |
| 772 |
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. |
| 773 |
""" |
| 774 |
... |
| 775 |
|
| 776 |
@overload |
| 777 |
async def succeed_async( |
| 778 |
self, **params: Unpack["InboundTransferSucceedParams"] |
| 779 |
) -> "InboundTransfer": |
| 780 |
""" |
| 781 |
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. |
| 782 |
""" |
| 783 |
... |
| 784 |
|
| 785 |
@class_method_variant("_cls_succeed_async") |
| 786 |
async def succeed_async( # pyright: ignore[reportGeneralTypeIssues] |
| 787 |
self, **params: Unpack["InboundTransferSucceedParams"] |
| 788 |
) -> "InboundTransfer": |
| 789 |
""" |
| 790 |
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. |
| 791 |
""" |
| 792 |
return cast( |
| 793 |
"InboundTransfer", |
| 794 |
await self.resource._request_async( |
| 795 |
"post", |
| 796 |
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format( |
| 797 |
id=sanitize_id(self.resource.get("id")) |
| 798 |
), |
| 799 |
params=params, |
| 800 |
), |
| 801 |
) |
| 802 |
|
| 803 |
@property |
| 804 |
def test_helpers(self): |
| 805 |
return self.TestHelpers(self) |
| 806 |
|
| 807 |
_inner_class_types = { |
| 808 |
"failure_details": FailureDetails, |
| 809 |
"linked_flows": LinkedFlows, |
| 810 |
"origin_payment_method_details": OriginPaymentMethodDetails, |
| 811 |
"status_transitions": StatusTransitions, |
| 812 |
} |
| 813 |
|
| 814 |
|
| 815 |
InboundTransfer.TestHelpers._resource_cls = InboundTransfer |