Debian Codegraph @

stripe/treasury/_outbound_payment.py

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