| 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._outbound_transfer_cancel_params import ( |
| 16 |
OutboundTransferCancelParams, |
| 17 |
) |
| 18 |
from stripe.params.treasury._outbound_transfer_create_params import ( |
| 19 |
OutboundTransferCreateParams, |
| 20 |
) |
| 21 |
from stripe.params.treasury._outbound_transfer_fail_params import ( |
| 22 |
OutboundTransferFailParams, |
| 23 |
) |
| 24 |
from stripe.params.treasury._outbound_transfer_list_params import ( |
| 25 |
OutboundTransferListParams, |
| 26 |
) |
| 27 |
from stripe.params.treasury._outbound_transfer_post_params import ( |
| 28 |
OutboundTransferPostParams, |
| 29 |
) |
| 30 |
from stripe.params.treasury._outbound_transfer_retrieve_params import ( |
| 31 |
OutboundTransferRetrieveParams, |
| 32 |
) |
| 33 |
from stripe.params.treasury._outbound_transfer_return_outbound_transfer_params import ( |
| 34 |
OutboundTransferReturnOutboundTransferParams, |
| 35 |
) |
| 36 |
from stripe.params.treasury._outbound_transfer_update_params import ( |
| 37 |
OutboundTransferUpdateParams, |
| 38 |
) |
| 39 |
from stripe.treasury._transaction import Transaction |
| 40 |
|
| 41 |
|
| 42 |
class OutboundTransfer( |
| 43 |
CreateableAPIResource["OutboundTransfer"], |
| 44 |
ListableAPIResource["OutboundTransfer"], |
| 45 |
): |
| 46 |
""" |
| 47 |
Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) to transfer funds from a [FinancialAccount](https://api.stripe.com#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://api.stripe.com#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account. |
| 48 |
|
| 49 |
Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects. |
| 50 |
|
| 51 |
Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) |
| 52 |
""" |
| 53 |
|
| 54 |
OBJECT_NAME: ClassVar[Literal["treasury.outbound_transfer"]] = ( |
| 55 |
"treasury.outbound_transfer" |
| 56 |
) |
| 57 |
|
| 58 |
class DestinationPaymentMethodDetails(StripeObject): |
| 59 |
class BillingDetails(StripeObject): |
| 60 |
class Address(StripeObject): |
| 61 |
city: Optional[str] |
| 62 |
""" |
| 63 |
City, district, suburb, town, or village. |
| 64 |
""" |
| 65 |
country: Optional[str] |
| 66 |
""" |
| 67 |
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). |
| 68 |
""" |
| 69 |
line1: Optional[str] |
| 70 |
""" |
| 71 |
Address line 1, such as the street, PO Box, or company name. |
| 72 |
""" |
| 73 |
line2: Optional[str] |
| 74 |
""" |
| 75 |
Address line 2, such as the apartment, suite, unit, or building. |
| 76 |
""" |
| 77 |
postal_code: Optional[str] |
| 78 |
""" |
| 79 |
ZIP or postal code. |
| 80 |
""" |
| 81 |
state: Optional[str] |
| 82 |
""" |
| 83 |
State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). |
| 84 |
""" |
| 85 |
|
| 86 |
address: Address |
| 87 |
email: Optional[str] |
| 88 |
""" |
| 89 |
Email address. |
| 90 |
""" |
| 91 |
name: Optional[str] |
| 92 |
""" |
| 93 |
Full name. |
| 94 |
""" |
| 95 |
_inner_class_types = {"address": Address} |
| 96 |
|
| 97 |
class FinancialAccount(StripeObject): |
| 98 |
id: str |
| 99 |
""" |
| 100 |
Token of the FinancialAccount. |
| 101 |
""" |
| 102 |
network: Literal["stripe"] |
| 103 |
""" |
| 104 |
The rails used to send funds. |
| 105 |
""" |
| 106 |
|
| 107 |
class UsBankAccount(StripeObject): |
| 108 |
account_holder_type: Optional[Literal["company", "individual"]] |
| 109 |
""" |
| 110 |
Account holder type: individual or company. |
| 111 |
""" |
| 112 |
account_type: Optional[Literal["checking", "savings"]] |
| 113 |
""" |
| 114 |
Account type: checkings or savings. Defaults to checking if omitted. |
| 115 |
""" |
| 116 |
bank_name: Optional[str] |
| 117 |
""" |
| 118 |
Name of the bank associated with the bank account. |
| 119 |
""" |
| 120 |
fingerprint: Optional[str] |
| 121 |
""" |
| 122 |
Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same. |
| 123 |
""" |
| 124 |
last4: Optional[str] |
| 125 |
""" |
| 126 |
Last four digits of the bank account number. |
| 127 |
""" |
| 128 |
mandate: Optional[ExpandableField["Mandate"]] |
| 129 |
""" |
| 130 |
ID of the mandate used to make this payment. |
| 131 |
""" |
| 132 |
network: Literal["ach", "us_domestic_wire"] |
| 133 |
""" |
| 134 |
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. |
| 135 |
""" |
| 136 |
routing_number: Optional[str] |
| 137 |
""" |
| 138 |
Routing number of the bank account. |
| 139 |
""" |
| 140 |
|
| 141 |
billing_details: BillingDetails |
| 142 |
financial_account: Optional[FinancialAccount] |
| 143 |
type: Literal["financial_account", "us_bank_account"] |
| 144 |
""" |
| 145 |
The type of the payment method used in the OutboundTransfer. |
| 146 |
""" |
| 147 |
us_bank_account: Optional[UsBankAccount] |
| 148 |
_inner_class_types = { |
| 149 |
"billing_details": BillingDetails, |
| 150 |
"financial_account": FinancialAccount, |
| 151 |
"us_bank_account": UsBankAccount, |
| 152 |
} |
| 153 |
|
| 154 |
class ReturnedDetails(StripeObject): |
| 155 |
code: Literal[ |
| 156 |
"account_closed", |
| 157 |
"account_frozen", |
| 158 |
"bank_account_restricted", |
| 159 |
"bank_ownership_changed", |
| 160 |
"declined", |
| 161 |
"incorrect_account_holder_name", |
| 162 |
"invalid_account_number", |
| 163 |
"invalid_currency", |
| 164 |
"no_account", |
| 165 |
"other", |
| 166 |
] |
| 167 |
""" |
| 168 |
Reason for the return. |
| 169 |
""" |
| 170 |
transaction: ExpandableField["Transaction"] |
| 171 |
""" |
| 172 |
The Transaction associated with this object. |
| 173 |
""" |
| 174 |
|
| 175 |
class StatusTransitions(StripeObject): |
| 176 |
canceled_at: Optional[int] |
| 177 |
""" |
| 178 |
Timestamp describing when an OutboundTransfer changed status to `canceled` |
| 179 |
""" |
| 180 |
failed_at: Optional[int] |
| 181 |
""" |
| 182 |
Timestamp describing when an OutboundTransfer changed status to `failed` |
| 183 |
""" |
| 184 |
posted_at: Optional[int] |
| 185 |
""" |
| 186 |
Timestamp describing when an OutboundTransfer changed status to `posted` |
| 187 |
""" |
| 188 |
returned_at: Optional[int] |
| 189 |
""" |
| 190 |
Timestamp describing when an OutboundTransfer changed status to `returned` |
| 191 |
""" |
| 192 |
|
| 193 |
class TrackingDetails(StripeObject): |
| 194 |
class Ach(StripeObject): |
| 195 |
trace_id: str |
| 196 |
""" |
| 197 |
ACH trace ID of the OutboundTransfer for transfers sent over the `ach` network. |
| 198 |
""" |
| 199 |
|
| 200 |
class UsDomesticWire(StripeObject): |
| 201 |
chips: Optional[str] |
| 202 |
""" |
| 203 |
CHIPS System Sequence Number (SSN) of the OutboundTransfer for transfers sent over the `us_domestic_wire` network. |
| 204 |
""" |
| 205 |
imad: Optional[str] |
| 206 |
""" |
| 207 |
IMAD of the OutboundTransfer for transfers sent over the `us_domestic_wire` network. |
| 208 |
""" |
| 209 |
omad: Optional[str] |
| 210 |
""" |
| 211 |
OMAD of the OutboundTransfer for transfers sent over the `us_domestic_wire` network. |
| 212 |
""" |
| 213 |
|
| 214 |
ach: Optional[Ach] |
| 215 |
type: Literal["ach", "us_domestic_wire"] |
| 216 |
""" |
| 217 |
The US bank account network used to send funds. |
| 218 |
""" |
| 219 |
us_domestic_wire: Optional[UsDomesticWire] |
| 220 |
_inner_class_types = {"ach": Ach, "us_domestic_wire": UsDomesticWire} |
| 221 |
|
| 222 |
amount: int |
| 223 |
""" |
| 224 |
Amount (in cents) transferred. |
| 225 |
""" |
| 226 |
cancelable: bool |
| 227 |
""" |
| 228 |
Returns `true` if the object can be canceled, and `false` otherwise. |
| 229 |
""" |
| 230 |
created: int |
| 231 |
""" |
| 232 |
Time at which the object was created. Measured in seconds since the Unix epoch. |
| 233 |
""" |
| 234 |
currency: str |
| 235 |
""" |
| 236 |
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). |
| 237 |
""" |
| 238 |
description: Optional[str] |
| 239 |
""" |
| 240 |
An arbitrary string attached to the object. Often useful for displaying to users. |
| 241 |
""" |
| 242 |
destination_payment_method: Optional[str] |
| 243 |
""" |
| 244 |
The PaymentMethod used as the payment instrument for an OutboundTransfer. |
| 245 |
""" |
| 246 |
destination_payment_method_details: DestinationPaymentMethodDetails |
| 247 |
expected_arrival_date: int |
| 248 |
""" |
| 249 |
The date when funds are expected to arrive in the destination account. |
| 250 |
""" |
| 251 |
financial_account: str |
| 252 |
""" |
| 253 |
The FinancialAccount that funds were pulled from. |
| 254 |
""" |
| 255 |
hosted_regulatory_receipt_url: Optional[str] |
| 256 |
""" |
| 257 |
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. |
| 258 |
""" |
| 259 |
id: str |
| 260 |
""" |
| 261 |
Unique identifier for the object. |
| 262 |
""" |
| 263 |
livemode: bool |
| 264 |
""" |
| 265 |
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. |
| 266 |
""" |
| 267 |
metadata: Dict[str, str] |
| 268 |
""" |
| 269 |
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. |
| 270 |
""" |
| 271 |
object: Literal["treasury.outbound_transfer"] |
| 272 |
""" |
| 273 |
String representing the object's type. Objects of the same type share the same value. |
| 274 |
""" |
| 275 |
returned_details: Optional[ReturnedDetails] |
| 276 |
""" |
| 277 |
Details about a returned OutboundTransfer. Only set when the status is `returned`. |
| 278 |
""" |
| 279 |
statement_descriptor: str |
| 280 |
""" |
| 281 |
Information about the OutboundTransfer to be sent to the recipient account. |
| 282 |
""" |
| 283 |
status: Literal["canceled", "failed", "posted", "processing", "returned"] |
| 284 |
""" |
| 285 |
Current status of the OutboundTransfer: `processing`, `failed`, `canceled`, `posted`, `returned`. An OutboundTransfer is `processing` if it has been created and is pending. The status changes to `posted` once the OutboundTransfer has been "confirmed" and funds have left the account, or to `failed` or `canceled`. If an OutboundTransfer fails to arrive at its destination, its status will change to `returned`. |
| 286 |
""" |
| 287 |
status_transitions: StatusTransitions |
| 288 |
tracking_details: Optional[TrackingDetails] |
| 289 |
""" |
| 290 |
Details about network-specific tracking information if available. |
| 291 |
""" |
| 292 |
transaction: ExpandableField["Transaction"] |
| 293 |
""" |
| 294 |
The Transaction associated with this object. |
| 295 |
""" |
| 296 |
|
| 297 |
@classmethod |
| 298 |
def _cls_cancel( |
| 299 |
cls, |
| 300 |
outbound_transfer: str, |
| 301 |
**params: Unpack["OutboundTransferCancelParams"], |
| 302 |
) -> "OutboundTransfer": |
| 303 |
""" |
| 304 |
An OutboundTransfer can be canceled if the funds have not yet been paid out. |
| 305 |
""" |
| 306 |
return cast( |
| 307 |
"OutboundTransfer", |
| 308 |
cls._static_request( |
| 309 |
"post", |
| 310 |
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format( |
| 311 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 312 |
), |
| 313 |
params=params, |
| 314 |
), |
| 315 |
) |
| 316 |
|
| 317 |
@overload |
| 318 |
@staticmethod |
| 319 |
def cancel( |
| 320 |
outbound_transfer: str, |
| 321 |
**params: Unpack["OutboundTransferCancelParams"], |
| 322 |
) -> "OutboundTransfer": |
| 323 |
""" |
| 324 |
An OutboundTransfer can be canceled if the funds have not yet been paid out. |
| 325 |
""" |
| 326 |
... |
| 327 |
|
| 328 |
@overload |
| 329 |
def cancel( |
| 330 |
self, **params: Unpack["OutboundTransferCancelParams"] |
| 331 |
) -> "OutboundTransfer": |
| 332 |
""" |
| 333 |
An OutboundTransfer can be canceled if the funds have not yet been paid out. |
| 334 |
""" |
| 335 |
... |
| 336 |
|
| 337 |
@class_method_variant("_cls_cancel") |
| 338 |
def cancel( # pyright: ignore[reportGeneralTypeIssues] |
| 339 |
self, **params: Unpack["OutboundTransferCancelParams"] |
| 340 |
) -> "OutboundTransfer": |
| 341 |
""" |
| 342 |
An OutboundTransfer can be canceled if the funds have not yet been paid out. |
| 343 |
""" |
| 344 |
return cast( |
| 345 |
"OutboundTransfer", |
| 346 |
self._request( |
| 347 |
"post", |
| 348 |
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format( |
| 349 |
outbound_transfer=sanitize_id(self.get("id")) |
| 350 |
), |
| 351 |
params=params, |
| 352 |
), |
| 353 |
) |
| 354 |
|
| 355 |
@classmethod |
| 356 |
async def _cls_cancel_async( |
| 357 |
cls, |
| 358 |
outbound_transfer: str, |
| 359 |
**params: Unpack["OutboundTransferCancelParams"], |
| 360 |
) -> "OutboundTransfer": |
| 361 |
""" |
| 362 |
An OutboundTransfer can be canceled if the funds have not yet been paid out. |
| 363 |
""" |
| 364 |
return cast( |
| 365 |
"OutboundTransfer", |
| 366 |
await cls._static_request_async( |
| 367 |
"post", |
| 368 |
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format( |
| 369 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 370 |
), |
| 371 |
params=params, |
| 372 |
), |
| 373 |
) |
| 374 |
|
| 375 |
@overload |
| 376 |
@staticmethod |
| 377 |
async def cancel_async( |
| 378 |
outbound_transfer: str, |
| 379 |
**params: Unpack["OutboundTransferCancelParams"], |
| 380 |
) -> "OutboundTransfer": |
| 381 |
""" |
| 382 |
An OutboundTransfer can be canceled if the funds have not yet been paid out. |
| 383 |
""" |
| 384 |
... |
| 385 |
|
| 386 |
@overload |
| 387 |
async def cancel_async( |
| 388 |
self, **params: Unpack["OutboundTransferCancelParams"] |
| 389 |
) -> "OutboundTransfer": |
| 390 |
""" |
| 391 |
An OutboundTransfer can be canceled if the funds have not yet been paid out. |
| 392 |
""" |
| 393 |
... |
| 394 |
|
| 395 |
@class_method_variant("_cls_cancel_async") |
| 396 |
async def cancel_async( # pyright: ignore[reportGeneralTypeIssues] |
| 397 |
self, **params: Unpack["OutboundTransferCancelParams"] |
| 398 |
) -> "OutboundTransfer": |
| 399 |
""" |
| 400 |
An OutboundTransfer can be canceled if the funds have not yet been paid out. |
| 401 |
""" |
| 402 |
return cast( |
| 403 |
"OutboundTransfer", |
| 404 |
await self._request_async( |
| 405 |
"post", |
| 406 |
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format( |
| 407 |
outbound_transfer=sanitize_id(self.get("id")) |
| 408 |
), |
| 409 |
params=params, |
| 410 |
), |
| 411 |
) |
| 412 |
|
| 413 |
@classmethod |
| 414 |
def create( |
| 415 |
cls, **params: Unpack["OutboundTransferCreateParams"] |
| 416 |
) -> "OutboundTransfer": |
| 417 |
""" |
| 418 |
Creates an OutboundTransfer. |
| 419 |
""" |
| 420 |
return cast( |
| 421 |
"OutboundTransfer", |
| 422 |
cls._static_request( |
| 423 |
"post", |
| 424 |
cls.class_url(), |
| 425 |
params=params, |
| 426 |
), |
| 427 |
) |
| 428 |
|
| 429 |
@classmethod |
| 430 |
async def create_async( |
| 431 |
cls, **params: Unpack["OutboundTransferCreateParams"] |
| 432 |
) -> "OutboundTransfer": |
| 433 |
""" |
| 434 |
Creates an OutboundTransfer. |
| 435 |
""" |
| 436 |
return cast( |
| 437 |
"OutboundTransfer", |
| 438 |
await cls._static_request_async( |
| 439 |
"post", |
| 440 |
cls.class_url(), |
| 441 |
params=params, |
| 442 |
), |
| 443 |
) |
| 444 |
|
| 445 |
@classmethod |
| 446 |
def list( |
| 447 |
cls, **params: Unpack["OutboundTransferListParams"] |
| 448 |
) -> ListObject["OutboundTransfer"]: |
| 449 |
""" |
| 450 |
Returns a list of OutboundTransfers sent from the specified FinancialAccount. |
| 451 |
""" |
| 452 |
result = cls._static_request( |
| 453 |
"get", |
| 454 |
cls.class_url(), |
| 455 |
params=params, |
| 456 |
) |
| 457 |
if not isinstance(result, ListObject): |
| 458 |
raise TypeError( |
| 459 |
"Expected list object from API, got %s" |
| 460 |
% (type(result).__name__) |
| 461 |
) |
| 462 |
|
| 463 |
return result |
| 464 |
|
| 465 |
@classmethod |
| 466 |
async def list_async( |
| 467 |
cls, **params: Unpack["OutboundTransferListParams"] |
| 468 |
) -> ListObject["OutboundTransfer"]: |
| 469 |
""" |
| 470 |
Returns a list of OutboundTransfers sent from the specified FinancialAccount. |
| 471 |
""" |
| 472 |
result = await cls._static_request_async( |
| 473 |
"get", |
| 474 |
cls.class_url(), |
| 475 |
params=params, |
| 476 |
) |
| 477 |
if not isinstance(result, ListObject): |
| 478 |
raise TypeError( |
| 479 |
"Expected list object from API, got %s" |
| 480 |
% (type(result).__name__) |
| 481 |
) |
| 482 |
|
| 483 |
return result |
| 484 |
|
| 485 |
@classmethod |
| 486 |
def retrieve( |
| 487 |
cls, id: str, **params: Unpack["OutboundTransferRetrieveParams"] |
| 488 |
) -> "OutboundTransfer": |
| 489 |
""" |
| 490 |
Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list. |
| 491 |
""" |
| 492 |
instance = cls(id, **params) |
| 493 |
instance.refresh() |
| 494 |
return instance |
| 495 |
|
| 496 |
@classmethod |
| 497 |
async def retrieve_async( |
| 498 |
cls, id: str, **params: Unpack["OutboundTransferRetrieveParams"] |
| 499 |
) -> "OutboundTransfer": |
| 500 |
""" |
| 501 |
Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list. |
| 502 |
""" |
| 503 |
instance = cls(id, **params) |
| 504 |
await instance.refresh_async() |
| 505 |
return instance |
| 506 |
|
| 507 |
class TestHelpers(APIResourceTestHelpers["OutboundTransfer"]): |
| 508 |
_resource_cls: Type["OutboundTransfer"] |
| 509 |
|
| 510 |
@classmethod |
| 511 |
def _cls_fail( |
| 512 |
cls, |
| 513 |
outbound_transfer: str, |
| 514 |
**params: Unpack["OutboundTransferFailParams"], |
| 515 |
) -> "OutboundTransfer": |
| 516 |
""" |
| 517 |
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. |
| 518 |
""" |
| 519 |
return cast( |
| 520 |
"OutboundTransfer", |
| 521 |
cls._static_request( |
| 522 |
"post", |
| 523 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format( |
| 524 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 525 |
), |
| 526 |
params=params, |
| 527 |
), |
| 528 |
) |
| 529 |
|
| 530 |
@overload |
| 531 |
@staticmethod |
| 532 |
def fail( |
| 533 |
outbound_transfer: str, |
| 534 |
**params: Unpack["OutboundTransferFailParams"], |
| 535 |
) -> "OutboundTransfer": |
| 536 |
""" |
| 537 |
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. |
| 538 |
""" |
| 539 |
... |
| 540 |
|
| 541 |
@overload |
| 542 |
def fail( |
| 543 |
self, **params: Unpack["OutboundTransferFailParams"] |
| 544 |
) -> "OutboundTransfer": |
| 545 |
""" |
| 546 |
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. |
| 547 |
""" |
| 548 |
... |
| 549 |
|
| 550 |
@class_method_variant("_cls_fail") |
| 551 |
def fail( # pyright: ignore[reportGeneralTypeIssues] |
| 552 |
self, **params: Unpack["OutboundTransferFailParams"] |
| 553 |
) -> "OutboundTransfer": |
| 554 |
""" |
| 555 |
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. |
| 556 |
""" |
| 557 |
return cast( |
| 558 |
"OutboundTransfer", |
| 559 |
self.resource._request( |
| 560 |
"post", |
| 561 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format( |
| 562 |
outbound_transfer=sanitize_id(self.resource.get("id")) |
| 563 |
), |
| 564 |
params=params, |
| 565 |
), |
| 566 |
) |
| 567 |
|
| 568 |
@classmethod |
| 569 |
async def _cls_fail_async( |
| 570 |
cls, |
| 571 |
outbound_transfer: str, |
| 572 |
**params: Unpack["OutboundTransferFailParams"], |
| 573 |
) -> "OutboundTransfer": |
| 574 |
""" |
| 575 |
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. |
| 576 |
""" |
| 577 |
return cast( |
| 578 |
"OutboundTransfer", |
| 579 |
await cls._static_request_async( |
| 580 |
"post", |
| 581 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format( |
| 582 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 583 |
), |
| 584 |
params=params, |
| 585 |
), |
| 586 |
) |
| 587 |
|
| 588 |
@overload |
| 589 |
@staticmethod |
| 590 |
async def fail_async( |
| 591 |
outbound_transfer: str, |
| 592 |
**params: Unpack["OutboundTransferFailParams"], |
| 593 |
) -> "OutboundTransfer": |
| 594 |
""" |
| 595 |
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. |
| 596 |
""" |
| 597 |
... |
| 598 |
|
| 599 |
@overload |
| 600 |
async def fail_async( |
| 601 |
self, **params: Unpack["OutboundTransferFailParams"] |
| 602 |
) -> "OutboundTransfer": |
| 603 |
""" |
| 604 |
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. |
| 605 |
""" |
| 606 |
... |
| 607 |
|
| 608 |
@class_method_variant("_cls_fail_async") |
| 609 |
async def fail_async( # pyright: ignore[reportGeneralTypeIssues] |
| 610 |
self, **params: Unpack["OutboundTransferFailParams"] |
| 611 |
) -> "OutboundTransfer": |
| 612 |
""" |
| 613 |
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. |
| 614 |
""" |
| 615 |
return cast( |
| 616 |
"OutboundTransfer", |
| 617 |
await self.resource._request_async( |
| 618 |
"post", |
| 619 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format( |
| 620 |
outbound_transfer=sanitize_id(self.resource.get("id")) |
| 621 |
), |
| 622 |
params=params, |
| 623 |
), |
| 624 |
) |
| 625 |
|
| 626 |
@classmethod |
| 627 |
def _cls_post( |
| 628 |
cls, |
| 629 |
outbound_transfer: str, |
| 630 |
**params: Unpack["OutboundTransferPostParams"], |
| 631 |
) -> "OutboundTransfer": |
| 632 |
""" |
| 633 |
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. |
| 634 |
""" |
| 635 |
return cast( |
| 636 |
"OutboundTransfer", |
| 637 |
cls._static_request( |
| 638 |
"post", |
| 639 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format( |
| 640 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 641 |
), |
| 642 |
params=params, |
| 643 |
), |
| 644 |
) |
| 645 |
|
| 646 |
@overload |
| 647 |
@staticmethod |
| 648 |
def post( |
| 649 |
outbound_transfer: str, |
| 650 |
**params: Unpack["OutboundTransferPostParams"], |
| 651 |
) -> "OutboundTransfer": |
| 652 |
""" |
| 653 |
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. |
| 654 |
""" |
| 655 |
... |
| 656 |
|
| 657 |
@overload |
| 658 |
def post( |
| 659 |
self, **params: Unpack["OutboundTransferPostParams"] |
| 660 |
) -> "OutboundTransfer": |
| 661 |
""" |
| 662 |
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. |
| 663 |
""" |
| 664 |
... |
| 665 |
|
| 666 |
@class_method_variant("_cls_post") |
| 667 |
def post( # pyright: ignore[reportGeneralTypeIssues] |
| 668 |
self, **params: Unpack["OutboundTransferPostParams"] |
| 669 |
) -> "OutboundTransfer": |
| 670 |
""" |
| 671 |
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. |
| 672 |
""" |
| 673 |
return cast( |
| 674 |
"OutboundTransfer", |
| 675 |
self.resource._request( |
| 676 |
"post", |
| 677 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format( |
| 678 |
outbound_transfer=sanitize_id(self.resource.get("id")) |
| 679 |
), |
| 680 |
params=params, |
| 681 |
), |
| 682 |
) |
| 683 |
|
| 684 |
@classmethod |
| 685 |
async def _cls_post_async( |
| 686 |
cls, |
| 687 |
outbound_transfer: str, |
| 688 |
**params: Unpack["OutboundTransferPostParams"], |
| 689 |
) -> "OutboundTransfer": |
| 690 |
""" |
| 691 |
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. |
| 692 |
""" |
| 693 |
return cast( |
| 694 |
"OutboundTransfer", |
| 695 |
await cls._static_request_async( |
| 696 |
"post", |
| 697 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format( |
| 698 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 699 |
), |
| 700 |
params=params, |
| 701 |
), |
| 702 |
) |
| 703 |
|
| 704 |
@overload |
| 705 |
@staticmethod |
| 706 |
async def post_async( |
| 707 |
outbound_transfer: str, |
| 708 |
**params: Unpack["OutboundTransferPostParams"], |
| 709 |
) -> "OutboundTransfer": |
| 710 |
""" |
| 711 |
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. |
| 712 |
""" |
| 713 |
... |
| 714 |
|
| 715 |
@overload |
| 716 |
async def post_async( |
| 717 |
self, **params: Unpack["OutboundTransferPostParams"] |
| 718 |
) -> "OutboundTransfer": |
| 719 |
""" |
| 720 |
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. |
| 721 |
""" |
| 722 |
... |
| 723 |
|
| 724 |
@class_method_variant("_cls_post_async") |
| 725 |
async def post_async( # pyright: ignore[reportGeneralTypeIssues] |
| 726 |
self, **params: Unpack["OutboundTransferPostParams"] |
| 727 |
) -> "OutboundTransfer": |
| 728 |
""" |
| 729 |
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. |
| 730 |
""" |
| 731 |
return cast( |
| 732 |
"OutboundTransfer", |
| 733 |
await self.resource._request_async( |
| 734 |
"post", |
| 735 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format( |
| 736 |
outbound_transfer=sanitize_id(self.resource.get("id")) |
| 737 |
), |
| 738 |
params=params, |
| 739 |
), |
| 740 |
) |
| 741 |
|
| 742 |
@classmethod |
| 743 |
def _cls_return_outbound_transfer( |
| 744 |
cls, |
| 745 |
outbound_transfer: str, |
| 746 |
**params: Unpack["OutboundTransferReturnOutboundTransferParams"], |
| 747 |
) -> "OutboundTransfer": |
| 748 |
""" |
| 749 |
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. |
| 750 |
""" |
| 751 |
return cast( |
| 752 |
"OutboundTransfer", |
| 753 |
cls._static_request( |
| 754 |
"post", |
| 755 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format( |
| 756 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 757 |
), |
| 758 |
params=params, |
| 759 |
), |
| 760 |
) |
| 761 |
|
| 762 |
@overload |
| 763 |
@staticmethod |
| 764 |
def return_outbound_transfer( |
| 765 |
outbound_transfer: str, |
| 766 |
**params: Unpack["OutboundTransferReturnOutboundTransferParams"], |
| 767 |
) -> "OutboundTransfer": |
| 768 |
""" |
| 769 |
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. |
| 770 |
""" |
| 771 |
... |
| 772 |
|
| 773 |
@overload |
| 774 |
def return_outbound_transfer( |
| 775 |
self, |
| 776 |
**params: Unpack["OutboundTransferReturnOutboundTransferParams"], |
| 777 |
) -> "OutboundTransfer": |
| 778 |
""" |
| 779 |
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. |
| 780 |
""" |
| 781 |
... |
| 782 |
|
| 783 |
@class_method_variant("_cls_return_outbound_transfer") |
| 784 |
def return_outbound_transfer( # pyright: ignore[reportGeneralTypeIssues] |
| 785 |
self, |
| 786 |
**params: Unpack["OutboundTransferReturnOutboundTransferParams"], |
| 787 |
) -> "OutboundTransfer": |
| 788 |
""" |
| 789 |
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. |
| 790 |
""" |
| 791 |
return cast( |
| 792 |
"OutboundTransfer", |
| 793 |
self.resource._request( |
| 794 |
"post", |
| 795 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format( |
| 796 |
outbound_transfer=sanitize_id(self.resource.get("id")) |
| 797 |
), |
| 798 |
params=params, |
| 799 |
), |
| 800 |
) |
| 801 |
|
| 802 |
@classmethod |
| 803 |
async def _cls_return_outbound_transfer_async( |
| 804 |
cls, |
| 805 |
outbound_transfer: str, |
| 806 |
**params: Unpack["OutboundTransferReturnOutboundTransferParams"], |
| 807 |
) -> "OutboundTransfer": |
| 808 |
""" |
| 809 |
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. |
| 810 |
""" |
| 811 |
return cast( |
| 812 |
"OutboundTransfer", |
| 813 |
await cls._static_request_async( |
| 814 |
"post", |
| 815 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format( |
| 816 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 817 |
), |
| 818 |
params=params, |
| 819 |
), |
| 820 |
) |
| 821 |
|
| 822 |
@overload |
| 823 |
@staticmethod |
| 824 |
async def return_outbound_transfer_async( |
| 825 |
outbound_transfer: str, |
| 826 |
**params: Unpack["OutboundTransferReturnOutboundTransferParams"], |
| 827 |
) -> "OutboundTransfer": |
| 828 |
""" |
| 829 |
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. |
| 830 |
""" |
| 831 |
... |
| 832 |
|
| 833 |
@overload |
| 834 |
async def return_outbound_transfer_async( |
| 835 |
self, |
| 836 |
**params: Unpack["OutboundTransferReturnOutboundTransferParams"], |
| 837 |
) -> "OutboundTransfer": |
| 838 |
""" |
| 839 |
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. |
| 840 |
""" |
| 841 |
... |
| 842 |
|
| 843 |
@class_method_variant("_cls_return_outbound_transfer_async") |
| 844 |
async def return_outbound_transfer_async( # pyright: ignore[reportGeneralTypeIssues] |
| 845 |
self, |
| 846 |
**params: Unpack["OutboundTransferReturnOutboundTransferParams"], |
| 847 |
) -> "OutboundTransfer": |
| 848 |
""" |
| 849 |
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. |
| 850 |
""" |
| 851 |
return cast( |
| 852 |
"OutboundTransfer", |
| 853 |
await self.resource._request_async( |
| 854 |
"post", |
| 855 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format( |
| 856 |
outbound_transfer=sanitize_id(self.resource.get("id")) |
| 857 |
), |
| 858 |
params=params, |
| 859 |
), |
| 860 |
) |
| 861 |
|
| 862 |
@classmethod |
| 863 |
def _cls_update( |
| 864 |
cls, |
| 865 |
outbound_transfer: str, |
| 866 |
**params: Unpack["OutboundTransferUpdateParams"], |
| 867 |
) -> "OutboundTransfer": |
| 868 |
""" |
| 869 |
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. |
| 870 |
""" |
| 871 |
return cast( |
| 872 |
"OutboundTransfer", |
| 873 |
cls._static_request( |
| 874 |
"post", |
| 875 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format( |
| 876 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 877 |
), |
| 878 |
params=params, |
| 879 |
), |
| 880 |
) |
| 881 |
|
| 882 |
@overload |
| 883 |
@staticmethod |
| 884 |
def update( |
| 885 |
outbound_transfer: str, |
| 886 |
**params: Unpack["OutboundTransferUpdateParams"], |
| 887 |
) -> "OutboundTransfer": |
| 888 |
""" |
| 889 |
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. |
| 890 |
""" |
| 891 |
... |
| 892 |
|
| 893 |
@overload |
| 894 |
def update( |
| 895 |
self, **params: Unpack["OutboundTransferUpdateParams"] |
| 896 |
) -> "OutboundTransfer": |
| 897 |
""" |
| 898 |
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. |
| 899 |
""" |
| 900 |
... |
| 901 |
|
| 902 |
@class_method_variant("_cls_update") |
| 903 |
def update( # pyright: ignore[reportGeneralTypeIssues] |
| 904 |
self, **params: Unpack["OutboundTransferUpdateParams"] |
| 905 |
) -> "OutboundTransfer": |
| 906 |
""" |
| 907 |
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. |
| 908 |
""" |
| 909 |
return cast( |
| 910 |
"OutboundTransfer", |
| 911 |
self.resource._request( |
| 912 |
"post", |
| 913 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format( |
| 914 |
outbound_transfer=sanitize_id(self.resource.get("id")) |
| 915 |
), |
| 916 |
params=params, |
| 917 |
), |
| 918 |
) |
| 919 |
|
| 920 |
@classmethod |
| 921 |
async def _cls_update_async( |
| 922 |
cls, |
| 923 |
outbound_transfer: str, |
| 924 |
**params: Unpack["OutboundTransferUpdateParams"], |
| 925 |
) -> "OutboundTransfer": |
| 926 |
""" |
| 927 |
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. |
| 928 |
""" |
| 929 |
return cast( |
| 930 |
"OutboundTransfer", |
| 931 |
await cls._static_request_async( |
| 932 |
"post", |
| 933 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format( |
| 934 |
outbound_transfer=sanitize_id(outbound_transfer) |
| 935 |
), |
| 936 |
params=params, |
| 937 |
), |
| 938 |
) |
| 939 |
|
| 940 |
@overload |
| 941 |
@staticmethod |
| 942 |
async def update_async( |
| 943 |
outbound_transfer: str, |
| 944 |
**params: Unpack["OutboundTransferUpdateParams"], |
| 945 |
) -> "OutboundTransfer": |
| 946 |
""" |
| 947 |
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. |
| 948 |
""" |
| 949 |
... |
| 950 |
|
| 951 |
@overload |
| 952 |
async def update_async( |
| 953 |
self, **params: Unpack["OutboundTransferUpdateParams"] |
| 954 |
) -> "OutboundTransfer": |
| 955 |
""" |
| 956 |
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. |
| 957 |
""" |
| 958 |
... |
| 959 |
|
| 960 |
@class_method_variant("_cls_update_async") |
| 961 |
async def update_async( # pyright: ignore[reportGeneralTypeIssues] |
| 962 |
self, **params: Unpack["OutboundTransferUpdateParams"] |
| 963 |
) -> "OutboundTransfer": |
| 964 |
""" |
| 965 |
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states. |
| 966 |
""" |
| 967 |
return cast( |
| 968 |
"OutboundTransfer", |
| 969 |
await self.resource._request_async( |
| 970 |
"post", |
| 971 |
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format( |
| 972 |
outbound_transfer=sanitize_id(self.resource.get("id")) |
| 973 |
), |
| 974 |
params=params, |
| 975 |
), |
| 976 |
) |
| 977 |
|
| 978 |
@property |
| 979 |
def test_helpers(self): |
| 980 |
return self.TestHelpers(self) |
| 981 |
|
| 982 |
_inner_class_types = { |
| 983 |
"destination_payment_method_details": DestinationPaymentMethodDetails, |
| 984 |
"returned_details": ReturnedDetails, |
| 985 |
"status_transitions": StatusTransitions, |
| 986 |
"tracking_details": TrackingDetails, |
| 987 |
} |
| 988 |
|
| 989 |
|
| 990 |
OutboundTransfer.TestHelpers._resource_cls = OutboundTransfer |