airbyte-agent-stripe 0.5.28__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_agent_stripe/__init__.py +237 -0
- airbyte_agent_stripe/_vendored/__init__.py +1 -0
- airbyte_agent_stripe/_vendored/connector_sdk/__init__.py +82 -0
- airbyte_agent_stripe/_vendored/connector_sdk/auth_strategies.py +1123 -0
- airbyte_agent_stripe/_vendored/connector_sdk/auth_template.py +135 -0
- airbyte_agent_stripe/_vendored/connector_sdk/cloud_utils/__init__.py +5 -0
- airbyte_agent_stripe/_vendored/connector_sdk/cloud_utils/client.py +213 -0
- airbyte_agent_stripe/_vendored/connector_sdk/connector_model_loader.py +957 -0
- airbyte_agent_stripe/_vendored/connector_sdk/constants.py +78 -0
- airbyte_agent_stripe/_vendored/connector_sdk/exceptions.py +23 -0
- airbyte_agent_stripe/_vendored/connector_sdk/executor/__init__.py +31 -0
- airbyte_agent_stripe/_vendored/connector_sdk/executor/hosted_executor.py +197 -0
- airbyte_agent_stripe/_vendored/connector_sdk/executor/local_executor.py +1524 -0
- airbyte_agent_stripe/_vendored/connector_sdk/executor/models.py +190 -0
- airbyte_agent_stripe/_vendored/connector_sdk/extensions.py +655 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/__init__.py +37 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/adapters/__init__.py +9 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/adapters/httpx_adapter.py +251 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/config.py +98 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/exceptions.py +119 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/protocols.py +114 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http/response.py +102 -0
- airbyte_agent_stripe/_vendored/connector_sdk/http_client.py +686 -0
- airbyte_agent_stripe/_vendored/connector_sdk/logging/__init__.py +11 -0
- airbyte_agent_stripe/_vendored/connector_sdk/logging/logger.py +264 -0
- airbyte_agent_stripe/_vendored/connector_sdk/logging/types.py +92 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/__init__.py +11 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/models.py +19 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/redactor.py +81 -0
- airbyte_agent_stripe/_vendored/connector_sdk/observability/session.py +94 -0
- airbyte_agent_stripe/_vendored/connector_sdk/performance/__init__.py +6 -0
- airbyte_agent_stripe/_vendored/connector_sdk/performance/instrumentation.py +57 -0
- airbyte_agent_stripe/_vendored/connector_sdk/performance/metrics.py +93 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/__init__.py +75 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/base.py +161 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/components.py +238 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/connector.py +131 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/extensions.py +109 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/operations.py +146 -0
- airbyte_agent_stripe/_vendored/connector_sdk/schema/security.py +213 -0
- airbyte_agent_stripe/_vendored/connector_sdk/secrets.py +182 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/__init__.py +10 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/config.py +32 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/events.py +58 -0
- airbyte_agent_stripe/_vendored/connector_sdk/telemetry/tracker.py +151 -0
- airbyte_agent_stripe/_vendored/connector_sdk/types.py +241 -0
- airbyte_agent_stripe/_vendored/connector_sdk/utils.py +60 -0
- airbyte_agent_stripe/_vendored/connector_sdk/validation.py +822 -0
- airbyte_agent_stripe/connector.py +1579 -0
- airbyte_agent_stripe/connector_model.py +14869 -0
- airbyte_agent_stripe/models.py +2353 -0
- airbyte_agent_stripe/types.py +295 -0
- airbyte_agent_stripe-0.5.28.dist-info/METADATA +114 -0
- airbyte_agent_stripe-0.5.28.dist-info/RECORD +55 -0
- airbyte_agent_stripe-0.5.28.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,1579 @@
|
|
|
1
|
+
"""
|
|
2
|
+
stripe connector.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import TYPE_CHECKING, Any, overload
|
|
8
|
+
try:
|
|
9
|
+
from typing import Literal
|
|
10
|
+
except ImportError:
|
|
11
|
+
from typing_extensions import Literal
|
|
12
|
+
|
|
13
|
+
from .connector_model import StripeConnectorModel
|
|
14
|
+
|
|
15
|
+
from .types import (
|
|
16
|
+
BalanceGetParams,
|
|
17
|
+
BalanceTransactionsGetParams,
|
|
18
|
+
BalanceTransactionsListParams,
|
|
19
|
+
BalanceTransactionsListParamsCreated,
|
|
20
|
+
ChargesGetParams,
|
|
21
|
+
ChargesListParams,
|
|
22
|
+
ChargesListParamsCreated,
|
|
23
|
+
ChargesSearchParams,
|
|
24
|
+
CustomersGetParams,
|
|
25
|
+
CustomersListParams,
|
|
26
|
+
CustomersListParamsCreated,
|
|
27
|
+
CustomersSearchParams,
|
|
28
|
+
DisputesGetParams,
|
|
29
|
+
DisputesListParams,
|
|
30
|
+
DisputesListParamsCreated,
|
|
31
|
+
InvoicesGetParams,
|
|
32
|
+
InvoicesListParams,
|
|
33
|
+
InvoicesListParamsCreated,
|
|
34
|
+
InvoicesSearchParams,
|
|
35
|
+
PaymentIntentsGetParams,
|
|
36
|
+
PaymentIntentsListParams,
|
|
37
|
+
PaymentIntentsListParamsCreated,
|
|
38
|
+
PaymentIntentsSearchParams,
|
|
39
|
+
PayoutsGetParams,
|
|
40
|
+
PayoutsListParams,
|
|
41
|
+
PayoutsListParamsArrivalDate,
|
|
42
|
+
PayoutsListParamsCreated,
|
|
43
|
+
ProductsGetParams,
|
|
44
|
+
ProductsListParams,
|
|
45
|
+
ProductsListParamsCreated,
|
|
46
|
+
ProductsSearchParams,
|
|
47
|
+
RefundsGetParams,
|
|
48
|
+
RefundsListParams,
|
|
49
|
+
RefundsListParamsCreated,
|
|
50
|
+
SubscriptionsGetParams,
|
|
51
|
+
SubscriptionsListParams,
|
|
52
|
+
SubscriptionsListParamsAutomaticTax,
|
|
53
|
+
SubscriptionsListParamsCreated,
|
|
54
|
+
SubscriptionsListParamsCurrentPeriodEnd,
|
|
55
|
+
SubscriptionsListParamsCurrentPeriodStart,
|
|
56
|
+
SubscriptionsSearchParams,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if TYPE_CHECKING:
|
|
60
|
+
from .models import StripeAuthConfig
|
|
61
|
+
# Import response models and envelope models at runtime
|
|
62
|
+
from .models import (
|
|
63
|
+
StripeExecuteResult,
|
|
64
|
+
StripeExecuteResultWithMeta,
|
|
65
|
+
CustomersListResult,
|
|
66
|
+
CustomersSearchResult,
|
|
67
|
+
InvoicesListResult,
|
|
68
|
+
ChargesListResult,
|
|
69
|
+
SubscriptionsListResult,
|
|
70
|
+
RefundsListResult,
|
|
71
|
+
ProductsListResult,
|
|
72
|
+
ProductsSearchResult,
|
|
73
|
+
BalanceTransactionsListResult,
|
|
74
|
+
PaymentIntentsListResult,
|
|
75
|
+
PaymentIntentsSearchResult,
|
|
76
|
+
DisputesListResult,
|
|
77
|
+
PayoutsListResult,
|
|
78
|
+
Balance,
|
|
79
|
+
BalanceTransaction,
|
|
80
|
+
Charge,
|
|
81
|
+
ChargeSearchResult,
|
|
82
|
+
Customer,
|
|
83
|
+
Dispute,
|
|
84
|
+
Invoice,
|
|
85
|
+
InvoiceSearchResult,
|
|
86
|
+
PaymentIntent,
|
|
87
|
+
Payout,
|
|
88
|
+
Product,
|
|
89
|
+
Refund,
|
|
90
|
+
Subscription,
|
|
91
|
+
SubscriptionSearchResult,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class StripeConnector:
|
|
96
|
+
"""
|
|
97
|
+
Type-safe Stripe API connector.
|
|
98
|
+
|
|
99
|
+
Auto-generated from OpenAPI specification with full type safety.
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
connector_name = "stripe"
|
|
103
|
+
connector_version = "0.1.3"
|
|
104
|
+
vendored_sdk_version = "0.1.0" # Version of vendored connector-sdk
|
|
105
|
+
|
|
106
|
+
# Map of (entity, action) -> has_extractors for envelope wrapping decision
|
|
107
|
+
_EXTRACTOR_MAP = {
|
|
108
|
+
("customers", "list"): True,
|
|
109
|
+
("customers", "get"): False,
|
|
110
|
+
("customers", "search"): True,
|
|
111
|
+
("invoices", "list"): True,
|
|
112
|
+
("invoices", "get"): False,
|
|
113
|
+
("invoices", "search"): False,
|
|
114
|
+
("charges", "list"): True,
|
|
115
|
+
("charges", "get"): False,
|
|
116
|
+
("charges", "search"): False,
|
|
117
|
+
("subscriptions", "list"): True,
|
|
118
|
+
("subscriptions", "get"): False,
|
|
119
|
+
("subscriptions", "search"): False,
|
|
120
|
+
("refunds", "list"): True,
|
|
121
|
+
("refunds", "get"): False,
|
|
122
|
+
("products", "list"): True,
|
|
123
|
+
("products", "get"): False,
|
|
124
|
+
("products", "search"): True,
|
|
125
|
+
("balance", "get"): False,
|
|
126
|
+
("balance_transactions", "list"): True,
|
|
127
|
+
("balance_transactions", "get"): False,
|
|
128
|
+
("payment_intents", "list"): True,
|
|
129
|
+
("payment_intents", "get"): False,
|
|
130
|
+
("payment_intents", "search"): True,
|
|
131
|
+
("disputes", "list"): True,
|
|
132
|
+
("disputes", "get"): False,
|
|
133
|
+
("payouts", "list"): True,
|
|
134
|
+
("payouts", "get"): False,
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
# Map of (entity, action) -> {python_param_name: api_param_name}
|
|
138
|
+
# Used to convert snake_case TypedDict keys to API parameter names in execute()
|
|
139
|
+
_PARAM_MAP = {
|
|
140
|
+
('customers', 'list'): {'limit': 'limit', 'starting_after': 'starting_after', 'ending_before': 'ending_before', 'email': 'email', 'created': 'created'},
|
|
141
|
+
('customers', 'get'): {'id': 'id'},
|
|
142
|
+
('customers', 'search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
143
|
+
('invoices', 'list'): {'collection_method': 'collection_method', 'created': 'created', 'customer': 'customer', 'customer_account': 'customer_account', 'ending_before': 'ending_before', 'limit': 'limit', 'starting_after': 'starting_after', 'status': 'status', 'subscription': 'subscription'},
|
|
144
|
+
('invoices', 'get'): {'id': 'id'},
|
|
145
|
+
('invoices', 'search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
146
|
+
('charges', 'list'): {'created': 'created', 'customer': 'customer', 'ending_before': 'ending_before', 'limit': 'limit', 'payment_intent': 'payment_intent', 'starting_after': 'starting_after'},
|
|
147
|
+
('charges', 'get'): {'id': 'id'},
|
|
148
|
+
('charges', 'search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
149
|
+
('subscriptions', 'list'): {'automatic_tax': 'automatic_tax', 'collection_method': 'collection_method', 'created': 'created', 'current_period_end': 'current_period_end', 'current_period_start': 'current_period_start', 'customer': 'customer', 'customer_account': 'customer_account', 'ending_before': 'ending_before', 'limit': 'limit', 'price': 'price', 'starting_after': 'starting_after', 'status': 'status'},
|
|
150
|
+
('subscriptions', 'get'): {'id': 'id'},
|
|
151
|
+
('subscriptions', 'search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
152
|
+
('refunds', 'list'): {'charge': 'charge', 'created': 'created', 'ending_before': 'ending_before', 'limit': 'limit', 'payment_intent': 'payment_intent', 'starting_after': 'starting_after'},
|
|
153
|
+
('refunds', 'get'): {'id': 'id'},
|
|
154
|
+
('products', 'list'): {'active': 'active', 'created': 'created', 'ending_before': 'ending_before', 'ids': 'ids', 'limit': 'limit', 'shippable': 'shippable', 'starting_after': 'starting_after', 'url': 'url'},
|
|
155
|
+
('products', 'get'): {'id': 'id'},
|
|
156
|
+
('products', 'search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
157
|
+
('balance_transactions', 'list'): {'created': 'created', 'currency': 'currency', 'ending_before': 'ending_before', 'limit': 'limit', 'payout': 'payout', 'source': 'source', 'starting_after': 'starting_after', 'type': 'type'},
|
|
158
|
+
('balance_transactions', 'get'): {'id': 'id'},
|
|
159
|
+
('payment_intents', 'list'): {'created': 'created', 'customer': 'customer', 'customer_account': 'customer_account', 'ending_before': 'ending_before', 'limit': 'limit', 'starting_after': 'starting_after'},
|
|
160
|
+
('payment_intents', 'get'): {'id': 'id'},
|
|
161
|
+
('payment_intents', 'search'): {'query': 'query', 'limit': 'limit', 'page': 'page'},
|
|
162
|
+
('disputes', 'list'): {'charge': 'charge', 'created': 'created', 'ending_before': 'ending_before', 'limit': 'limit', 'payment_intent': 'payment_intent', 'starting_after': 'starting_after'},
|
|
163
|
+
('disputes', 'get'): {'id': 'id'},
|
|
164
|
+
('payouts', 'list'): {'arrival_date': 'arrival_date', 'created': 'created', 'destination': 'destination', 'ending_before': 'ending_before', 'limit': 'limit', 'starting_after': 'starting_after', 'status': 'status'},
|
|
165
|
+
('payouts', 'get'): {'id': 'id'},
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
def __init__(
|
|
169
|
+
self,
|
|
170
|
+
auth_config: StripeAuthConfig | None = None,
|
|
171
|
+
external_user_id: str | None = None,
|
|
172
|
+
airbyte_client_id: str | None = None,
|
|
173
|
+
airbyte_client_secret: str | None = None,
|
|
174
|
+
on_token_refresh: Any | None = None ):
|
|
175
|
+
"""
|
|
176
|
+
Initialize a new stripe connector instance.
|
|
177
|
+
|
|
178
|
+
Supports both local and hosted execution modes:
|
|
179
|
+
- Local mode: Provide `auth_config` for direct API calls
|
|
180
|
+
- Hosted mode: Provide `external_user_id`, `airbyte_client_id`, and `airbyte_client_secret` for hosted execution
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
auth_config: Typed authentication configuration (required for local mode)
|
|
184
|
+
external_user_id: External user ID (required for hosted mode)
|
|
185
|
+
airbyte_client_id: Airbyte OAuth client ID (required for hosted mode)
|
|
186
|
+
airbyte_client_secret: Airbyte OAuth client secret (required for hosted mode)
|
|
187
|
+
on_token_refresh: Optional callback for OAuth2 token refresh persistence.
|
|
188
|
+
Called with new_tokens dict when tokens are refreshed. Can be sync or async.
|
|
189
|
+
Example: lambda tokens: save_to_database(tokens)
|
|
190
|
+
Examples:
|
|
191
|
+
# Local mode (direct API calls)
|
|
192
|
+
connector = StripeConnector(auth_config=StripeAuthConfig(api_key="..."))
|
|
193
|
+
# Hosted mode (executed on Airbyte cloud)
|
|
194
|
+
connector = StripeConnector(
|
|
195
|
+
external_user_id="user-123",
|
|
196
|
+
airbyte_client_id="client_abc123",
|
|
197
|
+
airbyte_client_secret="secret_xyz789"
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
# Local mode with OAuth2 token refresh callback
|
|
201
|
+
def save_tokens(new_tokens: dict) -> None:
|
|
202
|
+
# Persist updated tokens to your storage (file, database, etc.)
|
|
203
|
+
with open("tokens.json", "w") as f:
|
|
204
|
+
json.dump(new_tokens, f)
|
|
205
|
+
|
|
206
|
+
connector = StripeConnector(
|
|
207
|
+
auth_config=StripeAuthConfig(access_token="...", refresh_token="..."),
|
|
208
|
+
on_token_refresh=save_tokens
|
|
209
|
+
)
|
|
210
|
+
"""
|
|
211
|
+
# Hosted mode: external_user_id, airbyte_client_id, and airbyte_client_secret provided
|
|
212
|
+
if external_user_id and airbyte_client_id and airbyte_client_secret:
|
|
213
|
+
from ._vendored.connector_sdk.executor import HostedExecutor
|
|
214
|
+
self._executor = HostedExecutor(
|
|
215
|
+
external_user_id=external_user_id,
|
|
216
|
+
airbyte_client_id=airbyte_client_id,
|
|
217
|
+
airbyte_client_secret=airbyte_client_secret,
|
|
218
|
+
connector_definition_id=str(StripeConnectorModel.id),
|
|
219
|
+
)
|
|
220
|
+
else:
|
|
221
|
+
# Local mode: auth_config required
|
|
222
|
+
if not auth_config:
|
|
223
|
+
raise ValueError(
|
|
224
|
+
"Either provide (external_user_id, airbyte_client_id, airbyte_client_secret) for hosted mode "
|
|
225
|
+
"or auth_config for local mode"
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
from ._vendored.connector_sdk.executor import LocalExecutor
|
|
229
|
+
|
|
230
|
+
# Build config_values dict from server variables
|
|
231
|
+
config_values = None
|
|
232
|
+
|
|
233
|
+
self._executor = LocalExecutor(
|
|
234
|
+
model=StripeConnectorModel,
|
|
235
|
+
auth_config=auth_config.model_dump() if auth_config else None,
|
|
236
|
+
config_values=config_values,
|
|
237
|
+
on_token_refresh=on_token_refresh
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
# Update base_url with server variables if provided
|
|
241
|
+
|
|
242
|
+
# Initialize entity query objects
|
|
243
|
+
self.customers = CustomersQuery(self)
|
|
244
|
+
self.invoices = InvoicesQuery(self)
|
|
245
|
+
self.charges = ChargesQuery(self)
|
|
246
|
+
self.subscriptions = SubscriptionsQuery(self)
|
|
247
|
+
self.refunds = RefundsQuery(self)
|
|
248
|
+
self.products = ProductsQuery(self)
|
|
249
|
+
self.balance = BalanceQuery(self)
|
|
250
|
+
self.balance_transactions = BalanceTransactionsQuery(self)
|
|
251
|
+
self.payment_intents = PaymentIntentsQuery(self)
|
|
252
|
+
self.disputes = DisputesQuery(self)
|
|
253
|
+
self.payouts = PayoutsQuery(self)
|
|
254
|
+
|
|
255
|
+
# ===== TYPED EXECUTE METHOD (Recommended Interface) =====
|
|
256
|
+
|
|
257
|
+
@overload
|
|
258
|
+
async def execute(
|
|
259
|
+
self,
|
|
260
|
+
entity: Literal["customers"],
|
|
261
|
+
action: Literal["list"],
|
|
262
|
+
params: "CustomersListParams"
|
|
263
|
+
) -> "CustomersListResult": ...
|
|
264
|
+
|
|
265
|
+
@overload
|
|
266
|
+
async def execute(
|
|
267
|
+
self,
|
|
268
|
+
entity: Literal["customers"],
|
|
269
|
+
action: Literal["get"],
|
|
270
|
+
params: "CustomersGetParams"
|
|
271
|
+
) -> "Customer": ...
|
|
272
|
+
|
|
273
|
+
@overload
|
|
274
|
+
async def execute(
|
|
275
|
+
self,
|
|
276
|
+
entity: Literal["customers"],
|
|
277
|
+
action: Literal["search"],
|
|
278
|
+
params: "CustomersSearchParams"
|
|
279
|
+
) -> "CustomersSearchResult": ...
|
|
280
|
+
|
|
281
|
+
@overload
|
|
282
|
+
async def execute(
|
|
283
|
+
self,
|
|
284
|
+
entity: Literal["invoices"],
|
|
285
|
+
action: Literal["list"],
|
|
286
|
+
params: "InvoicesListParams"
|
|
287
|
+
) -> "InvoicesListResult": ...
|
|
288
|
+
|
|
289
|
+
@overload
|
|
290
|
+
async def execute(
|
|
291
|
+
self,
|
|
292
|
+
entity: Literal["invoices"],
|
|
293
|
+
action: Literal["get"],
|
|
294
|
+
params: "InvoicesGetParams"
|
|
295
|
+
) -> "Invoice": ...
|
|
296
|
+
|
|
297
|
+
@overload
|
|
298
|
+
async def execute(
|
|
299
|
+
self,
|
|
300
|
+
entity: Literal["invoices"],
|
|
301
|
+
action: Literal["search"],
|
|
302
|
+
params: "InvoicesSearchParams"
|
|
303
|
+
) -> "InvoiceSearchResult": ...
|
|
304
|
+
|
|
305
|
+
@overload
|
|
306
|
+
async def execute(
|
|
307
|
+
self,
|
|
308
|
+
entity: Literal["charges"],
|
|
309
|
+
action: Literal["list"],
|
|
310
|
+
params: "ChargesListParams"
|
|
311
|
+
) -> "ChargesListResult": ...
|
|
312
|
+
|
|
313
|
+
@overload
|
|
314
|
+
async def execute(
|
|
315
|
+
self,
|
|
316
|
+
entity: Literal["charges"],
|
|
317
|
+
action: Literal["get"],
|
|
318
|
+
params: "ChargesGetParams"
|
|
319
|
+
) -> "Charge": ...
|
|
320
|
+
|
|
321
|
+
@overload
|
|
322
|
+
async def execute(
|
|
323
|
+
self,
|
|
324
|
+
entity: Literal["charges"],
|
|
325
|
+
action: Literal["search"],
|
|
326
|
+
params: "ChargesSearchParams"
|
|
327
|
+
) -> "ChargeSearchResult": ...
|
|
328
|
+
|
|
329
|
+
@overload
|
|
330
|
+
async def execute(
|
|
331
|
+
self,
|
|
332
|
+
entity: Literal["subscriptions"],
|
|
333
|
+
action: Literal["list"],
|
|
334
|
+
params: "SubscriptionsListParams"
|
|
335
|
+
) -> "SubscriptionsListResult": ...
|
|
336
|
+
|
|
337
|
+
@overload
|
|
338
|
+
async def execute(
|
|
339
|
+
self,
|
|
340
|
+
entity: Literal["subscriptions"],
|
|
341
|
+
action: Literal["get"],
|
|
342
|
+
params: "SubscriptionsGetParams"
|
|
343
|
+
) -> "Subscription": ...
|
|
344
|
+
|
|
345
|
+
@overload
|
|
346
|
+
async def execute(
|
|
347
|
+
self,
|
|
348
|
+
entity: Literal["subscriptions"],
|
|
349
|
+
action: Literal["search"],
|
|
350
|
+
params: "SubscriptionsSearchParams"
|
|
351
|
+
) -> "SubscriptionSearchResult": ...
|
|
352
|
+
|
|
353
|
+
@overload
|
|
354
|
+
async def execute(
|
|
355
|
+
self,
|
|
356
|
+
entity: Literal["refunds"],
|
|
357
|
+
action: Literal["list"],
|
|
358
|
+
params: "RefundsListParams"
|
|
359
|
+
) -> "RefundsListResult": ...
|
|
360
|
+
|
|
361
|
+
@overload
|
|
362
|
+
async def execute(
|
|
363
|
+
self,
|
|
364
|
+
entity: Literal["refunds"],
|
|
365
|
+
action: Literal["get"],
|
|
366
|
+
params: "RefundsGetParams"
|
|
367
|
+
) -> "Refund": ...
|
|
368
|
+
|
|
369
|
+
@overload
|
|
370
|
+
async def execute(
|
|
371
|
+
self,
|
|
372
|
+
entity: Literal["products"],
|
|
373
|
+
action: Literal["list"],
|
|
374
|
+
params: "ProductsListParams"
|
|
375
|
+
) -> "ProductsListResult": ...
|
|
376
|
+
|
|
377
|
+
@overload
|
|
378
|
+
async def execute(
|
|
379
|
+
self,
|
|
380
|
+
entity: Literal["products"],
|
|
381
|
+
action: Literal["get"],
|
|
382
|
+
params: "ProductsGetParams"
|
|
383
|
+
) -> "Product": ...
|
|
384
|
+
|
|
385
|
+
@overload
|
|
386
|
+
async def execute(
|
|
387
|
+
self,
|
|
388
|
+
entity: Literal["products"],
|
|
389
|
+
action: Literal["search"],
|
|
390
|
+
params: "ProductsSearchParams"
|
|
391
|
+
) -> "ProductsSearchResult": ...
|
|
392
|
+
|
|
393
|
+
@overload
|
|
394
|
+
async def execute(
|
|
395
|
+
self,
|
|
396
|
+
entity: Literal["balance"],
|
|
397
|
+
action: Literal["get"],
|
|
398
|
+
params: "BalanceGetParams"
|
|
399
|
+
) -> "Balance": ...
|
|
400
|
+
|
|
401
|
+
@overload
|
|
402
|
+
async def execute(
|
|
403
|
+
self,
|
|
404
|
+
entity: Literal["balance_transactions"],
|
|
405
|
+
action: Literal["list"],
|
|
406
|
+
params: "BalanceTransactionsListParams"
|
|
407
|
+
) -> "BalanceTransactionsListResult": ...
|
|
408
|
+
|
|
409
|
+
@overload
|
|
410
|
+
async def execute(
|
|
411
|
+
self,
|
|
412
|
+
entity: Literal["balance_transactions"],
|
|
413
|
+
action: Literal["get"],
|
|
414
|
+
params: "BalanceTransactionsGetParams"
|
|
415
|
+
) -> "BalanceTransaction": ...
|
|
416
|
+
|
|
417
|
+
@overload
|
|
418
|
+
async def execute(
|
|
419
|
+
self,
|
|
420
|
+
entity: Literal["payment_intents"],
|
|
421
|
+
action: Literal["list"],
|
|
422
|
+
params: "PaymentIntentsListParams"
|
|
423
|
+
) -> "PaymentIntentsListResult": ...
|
|
424
|
+
|
|
425
|
+
@overload
|
|
426
|
+
async def execute(
|
|
427
|
+
self,
|
|
428
|
+
entity: Literal["payment_intents"],
|
|
429
|
+
action: Literal["get"],
|
|
430
|
+
params: "PaymentIntentsGetParams"
|
|
431
|
+
) -> "PaymentIntent": ...
|
|
432
|
+
|
|
433
|
+
@overload
|
|
434
|
+
async def execute(
|
|
435
|
+
self,
|
|
436
|
+
entity: Literal["payment_intents"],
|
|
437
|
+
action: Literal["search"],
|
|
438
|
+
params: "PaymentIntentsSearchParams"
|
|
439
|
+
) -> "PaymentIntentsSearchResult": ...
|
|
440
|
+
|
|
441
|
+
@overload
|
|
442
|
+
async def execute(
|
|
443
|
+
self,
|
|
444
|
+
entity: Literal["disputes"],
|
|
445
|
+
action: Literal["list"],
|
|
446
|
+
params: "DisputesListParams"
|
|
447
|
+
) -> "DisputesListResult": ...
|
|
448
|
+
|
|
449
|
+
@overload
|
|
450
|
+
async def execute(
|
|
451
|
+
self,
|
|
452
|
+
entity: Literal["disputes"],
|
|
453
|
+
action: Literal["get"],
|
|
454
|
+
params: "DisputesGetParams"
|
|
455
|
+
) -> "Dispute": ...
|
|
456
|
+
|
|
457
|
+
@overload
|
|
458
|
+
async def execute(
|
|
459
|
+
self,
|
|
460
|
+
entity: Literal["payouts"],
|
|
461
|
+
action: Literal["list"],
|
|
462
|
+
params: "PayoutsListParams"
|
|
463
|
+
) -> "PayoutsListResult": ...
|
|
464
|
+
|
|
465
|
+
@overload
|
|
466
|
+
async def execute(
|
|
467
|
+
self,
|
|
468
|
+
entity: Literal["payouts"],
|
|
469
|
+
action: Literal["get"],
|
|
470
|
+
params: "PayoutsGetParams"
|
|
471
|
+
) -> "Payout": ...
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
@overload
|
|
475
|
+
async def execute(
|
|
476
|
+
self,
|
|
477
|
+
entity: str,
|
|
478
|
+
action: str,
|
|
479
|
+
params: dict[str, Any]
|
|
480
|
+
) -> StripeExecuteResult[Any] | StripeExecuteResultWithMeta[Any, Any] | Any: ...
|
|
481
|
+
|
|
482
|
+
async def execute(
|
|
483
|
+
self,
|
|
484
|
+
entity: str,
|
|
485
|
+
action: str,
|
|
486
|
+
params: dict[str, Any] | None = None
|
|
487
|
+
) -> Any:
|
|
488
|
+
"""
|
|
489
|
+
Execute an entity operation with full type safety.
|
|
490
|
+
|
|
491
|
+
This is the recommended interface for blessed connectors as it:
|
|
492
|
+
- Uses the same signature as non-blessed connectors
|
|
493
|
+
- Provides full IDE autocomplete for entity/action/params
|
|
494
|
+
- Makes migration from generic to blessed connectors seamless
|
|
495
|
+
|
|
496
|
+
Args:
|
|
497
|
+
entity: Entity name (e.g., "customers")
|
|
498
|
+
action: Operation action (e.g., "create", "get", "list")
|
|
499
|
+
params: Operation parameters (typed based on entity+action)
|
|
500
|
+
|
|
501
|
+
Returns:
|
|
502
|
+
Typed response based on the operation
|
|
503
|
+
|
|
504
|
+
Example:
|
|
505
|
+
customer = await connector.execute(
|
|
506
|
+
entity="customers",
|
|
507
|
+
action="get",
|
|
508
|
+
params={"id": "cus_123"}
|
|
509
|
+
)
|
|
510
|
+
"""
|
|
511
|
+
from ._vendored.connector_sdk.executor import ExecutionConfig
|
|
512
|
+
|
|
513
|
+
# Remap parameter names from snake_case (TypedDict keys) to API parameter names
|
|
514
|
+
if params:
|
|
515
|
+
param_map = self._PARAM_MAP.get((entity, action), {})
|
|
516
|
+
if param_map:
|
|
517
|
+
params = {param_map.get(k, k): v for k, v in params.items()}
|
|
518
|
+
|
|
519
|
+
# Use ExecutionConfig for both local and hosted executors
|
|
520
|
+
config = ExecutionConfig(
|
|
521
|
+
entity=entity,
|
|
522
|
+
action=action,
|
|
523
|
+
params=params
|
|
524
|
+
)
|
|
525
|
+
|
|
526
|
+
result = await self._executor.execute(config)
|
|
527
|
+
|
|
528
|
+
if not result.success:
|
|
529
|
+
raise RuntimeError(f"Execution failed: {result.error}")
|
|
530
|
+
|
|
531
|
+
# Check if this operation has extractors configured
|
|
532
|
+
has_extractors = self._EXTRACTOR_MAP.get((entity, action), False)
|
|
533
|
+
|
|
534
|
+
if has_extractors:
|
|
535
|
+
# With extractors - return Pydantic envelope with data and meta
|
|
536
|
+
if result.meta is not None:
|
|
537
|
+
return StripeExecuteResultWithMeta[Any, Any](
|
|
538
|
+
data=result.data,
|
|
539
|
+
meta=result.meta
|
|
540
|
+
)
|
|
541
|
+
else:
|
|
542
|
+
return StripeExecuteResult[Any](data=result.data)
|
|
543
|
+
else:
|
|
544
|
+
# No extractors - return raw response data
|
|
545
|
+
return result.data
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
class CustomersQuery:
|
|
550
|
+
"""
|
|
551
|
+
Query class for Customers entity operations.
|
|
552
|
+
"""
|
|
553
|
+
|
|
554
|
+
def __init__(self, connector: StripeConnector):
|
|
555
|
+
"""Initialize query with connector reference."""
|
|
556
|
+
self._connector = connector
|
|
557
|
+
|
|
558
|
+
async def list(
|
|
559
|
+
self,
|
|
560
|
+
limit: int | None = None,
|
|
561
|
+
starting_after: str | None = None,
|
|
562
|
+
ending_before: str | None = None,
|
|
563
|
+
email: str | None = None,
|
|
564
|
+
created: CustomersListParamsCreated | None = None,
|
|
565
|
+
**kwargs
|
|
566
|
+
) -> CustomersListResult:
|
|
567
|
+
"""
|
|
568
|
+
Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.
|
|
569
|
+
|
|
570
|
+
Args:
|
|
571
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
572
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.
|
|
573
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.
|
|
574
|
+
email: A case-sensitive filter on the list based on the customer's email field. The value must be a string.
|
|
575
|
+
created: Only return customers that were created during the given date interval.
|
|
576
|
+
**kwargs: Additional parameters
|
|
577
|
+
|
|
578
|
+
Returns:
|
|
579
|
+
CustomersListResult
|
|
580
|
+
"""
|
|
581
|
+
params = {k: v for k, v in {
|
|
582
|
+
"limit": limit,
|
|
583
|
+
"starting_after": starting_after,
|
|
584
|
+
"ending_before": ending_before,
|
|
585
|
+
"email": email,
|
|
586
|
+
"created": created,
|
|
587
|
+
**kwargs
|
|
588
|
+
}.items() if v is not None}
|
|
589
|
+
|
|
590
|
+
result = await self._connector.execute("customers", "list", params)
|
|
591
|
+
# Cast generic envelope to concrete typed result
|
|
592
|
+
return CustomersListResult(
|
|
593
|
+
data=result.data,
|
|
594
|
+
meta=result.meta )
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
async def get(
|
|
599
|
+
self,
|
|
600
|
+
id: str | None = None,
|
|
601
|
+
**kwargs
|
|
602
|
+
) -> Customer:
|
|
603
|
+
"""
|
|
604
|
+
Retrieves a Customer object.
|
|
605
|
+
|
|
606
|
+
Args:
|
|
607
|
+
id: The customer ID
|
|
608
|
+
**kwargs: Additional parameters
|
|
609
|
+
|
|
610
|
+
Returns:
|
|
611
|
+
Customer
|
|
612
|
+
"""
|
|
613
|
+
params = {k: v for k, v in {
|
|
614
|
+
"id": id,
|
|
615
|
+
**kwargs
|
|
616
|
+
}.items() if v is not None}
|
|
617
|
+
|
|
618
|
+
result = await self._connector.execute("customers", "get", params)
|
|
619
|
+
return result
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
async def search(
|
|
624
|
+
self,
|
|
625
|
+
query: str,
|
|
626
|
+
limit: int | None = None,
|
|
627
|
+
page: str | None = None,
|
|
628
|
+
**kwargs
|
|
629
|
+
) -> CustomersSearchResult:
|
|
630
|
+
"""
|
|
631
|
+
Search for customers using Stripe's Search Query Language.
|
|
632
|
+
|
|
633
|
+
Args:
|
|
634
|
+
query: The search query string using Stripe's Search Query Language
|
|
635
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
636
|
+
page: A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
|
637
|
+
**kwargs: Additional parameters
|
|
638
|
+
|
|
639
|
+
Returns:
|
|
640
|
+
CustomersSearchResult
|
|
641
|
+
"""
|
|
642
|
+
params = {k: v for k, v in {
|
|
643
|
+
"query": query,
|
|
644
|
+
"limit": limit,
|
|
645
|
+
"page": page,
|
|
646
|
+
**kwargs
|
|
647
|
+
}.items() if v is not None}
|
|
648
|
+
|
|
649
|
+
result = await self._connector.execute("customers", "search", params)
|
|
650
|
+
# Cast generic envelope to concrete typed result
|
|
651
|
+
return CustomersSearchResult(
|
|
652
|
+
data=result.data,
|
|
653
|
+
meta=result.meta )
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
class InvoicesQuery:
|
|
658
|
+
"""
|
|
659
|
+
Query class for Invoices entity operations.
|
|
660
|
+
"""
|
|
661
|
+
|
|
662
|
+
def __init__(self, connector: StripeConnector):
|
|
663
|
+
"""Initialize query with connector reference."""
|
|
664
|
+
self._connector = connector
|
|
665
|
+
|
|
666
|
+
async def list(
|
|
667
|
+
self,
|
|
668
|
+
collection_method: str | None = None,
|
|
669
|
+
created: InvoicesListParamsCreated | None = None,
|
|
670
|
+
customer: str | None = None,
|
|
671
|
+
customer_account: str | None = None,
|
|
672
|
+
ending_before: str | None = None,
|
|
673
|
+
limit: int | None = None,
|
|
674
|
+
starting_after: str | None = None,
|
|
675
|
+
status: str | None = None,
|
|
676
|
+
subscription: str | None = None,
|
|
677
|
+
**kwargs
|
|
678
|
+
) -> InvoicesListResult:
|
|
679
|
+
"""
|
|
680
|
+
Returns a list of invoices
|
|
681
|
+
|
|
682
|
+
Args:
|
|
683
|
+
collection_method: The collection method of the invoices to retrieve
|
|
684
|
+
created: Only return customers that were created during the given date interval.
|
|
685
|
+
customer: Only return invoices for the customer specified by this customer ID.
|
|
686
|
+
customer_account: Only return invoices for the account specified by this account ID
|
|
687
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.
|
|
688
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
689
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.
|
|
690
|
+
status: The status of the invoices to retrieve
|
|
691
|
+
subscription: Only return invoices for the subscription specified by this subscription ID.
|
|
692
|
+
**kwargs: Additional parameters
|
|
693
|
+
|
|
694
|
+
Returns:
|
|
695
|
+
InvoicesListResult
|
|
696
|
+
"""
|
|
697
|
+
params = {k: v for k, v in {
|
|
698
|
+
"collection_method": collection_method,
|
|
699
|
+
"created": created,
|
|
700
|
+
"customer": customer,
|
|
701
|
+
"customer_account": customer_account,
|
|
702
|
+
"ending_before": ending_before,
|
|
703
|
+
"limit": limit,
|
|
704
|
+
"starting_after": starting_after,
|
|
705
|
+
"status": status,
|
|
706
|
+
"subscription": subscription,
|
|
707
|
+
**kwargs
|
|
708
|
+
}.items() if v is not None}
|
|
709
|
+
|
|
710
|
+
result = await self._connector.execute("invoices", "list", params)
|
|
711
|
+
# Cast generic envelope to concrete typed result
|
|
712
|
+
return InvoicesListResult(
|
|
713
|
+
data=result.data,
|
|
714
|
+
meta=result.meta )
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
async def get(
|
|
719
|
+
self,
|
|
720
|
+
id: str | None = None,
|
|
721
|
+
**kwargs
|
|
722
|
+
) -> Invoice:
|
|
723
|
+
"""
|
|
724
|
+
Retrieves the invoice with the given ID
|
|
725
|
+
|
|
726
|
+
Args:
|
|
727
|
+
id: The invoice ID
|
|
728
|
+
**kwargs: Additional parameters
|
|
729
|
+
|
|
730
|
+
Returns:
|
|
731
|
+
Invoice
|
|
732
|
+
"""
|
|
733
|
+
params = {k: v for k, v in {
|
|
734
|
+
"id": id,
|
|
735
|
+
**kwargs
|
|
736
|
+
}.items() if v is not None}
|
|
737
|
+
|
|
738
|
+
result = await self._connector.execute("invoices", "get", params)
|
|
739
|
+
return result
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
async def search(
|
|
744
|
+
self,
|
|
745
|
+
query: str,
|
|
746
|
+
limit: int | None = None,
|
|
747
|
+
page: str | None = None,
|
|
748
|
+
**kwargs
|
|
749
|
+
) -> InvoiceSearchResult:
|
|
750
|
+
"""
|
|
751
|
+
Search for invoices using Stripe's Search Query Language
|
|
752
|
+
|
|
753
|
+
Args:
|
|
754
|
+
query: The search query string using Stripe's Search Query Language
|
|
755
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
756
|
+
page: A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
|
757
|
+
**kwargs: Additional parameters
|
|
758
|
+
|
|
759
|
+
Returns:
|
|
760
|
+
InvoiceSearchResult
|
|
761
|
+
"""
|
|
762
|
+
params = {k: v for k, v in {
|
|
763
|
+
"query": query,
|
|
764
|
+
"limit": limit,
|
|
765
|
+
"page": page,
|
|
766
|
+
**kwargs
|
|
767
|
+
}.items() if v is not None}
|
|
768
|
+
|
|
769
|
+
result = await self._connector.execute("invoices", "search", params)
|
|
770
|
+
return result
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
class ChargesQuery:
|
|
775
|
+
"""
|
|
776
|
+
Query class for Charges entity operations.
|
|
777
|
+
"""
|
|
778
|
+
|
|
779
|
+
def __init__(self, connector: StripeConnector):
|
|
780
|
+
"""Initialize query with connector reference."""
|
|
781
|
+
self._connector = connector
|
|
782
|
+
|
|
783
|
+
async def list(
|
|
784
|
+
self,
|
|
785
|
+
created: ChargesListParamsCreated | None = None,
|
|
786
|
+
customer: str | None = None,
|
|
787
|
+
ending_before: str | None = None,
|
|
788
|
+
limit: int | None = None,
|
|
789
|
+
payment_intent: str | None = None,
|
|
790
|
+
starting_after: str | None = None,
|
|
791
|
+
**kwargs
|
|
792
|
+
) -> ChargesListResult:
|
|
793
|
+
"""
|
|
794
|
+
Returns a list of charges you've previously created. The charges are returned in sorted order, with the most recent charges appearing first.
|
|
795
|
+
|
|
796
|
+
Args:
|
|
797
|
+
created: Only return customers that were created during the given date interval.
|
|
798
|
+
customer: Only return charges for the customer specified by this customer ID
|
|
799
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.
|
|
800
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
801
|
+
payment_intent: Only return charges that were created by the PaymentIntent specified by this ID
|
|
802
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.
|
|
803
|
+
**kwargs: Additional parameters
|
|
804
|
+
|
|
805
|
+
Returns:
|
|
806
|
+
ChargesListResult
|
|
807
|
+
"""
|
|
808
|
+
params = {k: v for k, v in {
|
|
809
|
+
"created": created,
|
|
810
|
+
"customer": customer,
|
|
811
|
+
"ending_before": ending_before,
|
|
812
|
+
"limit": limit,
|
|
813
|
+
"payment_intent": payment_intent,
|
|
814
|
+
"starting_after": starting_after,
|
|
815
|
+
**kwargs
|
|
816
|
+
}.items() if v is not None}
|
|
817
|
+
|
|
818
|
+
result = await self._connector.execute("charges", "list", params)
|
|
819
|
+
# Cast generic envelope to concrete typed result
|
|
820
|
+
return ChargesListResult(
|
|
821
|
+
data=result.data,
|
|
822
|
+
meta=result.meta )
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
async def get(
|
|
827
|
+
self,
|
|
828
|
+
id: str | None = None,
|
|
829
|
+
**kwargs
|
|
830
|
+
) -> Charge:
|
|
831
|
+
"""
|
|
832
|
+
Retrieves the details of a charge that has previously been created
|
|
833
|
+
|
|
834
|
+
Args:
|
|
835
|
+
id: The charge ID
|
|
836
|
+
**kwargs: Additional parameters
|
|
837
|
+
|
|
838
|
+
Returns:
|
|
839
|
+
Charge
|
|
840
|
+
"""
|
|
841
|
+
params = {k: v for k, v in {
|
|
842
|
+
"id": id,
|
|
843
|
+
**kwargs
|
|
844
|
+
}.items() if v is not None}
|
|
845
|
+
|
|
846
|
+
result = await self._connector.execute("charges", "get", params)
|
|
847
|
+
return result
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
async def search(
|
|
852
|
+
self,
|
|
853
|
+
query: str,
|
|
854
|
+
limit: int | None = None,
|
|
855
|
+
page: str | None = None,
|
|
856
|
+
**kwargs
|
|
857
|
+
) -> ChargeSearchResult:
|
|
858
|
+
"""
|
|
859
|
+
Search for charges using Stripe's Search Query Language
|
|
860
|
+
|
|
861
|
+
Args:
|
|
862
|
+
query: The search query string using Stripe's Search Query Language
|
|
863
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
864
|
+
page: A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
|
865
|
+
**kwargs: Additional parameters
|
|
866
|
+
|
|
867
|
+
Returns:
|
|
868
|
+
ChargeSearchResult
|
|
869
|
+
"""
|
|
870
|
+
params = {k: v for k, v in {
|
|
871
|
+
"query": query,
|
|
872
|
+
"limit": limit,
|
|
873
|
+
"page": page,
|
|
874
|
+
**kwargs
|
|
875
|
+
}.items() if v is not None}
|
|
876
|
+
|
|
877
|
+
result = await self._connector.execute("charges", "search", params)
|
|
878
|
+
return result
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
class SubscriptionsQuery:
|
|
883
|
+
"""
|
|
884
|
+
Query class for Subscriptions entity operations.
|
|
885
|
+
"""
|
|
886
|
+
|
|
887
|
+
def __init__(self, connector: StripeConnector):
|
|
888
|
+
"""Initialize query with connector reference."""
|
|
889
|
+
self._connector = connector
|
|
890
|
+
|
|
891
|
+
async def list(
|
|
892
|
+
self,
|
|
893
|
+
automatic_tax: SubscriptionsListParamsAutomaticTax | None = None,
|
|
894
|
+
collection_method: str | None = None,
|
|
895
|
+
created: SubscriptionsListParamsCreated | None = None,
|
|
896
|
+
current_period_end: SubscriptionsListParamsCurrentPeriodEnd | None = None,
|
|
897
|
+
current_period_start: SubscriptionsListParamsCurrentPeriodStart | None = None,
|
|
898
|
+
customer: str | None = None,
|
|
899
|
+
customer_account: str | None = None,
|
|
900
|
+
ending_before: str | None = None,
|
|
901
|
+
limit: int | None = None,
|
|
902
|
+
price: str | None = None,
|
|
903
|
+
starting_after: str | None = None,
|
|
904
|
+
status: str | None = None,
|
|
905
|
+
**kwargs
|
|
906
|
+
) -> SubscriptionsListResult:
|
|
907
|
+
"""
|
|
908
|
+
By default, returns a list of subscriptions that have not been canceled
|
|
909
|
+
|
|
910
|
+
Args:
|
|
911
|
+
automatic_tax: Filter subscriptions by their automatic tax settings.
|
|
912
|
+
collection_method: The collection method of the subscriptions to retrieve
|
|
913
|
+
created: Only return customers that were created during the given date interval.
|
|
914
|
+
current_period_end: Only return subscriptions whose minimum item current_period_end falls within the given date interval.
|
|
915
|
+
current_period_start: Only return subscriptions whose maximum item current_period_start falls within the given date interval.
|
|
916
|
+
customer: Only return subscriptions for the customer specified by this customer ID
|
|
917
|
+
customer_account: The ID of the account whose subscriptions will be retrieved.
|
|
918
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.
|
|
919
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
920
|
+
price: Filter for subscriptions that contain this recurring price ID.
|
|
921
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.
|
|
922
|
+
status: The status of the subscriptions to retrieve. Passing in a value of canceled will return all canceled subscriptions, including those belonging to deleted customers. Pass ended to find subscriptions that are canceled and subscriptions that are expired due to incomplete payment. Passing in a value of all will return subscriptions of all statuses. If no value is supplied, all subscriptions that have not been canceled are returned.
|
|
923
|
+
**kwargs: Additional parameters
|
|
924
|
+
|
|
925
|
+
Returns:
|
|
926
|
+
SubscriptionsListResult
|
|
927
|
+
"""
|
|
928
|
+
params = {k: v for k, v in {
|
|
929
|
+
"automatic_tax": automatic_tax,
|
|
930
|
+
"collection_method": collection_method,
|
|
931
|
+
"created": created,
|
|
932
|
+
"current_period_end": current_period_end,
|
|
933
|
+
"current_period_start": current_period_start,
|
|
934
|
+
"customer": customer,
|
|
935
|
+
"customer_account": customer_account,
|
|
936
|
+
"ending_before": ending_before,
|
|
937
|
+
"limit": limit,
|
|
938
|
+
"price": price,
|
|
939
|
+
"starting_after": starting_after,
|
|
940
|
+
"status": status,
|
|
941
|
+
**kwargs
|
|
942
|
+
}.items() if v is not None}
|
|
943
|
+
|
|
944
|
+
result = await self._connector.execute("subscriptions", "list", params)
|
|
945
|
+
# Cast generic envelope to concrete typed result
|
|
946
|
+
return SubscriptionsListResult(
|
|
947
|
+
data=result.data,
|
|
948
|
+
meta=result.meta )
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
async def get(
|
|
953
|
+
self,
|
|
954
|
+
id: str | None = None,
|
|
955
|
+
**kwargs
|
|
956
|
+
) -> Subscription:
|
|
957
|
+
"""
|
|
958
|
+
Retrieves the subscription with the given ID
|
|
959
|
+
|
|
960
|
+
Args:
|
|
961
|
+
id: The subscription ID
|
|
962
|
+
**kwargs: Additional parameters
|
|
963
|
+
|
|
964
|
+
Returns:
|
|
965
|
+
Subscription
|
|
966
|
+
"""
|
|
967
|
+
params = {k: v for k, v in {
|
|
968
|
+
"id": id,
|
|
969
|
+
**kwargs
|
|
970
|
+
}.items() if v is not None}
|
|
971
|
+
|
|
972
|
+
result = await self._connector.execute("subscriptions", "get", params)
|
|
973
|
+
return result
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
async def search(
|
|
978
|
+
self,
|
|
979
|
+
query: str,
|
|
980
|
+
limit: int | None = None,
|
|
981
|
+
page: str | None = None,
|
|
982
|
+
**kwargs
|
|
983
|
+
) -> SubscriptionSearchResult:
|
|
984
|
+
"""
|
|
985
|
+
Search for subscriptions using Stripe's Search Query Language
|
|
986
|
+
|
|
987
|
+
Args:
|
|
988
|
+
query: The search query string using Stripe's Search Query Language
|
|
989
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
990
|
+
page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
|
991
|
+
**kwargs: Additional parameters
|
|
992
|
+
|
|
993
|
+
Returns:
|
|
994
|
+
SubscriptionSearchResult
|
|
995
|
+
"""
|
|
996
|
+
params = {k: v for k, v in {
|
|
997
|
+
"query": query,
|
|
998
|
+
"limit": limit,
|
|
999
|
+
"page": page,
|
|
1000
|
+
**kwargs
|
|
1001
|
+
}.items() if v is not None}
|
|
1002
|
+
|
|
1003
|
+
result = await self._connector.execute("subscriptions", "search", params)
|
|
1004
|
+
return result
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
class RefundsQuery:
|
|
1009
|
+
"""
|
|
1010
|
+
Query class for Refunds entity operations.
|
|
1011
|
+
"""
|
|
1012
|
+
|
|
1013
|
+
def __init__(self, connector: StripeConnector):
|
|
1014
|
+
"""Initialize query with connector reference."""
|
|
1015
|
+
self._connector = connector
|
|
1016
|
+
|
|
1017
|
+
async def list(
|
|
1018
|
+
self,
|
|
1019
|
+
charge: str | None = None,
|
|
1020
|
+
created: RefundsListParamsCreated | None = None,
|
|
1021
|
+
ending_before: str | None = None,
|
|
1022
|
+
limit: int | None = None,
|
|
1023
|
+
payment_intent: str | None = None,
|
|
1024
|
+
starting_after: str | None = None,
|
|
1025
|
+
**kwargs
|
|
1026
|
+
) -> RefundsListResult:
|
|
1027
|
+
"""
|
|
1028
|
+
Returns a list of all refunds you've previously created. The refunds are returned in sorted order, with the most recent refunds appearing first.
|
|
1029
|
+
|
|
1030
|
+
Args:
|
|
1031
|
+
charge: Only return refunds for the charge specified by this charge ID
|
|
1032
|
+
created: Only return customers that were created during the given date interval.
|
|
1033
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.
|
|
1034
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
1035
|
+
payment_intent: Only return refunds for the PaymentIntent specified by this ID
|
|
1036
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.
|
|
1037
|
+
**kwargs: Additional parameters
|
|
1038
|
+
|
|
1039
|
+
Returns:
|
|
1040
|
+
RefundsListResult
|
|
1041
|
+
"""
|
|
1042
|
+
params = {k: v for k, v in {
|
|
1043
|
+
"charge": charge,
|
|
1044
|
+
"created": created,
|
|
1045
|
+
"ending_before": ending_before,
|
|
1046
|
+
"limit": limit,
|
|
1047
|
+
"payment_intent": payment_intent,
|
|
1048
|
+
"starting_after": starting_after,
|
|
1049
|
+
**kwargs
|
|
1050
|
+
}.items() if v is not None}
|
|
1051
|
+
|
|
1052
|
+
result = await self._connector.execute("refunds", "list", params)
|
|
1053
|
+
# Cast generic envelope to concrete typed result
|
|
1054
|
+
return RefundsListResult(
|
|
1055
|
+
data=result.data,
|
|
1056
|
+
meta=result.meta )
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
async def get(
|
|
1061
|
+
self,
|
|
1062
|
+
id: str | None = None,
|
|
1063
|
+
**kwargs
|
|
1064
|
+
) -> Refund:
|
|
1065
|
+
"""
|
|
1066
|
+
Retrieves the details of an existing refund
|
|
1067
|
+
|
|
1068
|
+
Args:
|
|
1069
|
+
id: The refund ID
|
|
1070
|
+
**kwargs: Additional parameters
|
|
1071
|
+
|
|
1072
|
+
Returns:
|
|
1073
|
+
Refund
|
|
1074
|
+
"""
|
|
1075
|
+
params = {k: v for k, v in {
|
|
1076
|
+
"id": id,
|
|
1077
|
+
**kwargs
|
|
1078
|
+
}.items() if v is not None}
|
|
1079
|
+
|
|
1080
|
+
result = await self._connector.execute("refunds", "get", params)
|
|
1081
|
+
return result
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
class ProductsQuery:
|
|
1086
|
+
"""
|
|
1087
|
+
Query class for Products entity operations.
|
|
1088
|
+
"""
|
|
1089
|
+
|
|
1090
|
+
def __init__(self, connector: StripeConnector):
|
|
1091
|
+
"""Initialize query with connector reference."""
|
|
1092
|
+
self._connector = connector
|
|
1093
|
+
|
|
1094
|
+
async def list(
|
|
1095
|
+
self,
|
|
1096
|
+
active: bool | None = None,
|
|
1097
|
+
created: ProductsListParamsCreated | None = None,
|
|
1098
|
+
ending_before: str | None = None,
|
|
1099
|
+
ids: list[str] | None = None,
|
|
1100
|
+
limit: int | None = None,
|
|
1101
|
+
shippable: bool | None = None,
|
|
1102
|
+
starting_after: str | None = None,
|
|
1103
|
+
url: str | None = None,
|
|
1104
|
+
**kwargs
|
|
1105
|
+
) -> ProductsListResult:
|
|
1106
|
+
"""
|
|
1107
|
+
Returns a list of your products. The products are returned sorted by creation date, with the most recent products appearing first.
|
|
1108
|
+
|
|
1109
|
+
Args:
|
|
1110
|
+
active: Only return products that are active or inactive
|
|
1111
|
+
created: Only return products that were created during the given date interval.
|
|
1112
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list.
|
|
1113
|
+
ids: Only return products with the given IDs
|
|
1114
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
1115
|
+
shippable: Only return products that can be shipped
|
|
1116
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list.
|
|
1117
|
+
url: Only return products with the given url
|
|
1118
|
+
**kwargs: Additional parameters
|
|
1119
|
+
|
|
1120
|
+
Returns:
|
|
1121
|
+
ProductsListResult
|
|
1122
|
+
"""
|
|
1123
|
+
params = {k: v for k, v in {
|
|
1124
|
+
"active": active,
|
|
1125
|
+
"created": created,
|
|
1126
|
+
"ending_before": ending_before,
|
|
1127
|
+
"ids": ids,
|
|
1128
|
+
"limit": limit,
|
|
1129
|
+
"shippable": shippable,
|
|
1130
|
+
"starting_after": starting_after,
|
|
1131
|
+
"url": url,
|
|
1132
|
+
**kwargs
|
|
1133
|
+
}.items() if v is not None}
|
|
1134
|
+
|
|
1135
|
+
result = await self._connector.execute("products", "list", params)
|
|
1136
|
+
# Cast generic envelope to concrete typed result
|
|
1137
|
+
return ProductsListResult(
|
|
1138
|
+
data=result.data,
|
|
1139
|
+
meta=result.meta )
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
async def get(
|
|
1144
|
+
self,
|
|
1145
|
+
id: str | None = None,
|
|
1146
|
+
**kwargs
|
|
1147
|
+
) -> Product:
|
|
1148
|
+
"""
|
|
1149
|
+
Retrieves the details of an existing product. Supply the unique product ID and Stripe will return the corresponding product information.
|
|
1150
|
+
|
|
1151
|
+
Args:
|
|
1152
|
+
id: The product ID
|
|
1153
|
+
**kwargs: Additional parameters
|
|
1154
|
+
|
|
1155
|
+
Returns:
|
|
1156
|
+
Product
|
|
1157
|
+
"""
|
|
1158
|
+
params = {k: v for k, v in {
|
|
1159
|
+
"id": id,
|
|
1160
|
+
**kwargs
|
|
1161
|
+
}.items() if v is not None}
|
|
1162
|
+
|
|
1163
|
+
result = await self._connector.execute("products", "get", params)
|
|
1164
|
+
return result
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
async def search(
|
|
1169
|
+
self,
|
|
1170
|
+
query: str,
|
|
1171
|
+
limit: int | None = None,
|
|
1172
|
+
page: str | None = None,
|
|
1173
|
+
**kwargs
|
|
1174
|
+
) -> ProductsSearchResult:
|
|
1175
|
+
"""
|
|
1176
|
+
Search for products using Stripe's Search Query Language.
|
|
1177
|
+
|
|
1178
|
+
Args:
|
|
1179
|
+
query: The search query string using Stripe's Search Query Language
|
|
1180
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
1181
|
+
page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
|
1182
|
+
**kwargs: Additional parameters
|
|
1183
|
+
|
|
1184
|
+
Returns:
|
|
1185
|
+
ProductsSearchResult
|
|
1186
|
+
"""
|
|
1187
|
+
params = {k: v for k, v in {
|
|
1188
|
+
"query": query,
|
|
1189
|
+
"limit": limit,
|
|
1190
|
+
"page": page,
|
|
1191
|
+
**kwargs
|
|
1192
|
+
}.items() if v is not None}
|
|
1193
|
+
|
|
1194
|
+
result = await self._connector.execute("products", "search", params)
|
|
1195
|
+
# Cast generic envelope to concrete typed result
|
|
1196
|
+
return ProductsSearchResult(
|
|
1197
|
+
data=result.data,
|
|
1198
|
+
meta=result.meta )
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
class BalanceQuery:
|
|
1203
|
+
"""
|
|
1204
|
+
Query class for Balance entity operations.
|
|
1205
|
+
"""
|
|
1206
|
+
|
|
1207
|
+
def __init__(self, connector: StripeConnector):
|
|
1208
|
+
"""Initialize query with connector reference."""
|
|
1209
|
+
self._connector = connector
|
|
1210
|
+
|
|
1211
|
+
async def get(
|
|
1212
|
+
self,
|
|
1213
|
+
**kwargs
|
|
1214
|
+
) -> Balance:
|
|
1215
|
+
"""
|
|
1216
|
+
Retrieves the current account balance, based on the authentication that was used to make the request.
|
|
1217
|
+
|
|
1218
|
+
Returns:
|
|
1219
|
+
Balance
|
|
1220
|
+
"""
|
|
1221
|
+
params = {k: v for k, v in {
|
|
1222
|
+
**kwargs
|
|
1223
|
+
}.items() if v is not None}
|
|
1224
|
+
|
|
1225
|
+
result = await self._connector.execute("balance", "get", params)
|
|
1226
|
+
return result
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
class BalanceTransactionsQuery:
|
|
1231
|
+
"""
|
|
1232
|
+
Query class for BalanceTransactions entity operations.
|
|
1233
|
+
"""
|
|
1234
|
+
|
|
1235
|
+
def __init__(self, connector: StripeConnector):
|
|
1236
|
+
"""Initialize query with connector reference."""
|
|
1237
|
+
self._connector = connector
|
|
1238
|
+
|
|
1239
|
+
async def list(
|
|
1240
|
+
self,
|
|
1241
|
+
created: BalanceTransactionsListParamsCreated | None = None,
|
|
1242
|
+
currency: str | None = None,
|
|
1243
|
+
ending_before: str | None = None,
|
|
1244
|
+
limit: int | None = None,
|
|
1245
|
+
payout: str | None = None,
|
|
1246
|
+
source: str | None = None,
|
|
1247
|
+
starting_after: str | None = None,
|
|
1248
|
+
type: str | None = None,
|
|
1249
|
+
**kwargs
|
|
1250
|
+
) -> BalanceTransactionsListResult:
|
|
1251
|
+
"""
|
|
1252
|
+
Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first.
|
|
1253
|
+
|
|
1254
|
+
Args:
|
|
1255
|
+
created: Only return transactions that were created during the given date interval.
|
|
1256
|
+
currency: Only return transactions in a certain currency. Three-letter ISO currency code, in lowercase.
|
|
1257
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list.
|
|
1258
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
1259
|
+
payout: For automatic Stripe payouts only, only returns transactions that were paid out on the specified payout ID.
|
|
1260
|
+
source: Only returns the original transaction.
|
|
1261
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list.
|
|
1262
|
+
type: Only returns transactions of the given type.
|
|
1263
|
+
**kwargs: Additional parameters
|
|
1264
|
+
|
|
1265
|
+
Returns:
|
|
1266
|
+
BalanceTransactionsListResult
|
|
1267
|
+
"""
|
|
1268
|
+
params = {k: v for k, v in {
|
|
1269
|
+
"created": created,
|
|
1270
|
+
"currency": currency,
|
|
1271
|
+
"ending_before": ending_before,
|
|
1272
|
+
"limit": limit,
|
|
1273
|
+
"payout": payout,
|
|
1274
|
+
"source": source,
|
|
1275
|
+
"starting_after": starting_after,
|
|
1276
|
+
"type": type,
|
|
1277
|
+
**kwargs
|
|
1278
|
+
}.items() if v is not None}
|
|
1279
|
+
|
|
1280
|
+
result = await self._connector.execute("balance_transactions", "list", params)
|
|
1281
|
+
# Cast generic envelope to concrete typed result
|
|
1282
|
+
return BalanceTransactionsListResult(
|
|
1283
|
+
data=result.data,
|
|
1284
|
+
meta=result.meta )
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
async def get(
|
|
1289
|
+
self,
|
|
1290
|
+
id: str | None = None,
|
|
1291
|
+
**kwargs
|
|
1292
|
+
) -> BalanceTransaction:
|
|
1293
|
+
"""
|
|
1294
|
+
Retrieves the balance transaction with the given ID.
|
|
1295
|
+
|
|
1296
|
+
Args:
|
|
1297
|
+
id: The ID of the desired balance transaction
|
|
1298
|
+
**kwargs: Additional parameters
|
|
1299
|
+
|
|
1300
|
+
Returns:
|
|
1301
|
+
BalanceTransaction
|
|
1302
|
+
"""
|
|
1303
|
+
params = {k: v for k, v in {
|
|
1304
|
+
"id": id,
|
|
1305
|
+
**kwargs
|
|
1306
|
+
}.items() if v is not None}
|
|
1307
|
+
|
|
1308
|
+
result = await self._connector.execute("balance_transactions", "get", params)
|
|
1309
|
+
return result
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
class PaymentIntentsQuery:
|
|
1314
|
+
"""
|
|
1315
|
+
Query class for PaymentIntents entity operations.
|
|
1316
|
+
"""
|
|
1317
|
+
|
|
1318
|
+
def __init__(self, connector: StripeConnector):
|
|
1319
|
+
"""Initialize query with connector reference."""
|
|
1320
|
+
self._connector = connector
|
|
1321
|
+
|
|
1322
|
+
async def list(
|
|
1323
|
+
self,
|
|
1324
|
+
created: PaymentIntentsListParamsCreated | None = None,
|
|
1325
|
+
customer: str | None = None,
|
|
1326
|
+
customer_account: str | None = None,
|
|
1327
|
+
ending_before: str | None = None,
|
|
1328
|
+
limit: int | None = None,
|
|
1329
|
+
starting_after: str | None = None,
|
|
1330
|
+
**kwargs
|
|
1331
|
+
) -> PaymentIntentsListResult:
|
|
1332
|
+
"""
|
|
1333
|
+
Returns a list of PaymentIntents. The payment intents are returned sorted by creation date, with the most recent payment intents appearing first.
|
|
1334
|
+
|
|
1335
|
+
Args:
|
|
1336
|
+
created: Only return payment intents that were created during the given date interval.
|
|
1337
|
+
customer: Only return payment intents for the customer specified by this customer ID
|
|
1338
|
+
customer_account: Only return payment intents for the account specified by this account ID
|
|
1339
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list.
|
|
1340
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
1341
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list.
|
|
1342
|
+
**kwargs: Additional parameters
|
|
1343
|
+
|
|
1344
|
+
Returns:
|
|
1345
|
+
PaymentIntentsListResult
|
|
1346
|
+
"""
|
|
1347
|
+
params = {k: v for k, v in {
|
|
1348
|
+
"created": created,
|
|
1349
|
+
"customer": customer,
|
|
1350
|
+
"customer_account": customer_account,
|
|
1351
|
+
"ending_before": ending_before,
|
|
1352
|
+
"limit": limit,
|
|
1353
|
+
"starting_after": starting_after,
|
|
1354
|
+
**kwargs
|
|
1355
|
+
}.items() if v is not None}
|
|
1356
|
+
|
|
1357
|
+
result = await self._connector.execute("payment_intents", "list", params)
|
|
1358
|
+
# Cast generic envelope to concrete typed result
|
|
1359
|
+
return PaymentIntentsListResult(
|
|
1360
|
+
data=result.data,
|
|
1361
|
+
meta=result.meta )
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
async def get(
|
|
1366
|
+
self,
|
|
1367
|
+
id: str | None = None,
|
|
1368
|
+
**kwargs
|
|
1369
|
+
) -> PaymentIntent:
|
|
1370
|
+
"""
|
|
1371
|
+
Retrieves the details of a PaymentIntent that has previously been created.
|
|
1372
|
+
|
|
1373
|
+
Args:
|
|
1374
|
+
id: The ID of the payment intent
|
|
1375
|
+
**kwargs: Additional parameters
|
|
1376
|
+
|
|
1377
|
+
Returns:
|
|
1378
|
+
PaymentIntent
|
|
1379
|
+
"""
|
|
1380
|
+
params = {k: v for k, v in {
|
|
1381
|
+
"id": id,
|
|
1382
|
+
**kwargs
|
|
1383
|
+
}.items() if v is not None}
|
|
1384
|
+
|
|
1385
|
+
result = await self._connector.execute("payment_intents", "get", params)
|
|
1386
|
+
return result
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
|
|
1390
|
+
async def search(
|
|
1391
|
+
self,
|
|
1392
|
+
query: str,
|
|
1393
|
+
limit: int | None = None,
|
|
1394
|
+
page: str | None = None,
|
|
1395
|
+
**kwargs
|
|
1396
|
+
) -> PaymentIntentsSearchResult:
|
|
1397
|
+
"""
|
|
1398
|
+
Search for payment intents using Stripe's Search Query Language.
|
|
1399
|
+
|
|
1400
|
+
Args:
|
|
1401
|
+
query: The search query string using Stripe's Search Query Language
|
|
1402
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
1403
|
+
page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
|
1404
|
+
**kwargs: Additional parameters
|
|
1405
|
+
|
|
1406
|
+
Returns:
|
|
1407
|
+
PaymentIntentsSearchResult
|
|
1408
|
+
"""
|
|
1409
|
+
params = {k: v for k, v in {
|
|
1410
|
+
"query": query,
|
|
1411
|
+
"limit": limit,
|
|
1412
|
+
"page": page,
|
|
1413
|
+
**kwargs
|
|
1414
|
+
}.items() if v is not None}
|
|
1415
|
+
|
|
1416
|
+
result = await self._connector.execute("payment_intents", "search", params)
|
|
1417
|
+
# Cast generic envelope to concrete typed result
|
|
1418
|
+
return PaymentIntentsSearchResult(
|
|
1419
|
+
data=result.data,
|
|
1420
|
+
meta=result.meta )
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
class DisputesQuery:
|
|
1425
|
+
"""
|
|
1426
|
+
Query class for Disputes entity operations.
|
|
1427
|
+
"""
|
|
1428
|
+
|
|
1429
|
+
def __init__(self, connector: StripeConnector):
|
|
1430
|
+
"""Initialize query with connector reference."""
|
|
1431
|
+
self._connector = connector
|
|
1432
|
+
|
|
1433
|
+
async def list(
|
|
1434
|
+
self,
|
|
1435
|
+
charge: str | None = None,
|
|
1436
|
+
created: DisputesListParamsCreated | None = None,
|
|
1437
|
+
ending_before: str | None = None,
|
|
1438
|
+
limit: int | None = None,
|
|
1439
|
+
payment_intent: str | None = None,
|
|
1440
|
+
starting_after: str | None = None,
|
|
1441
|
+
**kwargs
|
|
1442
|
+
) -> DisputesListResult:
|
|
1443
|
+
"""
|
|
1444
|
+
Returns a list of your disputes. The disputes are returned sorted by creation date, with the most recent disputes appearing first.
|
|
1445
|
+
|
|
1446
|
+
Args:
|
|
1447
|
+
charge: Only return disputes associated to the charge specified by this charge ID
|
|
1448
|
+
created: Only return disputes that were created during the given date interval.
|
|
1449
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list.
|
|
1450
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
1451
|
+
payment_intent: Only return disputes associated to the PaymentIntent specified by this PaymentIntent ID
|
|
1452
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list.
|
|
1453
|
+
**kwargs: Additional parameters
|
|
1454
|
+
|
|
1455
|
+
Returns:
|
|
1456
|
+
DisputesListResult
|
|
1457
|
+
"""
|
|
1458
|
+
params = {k: v for k, v in {
|
|
1459
|
+
"charge": charge,
|
|
1460
|
+
"created": created,
|
|
1461
|
+
"ending_before": ending_before,
|
|
1462
|
+
"limit": limit,
|
|
1463
|
+
"payment_intent": payment_intent,
|
|
1464
|
+
"starting_after": starting_after,
|
|
1465
|
+
**kwargs
|
|
1466
|
+
}.items() if v is not None}
|
|
1467
|
+
|
|
1468
|
+
result = await self._connector.execute("disputes", "list", params)
|
|
1469
|
+
# Cast generic envelope to concrete typed result
|
|
1470
|
+
return DisputesListResult(
|
|
1471
|
+
data=result.data,
|
|
1472
|
+
meta=result.meta )
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
|
|
1476
|
+
async def get(
|
|
1477
|
+
self,
|
|
1478
|
+
id: str | None = None,
|
|
1479
|
+
**kwargs
|
|
1480
|
+
) -> Dispute:
|
|
1481
|
+
"""
|
|
1482
|
+
Retrieves the dispute with the given ID.
|
|
1483
|
+
|
|
1484
|
+
Args:
|
|
1485
|
+
id: The ID of the dispute
|
|
1486
|
+
**kwargs: Additional parameters
|
|
1487
|
+
|
|
1488
|
+
Returns:
|
|
1489
|
+
Dispute
|
|
1490
|
+
"""
|
|
1491
|
+
params = {k: v for k, v in {
|
|
1492
|
+
"id": id,
|
|
1493
|
+
**kwargs
|
|
1494
|
+
}.items() if v is not None}
|
|
1495
|
+
|
|
1496
|
+
result = await self._connector.execute("disputes", "get", params)
|
|
1497
|
+
return result
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
class PayoutsQuery:
|
|
1502
|
+
"""
|
|
1503
|
+
Query class for Payouts entity operations.
|
|
1504
|
+
"""
|
|
1505
|
+
|
|
1506
|
+
def __init__(self, connector: StripeConnector):
|
|
1507
|
+
"""Initialize query with connector reference."""
|
|
1508
|
+
self._connector = connector
|
|
1509
|
+
|
|
1510
|
+
async def list(
|
|
1511
|
+
self,
|
|
1512
|
+
arrival_date: PayoutsListParamsArrivalDate | None = None,
|
|
1513
|
+
created: PayoutsListParamsCreated | None = None,
|
|
1514
|
+
destination: str | None = None,
|
|
1515
|
+
ending_before: str | None = None,
|
|
1516
|
+
limit: int | None = None,
|
|
1517
|
+
starting_after: str | None = None,
|
|
1518
|
+
status: str | None = None,
|
|
1519
|
+
**kwargs
|
|
1520
|
+
) -> PayoutsListResult:
|
|
1521
|
+
"""
|
|
1522
|
+
Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. The payouts return in sorted order, with the most recently created payouts appearing first.
|
|
1523
|
+
|
|
1524
|
+
Args:
|
|
1525
|
+
arrival_date: Filter payouts by expected arrival date range.
|
|
1526
|
+
created: Only return payouts that were created during the given date interval.
|
|
1527
|
+
destination: The ID of the external account the payout was sent to.
|
|
1528
|
+
ending_before: A cursor for use in pagination. ending_before is an object ID that defines your place in the list.
|
|
1529
|
+
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
|
1530
|
+
starting_after: A cursor for use in pagination. starting_after is an object ID that defines your place in the list.
|
|
1531
|
+
status: Only return payouts that have the given status
|
|
1532
|
+
**kwargs: Additional parameters
|
|
1533
|
+
|
|
1534
|
+
Returns:
|
|
1535
|
+
PayoutsListResult
|
|
1536
|
+
"""
|
|
1537
|
+
params = {k: v for k, v in {
|
|
1538
|
+
"arrival_date": arrival_date,
|
|
1539
|
+
"created": created,
|
|
1540
|
+
"destination": destination,
|
|
1541
|
+
"ending_before": ending_before,
|
|
1542
|
+
"limit": limit,
|
|
1543
|
+
"starting_after": starting_after,
|
|
1544
|
+
"status": status,
|
|
1545
|
+
**kwargs
|
|
1546
|
+
}.items() if v is not None}
|
|
1547
|
+
|
|
1548
|
+
result = await self._connector.execute("payouts", "list", params)
|
|
1549
|
+
# Cast generic envelope to concrete typed result
|
|
1550
|
+
return PayoutsListResult(
|
|
1551
|
+
data=result.data,
|
|
1552
|
+
meta=result.meta )
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
async def get(
|
|
1557
|
+
self,
|
|
1558
|
+
id: str | None = None,
|
|
1559
|
+
**kwargs
|
|
1560
|
+
) -> Payout:
|
|
1561
|
+
"""
|
|
1562
|
+
Retrieves the details of an existing payout. Supply the unique payout ID from either a payout creation request or the payout list, and Stripe will return the corresponding payout information.
|
|
1563
|
+
|
|
1564
|
+
Args:
|
|
1565
|
+
id: The ID of the payout
|
|
1566
|
+
**kwargs: Additional parameters
|
|
1567
|
+
|
|
1568
|
+
Returns:
|
|
1569
|
+
Payout
|
|
1570
|
+
"""
|
|
1571
|
+
params = {k: v for k, v in {
|
|
1572
|
+
"id": id,
|
|
1573
|
+
**kwargs
|
|
1574
|
+
}.items() if v is not None}
|
|
1575
|
+
|
|
1576
|
+
result = await self._connector.execute("payouts", "get", params)
|
|
1577
|
+
return result
|
|
1578
|
+
|
|
1579
|
+
|