vortex-sdk 0.2.0__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.
Files changed (123) hide show
  1. vortex/__init__.py +265 -0
  2. vortex/api/__init__.py +24 -0
  3. vortex/api/billing_api.py +34608 -0
  4. vortex/api/catalog_api.py +708 -0
  5. vortex/api/checkout_api.py +372 -0
  6. vortex/api/credit_notes_api.py +1688 -0
  7. vortex/api/customer_balance_api.py +1747 -0
  8. vortex/api/customers_api.py +387 -0
  9. vortex/api/discounts_api.py +2623 -0
  10. vortex/api/entitlements_api.py +1646 -0
  11. vortex/api/hosted_api.py +2855 -0
  12. vortex/api/invoices_api.py +2402 -0
  13. vortex/api/payables_api.py +1380 -0
  14. vortex/api/payment_methods_api.py +2069 -0
  15. vortex/api/payment_requests_api.py +1877 -0
  16. vortex/api/payments_api.py +694 -0
  17. vortex/api/payments_readiness_api.py +2311 -0
  18. vortex/api/public_api.py +6931 -0
  19. vortex/api/quotes_api.py +6817 -0
  20. vortex/api/receipts_api.py +1111 -0
  21. vortex/api/subscriptions_api.py +1059 -0
  22. vortex/api/tax_api.py +1397 -0
  23. vortex/api/webhooks_api.py +4931 -0
  24. vortex/api_client.py +804 -0
  25. vortex/api_response.py +21 -0
  26. vortex/configuration.py +658 -0
  27. vortex/exceptions.py +218 -0
  28. vortex/models/__init__.py +104 -0
  29. vortex/models/api_error.py +103 -0
  30. vortex/models/api_error_error.py +114 -0
  31. vortex/models/api_write_envelope.py +101 -0
  32. vortex/models/apply_coupon_request.py +97 -0
  33. vortex/models/billing_order_form_sign_request.py +103 -0
  34. vortex/models/billing_order_form_signature_request_request.py +86 -0
  35. vortex/models/billing_order_form_void_request.py +86 -0
  36. vortex/models/billing_order_forms_expire_due_request.py +90 -0
  37. vortex/models/billing_order_update_request.py +99 -0
  38. vortex/models/billing_orders_execute_due_request.py +90 -0
  39. vortex/models/billing_quote_create_request.py +119 -0
  40. vortex/models/billing_quote_line_input.py +93 -0
  41. vortex/models/billing_quote_version_approve_request.py +87 -0
  42. vortex/models/billing_quote_version_create_request.py +103 -0
  43. vortex/models/billing_quote_version_update_request.py +102 -0
  44. vortex/models/billing_quote_version_void_request.py +96 -0
  45. vortex/models/checkout_session_line_item_request.py +91 -0
  46. vortex/models/coupon_targets.py +89 -0
  47. vortex/models/create_checkout_session_request.py +140 -0
  48. vortex/models/create_coupon_request.py +132 -0
  49. vortex/models/create_deposit_balance_payable_request.py +172 -0
  50. vortex/models/create_installment_payable_request.py +170 -0
  51. vortex/models/create_payable_request.py +158 -0
  52. vortex/models/create_recurring_payable_request.py +181 -0
  53. vortex/models/create_recurring_payable_request_cadence.py +96 -0
  54. vortex/models/credit_note_create_line.py +105 -0
  55. vortex/models/credit_note_create_request.py +112 -0
  56. vortex/models/credit_note_reason.py +39 -0
  57. vortex/models/credit_note_refund_reconcile_request.py +86 -0
  58. vortex/models/credit_note_refund_request.py +94 -0
  59. vortex/models/customer_balance_targets.py +102 -0
  60. vortex/models/customer_default_payment_method_request.py +88 -0
  61. vortex/models/customer_payment_method_archive_request.py +88 -0
  62. vortex/models/customer_payment_method_attach_request.py +94 -0
  63. vortex/models/customer_payment_method_setup_request.py +100 -0
  64. vortex/models/customer_upsert_request.py +96 -0
  65. vortex/models/expire_customer_balance_request.py +98 -0
  66. vortex/models/grant_customer_balance_from_payment_request.py +103 -0
  67. vortex/models/grant_customer_balance_request.py +106 -0
  68. vortex/models/grant_entitlement_request.py +106 -0
  69. vortex/models/invoice_collect_request.py +86 -0
  70. vortex/models/invoice_create_request.py +92 -0
  71. vortex/models/invoice_finalize_request.py +86 -0
  72. vortex/models/invoice_mark_uncollectible_request.py +90 -0
  73. vortex/models/invoice_tax.py +142 -0
  74. vortex/models/invoice_void_request.py +88 -0
  75. vortex/models/merchant_account_create_request.py +183 -0
  76. vortex/models/merchant_address.py +96 -0
  77. vortex/models/merchant_associated_identity.py +114 -0
  78. vortex/models/merchant_onboarding_link_request.py +95 -0
  79. vortex/models/merchant_profile_date.py +90 -0
  80. vortex/models/merchant_settlement_bank_account.py +94 -0
  81. vortex/models/merchant_tax_profile_request.py +125 -0
  82. vortex/models/merchant_tax_profile_request_registrations_inner.py +88 -0
  83. vortex/models/merchant_underwriting_data.py +127 -0
  84. vortex/models/merchant_underwriting_data_card_volume_distribution.py +90 -0
  85. vortex/models/merchant_underwriting_data_volume_distribution_by_business_type.py +90 -0
  86. vortex/models/open_api_invoice_tax_response.py +92 -0
  87. vortex/models/open_api_invoice_tax_response_all_of_data.py +92 -0
  88. vortex/models/payment_request_collect_request.py +86 -0
  89. vortex/models/payment_request_create_request.py +100 -0
  90. vortex/models/payment_request_link_create_request.py +89 -0
  91. vortex/models/price_create_request.py +122 -0
  92. vortex/models/product_create_request.py +92 -0
  93. vortex/models/reverse_customer_balance_request.py +98 -0
  94. vortex/models/revoke_entitlement_request.py +106 -0
  95. vortex/models/subscription_change_request.py +111 -0
  96. vortex/models/subscription_create_request.py +122 -0
  97. vortex/models/subscription_item_change_preview_request.py +100 -0
  98. vortex/models/subscription_item_change_request_item.py +91 -0
  99. vortex/models/tax_address.py +96 -0
  100. vortex/models/tax_behavior.py +36 -0
  101. vortex/models/tax_behavior_policy.py +100 -0
  102. vortex/models/tax_behavior_policy_request.py +89 -0
  103. vortex/models/tax_failure.py +104 -0
  104. vortex/models/tax_finalize_request.py +98 -0
  105. vortex/models/tax_jurisdiction_evidence.py +94 -0
  106. vortex/models/tax_line_evidence.py +103 -0
  107. vortex/models/tax_quote_request.py +98 -0
  108. vortex/models/terminate_applied_coupon_request.py +87 -0
  109. vortex/models/terminate_coupon_request.py +87 -0
  110. vortex/models/webhook_deliveries_dispatch_request.py +91 -0
  111. vortex/models/webhook_deliveries_redrive_request.py +107 -0
  112. vortex/models/webhook_delivery_replay_request.py +88 -0
  113. vortex/models/webhook_endpoint_create_request.py +91 -0
  114. vortex/models/webhook_endpoint_secret_rotate_request.py +87 -0
  115. vortex/models/webhook_endpoint_test_request.py +88 -0
  116. vortex/models/webhook_endpoint_update_request.py +103 -0
  117. vortex/models/webhook_event_resend_request.py +86 -0
  118. vortex/rest.py +263 -0
  119. vortex_sdk-0.2.0.dist-info/METADATA +34 -0
  120. vortex_sdk-0.2.0.dist-info/RECORD +123 -0
  121. vortex_sdk-0.2.0.dist-info/WHEEL +5 -0
  122. vortex_sdk-0.2.0.dist-info/licenses/LICENSE +21 -0
  123. vortex_sdk-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1059 @@
