Debian Codegraph @

stripe/test_helpers/treasury/_outbound_payment_service.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._stripe_service import StripeService
4 from stripe._util import sanitize_id
5 from typing import Optional, cast
6 from typing_extensions import TYPE_CHECKING
7
8 if TYPE_CHECKING:
9 from stripe._request_options import RequestOptions
10 from stripe.params.test_helpers.treasury._outbound_payment_fail_params import (
11 OutboundPaymentFailParams,
12 )
13 from stripe.params.test_helpers.treasury._outbound_payment_post_params import (
14 OutboundPaymentPostParams,
15 )
16 from stripe.params.test_helpers.treasury._outbound_payment_return_outbound_payment_params import (
17 OutboundPaymentReturnOutboundPaymentParams,
18 )
19 from stripe.params.test_helpers.treasury._outbound_payment_update_params import (
20 OutboundPaymentUpdateParams,
21 )
22 from stripe.treasury._outbound_payment import OutboundPayment
23
24
25 class OutboundPaymentService(StripeService):
26 def update(
27 self,
28 id: str,
29 params: "OutboundPaymentUpdateParams",
30 options: Optional["RequestOptions"] = None,
31 ) -> "OutboundPayment":
32 """
33 Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
34 """
35 return cast(
36 "OutboundPayment",
37 self._request(
38 "post",
39 "/v1/test_helpers/treasury/outbound_payments/{id}".format(
40 id=sanitize_id(id),
41 ),
42 base_address="api",
43 params=params,
44 options=options,
45 ),
46 )
47
48 async def update_async(
49 self,
50 id: str,
51 params: "OutboundPaymentUpdateParams",
52 options: Optional["RequestOptions"] = None,
53 ) -> "OutboundPayment":
54 """
55 Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
56 """
57 return cast(
58 "OutboundPayment",
59 await self._request_async(
60 "post",
61 "/v1/test_helpers/treasury/outbound_payments/{id}".format(
62 id=sanitize_id(id),
63 ),
64 base_address="api",
65 params=params,
66 options=options,
67 ),
68 )
69
70 def fail(
71 self,
72 id: str,
73 params: Optional["OutboundPaymentFailParams"] = None,
74 options: Optional["RequestOptions"] = None,
75 ) -> "OutboundPayment":
76 """
77 Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
78 """
79 return cast(
80 "OutboundPayment",
81 self._request(
82 "post",
83 "/v1/test_helpers/treasury/outbound_payments/{id}/fail".format(
84 id=sanitize_id(id),
85 ),
86 base_address="api",
87 params=params,
88 options=options,
89 ),
90 )
91
92 async def fail_async(
93 self,
94 id: str,
95 params: Optional["OutboundPaymentFailParams"] = None,
96 options: Optional["RequestOptions"] = None,
97 ) -> "OutboundPayment":
98 """
99 Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
100 """
101 return cast(
102 "OutboundPayment",
103 await self._request_async(
104 "post",
105 "/v1/test_helpers/treasury/outbound_payments/{id}/fail".format(
106 id=sanitize_id(id),
107 ),
108 base_address="api",
109 params=params,
110 options=options,
111 ),
112 )
113
114 def post(
115 self,
116 id: str,
117 params: Optional["OutboundPaymentPostParams"] = None,
118 options: Optional["RequestOptions"] = None,
119 ) -> "OutboundPayment":
120 """
121 Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
122 """
123 return cast(
124 "OutboundPayment",
125 self._request(
126 "post",
127 "/v1/test_helpers/treasury/outbound_payments/{id}/post".format(
128 id=sanitize_id(id),
129 ),
130 base_address="api",
131 params=params,
132 options=options,
133 ),
134 )
135
136 async def post_async(
137 self,
138 id: str,
139 params: Optional["OutboundPaymentPostParams"] = None,
140 options: Optional["RequestOptions"] = None,
141 ) -> "OutboundPayment":
142 """
143 Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
144 """
145 return cast(
146 "OutboundPayment",
147 await self._request_async(
148 "post",
149 "/v1/test_helpers/treasury/outbound_payments/{id}/post".format(
150 id=sanitize_id(id),
151 ),
152 base_address="api",
153 params=params,
154 options=options,
155 ),
156 )
157
158 def return_outbound_payment(
159 self,
160 id: str,
161 params: Optional["OutboundPaymentReturnOutboundPaymentParams"] = None,
162 options: Optional["RequestOptions"] = None,
163 ) -> "OutboundPayment":
164 """
165 Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
166 """
167 return cast(
168 "OutboundPayment",
169 self._request(
170 "post",
171 "/v1/test_helpers/treasury/outbound_payments/{id}/return".format(
172 id=sanitize_id(id),
173 ),
174 base_address="api",
175 params=params,
176 options=options,
177 ),
178 )
179
180 async def return_outbound_payment_async(
181 self,
182 id: str,
183 params: Optional["OutboundPaymentReturnOutboundPaymentParams"] = None,
184 options: Optional["RequestOptions"] = None,
185 ) -> "OutboundPayment":
186 """
187 Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
188 """
189 return cast(
190 "OutboundPayment",
191 await self._request_async(
192 "post",
193 "/v1/test_helpers/treasury/outbound_payments/{id}/return".format(
194 id=sanitize_id(id),
195 ),
196 base_address="api",
197 params=params,
198 options=options,
199 ),
200 )