Debian Codegraph @

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