Debian Codegraph @

stripe/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._list_object import ListObject
10 from stripe._request_options import RequestOptions
11 from stripe.params.treasury._outbound_transfer_cancel_params import (
12 OutboundTransferCancelParams,
13 )
14 from stripe.params.treasury._outbound_transfer_create_params import (
15 OutboundTransferCreateParams,
16 )
17 from stripe.params.treasury._outbound_transfer_list_params import (
18 OutboundTransferListParams,
19 )
20 from stripe.params.treasury._outbound_transfer_retrieve_params import (
21 OutboundTransferRetrieveParams,
22 )
23 from stripe.treasury._outbound_transfer import OutboundTransfer
24
25
26 class OutboundTransferService(StripeService):
27 def list(
28 self,
29 params: "OutboundTransferListParams",
30 options: Optional["RequestOptions"] = None,
31 ) -> "ListObject[OutboundTransfer]":
32 """
33 Returns a list of OutboundTransfers sent from the specified FinancialAccount.
34 """
35 return cast(
36 "ListObject[OutboundTransfer]",
37 self._request(
38 "get",
39 "/v1/treasury/outbound_transfers",
40 base_address="api",
41 params=params,
42 options=options,
43 ),
44 )
45
46 async def list_async(
47 self,
48 params: "OutboundTransferListParams",
49 options: Optional["RequestOptions"] = None,
50 ) -> "ListObject[OutboundTransfer]":
51 """
52 Returns a list of OutboundTransfers sent from the specified FinancialAccount.
53 """
54 return cast(
55 "ListObject[OutboundTransfer]",
56 await self._request_async(
57 "get",
58 "/v1/treasury/outbound_transfers",
59 base_address="api",
60 params=params,
61 options=options,
62 ),
63 )
64
65 def create(
66 self,
67 params: "OutboundTransferCreateParams",
68 options: Optional["RequestOptions"] = None,
69 ) -> "OutboundTransfer":
70 """
71 Creates an OutboundTransfer.
72 """
73 return cast(
74 "OutboundTransfer",
75 self._request(
76 "post",
77 "/v1/treasury/outbound_transfers",
78 base_address="api",
79 params=params,
80 options=options,
81 ),
82 )
83
84 async def create_async(
85 self,
86 params: "OutboundTransferCreateParams",
87 options: Optional["RequestOptions"] = None,
88 ) -> "OutboundTransfer":
89 """
90 Creates an OutboundTransfer.
91 """
92 return cast(
93 "OutboundTransfer",
94 await self._request_async(
95 "post",
96 "/v1/treasury/outbound_transfers",
97 base_address="api",
98 params=params,
99 options=options,
100 ),
101 )
102
103 def retrieve(
104 self,
105 outbound_transfer: str,
106 params: Optional["OutboundTransferRetrieveParams"] = None,
107 options: Optional["RequestOptions"] = None,
108 ) -> "OutboundTransfer":
109 """
110 Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list.
111 """
112 return cast(
113 "OutboundTransfer",
114 self._request(
115 "get",
116 "/v1/treasury/outbound_transfers/{outbound_transfer}".format(
117 outbound_transfer=sanitize_id(outbound_transfer),
118 ),
119 base_address="api",
120 params=params,
121 options=options,
122 ),
123 )
124
125 async def retrieve_async(
126 self,
127 outbound_transfer: str,
128 params: Optional["OutboundTransferRetrieveParams"] = None,
129 options: Optional["RequestOptions"] = None,
130 ) -> "OutboundTransfer":
131 """
132 Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list.
133 """
134 return cast(
135 "OutboundTransfer",
136 await self._request_async(
137 "get",
138 "/v1/treasury/outbound_transfers/{outbound_transfer}".format(
139 outbound_transfer=sanitize_id(outbound_transfer),
140 ),
141 base_address="api",
142 params=params,
143 options=options,
144 ),
145 )
146
147 def cancel(
148 self,
149 outbound_transfer: str,
150 params: Optional["OutboundTransferCancelParams"] = None,
151 options: Optional["RequestOptions"] = None,
152 ) -> "OutboundTransfer":
153 """
154 An OutboundTransfer can be canceled if the funds have not yet been paid out.
155 """
156 return cast(
157 "OutboundTransfer",
158 self._request(
159 "post",
160 "/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format(
161 outbound_transfer=sanitize_id(outbound_transfer),
162 ),
163 base_address="api",
164 params=params,
165 options=options,
166 ),
167 )
168
169 async def cancel_async(
170 self,
171 outbound_transfer: str,
172 params: Optional["OutboundTransferCancelParams"] = None,
173 options: Optional["RequestOptions"] = None,
174 ) -> "OutboundTransfer":
175 """
176 An OutboundTransfer can be canceled if the funds have not yet been paid out.
177 """
178 return cast(
179 "OutboundTransfer",
180 await self._request_async(
181 "post",
182 "/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format(
183 outbound_transfer=sanitize_id(outbound_transfer),
184 ),
185 base_address="api",
186 params=params,
187 options=options,
188 ),
189 )