1
+ """
2
+ Vortex Payments API
3
+
4
+ Public Vortex Payments API for customers, subscriptions, invoices, payment requests, checkout, receipts, webhooks, tax.
5
+
6
+ The version of the OpenAPI document: 2026-08
7
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+
9
+ Do not edit the class manually.
10
+ """ # noqa: E501
11
+
12
+
13
+ import warnings
14
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
15
+ from typing import Any, Dict, List, Optional, Tuple, Union
16
+ from typing_extensions import Annotated
17
+
18
+ from pydantic import Field, StrictStr
19
+ from typing import Optional
20
+ from typing_extensions import Annotated
21
+ from vortex.models.api_write_envelope import ApiWriteEnvelope
22
+ from vortex.models.subscription_change_request import SubscriptionChangeRequest
23
+ from vortex.models.subscription_create_request import SubscriptionCreateRequest
24
+ from vortex.models.subscription_item_change_preview_request import SubscriptionItemChangePreviewRequest
25
+
26
+ from vortex.api_client import ApiClient, RequestSerialized
27
+ from vortex.api_response import ApiResponse
28
+ from vortex.rest import RESTResponseType
29
+
30
+
31
+ class SubscriptionsApi:
32
+ """NOTE: This class is auto generated by OpenAPI Generator
33
+ Ref: https://openapi-generator.tech
34
+
35
+ Do not edit the class manually.
36
+ """
37
+
38
+ def __init__(self, api_client=None) -> None:
39
+ if api_client is None:
40
+ api_client = ApiClient.get_default()
41
+ self.api_client = api_client
42
+
43
+
44
+ @validate_call
45
+ def change_subscription(
46
+ self,
47
+ subscription_id: StrictStr,
48
+ environment: StrictStr,
49
+ merchant_account_id: StrictStr,
50
+ subscription_change_request: SubscriptionChangeRequest,
51
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
52
+ _request_timeout: Union[
53
+ None,
54
+ Annotated[StrictFloat, Field(gt=0)],
55
+ Tuple[
56
+ Annotated[StrictFloat, Field(gt=0)],
57
+ Annotated[StrictFloat, Field(gt=0)]
58
+ ]
59
+ ] = None,
60
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
61
+ _content_type: Optional[StrictStr] = None,
62
+ _headers: Optional[Dict[StrictStr, Any]] = None,
63
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
64
+ ) -> ApiWriteEnvelope:
65
+ """Change subscription status or items
66
+
67
+
68
+ :param subscription_id: (required)
69
+ :type subscription_id: str
70
+ :param environment: (required)
71
+ :type environment: str
72
+ :param merchant_account_id: (required)
73
+ :type merchant_account_id: str
74
+ :param subscription_change_request: (required)
75
+ :type subscription_change_request: SubscriptionChangeRequest
76
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
77
+ :type idempotency_key: str
78
+ :param _request_timeout: timeout setting for this request. If one
79
+ number provided, it will be total request
80
+ timeout. It can also be a pair (tuple) of
81
+ (connection, read) timeouts.
82
+ :type _request_timeout: int, tuple(int, int), optional
83
+ :param _request_auth: set to override the auth_settings for an a single
84
+ request; this effectively ignores the
85
+ authentication in the spec for a single request.
86
+ :type _request_auth: dict, optional
87
+ :param _content_type: force content-type for the request.
88
+ :type _content_type: str, Optional
89
+ :param _headers: set to override the headers for a single
90
+ request; this effectively ignores the headers
91
+ in the spec for a single request.
92
+ :type _headers: dict, optional
93
+ :param _host_index: set to override the host_index for a single
94
+ request; this effectively ignores the host_index
95
+ in the spec for a single request.
96
+ :type _host_index: int, optional
97
+ :return: Returns the result object.
98
+ """ # noqa: E501
99
+
100
+ _param = self._change_subscription_serialize(
101
+ subscription_id=subscription_id,
102
+ environment=environment,
103
+ merchant_account_id=merchant_account_id,
104
+ subscription_change_request=subscription_change_request,
105
+ idempotency_key=idempotency_key,
106
+ _request_auth=_request_auth,
107
+ _content_type=_content_type,
108
+ _headers=_headers,
109
+ _host_index=_host_index
110
+ )
111
+
112
+ _response_types_map: Dict[str, Optional[str]] = {
113
+ '200': "ApiWriteEnvelope",
114
+ '400': "ApiError",
115
+ '401': "ApiError",
116
+ '409': "ApiError",
117
+ '422': "ApiError",
118
+ '429': "ApiError",
119
+ }
120
+ response_data = self.api_client.call_api(
121
+ *_param,
122
+ _request_timeout=_request_timeout
123
+ )
124
+ response_data.read()
125
+ return self.api_client.response_deserialize(
126
+ response_data=response_data,
127
+ response_types_map=_response_types_map,
128
+ ).data
129
+
130
+
131
+ @validate_call
132
+ def change_subscription_with_http_info(
133
+ self,
134
+ subscription_id: StrictStr,
135
+ environment: StrictStr,
136
+ merchant_account_id: StrictStr,
137
+ subscription_change_request: SubscriptionChangeRequest,
138
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
139
+ _request_timeout: Union[
140
+ None,
141
+ Annotated[StrictFloat, Field(gt=0)],
142
+ Tuple[
143
+ Annotated[StrictFloat, Field(gt=0)],
144
+ Annotated[StrictFloat, Field(gt=0)]
145
+ ]
146
+ ] = None,
147
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
148
+ _content_type: Optional[StrictStr] = None,
149
+ _headers: Optional[Dict[StrictStr, Any]] = None,
150
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
151
+ ) -> ApiResponse[ApiWriteEnvelope]:
152
+ """Change subscription status or items
153
+
154
+
155
+ :param subscription_id: (required)
156
+ :type subscription_id: str
157
+ :param environment: (required)
158
+ :type environment: str
159
+ :param merchant_account_id: (required)
160
+ :type merchant_account_id: str
161
+ :param subscription_change_request: (required)
162
+ :type subscription_change_request: SubscriptionChangeRequest
163
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
164
+ :type idempotency_key: str
165
+ :param _request_timeout: timeout setting for this request. If one
166
+ number provided, it will be total request
167
+ timeout. It can also be a pair (tuple) of
168
+ (connection, read) timeouts.
169
+ :type _request_timeout: int, tuple(int, int), optional
170
+ :param _request_auth: set to override the auth_settings for an a single
171
+ request; this effectively ignores the
172
+ authentication in the spec for a single request.
173
+ :type _request_auth: dict, optional
174
+ :param _content_type: force content-type for the request.
175
+ :type _content_type: str, Optional
176
+ :param _headers: set to override the headers for a single
177
+ request; this effectively ignores the headers
178
+ in the spec for a single request.
179
+ :type _headers: dict, optional
180
+ :param _host_index: set to override the host_index for a single
181
+ request; this effectively ignores the host_index
182
+ in the spec for a single request.
183
+ :type _host_index: int, optional
184
+ :return: Returns the result object.
185
+ """ # noqa: E501
186
+
187
+ _param = self._change_subscription_serialize(
188
+ subscription_id=subscription_id,
189
+ environment=environment,
190
+ merchant_account_id=merchant_account_id,
191
+ subscription_change_request=subscription_change_request,
192
+ idempotency_key=idempotency_key,
193
+ _request_auth=_request_auth,
194
+ _content_type=_content_type,
195
+ _headers=_headers,
196
+ _host_index=_host_index
197
+ )
198
+
199
+ _response_types_map: Dict[str, Optional[str]] = {
200
+ '200': "ApiWriteEnvelope",
201
+ '400': "ApiError",
202
+ '401': "ApiError",
203
+ '409': "ApiError",
204
+ '422': "ApiError",
205
+ '429': "ApiError",
206
+ }
207
+ response_data = self.api_client.call_api(
208
+ *_param,
209
+ _request_timeout=_request_timeout
210
+ )
211
+ response_data.read()
212
+ return self.api_client.response_deserialize(
213
+ response_data=response_data,
214
+ response_types_map=_response_types_map,
215
+ )
216
+
217
+
218
+ @validate_call
219
+ def change_subscription_without_preload_content(
220
+ self,
221
+ subscription_id: StrictStr,
222
+ environment: StrictStr,
223
+ merchant_account_id: StrictStr,
224
+ subscription_change_request: SubscriptionChangeRequest,
225
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
226
+ _request_timeout: Union[
227
+ None,
228
+ Annotated[StrictFloat, Field(gt=0)],
229
+ Tuple[
230
+ Annotated[StrictFloat, Field(gt=0)],
231
+ Annotated[StrictFloat, Field(gt=0)]
232
+ ]
233
+ ] = None,
234
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
235
+ _content_type: Optional[StrictStr] = None,
236
+ _headers: Optional[Dict[StrictStr, Any]] = None,
237
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
238
+ ) -> RESTResponseType:
239
+ """Change subscription status or items
240
+
241
+
242
+ :param subscription_id: (required)
243
+ :type subscription_id: str
244
+ :param environment: (required)
245
+ :type environment: str
246
+ :param merchant_account_id: (required)
247
+ :type merchant_account_id: str
248
+ :param subscription_change_request: (required)
249
+ :type subscription_change_request: SubscriptionChangeRequest
250
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
251
+ :type idempotency_key: str
252
+ :param _request_timeout: timeout setting for this request. If one
253
+ number provided, it will be total request
254
+ timeout. It can also be a pair (tuple) of
255
+ (connection, read) timeouts.
256
+ :type _request_timeout: int, tuple(int, int), optional
257
+ :param _request_auth: set to override the auth_settings for an a single
258
+ request; this effectively ignores the
259
+ authentication in the spec for a single request.
260
+ :type _request_auth: dict, optional
261
+ :param _content_type: force content-type for the request.
262
+ :type _content_type: str, Optional
263
+ :param _headers: set to override the headers for a single
264
+ request; this effectively ignores the headers
265
+ in the spec for a single request.
266
+ :type _headers: dict, optional
267
+ :param _host_index: set to override the host_index for a single
268
+ request; this effectively ignores the host_index
269
+ in the spec for a single request.
270
+ :type _host_index: int, optional
271
+ :return: Returns the result object.
272
+ """ # noqa: E501
273
+
274
+ _param = self._change_subscription_serialize(
275
+ subscription_id=subscription_id,
276
+ environment=environment,
277
+ merchant_account_id=merchant_account_id,
278
+ subscription_change_request=subscription_change_request,
279
+ idempotency_key=idempotency_key,
280
+ _request_auth=_request_auth,
281
+ _content_type=_content_type,
282
+ _headers=_headers,
283
+ _host_index=_host_index
284
+ )
285
+
286
+ _response_types_map: Dict[str, Optional[str]] = {
287
+ '200': "ApiWriteEnvelope",
288
+ '400': "ApiError",
289
+ '401': "ApiError",
290
+ '409': "ApiError",
291
+ '422': "ApiError",
292
+ '429': "ApiError",
293
+ }
294
+ response_data = self.api_client.call_api(
295
+ *_param,
296
+ _request_timeout=_request_timeout
297
+ )
298
+ return response_data.response
299
+
300
+
301
+ def _change_subscription_serialize(
302
+ self,
303
+ subscription_id,
304
+ environment,
305
+ merchant_account_id,
306
+ subscription_change_request,
307
+ idempotency_key,
308
+ _request_auth,
309
+ _content_type,
310
+ _headers,
311
+ _host_index,
312
+ ) -> RequestSerialized:
313
+
314
+ _host = None
315
+
316
+ _collection_formats: Dict[str, str] = {
317
+ }
318
+
319
+ _path_params: Dict[str, str] = {}
320
+ _query_params: List[Tuple[str, str]] = []
321
+ _header_params: Dict[str, Optional[str]] = _headers or {}
322
+ _form_params: List[Tuple[str, str]] = []
323
+ _files: Dict[
324
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
325
+ ] = {}
326
+ _body_params: Optional[bytes] = None
327
+
328
+ # process the path parameters
329
+ if subscription_id is not None:
330
+ _path_params['subscriptionId'] = subscription_id
331
+ # process the query parameters
332
+ if environment is not None:
333
+
334
+ _query_params.append(('environment', environment))
335
+
336
+ if merchant_account_id is not None:
337
+
338
+ _query_params.append(('merchantAccountId', merchant_account_id))
339
+
340
+ # process the header parameters
341
+ if idempotency_key is not None:
342
+ _header_params['Idempotency-Key'] = idempotency_key
343
+ # process the form parameters
344
+ # process the body parameter
345
+ if subscription_change_request is not None:
346
+ _body_params = subscription_change_request
347
+
348
+
349
+ # set the HTTP header `Accept`
350
+ if 'Accept' not in _header_params:
351
+ _header_params['Accept'] = self.api_client.select_header_accept(
352
+ [
353
+ 'application/json'
354
+ ]
355
+ )
356
+
357
+ # set the HTTP header `Content-Type`
358
+ if _content_type:
359
+ _header_params['Content-Type'] = _content_type
360
+ else:
361
+ _default_content_type = (
362
+ self.api_client.select_header_content_type(
363
+ [
364
+ 'application/json'
365
+ ]
366
+ )
367
+ )
368
+ if _default_content_type is not None:
369
+ _header_params['Content-Type'] = _default_content_type
370
+
371
+ # authentication setting
372
+ _auth_settings: List[str] = [
373
+ 'api-key'
374
+ ]
375
+
376
+ return self.api_client.param_serialize(
377
+ method='POST',
378
+ resource_path='/v1/subscriptions/{subscriptionId}/change',
379
+ path_params=_path_params,
380
+ query_params=_query_params,
381
+ header_params=_header_params,
382
+ body=_body_params,
383
+ post_params=_form_params,
384
+ files=_files,
385
+ auth_settings=_auth_settings,
386
+ collection_formats=_collection_formats,
387
+ _host=_host,
388
+ _request_auth=_request_auth
389
+ )
390
+
391
+
392
+
393
+
394
+ @validate_call
395
+ def create_subscription(
396
+ self,
397
+ environment: StrictStr,
398
+ merchant_account_id: StrictStr,
399
+ subscription_create_request: SubscriptionCreateRequest,
400
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
401
+ _request_timeout: Union[
402
+ None,
403
+ Annotated[StrictFloat, Field(gt=0)],
404
+ Tuple[
405
+ Annotated[StrictFloat, Field(gt=0)],
406
+ Annotated[StrictFloat, Field(gt=0)]
407
+ ]
408
+ ] = None,
409
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
410
+ _content_type: Optional[StrictStr] = None,
411
+ _headers: Optional[Dict[StrictStr, Any]] = None,
412
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
413
+ ) -> ApiWriteEnvelope:
414
+ """Create a subscription
415
+
416
+
417
+ :param environment: (required)
418
+ :type environment: str
419
+ :param merchant_account_id: (required)
420
+ :type merchant_account_id: str
421
+ :param subscription_create_request: (required)
422
+ :type subscription_create_request: SubscriptionCreateRequest
423
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
424
+ :type idempotency_key: str
425
+ :param _request_timeout: timeout setting for this request. If one
426
+ number provided, it will be total request
427
+ timeout. It can also be a pair (tuple) of
428
+ (connection, read) timeouts.
429
+ :type _request_timeout: int, tuple(int, int), optional
430
+ :param _request_auth: set to override the auth_settings for an a single
431
+ request; this effectively ignores the
432
+ authentication in the spec for a single request.
433
+ :type _request_auth: dict, optional
434
+ :param _content_type: force content-type for the request.
435
+ :type _content_type: str, Optional
436
+ :param _headers: set to override the headers for a single
437
+ request; this effectively ignores the headers
438
+ in the spec for a single request.
439
+ :type _headers: dict, optional
440
+ :param _host_index: set to override the host_index for a single
441
+ request; this effectively ignores the host_index
442
+ in the spec for a single request.
443
+ :type _host_index: int, optional
444
+ :return: Returns the result object.
445
+ """ # noqa: E501
446
+
447
+ _param = self._create_subscription_serialize(
448
+ environment=environment,
449
+ merchant_account_id=merchant_account_id,
450
+ subscription_create_request=subscription_create_request,
451
+ idempotency_key=idempotency_key,
452
+ _request_auth=_request_auth,
453
+ _content_type=_content_type,
454
+ _headers=_headers,
455
+ _host_index=_host_index
456
+ )
457
+
458
+ _response_types_map: Dict[str, Optional[str]] = {
459
+ '200': "ApiWriteEnvelope",
460
+ '400': "ApiError",
461
+ '401': "ApiError",
462
+ '409': "ApiError",
463
+ '422': "ApiError",
464
+ '429': "ApiError",
465
+ }
466
+ response_data = self.api_client.call_api(
467
+ *_param,
468
+ _request_timeout=_request_timeout
469
+ )
470
+ response_data.read()
471
+ return self.api_client.response_deserialize(
472
+ response_data=response_data,
473
+ response_types_map=_response_types_map,
474
+ ).data
475
+
476
+
477
+ @validate_call
478
+ def create_subscription_with_http_info(
479
+ self,
480
+ environment: StrictStr,
481
+ merchant_account_id: StrictStr,
482
+ subscription_create_request: SubscriptionCreateRequest,
483
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
484
+ _request_timeout: Union[
485
+ None,
486
+ Annotated[StrictFloat, Field(gt=0)],
487
+ Tuple[
488
+ Annotated[StrictFloat, Field(gt=0)],
489
+ Annotated[StrictFloat, Field(gt=0)]
490
+ ]
491
+ ] = None,
492
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
493
+ _content_type: Optional[StrictStr] = None,
494
+ _headers: Optional[Dict[StrictStr, Any]] = None,
495
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
496
+ ) -> ApiResponse[ApiWriteEnvelope]:
497
+ """Create a subscription
498
+
499
+
500
+ :param environment: (required)
501
+ :type environment: str
502
+ :param merchant_account_id: (required)
503
+ :type merchant_account_id: str
504
+ :param subscription_create_request: (required)
505
+ :type subscription_create_request: SubscriptionCreateRequest
506
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
507
+ :type idempotency_key: str
508
+ :param _request_timeout: timeout setting for this request. If one
509
+ number provided, it will be total request
510
+ timeout. It can also be a pair (tuple) of
511
+ (connection, read) timeouts.
512
+ :type _request_timeout: int, tuple(int, int), optional
513
+ :param _request_auth: set to override the auth_settings for an a single
514
+ request; this effectively ignores the
515
+ authentication in the spec for a single request.
516
+ :type _request_auth: dict, optional
517
+ :param _content_type: force content-type for the request.
518
+ :type _content_type: str, Optional
519
+ :param _headers: set to override the headers for a single
520
+ request; this effectively ignores the headers
521
+ in the spec for a single request.
522
+ :type _headers: dict, optional
523
+ :param _host_index: set to override the host_index for a single
524
+ request; this effectively ignores the host_index
525
+ in the spec for a single request.
526
+ :type _host_index: int, optional
527
+ :return: Returns the result object.
528
+ """ # noqa: E501
529
+
530
+ _param = self._create_subscription_serialize(
531
+ environment=environment,
532
+ merchant_account_id=merchant_account_id,
533
+ subscription_create_request=subscription_create_request,
534
+ idempotency_key=idempotency_key,
535
+ _request_auth=_request_auth,
536
+ _content_type=_content_type,
537
+ _headers=_headers,
538
+ _host_index=_host_index
539
+ )
540
+
541
+ _response_types_map: Dict[str, Optional[str]] = {
542
+ '200': "ApiWriteEnvelope",
543
+ '400': "ApiError",
544
+ '401': "ApiError",
545
+ '409': "ApiError",
546
+ '422': "ApiError",
547
+ '429': "ApiError",
548
+ }
549
+ response_data = self.api_client.call_api(
550
+ *_param,
551
+ _request_timeout=_request_timeout
552
+ )
553
+ response_data.read()
554
+ return self.api_client.response_deserialize(
555
+ response_data=response_data,
556
+ response_types_map=_response_types_map,
557
+ )
558
+
559
+
560
+ @validate_call
561
+ def create_subscription_without_preload_content(
562
+ self,
563
+ environment: StrictStr,
564
+ merchant_account_id: StrictStr,
565
+ subscription_create_request: SubscriptionCreateRequest,
566
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
567
+ _request_timeout: Union[
568
+ None,
569
+ Annotated[StrictFloat, Field(gt=0)],
570
+ Tuple[
571
+ Annotated[StrictFloat, Field(gt=0)],
572
+ Annotated[StrictFloat, Field(gt=0)]
573
+ ]
574
+ ] = None,
575
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
576
+ _content_type: Optional[StrictStr] = None,
577
+ _headers: Optional[Dict[StrictStr, Any]] = None,
578
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
579
+ ) -> RESTResponseType:
580
+ """Create a subscription
581
+
582
+
583
+ :param environment: (required)
584
+ :type environment: str
585
+ :param merchant_account_id: (required)
586
+ :type merchant_account_id: str
587
+ :param subscription_create_request: (required)
588
+ :type subscription_create_request: SubscriptionCreateRequest
589
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
590
+ :type idempotency_key: str
591
+ :param _request_timeout: timeout setting for this request. If one
592
+ number provided, it will be total request
593
+ timeout. It can also be a pair (tuple) of
594
+ (connection, read) timeouts.
595
+ :type _request_timeout: int, tuple(int, int), optional
596
+ :param _request_auth: set to override the auth_settings for an a single
597
+ request; this effectively ignores the
598
+ authentication in the spec for a single request.
599
+ :type _request_auth: dict, optional
600
+ :param _content_type: force content-type for the request.
601
+ :type _content_type: str, Optional
602
+ :param _headers: set to override the headers for a single
603
+ request; this effectively ignores the headers
604
+ in the spec for a single request.
605
+ :type _headers: dict, optional
606
+ :param _host_index: set to override the host_index for a single
607
+ request; this effectively ignores the host_index
608
+ in the spec for a single request.
609
+ :type _host_index: int, optional
610
+ :return: Returns the result object.
611
+ """ # noqa: E501
612
+
613
+ _param = self._create_subscription_serialize(
614
+ environment=environment,
615
+ merchant_account_id=merchant_account_id,
616
+ subscription_create_request=subscription_create_request,
617
+ idempotency_key=idempotency_key,
618
+ _request_auth=_request_auth,
619
+ _content_type=_content_type,
620
+ _headers=_headers,
621
+ _host_index=_host_index
622
+ )
623
+
624
+ _response_types_map: Dict[str, Optional[str]] = {
625
+ '200': "ApiWriteEnvelope",
626
+ '400': "ApiError",
627
+ '401': "ApiError",
628
+ '409': "ApiError",
629
+ '422': "ApiError",
630
+ '429': "ApiError",
631
+ }
632
+ response_data = self.api_client.call_api(
633
+ *_param,
634
+ _request_timeout=_request_timeout
635
+ )
636
+ return response_data.response
637
+
638
+
639
+ def _create_subscription_serialize(
640
+ self,
641
+ environment,
642
+ merchant_account_id,
643
+ subscription_create_request,
644
+ idempotency_key,
645
+ _request_auth,
646
+ _content_type,
647
+ _headers,
648
+ _host_index,
649
+ ) -> RequestSerialized:
650
+
651
+ _host = None
652
+
653
+ _collection_formats: Dict[str, str] = {
654
+ }
655
+
656
+ _path_params: Dict[str, str] = {}
657
+ _query_params: List[Tuple[str, str]] = []
658
+ _header_params: Dict[str, Optional[str]] = _headers or {}
659
+ _form_params: List[Tuple[str, str]] = []
660
+ _files: Dict[
661
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
662
+ ] = {}
663
+ _body_params: Optional[bytes] = None
664
+
665
+ # process the path parameters
666
+ # process the query parameters
667
+ if environment is not None:
668
+
669
+ _query_params.append(('environment', environment))
670
+
671
+ if merchant_account_id is not None:
672
+
673
+ _query_params.append(('merchantAccountId', merchant_account_id))
674
+
675
+ # process the header parameters
676
+ if idempotency_key is not None:
677
+ _header_params['Idempotency-Key'] = idempotency_key
678
+ # process the form parameters
679
+ # process the body parameter
680
+ if subscription_create_request is not None:
681
+ _body_params = subscription_create_request
682
+
683
+
684
+ # set the HTTP header `Accept`
685
+ if 'Accept' not in _header_params:
686
+ _header_params['Accept'] = self.api_client.select_header_accept(
687
+ [
688
+ 'application/json'
689
+ ]
690
+ )
691
+
692
+ # set the HTTP header `Content-Type`
693
+ if _content_type:
694
+ _header_params['Content-Type'] = _content_type
695
+ else:
696
+ _default_content_type = (
697
+ self.api_client.select_header_content_type(
698
+ [
699
+ 'application/json'
700
+ ]
701
+ )
702
+ )
703
+ if _default_content_type is not None:
704
+ _header_params['Content-Type'] = _default_content_type
705
+
706
+ # authentication setting
707
+ _auth_settings: List[str] = [
708
+ 'api-key'
709
+ ]
710
+
711
+ return self.api_client.param_serialize(
712
+ method='POST',
713
+ resource_path='/v1/subscriptions',
714
+ path_params=_path_params,
715
+ query_params=_query_params,
716
+ header_params=_header_params,
717
+ body=_body_params,
718
+ post_params=_form_params,
719
+ files=_files,
720
+ auth_settings=_auth_settings,
721
+ collection_formats=_collection_formats,
722
+ _host=_host,
723
+ _request_auth=_request_auth
724
+ )
725
+
726
+
727
+
728
+
729
+ @validate_call
730
+ def preview_subscription_item_change(
731
+ self,
732
+ subscription_id: StrictStr,
733
+ environment: StrictStr,
734
+ merchant_account_id: StrictStr,
735
+ subscription_item_change_preview_request: SubscriptionItemChangePreviewRequest,
736
+ _request_timeout: Union[
737
+ None,
738
+ Annotated[StrictFloat, Field(gt=0)],
739
+ Tuple[
740
+ Annotated[StrictFloat, Field(gt=0)],
741
+ Annotated[StrictFloat, Field(gt=0)]
742
+ ]
743
+ ] = None,
744
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
745
+ _content_type: Optional[StrictStr] = None,
746
+ _headers: Optional[Dict[StrictStr, Any]] = None,
747
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
748
+ ) -> ApiWriteEnvelope:
749
+ """Preview a subscription item change
750
+
751
+
752
+ :param subscription_id: (required)
753
+ :type subscription_id: str
754
+ :param environment: (required)
755
+ :type environment: str
756
+ :param merchant_account_id: (required)
757
+ :type merchant_account_id: str
758
+ :param subscription_item_change_preview_request: (required)
759
+ :type subscription_item_change_preview_request: SubscriptionItemChangePreviewRequest
760
+ :param _request_timeout: timeout setting for this request. If one
761
+ number provided, it will be total request
762
+ timeout. It can also be a pair (tuple) of
763
+ (connection, read) timeouts.
764
+ :type _request_timeout: int, tuple(int, int), optional
765
+ :param _request_auth: set to override the auth_settings for an a single
766
+ request; this effectively ignores the
767
+ authentication in the spec for a single request.
768
+ :type _request_auth: dict, optional
769
+ :param _content_type: force content-type for the request.
770
+ :type _content_type: str, Optional
771
+ :param _headers: set to override the headers for a single
772
+ request; this effectively ignores the headers
773
+ in the spec for a single request.
774
+ :type _headers: dict, optional
775
+ :param _host_index: set to override the host_index for a single
776
+ request; this effectively ignores the host_index
777
+ in the spec for a single request.
778
+ :type _host_index: int, optional
779
+ :return: Returns the result object.
780
+ """ # noqa: E501
781
+
782
+ _param = self._preview_subscription_item_change_serialize(
783
+ subscription_id=subscription_id,
784
+ environment=environment,
785
+ merchant_account_id=merchant_account_id,
786
+ subscription_item_change_preview_request=subscription_item_change_preview_request,
787
+ _request_auth=_request_auth,
788
+ _content_type=_content_type,
789
+ _headers=_headers,
790
+ _host_index=_host_index
791
+ )
792
+
793
+ _response_types_map: Dict[str, Optional[str]] = {
794
+ '200': "ApiWriteEnvelope",
795
+ '400': "ApiError",
796
+ '401': "ApiError",
797
+ '409': "ApiError",
798
+ '422': "ApiError",
799
+ '429': "ApiError",
800
+ }
801
+ response_data = self.api_client.call_api(
802
+ *_param,
803
+ _request_timeout=_request_timeout
804
+ )
805
+ response_data.read()
806
+ return self.api_client.response_deserialize(
807
+ response_data=response_data,
808
+ response_types_map=_response_types_map,
809
+ ).data
810
+
811
+
812
+ @validate_call
813
+ def preview_subscription_item_change_with_http_info(
814
+ self,
815
+ subscription_id: StrictStr,
816
+ environment: StrictStr,
817
+ merchant_account_id: StrictStr,
818
+ subscription_item_change_preview_request: SubscriptionItemChangePreviewRequest,
819
+ _request_timeout: Union[
820
+ None,
821
+ Annotated[StrictFloat, Field(gt=0)],
822
+ Tuple[
823
+ Annotated[StrictFloat, Field(gt=0)],
824
+ Annotated[StrictFloat, Field(gt=0)]
825
+ ]
826
+ ] = None,
827
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
828
+ _content_type: Optional[StrictStr] = None,
829
+ _headers: Optional[Dict[StrictStr, Any]] = None,
830
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
831
+ ) -> ApiResponse[ApiWriteEnvelope]:
832
+ """Preview a subscription item change
833
+
834
+
835
+ :param subscription_id: (required)
836
+ :type subscription_id: str
837
+ :param environment: (required)
838
+ :type environment: str
839
+ :param merchant_account_id: (required)
840
+ :type merchant_account_id: str
841
+ :param subscription_item_change_preview_request: (required)
842
+ :type subscription_item_change_preview_request: SubscriptionItemChangePreviewRequest
843
+ :param _request_timeout: timeout setting for this request. If one
844
+ number provided, it will be total request
845
+ timeout. It can also be a pair (tuple) of
846
+ (connection, read) timeouts.
847
+ :type _request_timeout: int, tuple(int, int), optional
848
+ :param _request_auth: set to override the auth_settings for an a single
849
+ request; this effectively ignores the
850
+ authentication in the spec for a single request.
851
+ :type _request_auth: dict, optional
852
+ :param _content_type: force content-type for the request.
853
+ :type _content_type: str, Optional
854
+ :param _headers: set to override the headers for a single
855
+ request; this effectively ignores the headers
856
+ in the spec for a single request.
857
+ :type _headers: dict, optional
858
+ :param _host_index: set to override the host_index for a single
859
+ request; this effectively ignores the host_index
860
+ in the spec for a single request.
861
+ :type _host_index: int, optional
862
+ :return: Returns the result object.
863
+ """ # noqa: E501
864
+
865
+ _param = self._preview_subscription_item_change_serialize(
866
+ subscription_id=subscription_id,
867
+ environment=environment,
868
+ merchant_account_id=merchant_account_id,
869
+ subscription_item_change_preview_request=subscription_item_change_preview_request,
870
+ _request_auth=_request_auth,
871
+ _content_type=_content_type,
872
+ _headers=_headers,
873
+ _host_index=_host_index
874
+ )
875
+
876
+ _response_types_map: Dict[str, Optional[str]] = {
877
+ '200': "ApiWriteEnvelope",
878
+ '400': "ApiError",
879
+ '401': "ApiError",
880
+ '409': "ApiError",
881
+ '422': "ApiError",
882
+ '429': "ApiError",
883
+ }
884
+ response_data = self.api_client.call_api(
885
+ *_param,
886
+ _request_timeout=_request_timeout
887
+ )
888
+ response_data.read()
889
+ return self.api_client.response_deserialize(
890
+ response_data=response_data,
891
+ response_types_map=_response_types_map,
892
+ )
893
+
894
+
895
+ @validate_call
896
+ def preview_subscription_item_change_without_preload_content(
897
+ self,
898
+ subscription_id: StrictStr,
899
+ environment: StrictStr,
900
+ merchant_account_id: StrictStr,
901
+ subscription_item_change_preview_request: SubscriptionItemChangePreviewRequest,
902
+ _request_timeout: Union[
903
+ None,
904
+ Annotated[StrictFloat, Field(gt=0)],
905
+ Tuple[
906
+ Annotated[StrictFloat, Field(gt=0)],
907
+ Annotated[StrictFloat, Field(gt=0)]
908
+ ]
909
+ ] = None,
910
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
911
+ _content_type: Optional[StrictStr] = None,
912
+ _headers: Optional[Dict[StrictStr, Any]] = None,
913
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
914
+ ) -> RESTResponseType:
915
+ """Preview a subscription item change
916
+
917
+
918
+ :param subscription_id: (required)
919
+ :type subscription_id: str
920
+ :param environment: (required)
921
+ :type environment: str
922
+ :param merchant_account_id: (required)
923
+ :type merchant_account_id: str
924
+ :param subscription_item_change_preview_request: (required)
925
+ :type subscription_item_change_preview_request: SubscriptionItemChangePreviewRequest
926
+ :param _request_timeout: timeout setting for this request. If one
927
+ number provided, it will be total request
928
+ timeout. It can also be a pair (tuple) of
929
+ (connection, read) timeouts.
930
+ :type _request_timeout: int, tuple(int, int), optional
931
+ :param _request_auth: set to override the auth_settings for an a single
932
+ request; this effectively ignores the
933
+ authentication in the spec for a single request.
934
+ :type _request_auth: dict, optional
935
+ :param _content_type: force content-type for the request.
936
+ :type _content_type: str, Optional
937
+ :param _headers: set to override the headers for a single
938
+ request; this effectively ignores the headers
939
+ in the spec for a single request.
940
+ :type _headers: dict, optional
941
+ :param _host_index: set to override the host_index for a single
942
+ request; this effectively ignores the host_index
943
+ in the spec for a single request.
944
+ :type _host_index: int, optional
945
+ :return: Returns the result object.
946
+ """ # noqa: E501
947
+
948
+ _param = self._preview_subscription_item_change_serialize(
949
+ subscription_id=subscription_id,
950
+ environment=environment,
951
+ merchant_account_id=merchant_account_id,
952
+ subscription_item_change_preview_request=subscription_item_change_preview_request,
953
+ _request_auth=_request_auth,
954
+ _content_type=_content_type,
955
+ _headers=_headers,
956
+ _host_index=_host_index
957
+ )
958
+
959
+ _response_types_map: Dict[str, Optional[str]] = {
960
+ '200': "ApiWriteEnvelope",
961
+ '400': "ApiError",
962
+ '401': "ApiError",
963
+ '409': "ApiError",
964
+ '422': "ApiError",
965
+ '429': "ApiError",
966
+ }
967
+ response_data = self.api_client.call_api(
968
+ *_param,
969
+ _request_timeout=_request_timeout
970
+ )
971
+ return response_data.response
972
+
973
+
974
+ def _preview_subscription_item_change_serialize(
975
+ self,
976
+ subscription_id,
977
+ environment,
978
+ merchant_account_id,
979
+ subscription_item_change_preview_request,
980
+ _request_auth,
981
+ _content_type,
982
+ _headers,
983
+ _host_index,
984
+ ) -> RequestSerialized:
985
+
986
+ _host = None
987
+
988
+ _collection_formats: Dict[str, str] = {
989
+ }
990
+
991
+ _path_params: Dict[str, str] = {}
992
+ _query_params: List[Tuple[str, str]] = []
993
+ _header_params: Dict[str, Optional[str]] = _headers or {}
994
+ _form_params: List[Tuple[str, str]] = []
995
+ _files: Dict[
996
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
997
+ ] = {}
998
+ _body_params: Optional[bytes] = None
999
+
1000
+ # process the path parameters
1001
+ if subscription_id is not None:
1002
+ _path_params['subscriptionId'] = subscription_id
1003
+ # process the query parameters
1004
+ if environment is not None:
1005
+
1006
+ _query_params.append(('environment', environment))
1007
+
1008
+ if merchant_account_id is not None:
1009
+
1010
+ _query_params.append(('merchantAccountId', merchant_account_id))
1011
+
1012
+ # process the header parameters
1013
+ # process the form parameters
1014
+ # process the body parameter
1015
+ if subscription_item_change_preview_request is not None:
1016
+ _body_params = subscription_item_change_preview_request
1017
+
1018
+
1019
+ # set the HTTP header `Accept`
1020
+ if 'Accept' not in _header_params:
1021
+ _header_params['Accept'] = self.api_client.select_header_accept(
1022
+ [
1023
+ 'application/json'
1024
+ ]
1025
+ )
1026
+
1027
+ # set the HTTP header `Content-Type`
1028
+ if _content_type:
1029
+ _header_params['Content-Type'] = _content_type
1030
+ else:
1031
+ _default_content_type = (
1032
+ self.api_client.select_header_content_type(
1033
+ [
1034
+ 'application/json'
1035
+ ]
1036
+ )
1037
+ )
1038
+ if _default_content_type is not None:
1039
+ _header_params['Content-Type'] = _default_content_type
1040
+
1041
+ # authentication setting
1042
+ _auth_settings: List[str] = [
1043
+ 'api-key'
1044
+ ]
1045
+
1046
+ return self.api_client.param_serialize(
1047
+ method='POST',
1048
+ resource_path='/v1/subscriptions/{subscriptionId}/change/preview',
1049
+ path_params=_path_params,
1050
+ query_params=_query_params,
1051
+ header_params=_header_params,
1052
+ body=_body_params,
1053
+ post_params=_form_params,
1054
+ files=_files,
1055
+ auth_settings=_auth_settings,
1056
+ collection_formats=_collection_formats,
1057
+ _host=_host,
1058
+ _request_auth=_request_auth
1059
+ )