Debian Codegraph @

stripe/test_helpers/treasury/_inbound_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._inbound_transfer_fail_params import (
11 InboundTransferFailParams,
12 )
13 from stripe.params.test_helpers.treasury._inbound_transfer_return_inbound_transfer_params import (
14 InboundTransferReturnInboundTransferParams,
15 )
16 from stripe.params.test_helpers.treasury._inbound_transfer_succeed_params import (
17 InboundTransferSucceedParams,
18 )
19 from stripe.treasury._inbound_transfer import InboundTransfer
20
21
22 class InboundTransferService(StripeService):
23 def fail(
24 self,
25 id: str,
26 params: Optional["InboundTransferFailParams"] = None,
27 options: Optional["RequestOptions"] = None,
28 ) -> "InboundTransfer":
29 """
30 Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
31 """
32 return cast(
33 "InboundTransfer",
34 self._request(
35 "post",
36 "/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format(
37 id=sanitize_id(id),
38 ),
39 base_address="api",
40 params=params,
41 options=options,
42 ),
43 )
44
45 async def fail_async(
46 self,
47 id: str,
48 params: Optional["InboundTransferFailParams"] = None,
49 options: Optional["RequestOptions"] = None,
50 ) -> "InboundTransfer":
51 """
52 Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
53 """
54 return cast(
55 "InboundTransfer",
56 await self._request_async(
57 "post",
58 "/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format(
59 id=sanitize_id(id),
60 ),
61 base_address="api",
62 params=params,
63 options=options,
64 ),
65 )
66
67 def return_inbound_transfer(
68 self,
69 id: str,
70 params: Optional["InboundTransferReturnInboundTransferParams"] = None,
71 options: Optional["RequestOptions"] = None,
72 ) -> "InboundTransfer":
73 """
74 Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
75 """
76 return cast(
77 "InboundTransfer",
78 self._request(
79 "post",
80 "/v1/test_helpers/treasury/inbound_transfers/{id}/return".format(
81 id=sanitize_id(id),
82 ),
83 base_address="api",
84 params=params,
85 options=options,
86 ),
87 )
88
89 async def return_inbound_transfer_async(
90 self,
91 id: str,
92 params: Optional["InboundTransferReturnInboundTransferParams"] = None,
93 options: Optional["RequestOptions"] = None,
94 ) -> "InboundTransfer":
95 """
96 Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
97 """
98 return cast(
99 "InboundTransfer",
100 await self._request_async(
101 "post",
102 "/v1/test_helpers/treasury/inbound_transfers/{id}/return".format(
103 id=sanitize_id(id),
104 ),
105 base_address="api",
106 params=params,
107 options=options,
108 ),
109 )
110
111 def succeed(
112 self,
113 id: str,
114 params: Optional["InboundTransferSucceedParams"] = None,
115 options: Optional["RequestOptions"] = None,
116 ) -> "InboundTransfer":
117 """
118 Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
119 """
120 return cast(
121 "InboundTransfer",
122 self._request(
123 "post",
124 "/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format(
125 id=sanitize_id(id),
126 ),
127 base_address="api",
128 params=params,
129 options=options,
130 ),
131 )
132
133 async def succeed_async(
134 self,
135 id: str,
136 params: Optional["InboundTransferSucceedParams"] = None,
137 options: Optional["RequestOptions"] = None,
138 ) -> "InboundTransfer":
139 """
140 Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
141 """
142 return cast(
143 "InboundTransfer",
144 await self._request_async(
145 "post",
146 "/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format(
147 id=sanitize_id(id),
148 ),
149 base_address="api",
150 params=params,
151 options=options,
152 ),
153 )