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,2623 @@
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.apply_coupon_request import ApplyCouponRequest
23
+ from vortex.models.create_coupon_request import CreateCouponRequest
24
+ from vortex.models.terminate_applied_coupon_request import TerminateAppliedCouponRequest
25
+ from vortex.models.terminate_coupon_request import TerminateCouponRequest
26
+
27
+ from vortex.api_client import ApiClient, RequestSerialized
28
+ from vortex.api_response import ApiResponse
29
+ from vortex.rest import RESTResponseType
30
+
31
+
32
+ class DiscountsApi:
33
+ """NOTE: This class is auto generated by OpenAPI Generator
34
+ Ref: https://openapi-generator.tech
35
+
36
+ Do not edit the class manually.
37
+ """
38
+
39
+ def __init__(self, api_client=None) -> None:
40
+ if api_client is None:
41
+ api_client = ApiClient.get_default()
42
+ self.api_client = api_client
43
+
44
+
45
+ @validate_call
46
+ def apply_coupon(
47
+ self,
48
+ coupon_id: StrictStr,
49
+ environment: StrictStr,
50
+ merchant_account_id: StrictStr,
51
+ apply_coupon_request: ApplyCouponRequest,
52
+ 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,
53
+ _request_timeout: Union[
54
+ None,
55
+ Annotated[StrictFloat, Field(gt=0)],
56
+ Tuple[
57
+ Annotated[StrictFloat, Field(gt=0)],
58
+ Annotated[StrictFloat, Field(gt=0)]
59
+ ]
60
+ ] = None,
61
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
62
+ _content_type: Optional[StrictStr] = None,
63
+ _headers: Optional[Dict[StrictStr, Any]] = None,
64
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
65
+ ) -> ApiWriteEnvelope:
66
+ """Apply a coupon to a customer, account, or subscription
67
+
68
+
69
+ :param coupon_id: (required)
70
+ :type coupon_id: str
71
+ :param environment: (required)
72
+ :type environment: str
73
+ :param merchant_account_id: (required)
74
+ :type merchant_account_id: str
75
+ :param apply_coupon_request: (required)
76
+ :type apply_coupon_request: ApplyCouponRequest
77
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
78
+ :type idempotency_key: str
79
+ :param _request_timeout: timeout setting for this request. If one
80
+ number provided, it will be total request
81
+ timeout. It can also be a pair (tuple) of
82
+ (connection, read) timeouts.
83
+ :type _request_timeout: int, tuple(int, int), optional
84
+ :param _request_auth: set to override the auth_settings for an a single
85
+ request; this effectively ignores the
86
+ authentication in the spec for a single request.
87
+ :type _request_auth: dict, optional
88
+ :param _content_type: force content-type for the request.
89
+ :type _content_type: str, Optional
90
+ :param _headers: set to override the headers for a single
91
+ request; this effectively ignores the headers
92
+ in the spec for a single request.
93
+ :type _headers: dict, optional
94
+ :param _host_index: set to override the host_index for a single
95
+ request; this effectively ignores the host_index
96
+ in the spec for a single request.
97
+ :type _host_index: int, optional
98
+ :return: Returns the result object.
99
+ """ # noqa: E501
100
+
101
+ _param = self._apply_coupon_serialize(
102
+ coupon_id=coupon_id,
103
+ environment=environment,
104
+ merchant_account_id=merchant_account_id,
105
+ apply_coupon_request=apply_coupon_request,
106
+ idempotency_key=idempotency_key,
107
+ _request_auth=_request_auth,
108
+ _content_type=_content_type,
109
+ _headers=_headers,
110
+ _host_index=_host_index
111
+ )
112
+
113
+ _response_types_map: Dict[str, Optional[str]] = {
114
+ '200': "ApiWriteEnvelope",
115
+ '400': "ApiError",
116
+ '401': "ApiError",
117
+ '409': "ApiError",
118
+ '422': "ApiError",
119
+ '429': "ApiError",
120
+ }
121
+ response_data = self.api_client.call_api(
122
+ *_param,
123
+ _request_timeout=_request_timeout
124
+ )
125
+ response_data.read()
126
+ return self.api_client.response_deserialize(
127
+ response_data=response_data,
128
+ response_types_map=_response_types_map,
129
+ ).data
130
+
131
+
132
+ @validate_call
133
+ def apply_coupon_with_http_info(
134
+ self,
135
+ coupon_id: StrictStr,
136
+ environment: StrictStr,
137
+ merchant_account_id: StrictStr,
138
+ apply_coupon_request: ApplyCouponRequest,
139
+ 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,
140
+ _request_timeout: Union[
141
+ None,
142
+ Annotated[StrictFloat, Field(gt=0)],
143
+ Tuple[
144
+ Annotated[StrictFloat, Field(gt=0)],
145
+ Annotated[StrictFloat, Field(gt=0)]
146
+ ]
147
+ ] = None,
148
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
149
+ _content_type: Optional[StrictStr] = None,
150
+ _headers: Optional[Dict[StrictStr, Any]] = None,
151
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
152
+ ) -> ApiResponse[ApiWriteEnvelope]:
153
+ """Apply a coupon to a customer, account, or subscription
154
+
155
+
156
+ :param coupon_id: (required)
157
+ :type coupon_id: str
158
+ :param environment: (required)
159
+ :type environment: str
160
+ :param merchant_account_id: (required)
161
+ :type merchant_account_id: str
162
+ :param apply_coupon_request: (required)
163
+ :type apply_coupon_request: ApplyCouponRequest
164
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
165
+ :type idempotency_key: str
166
+ :param _request_timeout: timeout setting for this request. If one
167
+ number provided, it will be total request
168
+ timeout. It can also be a pair (tuple) of
169
+ (connection, read) timeouts.
170
+ :type _request_timeout: int, tuple(int, int), optional
171
+ :param _request_auth: set to override the auth_settings for an a single
172
+ request; this effectively ignores the
173
+ authentication in the spec for a single request.
174
+ :type _request_auth: dict, optional
175
+ :param _content_type: force content-type for the request.
176
+ :type _content_type: str, Optional
177
+ :param _headers: set to override the headers for a single
178
+ request; this effectively ignores the headers
179
+ in the spec for a single request.
180
+ :type _headers: dict, optional
181
+ :param _host_index: set to override the host_index for a single
182
+ request; this effectively ignores the host_index
183
+ in the spec for a single request.
184
+ :type _host_index: int, optional
185
+ :return: Returns the result object.
186
+ """ # noqa: E501
187
+
188
+ _param = self._apply_coupon_serialize(
189
+ coupon_id=coupon_id,
190
+ environment=environment,
191
+ merchant_account_id=merchant_account_id,
192
+ apply_coupon_request=apply_coupon_request,
193
+ idempotency_key=idempotency_key,
194
+ _request_auth=_request_auth,
195
+ _content_type=_content_type,
196
+ _headers=_headers,
197
+ _host_index=_host_index
198
+ )
199
+
200
+ _response_types_map: Dict[str, Optional[str]] = {
201
+ '200': "ApiWriteEnvelope",
202
+ '400': "ApiError",
203
+ '401': "ApiError",
204
+ '409': "ApiError",
205
+ '422': "ApiError",
206
+ '429': "ApiError",
207
+ }
208
+ response_data = self.api_client.call_api(
209
+ *_param,
210
+ _request_timeout=_request_timeout
211
+ )
212
+ response_data.read()
213
+ return self.api_client.response_deserialize(
214
+ response_data=response_data,
215
+ response_types_map=_response_types_map,
216
+ )
217
+
218
+
219
+ @validate_call
220
+ def apply_coupon_without_preload_content(
221
+ self,
222
+ coupon_id: StrictStr,
223
+ environment: StrictStr,
224
+ merchant_account_id: StrictStr,
225
+ apply_coupon_request: ApplyCouponRequest,
226
+ 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,
227
+ _request_timeout: Union[
228
+ None,
229
+ Annotated[StrictFloat, Field(gt=0)],
230
+ Tuple[
231
+ Annotated[StrictFloat, Field(gt=0)],
232
+ Annotated[StrictFloat, Field(gt=0)]
233
+ ]
234
+ ] = None,
235
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
236
+ _content_type: Optional[StrictStr] = None,
237
+ _headers: Optional[Dict[StrictStr, Any]] = None,
238
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
239
+ ) -> RESTResponseType:
240
+ """Apply a coupon to a customer, account, or subscription
241
+
242
+
243
+ :param coupon_id: (required)
244
+ :type coupon_id: str
245
+ :param environment: (required)
246
+ :type environment: str
247
+ :param merchant_account_id: (required)
248
+ :type merchant_account_id: str
249
+ :param apply_coupon_request: (required)
250
+ :type apply_coupon_request: ApplyCouponRequest
251
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
252
+ :type idempotency_key: str
253
+ :param _request_timeout: timeout setting for this request. If one
254
+ number provided, it will be total request
255
+ timeout. It can also be a pair (tuple) of
256
+ (connection, read) timeouts.
257
+ :type _request_timeout: int, tuple(int, int), optional
258
+ :param _request_auth: set to override the auth_settings for an a single
259
+ request; this effectively ignores the
260
+ authentication in the spec for a single request.
261
+ :type _request_auth: dict, optional
262
+ :param _content_type: force content-type for the request.
263
+ :type _content_type: str, Optional
264
+ :param _headers: set to override the headers for a single
265
+ request; this effectively ignores the headers
266
+ in the spec for a single request.
267
+ :type _headers: dict, optional
268
+ :param _host_index: set to override the host_index for a single
269
+ request; this effectively ignores the host_index
270
+ in the spec for a single request.
271
+ :type _host_index: int, optional
272
+ :return: Returns the result object.
273
+ """ # noqa: E501
274
+
275
+ _param = self._apply_coupon_serialize(
276
+ coupon_id=coupon_id,
277
+ environment=environment,
278
+ merchant_account_id=merchant_account_id,
279
+ apply_coupon_request=apply_coupon_request,
280
+ idempotency_key=idempotency_key,
281
+ _request_auth=_request_auth,
282
+ _content_type=_content_type,
283
+ _headers=_headers,
284
+ _host_index=_host_index
285
+ )
286
+
287
+ _response_types_map: Dict[str, Optional[str]] = {
288
+ '200': "ApiWriteEnvelope",
289
+ '400': "ApiError",
290
+ '401': "ApiError",
291
+ '409': "ApiError",
292
+ '422': "ApiError",
293
+ '429': "ApiError",
294
+ }
295
+ response_data = self.api_client.call_api(
296
+ *_param,
297
+ _request_timeout=_request_timeout
298
+ )
299
+ return response_data.response
300
+
301
+
302
+ def _apply_coupon_serialize(
303
+ self,
304
+ coupon_id,
305
+ environment,
306
+ merchant_account_id,
307
+ apply_coupon_request,
308
+ idempotency_key,
309
+ _request_auth,
310
+ _content_type,
311
+ _headers,
312
+ _host_index,
313
+ ) -> RequestSerialized:
314
+
315
+ _host = None
316
+
317
+ _collection_formats: Dict[str, str] = {
318
+ }
319
+
320
+ _path_params: Dict[str, str] = {}
321
+ _query_params: List[Tuple[str, str]] = []
322
+ _header_params: Dict[str, Optional[str]] = _headers or {}
323
+ _form_params: List[Tuple[str, str]] = []
324
+ _files: Dict[
325
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
326
+ ] = {}
327
+ _body_params: Optional[bytes] = None
328
+
329
+ # process the path parameters
330
+ if coupon_id is not None:
331
+ _path_params['couponId'] = coupon_id
332
+ # process the query parameters
333
+ if environment is not None:
334
+
335
+ _query_params.append(('environment', environment))
336
+
337
+ if merchant_account_id is not None:
338
+
339
+ _query_params.append(('merchantAccountId', merchant_account_id))
340
+
341
+ # process the header parameters
342
+ if idempotency_key is not None:
343
+ _header_params['Idempotency-Key'] = idempotency_key
344
+ # process the form parameters
345
+ # process the body parameter
346
+ if apply_coupon_request is not None:
347
+ _body_params = apply_coupon_request
348
+
349
+
350
+ # set the HTTP header `Accept`
351
+ if 'Accept' not in _header_params:
352
+ _header_params['Accept'] = self.api_client.select_header_accept(
353
+ [
354
+ 'application/json'
355
+ ]
356
+ )
357
+
358
+ # set the HTTP header `Content-Type`
359
+ if _content_type:
360
+ _header_params['Content-Type'] = _content_type
361
+ else:
362
+ _default_content_type = (
363
+ self.api_client.select_header_content_type(
364
+ [
365
+ 'application/json'
366
+ ]
367
+ )
368
+ )
369
+ if _default_content_type is not None:
370
+ _header_params['Content-Type'] = _default_content_type
371
+
372
+ # authentication setting
373
+ _auth_settings: List[str] = [
374
+ 'api-key'
375
+ ]
376
+
377
+ return self.api_client.param_serialize(
378
+ method='POST',
379
+ resource_path='/v1/coupons/{couponId}/apply',
380
+ path_params=_path_params,
381
+ query_params=_query_params,
382
+ header_params=_header_params,
383
+ body=_body_params,
384
+ post_params=_form_params,
385
+ files=_files,
386
+ auth_settings=_auth_settings,
387
+ collection_formats=_collection_formats,
388
+ _host=_host,
389
+ _request_auth=_request_auth
390
+ )
391
+
392
+
393
+
394
+
395
+ @validate_call
396
+ def create_coupon(
397
+ self,
398
+ environment: StrictStr,
399
+ merchant_account_id: StrictStr,
400
+ create_coupon_request: CreateCouponRequest,
401
+ 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,
402
+ _request_timeout: Union[
403
+ None,
404
+ Annotated[StrictFloat, Field(gt=0)],
405
+ Tuple[
406
+ Annotated[StrictFloat, Field(gt=0)],
407
+ Annotated[StrictFloat, Field(gt=0)]
408
+ ]
409
+ ] = None,
410
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
411
+ _content_type: Optional[StrictStr] = None,
412
+ _headers: Optional[Dict[StrictStr, Any]] = None,
413
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
414
+ ) -> ApiWriteEnvelope:
415
+ """Create a billing coupon
416
+
417
+
418
+ :param environment: (required)
419
+ :type environment: str
420
+ :param merchant_account_id: (required)
421
+ :type merchant_account_id: str
422
+ :param create_coupon_request: (required)
423
+ :type create_coupon_request: CreateCouponRequest
424
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
425
+ :type idempotency_key: str
426
+ :param _request_timeout: timeout setting for this request. If one
427
+ number provided, it will be total request
428
+ timeout. It can also be a pair (tuple) of
429
+ (connection, read) timeouts.
430
+ :type _request_timeout: int, tuple(int, int), optional
431
+ :param _request_auth: set to override the auth_settings for an a single
432
+ request; this effectively ignores the
433
+ authentication in the spec for a single request.
434
+ :type _request_auth: dict, optional
435
+ :param _content_type: force content-type for the request.
436
+ :type _content_type: str, Optional
437
+ :param _headers: set to override the headers for a single
438
+ request; this effectively ignores the headers
439
+ in the spec for a single request.
440
+ :type _headers: dict, optional
441
+ :param _host_index: set to override the host_index for a single
442
+ request; this effectively ignores the host_index
443
+ in the spec for a single request.
444
+ :type _host_index: int, optional
445
+ :return: Returns the result object.
446
+ """ # noqa: E501
447
+
448
+ _param = self._create_coupon_serialize(
449
+ environment=environment,
450
+ merchant_account_id=merchant_account_id,
451
+ create_coupon_request=create_coupon_request,
452
+ idempotency_key=idempotency_key,
453
+ _request_auth=_request_auth,
454
+ _content_type=_content_type,
455
+ _headers=_headers,
456
+ _host_index=_host_index
457
+ )
458
+
459
+ _response_types_map: Dict[str, Optional[str]] = {
460
+ '201': "ApiWriteEnvelope",
461
+ '400': "ApiError",
462
+ '401': "ApiError",
463
+ '409': "ApiError",
464
+ '422': "ApiError",
465
+ '429': "ApiError",
466
+ }
467
+ response_data = self.api_client.call_api(
468
+ *_param,
469
+ _request_timeout=_request_timeout
470
+ )
471
+ response_data.read()
472
+ return self.api_client.response_deserialize(
473
+ response_data=response_data,
474
+ response_types_map=_response_types_map,
475
+ ).data
476
+
477
+
478
+ @validate_call
479
+ def create_coupon_with_http_info(
480
+ self,
481
+ environment: StrictStr,
482
+ merchant_account_id: StrictStr,
483
+ create_coupon_request: CreateCouponRequest,
484
+ 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,
485
+ _request_timeout: Union[
486
+ None,
487
+ Annotated[StrictFloat, Field(gt=0)],
488
+ Tuple[
489
+ Annotated[StrictFloat, Field(gt=0)],
490
+ Annotated[StrictFloat, Field(gt=0)]
491
+ ]
492
+ ] = None,
493
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
494
+ _content_type: Optional[StrictStr] = None,
495
+ _headers: Optional[Dict[StrictStr, Any]] = None,
496
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
497
+ ) -> ApiResponse[ApiWriteEnvelope]:
498
+ """Create a billing coupon
499
+
500
+
501
+ :param environment: (required)
502
+ :type environment: str
503
+ :param merchant_account_id: (required)
504
+ :type merchant_account_id: str
505
+ :param create_coupon_request: (required)
506
+ :type create_coupon_request: CreateCouponRequest
507
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
508
+ :type idempotency_key: str
509
+ :param _request_timeout: timeout setting for this request. If one
510
+ number provided, it will be total request
511
+ timeout. It can also be a pair (tuple) of
512
+ (connection, read) timeouts.
513
+ :type _request_timeout: int, tuple(int, int), optional
514
+ :param _request_auth: set to override the auth_settings for an a single
515
+ request; this effectively ignores the
516
+ authentication in the spec for a single request.
517
+ :type _request_auth: dict, optional
518
+ :param _content_type: force content-type for the request.
519
+ :type _content_type: str, Optional
520
+ :param _headers: set to override the headers for a single
521
+ request; this effectively ignores the headers
522
+ in the spec for a single request.
523
+ :type _headers: dict, optional
524
+ :param _host_index: set to override the host_index for a single
525
+ request; this effectively ignores the host_index
526
+ in the spec for a single request.
527
+ :type _host_index: int, optional
528
+ :return: Returns the result object.
529
+ """ # noqa: E501
530
+
531
+ _param = self._create_coupon_serialize(
532
+ environment=environment,
533
+ merchant_account_id=merchant_account_id,
534
+ create_coupon_request=create_coupon_request,
535
+ idempotency_key=idempotency_key,
536
+ _request_auth=_request_auth,
537
+ _content_type=_content_type,
538
+ _headers=_headers,
539
+ _host_index=_host_index
540
+ )
541
+
542
+ _response_types_map: Dict[str, Optional[str]] = {
543
+ '201': "ApiWriteEnvelope",
544
+ '400': "ApiError",
545
+ '401': "ApiError",
546
+ '409': "ApiError",
547
+ '422': "ApiError",
548
+ '429': "ApiError",
549
+ }
550
+ response_data = self.api_client.call_api(
551
+ *_param,
552
+ _request_timeout=_request_timeout
553
+ )
554
+ response_data.read()
555
+ return self.api_client.response_deserialize(
556
+ response_data=response_data,
557
+ response_types_map=_response_types_map,
558
+ )
559
+
560
+
561
+ @validate_call
562
+ def create_coupon_without_preload_content(
563
+ self,
564
+ environment: StrictStr,
565
+ merchant_account_id: StrictStr,
566
+ create_coupon_request: CreateCouponRequest,
567
+ 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,
568
+ _request_timeout: Union[
569
+ None,
570
+ Annotated[StrictFloat, Field(gt=0)],
571
+ Tuple[
572
+ Annotated[StrictFloat, Field(gt=0)],
573
+ Annotated[StrictFloat, Field(gt=0)]
574
+ ]
575
+ ] = None,
576
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
577
+ _content_type: Optional[StrictStr] = None,
578
+ _headers: Optional[Dict[StrictStr, Any]] = None,
579
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
580
+ ) -> RESTResponseType:
581
+ """Create a billing coupon
582
+
583
+
584
+ :param environment: (required)
585
+ :type environment: str
586
+ :param merchant_account_id: (required)
587
+ :type merchant_account_id: str
588
+ :param create_coupon_request: (required)
589
+ :type create_coupon_request: CreateCouponRequest
590
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
591
+ :type idempotency_key: str
592
+ :param _request_timeout: timeout setting for this request. If one
593
+ number provided, it will be total request
594
+ timeout. It can also be a pair (tuple) of
595
+ (connection, read) timeouts.
596
+ :type _request_timeout: int, tuple(int, int), optional
597
+ :param _request_auth: set to override the auth_settings for an a single
598
+ request; this effectively ignores the
599
+ authentication in the spec for a single request.
600
+ :type _request_auth: dict, optional
601
+ :param _content_type: force content-type for the request.
602
+ :type _content_type: str, Optional
603
+ :param _headers: set to override the headers for a single
604
+ request; this effectively ignores the headers
605
+ in the spec for a single request.
606
+ :type _headers: dict, optional
607
+ :param _host_index: set to override the host_index for a single
608
+ request; this effectively ignores the host_index
609
+ in the spec for a single request.
610
+ :type _host_index: int, optional
611
+ :return: Returns the result object.
612
+ """ # noqa: E501
613
+
614
+ _param = self._create_coupon_serialize(
615
+ environment=environment,
616
+ merchant_account_id=merchant_account_id,
617
+ create_coupon_request=create_coupon_request,
618
+ idempotency_key=idempotency_key,
619
+ _request_auth=_request_auth,
620
+ _content_type=_content_type,
621
+ _headers=_headers,
622
+ _host_index=_host_index
623
+ )
624
+
625
+ _response_types_map: Dict[str, Optional[str]] = {
626
+ '201': "ApiWriteEnvelope",
627
+ '400': "ApiError",
628
+ '401': "ApiError",
629
+ '409': "ApiError",
630
+ '422': "ApiError",
631
+ '429': "ApiError",
632
+ }
633
+ response_data = self.api_client.call_api(
634
+ *_param,
635
+ _request_timeout=_request_timeout
636
+ )
637
+ return response_data.response
638
+
639
+
640
+ def _create_coupon_serialize(
641
+ self,
642
+ environment,
643
+ merchant_account_id,
644
+ create_coupon_request,
645
+ idempotency_key,
646
+ _request_auth,
647
+ _content_type,
648
+ _headers,
649
+ _host_index,
650
+ ) -> RequestSerialized:
651
+
652
+ _host = None
653
+
654
+ _collection_formats: Dict[str, str] = {
655
+ }
656
+
657
+ _path_params: Dict[str, str] = {}
658
+ _query_params: List[Tuple[str, str]] = []
659
+ _header_params: Dict[str, Optional[str]] = _headers or {}
660
+ _form_params: List[Tuple[str, str]] = []
661
+ _files: Dict[
662
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
663
+ ] = {}
664
+ _body_params: Optional[bytes] = None
665
+
666
+ # process the path parameters
667
+ # process the query parameters
668
+ if environment is not None:
669
+
670
+ _query_params.append(('environment', environment))
671
+
672
+ if merchant_account_id is not None:
673
+
674
+ _query_params.append(('merchantAccountId', merchant_account_id))
675
+
676
+ # process the header parameters
677
+ if idempotency_key is not None:
678
+ _header_params['Idempotency-Key'] = idempotency_key
679
+ # process the form parameters
680
+ # process the body parameter
681
+ if create_coupon_request is not None:
682
+ _body_params = create_coupon_request
683
+
684
+
685
+ # set the HTTP header `Accept`
686
+ if 'Accept' not in _header_params:
687
+ _header_params['Accept'] = self.api_client.select_header_accept(
688
+ [
689
+ 'application/json'
690
+ ]
691
+ )
692
+
693
+ # set the HTTP header `Content-Type`
694
+ if _content_type:
695
+ _header_params['Content-Type'] = _content_type
696
+ else:
697
+ _default_content_type = (
698
+ self.api_client.select_header_content_type(
699
+ [
700
+ 'application/json'
701
+ ]
702
+ )
703
+ )
704
+ if _default_content_type is not None:
705
+ _header_params['Content-Type'] = _default_content_type
706
+
707
+ # authentication setting
708
+ _auth_settings: List[str] = [
709
+ 'api-key'
710
+ ]
711
+
712
+ return self.api_client.param_serialize(
713
+ method='POST',
714
+ resource_path='/v1/coupons',
715
+ path_params=_path_params,
716
+ query_params=_query_params,
717
+ header_params=_header_params,
718
+ body=_body_params,
719
+ post_params=_form_params,
720
+ files=_files,
721
+ auth_settings=_auth_settings,
722
+ collection_formats=_collection_formats,
723
+ _host=_host,
724
+ _request_auth=_request_auth
725
+ )
726
+
727
+
728
+
729
+
730
+ @validate_call
731
+ def get_applied_coupon(
732
+ self,
733
+ applied_coupon_id: StrictStr,
734
+ environment: StrictStr,
735
+ merchant_account_id: StrictStr,
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
+ """Get one applied billing coupon
750
+
751
+
752
+ :param applied_coupon_id: (required)
753
+ :type applied_coupon_id: str
754
+ :param environment: (required)
755
+ :type environment: str
756
+ :param merchant_account_id: (required)
757
+ :type merchant_account_id: str
758
+ :param _request_timeout: timeout setting for this request. If one
759
+ number provided, it will be total request
760
+ timeout. It can also be a pair (tuple) of
761
+ (connection, read) timeouts.
762
+ :type _request_timeout: int, tuple(int, int), optional
763
+ :param _request_auth: set to override the auth_settings for an a single
764
+ request; this effectively ignores the
765
+ authentication in the spec for a single request.
766
+ :type _request_auth: dict, optional
767
+ :param _content_type: force content-type for the request.
768
+ :type _content_type: str, Optional
769
+ :param _headers: set to override the headers for a single
770
+ request; this effectively ignores the headers
771
+ in the spec for a single request.
772
+ :type _headers: dict, optional
773
+ :param _host_index: set to override the host_index for a single
774
+ request; this effectively ignores the host_index
775
+ in the spec for a single request.
776
+ :type _host_index: int, optional
777
+ :return: Returns the result object.
778
+ """ # noqa: E501
779
+
780
+ _param = self._get_applied_coupon_serialize(
781
+ applied_coupon_id=applied_coupon_id,
782
+ environment=environment,
783
+ merchant_account_id=merchant_account_id,
784
+ _request_auth=_request_auth,
785
+ _content_type=_content_type,
786
+ _headers=_headers,
787
+ _host_index=_host_index
788
+ )
789
+
790
+ _response_types_map: Dict[str, Optional[str]] = {
791
+ '200': "ApiWriteEnvelope",
792
+ '400': "ApiError",
793
+ '401': "ApiError",
794
+ '409': "ApiError",
795
+ '422': "ApiError",
796
+ '429': "ApiError",
797
+ }
798
+ response_data = self.api_client.call_api(
799
+ *_param,
800
+ _request_timeout=_request_timeout
801
+ )
802
+ response_data.read()
803
+ return self.api_client.response_deserialize(
804
+ response_data=response_data,
805
+ response_types_map=_response_types_map,
806
+ ).data
807
+
808
+
809
+ @validate_call
810
+ def get_applied_coupon_with_http_info(
811
+ self,
812
+ applied_coupon_id: StrictStr,
813
+ environment: StrictStr,
814
+ merchant_account_id: StrictStr,
815
+ _request_timeout: Union[
816
+ None,
817
+ Annotated[StrictFloat, Field(gt=0)],
818
+ Tuple[
819
+ Annotated[StrictFloat, Field(gt=0)],
820
+ Annotated[StrictFloat, Field(gt=0)]
821
+ ]
822
+ ] = None,
823
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
824
+ _content_type: Optional[StrictStr] = None,
825
+ _headers: Optional[Dict[StrictStr, Any]] = None,
826
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
827
+ ) -> ApiResponse[ApiWriteEnvelope]:
828
+ """Get one applied billing coupon
829
+
830
+
831
+ :param applied_coupon_id: (required)
832
+ :type applied_coupon_id: str
833
+ :param environment: (required)
834
+ :type environment: str
835
+ :param merchant_account_id: (required)
836
+ :type merchant_account_id: str
837
+ :param _request_timeout: timeout setting for this request. If one
838
+ number provided, it will be total request
839
+ timeout. It can also be a pair (tuple) of
840
+ (connection, read) timeouts.
841
+ :type _request_timeout: int, tuple(int, int), optional
842
+ :param _request_auth: set to override the auth_settings for an a single
843
+ request; this effectively ignores the
844
+ authentication in the spec for a single request.
845
+ :type _request_auth: dict, optional
846
+ :param _content_type: force content-type for the request.
847
+ :type _content_type: str, Optional
848
+ :param _headers: set to override the headers for a single
849
+ request; this effectively ignores the headers
850
+ in the spec for a single request.
851
+ :type _headers: dict, optional
852
+ :param _host_index: set to override the host_index for a single
853
+ request; this effectively ignores the host_index
854
+ in the spec for a single request.
855
+ :type _host_index: int, optional
856
+ :return: Returns the result object.
857
+ """ # noqa: E501
858
+
859
+ _param = self._get_applied_coupon_serialize(
860
+ applied_coupon_id=applied_coupon_id,
861
+ environment=environment,
862
+ merchant_account_id=merchant_account_id,
863
+ _request_auth=_request_auth,
864
+ _content_type=_content_type,
865
+ _headers=_headers,
866
+ _host_index=_host_index
867
+ )
868
+
869
+ _response_types_map: Dict[str, Optional[str]] = {
870
+ '200': "ApiWriteEnvelope",
871
+ '400': "ApiError",
872
+ '401': "ApiError",
873
+ '409': "ApiError",
874
+ '422': "ApiError",
875
+ '429': "ApiError",
876
+ }
877
+ response_data = self.api_client.call_api(
878
+ *_param,
879
+ _request_timeout=_request_timeout
880
+ )
881
+ response_data.read()
882
+ return self.api_client.response_deserialize(
883
+ response_data=response_data,
884
+ response_types_map=_response_types_map,
885
+ )
886
+
887
+
888
+ @validate_call
889
+ def get_applied_coupon_without_preload_content(
890
+ self,
891
+ applied_coupon_id: StrictStr,
892
+ environment: StrictStr,
893
+ merchant_account_id: StrictStr,
894
+ _request_timeout: Union[
895
+ None,
896
+ Annotated[StrictFloat, Field(gt=0)],
897
+ Tuple[
898
+ Annotated[StrictFloat, Field(gt=0)],
899
+ Annotated[StrictFloat, Field(gt=0)]
900
+ ]
901
+ ] = None,
902
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
903
+ _content_type: Optional[StrictStr] = None,
904
+ _headers: Optional[Dict[StrictStr, Any]] = None,
905
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
906
+ ) -> RESTResponseType:
907
+ """Get one applied billing coupon
908
+
909
+
910
+ :param applied_coupon_id: (required)
911
+ :type applied_coupon_id: str
912
+ :param environment: (required)
913
+ :type environment: str
914
+ :param merchant_account_id: (required)
915
+ :type merchant_account_id: str
916
+ :param _request_timeout: timeout setting for this request. If one
917
+ number provided, it will be total request
918
+ timeout. It can also be a pair (tuple) of
919
+ (connection, read) timeouts.
920
+ :type _request_timeout: int, tuple(int, int), optional
921
+ :param _request_auth: set to override the auth_settings for an a single
922
+ request; this effectively ignores the
923
+ authentication in the spec for a single request.
924
+ :type _request_auth: dict, optional
925
+ :param _content_type: force content-type for the request.
926
+ :type _content_type: str, Optional
927
+ :param _headers: set to override the headers for a single
928
+ request; this effectively ignores the headers
929
+ in the spec for a single request.
930
+ :type _headers: dict, optional
931
+ :param _host_index: set to override the host_index for a single
932
+ request; this effectively ignores the host_index
933
+ in the spec for a single request.
934
+ :type _host_index: int, optional
935
+ :return: Returns the result object.
936
+ """ # noqa: E501
937
+
938
+ _param = self._get_applied_coupon_serialize(
939
+ applied_coupon_id=applied_coupon_id,
940
+ environment=environment,
941
+ merchant_account_id=merchant_account_id,
942
+ _request_auth=_request_auth,
943
+ _content_type=_content_type,
944
+ _headers=_headers,
945
+ _host_index=_host_index
946
+ )
947
+
948
+ _response_types_map: Dict[str, Optional[str]] = {
949
+ '200': "ApiWriteEnvelope",
950
+ '400': "ApiError",
951
+ '401': "ApiError",
952
+ '409': "ApiError",
953
+ '422': "ApiError",
954
+ '429': "ApiError",
955
+ }
956
+ response_data = self.api_client.call_api(
957
+ *_param,
958
+ _request_timeout=_request_timeout
959
+ )
960
+ return response_data.response
961
+
962
+
963
+ def _get_applied_coupon_serialize(
964
+ self,
965
+ applied_coupon_id,
966
+ environment,
967
+ merchant_account_id,
968
+ _request_auth,
969
+ _content_type,
970
+ _headers,
971
+ _host_index,
972
+ ) -> RequestSerialized:
973
+
974
+ _host = None
975
+
976
+ _collection_formats: Dict[str, str] = {
977
+ }
978
+
979
+ _path_params: Dict[str, str] = {}
980
+ _query_params: List[Tuple[str, str]] = []
981
+ _header_params: Dict[str, Optional[str]] = _headers or {}
982
+ _form_params: List[Tuple[str, str]] = []
983
+ _files: Dict[
984
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
985
+ ] = {}
986
+ _body_params: Optional[bytes] = None
987
+
988
+ # process the path parameters
989
+ if applied_coupon_id is not None:
990
+ _path_params['appliedCouponId'] = applied_coupon_id
991
+ # process the query parameters
992
+ if environment is not None:
993
+
994
+ _query_params.append(('environment', environment))
995
+
996
+ if merchant_account_id is not None:
997
+
998
+ _query_params.append(('merchantAccountId', merchant_account_id))
999
+
1000
+ # process the header parameters
1001
+ # process the form parameters
1002
+ # process the body parameter
1003
+
1004
+
1005
+ # set the HTTP header `Accept`
1006
+ if 'Accept' not in _header_params:
1007
+ _header_params['Accept'] = self.api_client.select_header_accept(
1008
+ [
1009
+ 'application/json'
1010
+ ]
1011
+ )
1012
+
1013
+
1014
+ # authentication setting
1015
+ _auth_settings: List[str] = [
1016
+ 'api-key'
1017
+ ]
1018
+
1019
+ return self.api_client.param_serialize(
1020
+ method='GET',
1021
+ resource_path='/v1/applied-coupons/{appliedCouponId}',
1022
+ path_params=_path_params,
1023
+ query_params=_query_params,
1024
+ header_params=_header_params,
1025
+ body=_body_params,
1026
+ post_params=_form_params,
1027
+ files=_files,
1028
+ auth_settings=_auth_settings,
1029
+ collection_formats=_collection_formats,
1030
+ _host=_host,
1031
+ _request_auth=_request_auth
1032
+ )
1033
+
1034
+
1035
+
1036
+
1037
+ @validate_call
1038
+ def get_coupon(
1039
+ self,
1040
+ coupon_id: StrictStr,
1041
+ environment: StrictStr,
1042
+ merchant_account_id: StrictStr,
1043
+ _request_timeout: Union[
1044
+ None,
1045
+ Annotated[StrictFloat, Field(gt=0)],
1046
+ Tuple[
1047
+ Annotated[StrictFloat, Field(gt=0)],
1048
+ Annotated[StrictFloat, Field(gt=0)]
1049
+ ]
1050
+ ] = None,
1051
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1052
+ _content_type: Optional[StrictStr] = None,
1053
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1054
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1055
+ ) -> ApiWriteEnvelope:
1056
+ """Get one billing coupon
1057
+
1058
+
1059
+ :param coupon_id: (required)
1060
+ :type coupon_id: str
1061
+ :param environment: (required)
1062
+ :type environment: str
1063
+ :param merchant_account_id: (required)
1064
+ :type merchant_account_id: str
1065
+ :param _request_timeout: timeout setting for this request. If one
1066
+ number provided, it will be total request
1067
+ timeout. It can also be a pair (tuple) of
1068
+ (connection, read) timeouts.
1069
+ :type _request_timeout: int, tuple(int, int), optional
1070
+ :param _request_auth: set to override the auth_settings for an a single
1071
+ request; this effectively ignores the
1072
+ authentication in the spec for a single request.
1073
+ :type _request_auth: dict, optional
1074
+ :param _content_type: force content-type for the request.
1075
+ :type _content_type: str, Optional
1076
+ :param _headers: set to override the headers for a single
1077
+ request; this effectively ignores the headers
1078
+ in the spec for a single request.
1079
+ :type _headers: dict, optional
1080
+ :param _host_index: set to override the host_index for a single
1081
+ request; this effectively ignores the host_index
1082
+ in the spec for a single request.
1083
+ :type _host_index: int, optional
1084
+ :return: Returns the result object.
1085
+ """ # noqa: E501
1086
+
1087
+ _param = self._get_coupon_serialize(
1088
+ coupon_id=coupon_id,
1089
+ environment=environment,
1090
+ merchant_account_id=merchant_account_id,
1091
+ _request_auth=_request_auth,
1092
+ _content_type=_content_type,
1093
+ _headers=_headers,
1094
+ _host_index=_host_index
1095
+ )
1096
+
1097
+ _response_types_map: Dict[str, Optional[str]] = {
1098
+ '200': "ApiWriteEnvelope",
1099
+ '400': "ApiError",
1100
+ '401': "ApiError",
1101
+ '409': "ApiError",
1102
+ '422': "ApiError",
1103
+ '429': "ApiError",
1104
+ }
1105
+ response_data = self.api_client.call_api(
1106
+ *_param,
1107
+ _request_timeout=_request_timeout
1108
+ )
1109
+ response_data.read()
1110
+ return self.api_client.response_deserialize(
1111
+ response_data=response_data,
1112
+ response_types_map=_response_types_map,
1113
+ ).data
1114
+
1115
+
1116
+ @validate_call
1117
+ def get_coupon_with_http_info(
1118
+ self,
1119
+ coupon_id: StrictStr,
1120
+ environment: StrictStr,
1121
+ merchant_account_id: StrictStr,
1122
+ _request_timeout: Union[
1123
+ None,
1124
+ Annotated[StrictFloat, Field(gt=0)],
1125
+ Tuple[
1126
+ Annotated[StrictFloat, Field(gt=0)],
1127
+ Annotated[StrictFloat, Field(gt=0)]
1128
+ ]
1129
+ ] = None,
1130
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1131
+ _content_type: Optional[StrictStr] = None,
1132
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1133
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1134
+ ) -> ApiResponse[ApiWriteEnvelope]:
1135
+ """Get one billing coupon
1136
+
1137
+
1138
+ :param coupon_id: (required)
1139
+ :type coupon_id: str
1140
+ :param environment: (required)
1141
+ :type environment: str
1142
+ :param merchant_account_id: (required)
1143
+ :type merchant_account_id: str
1144
+ :param _request_timeout: timeout setting for this request. If one
1145
+ number provided, it will be total request
1146
+ timeout. It can also be a pair (tuple) of
1147
+ (connection, read) timeouts.
1148
+ :type _request_timeout: int, tuple(int, int), optional
1149
+ :param _request_auth: set to override the auth_settings for an a single
1150
+ request; this effectively ignores the
1151
+ authentication in the spec for a single request.
1152
+ :type _request_auth: dict, optional
1153
+ :param _content_type: force content-type for the request.
1154
+ :type _content_type: str, Optional
1155
+ :param _headers: set to override the headers for a single
1156
+ request; this effectively ignores the headers
1157
+ in the spec for a single request.
1158
+ :type _headers: dict, optional
1159
+ :param _host_index: set to override the host_index for a single
1160
+ request; this effectively ignores the host_index
1161
+ in the spec for a single request.
1162
+ :type _host_index: int, optional
1163
+ :return: Returns the result object.
1164
+ """ # noqa: E501
1165
+
1166
+ _param = self._get_coupon_serialize(
1167
+ coupon_id=coupon_id,
1168
+ environment=environment,
1169
+ merchant_account_id=merchant_account_id,
1170
+ _request_auth=_request_auth,
1171
+ _content_type=_content_type,
1172
+ _headers=_headers,
1173
+ _host_index=_host_index
1174
+ )
1175
+
1176
+ _response_types_map: Dict[str, Optional[str]] = {
1177
+ '200': "ApiWriteEnvelope",
1178
+ '400': "ApiError",
1179
+ '401': "ApiError",
1180
+ '409': "ApiError",
1181
+ '422': "ApiError",
1182
+ '429': "ApiError",
1183
+ }
1184
+ response_data = self.api_client.call_api(
1185
+ *_param,
1186
+ _request_timeout=_request_timeout
1187
+ )
1188
+ response_data.read()
1189
+ return self.api_client.response_deserialize(
1190
+ response_data=response_data,
1191
+ response_types_map=_response_types_map,
1192
+ )
1193
+
1194
+
1195
+ @validate_call
1196
+ def get_coupon_without_preload_content(
1197
+ self,
1198
+ coupon_id: StrictStr,
1199
+ environment: StrictStr,
1200
+ merchant_account_id: StrictStr,
1201
+ _request_timeout: Union[
1202
+ None,
1203
+ Annotated[StrictFloat, Field(gt=0)],
1204
+ Tuple[
1205
+ Annotated[StrictFloat, Field(gt=0)],
1206
+ Annotated[StrictFloat, Field(gt=0)]
1207
+ ]
1208
+ ] = None,
1209
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1210
+ _content_type: Optional[StrictStr] = None,
1211
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1212
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1213
+ ) -> RESTResponseType:
1214
+ """Get one billing coupon
1215
+
1216
+
1217
+ :param coupon_id: (required)
1218
+ :type coupon_id: str
1219
+ :param environment: (required)
1220
+ :type environment: str
1221
+ :param merchant_account_id: (required)
1222
+ :type merchant_account_id: str
1223
+ :param _request_timeout: timeout setting for this request. If one
1224
+ number provided, it will be total request
1225
+ timeout. It can also be a pair (tuple) of
1226
+ (connection, read) timeouts.
1227
+ :type _request_timeout: int, tuple(int, int), optional
1228
+ :param _request_auth: set to override the auth_settings for an a single
1229
+ request; this effectively ignores the
1230
+ authentication in the spec for a single request.
1231
+ :type _request_auth: dict, optional
1232
+ :param _content_type: force content-type for the request.
1233
+ :type _content_type: str, Optional
1234
+ :param _headers: set to override the headers for a single
1235
+ request; this effectively ignores the headers
1236
+ in the spec for a single request.
1237
+ :type _headers: dict, optional
1238
+ :param _host_index: set to override the host_index for a single
1239
+ request; this effectively ignores the host_index
1240
+ in the spec for a single request.
1241
+ :type _host_index: int, optional
1242
+ :return: Returns the result object.
1243
+ """ # noqa: E501
1244
+
1245
+ _param = self._get_coupon_serialize(
1246
+ coupon_id=coupon_id,
1247
+ environment=environment,
1248
+ merchant_account_id=merchant_account_id,
1249
+ _request_auth=_request_auth,
1250
+ _content_type=_content_type,
1251
+ _headers=_headers,
1252
+ _host_index=_host_index
1253
+ )
1254
+
1255
+ _response_types_map: Dict[str, Optional[str]] = {
1256
+ '200': "ApiWriteEnvelope",
1257
+ '400': "ApiError",
1258
+ '401': "ApiError",
1259
+ '409': "ApiError",
1260
+ '422': "ApiError",
1261
+ '429': "ApiError",
1262
+ }
1263
+ response_data = self.api_client.call_api(
1264
+ *_param,
1265
+ _request_timeout=_request_timeout
1266
+ )
1267
+ return response_data.response
1268
+
1269
+
1270
+ def _get_coupon_serialize(
1271
+ self,
1272
+ coupon_id,
1273
+ environment,
1274
+ merchant_account_id,
1275
+ _request_auth,
1276
+ _content_type,
1277
+ _headers,
1278
+ _host_index,
1279
+ ) -> RequestSerialized:
1280
+
1281
+ _host = None
1282
+
1283
+ _collection_formats: Dict[str, str] = {
1284
+ }
1285
+
1286
+ _path_params: Dict[str, str] = {}
1287
+ _query_params: List[Tuple[str, str]] = []
1288
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1289
+ _form_params: List[Tuple[str, str]] = []
1290
+ _files: Dict[
1291
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1292
+ ] = {}
1293
+ _body_params: Optional[bytes] = None
1294
+
1295
+ # process the path parameters
1296
+ if coupon_id is not None:
1297
+ _path_params['couponId'] = coupon_id
1298
+ # process the query parameters
1299
+ if environment is not None:
1300
+
1301
+ _query_params.append(('environment', environment))
1302
+
1303
+ if merchant_account_id is not None:
1304
+
1305
+ _query_params.append(('merchantAccountId', merchant_account_id))
1306
+
1307
+ # process the header parameters
1308
+ # process the form parameters
1309
+ # process the body parameter
1310
+
1311
+
1312
+ # set the HTTP header `Accept`
1313
+ if 'Accept' not in _header_params:
1314
+ _header_params['Accept'] = self.api_client.select_header_accept(
1315
+ [
1316
+ 'application/json'
1317
+ ]
1318
+ )
1319
+
1320
+
1321
+ # authentication setting
1322
+ _auth_settings: List[str] = [
1323
+ 'api-key'
1324
+ ]
1325
+
1326
+ return self.api_client.param_serialize(
1327
+ method='GET',
1328
+ resource_path='/v1/coupons/{couponId}',
1329
+ path_params=_path_params,
1330
+ query_params=_query_params,
1331
+ header_params=_header_params,
1332
+ body=_body_params,
1333
+ post_params=_form_params,
1334
+ files=_files,
1335
+ auth_settings=_auth_settings,
1336
+ collection_formats=_collection_formats,
1337
+ _host=_host,
1338
+ _request_auth=_request_auth
1339
+ )
1340
+
1341
+
1342
+
1343
+
1344
+ @validate_call
1345
+ def list_applied_coupons(
1346
+ self,
1347
+ environment: StrictStr,
1348
+ merchant_account_id: StrictStr,
1349
+ _request_timeout: Union[
1350
+ None,
1351
+ Annotated[StrictFloat, Field(gt=0)],
1352
+ Tuple[
1353
+ Annotated[StrictFloat, Field(gt=0)],
1354
+ Annotated[StrictFloat, Field(gt=0)]
1355
+ ]
1356
+ ] = None,
1357
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1358
+ _content_type: Optional[StrictStr] = None,
1359
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1360
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1361
+ ) -> ApiWriteEnvelope:
1362
+ """List applied billing coupons
1363
+
1364
+
1365
+ :param environment: (required)
1366
+ :type environment: str
1367
+ :param merchant_account_id: (required)
1368
+ :type merchant_account_id: str
1369
+ :param _request_timeout: timeout setting for this request. If one
1370
+ number provided, it will be total request
1371
+ timeout. It can also be a pair (tuple) of
1372
+ (connection, read) timeouts.
1373
+ :type _request_timeout: int, tuple(int, int), optional
1374
+ :param _request_auth: set to override the auth_settings for an a single
1375
+ request; this effectively ignores the
1376
+ authentication in the spec for a single request.
1377
+ :type _request_auth: dict, optional
1378
+ :param _content_type: force content-type for the request.
1379
+ :type _content_type: str, Optional
1380
+ :param _headers: set to override the headers for a single
1381
+ request; this effectively ignores the headers
1382
+ in the spec for a single request.
1383
+ :type _headers: dict, optional
1384
+ :param _host_index: set to override the host_index for a single
1385
+ request; this effectively ignores the host_index
1386
+ in the spec for a single request.
1387
+ :type _host_index: int, optional
1388
+ :return: Returns the result object.
1389
+ """ # noqa: E501
1390
+
1391
+ _param = self._list_applied_coupons_serialize(
1392
+ environment=environment,
1393
+ merchant_account_id=merchant_account_id,
1394
+ _request_auth=_request_auth,
1395
+ _content_type=_content_type,
1396
+ _headers=_headers,
1397
+ _host_index=_host_index
1398
+ )
1399
+
1400
+ _response_types_map: Dict[str, Optional[str]] = {
1401
+ '200': "ApiWriteEnvelope",
1402
+ '400': "ApiError",
1403
+ '401': "ApiError",
1404
+ '409': "ApiError",
1405
+ '422': "ApiError",
1406
+ '429': "ApiError",
1407
+ }
1408
+ response_data = self.api_client.call_api(
1409
+ *_param,
1410
+ _request_timeout=_request_timeout
1411
+ )
1412
+ response_data.read()
1413
+ return self.api_client.response_deserialize(
1414
+ response_data=response_data,
1415
+ response_types_map=_response_types_map,
1416
+ ).data
1417
+
1418
+
1419
+ @validate_call
1420
+ def list_applied_coupons_with_http_info(
1421
+ self,
1422
+ environment: StrictStr,
1423
+ merchant_account_id: StrictStr,
1424
+ _request_timeout: Union[
1425
+ None,
1426
+ Annotated[StrictFloat, Field(gt=0)],
1427
+ Tuple[
1428
+ Annotated[StrictFloat, Field(gt=0)],
1429
+ Annotated[StrictFloat, Field(gt=0)]
1430
+ ]
1431
+ ] = None,
1432
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1433
+ _content_type: Optional[StrictStr] = None,
1434
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1435
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1436
+ ) -> ApiResponse[ApiWriteEnvelope]:
1437
+ """List applied billing coupons
1438
+
1439
+
1440
+ :param environment: (required)
1441
+ :type environment: str
1442
+ :param merchant_account_id: (required)
1443
+ :type merchant_account_id: str
1444
+ :param _request_timeout: timeout setting for this request. If one
1445
+ number provided, it will be total request
1446
+ timeout. It can also be a pair (tuple) of
1447
+ (connection, read) timeouts.
1448
+ :type _request_timeout: int, tuple(int, int), optional
1449
+ :param _request_auth: set to override the auth_settings for an a single
1450
+ request; this effectively ignores the
1451
+ authentication in the spec for a single request.
1452
+ :type _request_auth: dict, optional
1453
+ :param _content_type: force content-type for the request.
1454
+ :type _content_type: str, Optional
1455
+ :param _headers: set to override the headers for a single
1456
+ request; this effectively ignores the headers
1457
+ in the spec for a single request.
1458
+ :type _headers: dict, optional
1459
+ :param _host_index: set to override the host_index for a single
1460
+ request; this effectively ignores the host_index
1461
+ in the spec for a single request.
1462
+ :type _host_index: int, optional
1463
+ :return: Returns the result object.
1464
+ """ # noqa: E501
1465
+
1466
+ _param = self._list_applied_coupons_serialize(
1467
+ environment=environment,
1468
+ merchant_account_id=merchant_account_id,
1469
+ _request_auth=_request_auth,
1470
+ _content_type=_content_type,
1471
+ _headers=_headers,
1472
+ _host_index=_host_index
1473
+ )
1474
+
1475
+ _response_types_map: Dict[str, Optional[str]] = {
1476
+ '200': "ApiWriteEnvelope",
1477
+ '400': "ApiError",
1478
+ '401': "ApiError",
1479
+ '409': "ApiError",
1480
+ '422': "ApiError",
1481
+ '429': "ApiError",
1482
+ }
1483
+ response_data = self.api_client.call_api(
1484
+ *_param,
1485
+ _request_timeout=_request_timeout
1486
+ )
1487
+ response_data.read()
1488
+ return self.api_client.response_deserialize(
1489
+ response_data=response_data,
1490
+ response_types_map=_response_types_map,
1491
+ )
1492
+
1493
+
1494
+ @validate_call
1495
+ def list_applied_coupons_without_preload_content(
1496
+ self,
1497
+ environment: StrictStr,
1498
+ merchant_account_id: StrictStr,
1499
+ _request_timeout: Union[
1500
+ None,
1501
+ Annotated[StrictFloat, Field(gt=0)],
1502
+ Tuple[
1503
+ Annotated[StrictFloat, Field(gt=0)],
1504
+ Annotated[StrictFloat, Field(gt=0)]
1505
+ ]
1506
+ ] = None,
1507
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1508
+ _content_type: Optional[StrictStr] = None,
1509
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1510
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1511
+ ) -> RESTResponseType:
1512
+ """List applied billing coupons
1513
+
1514
+
1515
+ :param environment: (required)
1516
+ :type environment: str
1517
+ :param merchant_account_id: (required)
1518
+ :type merchant_account_id: str
1519
+ :param _request_timeout: timeout setting for this request. If one
1520
+ number provided, it will be total request
1521
+ timeout. It can also be a pair (tuple) of
1522
+ (connection, read) timeouts.
1523
+ :type _request_timeout: int, tuple(int, int), optional
1524
+ :param _request_auth: set to override the auth_settings for an a single
1525
+ request; this effectively ignores the
1526
+ authentication in the spec for a single request.
1527
+ :type _request_auth: dict, optional
1528
+ :param _content_type: force content-type for the request.
1529
+ :type _content_type: str, Optional
1530
+ :param _headers: set to override the headers for a single
1531
+ request; this effectively ignores the headers
1532
+ in the spec for a single request.
1533
+ :type _headers: dict, optional
1534
+ :param _host_index: set to override the host_index for a single
1535
+ request; this effectively ignores the host_index
1536
+ in the spec for a single request.
1537
+ :type _host_index: int, optional
1538
+ :return: Returns the result object.
1539
+ """ # noqa: E501
1540
+
1541
+ _param = self._list_applied_coupons_serialize(
1542
+ environment=environment,
1543
+ merchant_account_id=merchant_account_id,
1544
+ _request_auth=_request_auth,
1545
+ _content_type=_content_type,
1546
+ _headers=_headers,
1547
+ _host_index=_host_index
1548
+ )
1549
+
1550
+ _response_types_map: Dict[str, Optional[str]] = {
1551
+ '200': "ApiWriteEnvelope",
1552
+ '400': "ApiError",
1553
+ '401': "ApiError",
1554
+ '409': "ApiError",
1555
+ '422': "ApiError",
1556
+ '429': "ApiError",
1557
+ }
1558
+ response_data = self.api_client.call_api(
1559
+ *_param,
1560
+ _request_timeout=_request_timeout
1561
+ )
1562
+ return response_data.response
1563
+
1564
+
1565
+ def _list_applied_coupons_serialize(
1566
+ self,
1567
+ environment,
1568
+ merchant_account_id,
1569
+ _request_auth,
1570
+ _content_type,
1571
+ _headers,
1572
+ _host_index,
1573
+ ) -> RequestSerialized:
1574
+
1575
+ _host = None
1576
+
1577
+ _collection_formats: Dict[str, str] = {
1578
+ }
1579
+
1580
+ _path_params: Dict[str, str] = {}
1581
+ _query_params: List[Tuple[str, str]] = []
1582
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1583
+ _form_params: List[Tuple[str, str]] = []
1584
+ _files: Dict[
1585
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1586
+ ] = {}
1587
+ _body_params: Optional[bytes] = None
1588
+
1589
+ # process the path parameters
1590
+ # process the query parameters
1591
+ if environment is not None:
1592
+
1593
+ _query_params.append(('environment', environment))
1594
+
1595
+ if merchant_account_id is not None:
1596
+
1597
+ _query_params.append(('merchantAccountId', merchant_account_id))
1598
+
1599
+ # process the header parameters
1600
+ # process the form parameters
1601
+ # process the body parameter
1602
+
1603
+
1604
+ # set the HTTP header `Accept`
1605
+ if 'Accept' not in _header_params:
1606
+ _header_params['Accept'] = self.api_client.select_header_accept(
1607
+ [
1608
+ 'application/json'
1609
+ ]
1610
+ )
1611
+
1612
+
1613
+ # authentication setting
1614
+ _auth_settings: List[str] = [
1615
+ 'api-key'
1616
+ ]
1617
+
1618
+ return self.api_client.param_serialize(
1619
+ method='GET',
1620
+ resource_path='/v1/applied-coupons',
1621
+ path_params=_path_params,
1622
+ query_params=_query_params,
1623
+ header_params=_header_params,
1624
+ body=_body_params,
1625
+ post_params=_form_params,
1626
+ files=_files,
1627
+ auth_settings=_auth_settings,
1628
+ collection_formats=_collection_formats,
1629
+ _host=_host,
1630
+ _request_auth=_request_auth
1631
+ )
1632
+
1633
+
1634
+
1635
+
1636
+ @validate_call
1637
+ def list_coupons(
1638
+ self,
1639
+ environment: StrictStr,
1640
+ merchant_account_id: StrictStr,
1641
+ _request_timeout: Union[
1642
+ None,
1643
+ Annotated[StrictFloat, Field(gt=0)],
1644
+ Tuple[
1645
+ Annotated[StrictFloat, Field(gt=0)],
1646
+ Annotated[StrictFloat, Field(gt=0)]
1647
+ ]
1648
+ ] = None,
1649
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1650
+ _content_type: Optional[StrictStr] = None,
1651
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1652
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1653
+ ) -> ApiWriteEnvelope:
1654
+ """List billing coupons
1655
+
1656
+
1657
+ :param environment: (required)
1658
+ :type environment: str
1659
+ :param merchant_account_id: (required)
1660
+ :type merchant_account_id: str
1661
+ :param _request_timeout: timeout setting for this request. If one
1662
+ number provided, it will be total request
1663
+ timeout. It can also be a pair (tuple) of
1664
+ (connection, read) timeouts.
1665
+ :type _request_timeout: int, tuple(int, int), optional
1666
+ :param _request_auth: set to override the auth_settings for an a single
1667
+ request; this effectively ignores the
1668
+ authentication in the spec for a single request.
1669
+ :type _request_auth: dict, optional
1670
+ :param _content_type: force content-type for the request.
1671
+ :type _content_type: str, Optional
1672
+ :param _headers: set to override the headers for a single
1673
+ request; this effectively ignores the headers
1674
+ in the spec for a single request.
1675
+ :type _headers: dict, optional
1676
+ :param _host_index: set to override the host_index for a single
1677
+ request; this effectively ignores the host_index
1678
+ in the spec for a single request.
1679
+ :type _host_index: int, optional
1680
+ :return: Returns the result object.
1681
+ """ # noqa: E501
1682
+
1683
+ _param = self._list_coupons_serialize(
1684
+ environment=environment,
1685
+ merchant_account_id=merchant_account_id,
1686
+ _request_auth=_request_auth,
1687
+ _content_type=_content_type,
1688
+ _headers=_headers,
1689
+ _host_index=_host_index
1690
+ )
1691
+
1692
+ _response_types_map: Dict[str, Optional[str]] = {
1693
+ '200': "ApiWriteEnvelope",
1694
+ '400': "ApiError",
1695
+ '401': "ApiError",
1696
+ '409': "ApiError",
1697
+ '422': "ApiError",
1698
+ '429': "ApiError",
1699
+ }
1700
+ response_data = self.api_client.call_api(
1701
+ *_param,
1702
+ _request_timeout=_request_timeout
1703
+ )
1704
+ response_data.read()
1705
+ return self.api_client.response_deserialize(
1706
+ response_data=response_data,
1707
+ response_types_map=_response_types_map,
1708
+ ).data
1709
+
1710
+
1711
+ @validate_call
1712
+ def list_coupons_with_http_info(
1713
+ self,
1714
+ environment: StrictStr,
1715
+ merchant_account_id: StrictStr,
1716
+ _request_timeout: Union[
1717
+ None,
1718
+ Annotated[StrictFloat, Field(gt=0)],
1719
+ Tuple[
1720
+ Annotated[StrictFloat, Field(gt=0)],
1721
+ Annotated[StrictFloat, Field(gt=0)]
1722
+ ]
1723
+ ] = None,
1724
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1725
+ _content_type: Optional[StrictStr] = None,
1726
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1727
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1728
+ ) -> ApiResponse[ApiWriteEnvelope]:
1729
+ """List billing coupons
1730
+
1731
+
1732
+ :param environment: (required)
1733
+ :type environment: str
1734
+ :param merchant_account_id: (required)
1735
+ :type merchant_account_id: str
1736
+ :param _request_timeout: timeout setting for this request. If one
1737
+ number provided, it will be total request
1738
+ timeout. It can also be a pair (tuple) of
1739
+ (connection, read) timeouts.
1740
+ :type _request_timeout: int, tuple(int, int), optional
1741
+ :param _request_auth: set to override the auth_settings for an a single
1742
+ request; this effectively ignores the
1743
+ authentication in the spec for a single request.
1744
+ :type _request_auth: dict, optional
1745
+ :param _content_type: force content-type for the request.
1746
+ :type _content_type: str, Optional
1747
+ :param _headers: set to override the headers for a single
1748
+ request; this effectively ignores the headers
1749
+ in the spec for a single request.
1750
+ :type _headers: dict, optional
1751
+ :param _host_index: set to override the host_index for a single
1752
+ request; this effectively ignores the host_index
1753
+ in the spec for a single request.
1754
+ :type _host_index: int, optional
1755
+ :return: Returns the result object.
1756
+ """ # noqa: E501
1757
+
1758
+ _param = self._list_coupons_serialize(
1759
+ environment=environment,
1760
+ merchant_account_id=merchant_account_id,
1761
+ _request_auth=_request_auth,
1762
+ _content_type=_content_type,
1763
+ _headers=_headers,
1764
+ _host_index=_host_index
1765
+ )
1766
+
1767
+ _response_types_map: Dict[str, Optional[str]] = {
1768
+ '200': "ApiWriteEnvelope",
1769
+ '400': "ApiError",
1770
+ '401': "ApiError",
1771
+ '409': "ApiError",
1772
+ '422': "ApiError",
1773
+ '429': "ApiError",
1774
+ }
1775
+ response_data = self.api_client.call_api(
1776
+ *_param,
1777
+ _request_timeout=_request_timeout
1778
+ )
1779
+ response_data.read()
1780
+ return self.api_client.response_deserialize(
1781
+ response_data=response_data,
1782
+ response_types_map=_response_types_map,
1783
+ )
1784
+
1785
+
1786
+ @validate_call
1787
+ def list_coupons_without_preload_content(
1788
+ self,
1789
+ environment: StrictStr,
1790
+ merchant_account_id: StrictStr,
1791
+ _request_timeout: Union[
1792
+ None,
1793
+ Annotated[StrictFloat, Field(gt=0)],
1794
+ Tuple[
1795
+ Annotated[StrictFloat, Field(gt=0)],
1796
+ Annotated[StrictFloat, Field(gt=0)]
1797
+ ]
1798
+ ] = None,
1799
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1800
+ _content_type: Optional[StrictStr] = None,
1801
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1802
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1803
+ ) -> RESTResponseType:
1804
+ """List billing coupons
1805
+
1806
+
1807
+ :param environment: (required)
1808
+ :type environment: str
1809
+ :param merchant_account_id: (required)
1810
+ :type merchant_account_id: str
1811
+ :param _request_timeout: timeout setting for this request. If one
1812
+ number provided, it will be total request
1813
+ timeout. It can also be a pair (tuple) of
1814
+ (connection, read) timeouts.
1815
+ :type _request_timeout: int, tuple(int, int), optional
1816
+ :param _request_auth: set to override the auth_settings for an a single
1817
+ request; this effectively ignores the
1818
+ authentication in the spec for a single request.
1819
+ :type _request_auth: dict, optional
1820
+ :param _content_type: force content-type for the request.
1821
+ :type _content_type: str, Optional
1822
+ :param _headers: set to override the headers for a single
1823
+ request; this effectively ignores the headers
1824
+ in the spec for a single request.
1825
+ :type _headers: dict, optional
1826
+ :param _host_index: set to override the host_index for a single
1827
+ request; this effectively ignores the host_index
1828
+ in the spec for a single request.
1829
+ :type _host_index: int, optional
1830
+ :return: Returns the result object.
1831
+ """ # noqa: E501
1832
+
1833
+ _param = self._list_coupons_serialize(
1834
+ environment=environment,
1835
+ merchant_account_id=merchant_account_id,
1836
+ _request_auth=_request_auth,
1837
+ _content_type=_content_type,
1838
+ _headers=_headers,
1839
+ _host_index=_host_index
1840
+ )
1841
+
1842
+ _response_types_map: Dict[str, Optional[str]] = {
1843
+ '200': "ApiWriteEnvelope",
1844
+ '400': "ApiError",
1845
+ '401': "ApiError",
1846
+ '409': "ApiError",
1847
+ '422': "ApiError",
1848
+ '429': "ApiError",
1849
+ }
1850
+ response_data = self.api_client.call_api(
1851
+ *_param,
1852
+ _request_timeout=_request_timeout
1853
+ )
1854
+ return response_data.response
1855
+
1856
+
1857
+ def _list_coupons_serialize(
1858
+ self,
1859
+ environment,
1860
+ merchant_account_id,
1861
+ _request_auth,
1862
+ _content_type,
1863
+ _headers,
1864
+ _host_index,
1865
+ ) -> RequestSerialized:
1866
+
1867
+ _host = None
1868
+
1869
+ _collection_formats: Dict[str, str] = {
1870
+ }
1871
+
1872
+ _path_params: Dict[str, str] = {}
1873
+ _query_params: List[Tuple[str, str]] = []
1874
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1875
+ _form_params: List[Tuple[str, str]] = []
1876
+ _files: Dict[
1877
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1878
+ ] = {}
1879
+ _body_params: Optional[bytes] = None
1880
+
1881
+ # process the path parameters
1882
+ # process the query parameters
1883
+ if environment is not None:
1884
+
1885
+ _query_params.append(('environment', environment))
1886
+
1887
+ if merchant_account_id is not None:
1888
+
1889
+ _query_params.append(('merchantAccountId', merchant_account_id))
1890
+
1891
+ # process the header parameters
1892
+ # process the form parameters
1893
+ # process the body parameter
1894
+
1895
+
1896
+ # set the HTTP header `Accept`
1897
+ if 'Accept' not in _header_params:
1898
+ _header_params['Accept'] = self.api_client.select_header_accept(
1899
+ [
1900
+ 'application/json'
1901
+ ]
1902
+ )
1903
+
1904
+
1905
+ # authentication setting
1906
+ _auth_settings: List[str] = [
1907
+ 'api-key'
1908
+ ]
1909
+
1910
+ return self.api_client.param_serialize(
1911
+ method='GET',
1912
+ resource_path='/v1/coupons',
1913
+ path_params=_path_params,
1914
+ query_params=_query_params,
1915
+ header_params=_header_params,
1916
+ body=_body_params,
1917
+ post_params=_form_params,
1918
+ files=_files,
1919
+ auth_settings=_auth_settings,
1920
+ collection_formats=_collection_formats,
1921
+ _host=_host,
1922
+ _request_auth=_request_auth
1923
+ )
1924
+
1925
+
1926
+
1927
+
1928
+ @validate_call
1929
+ def terminate_applied_coupon(
1930
+ self,
1931
+ applied_coupon_id: StrictStr,
1932
+ environment: StrictStr,
1933
+ merchant_account_id: StrictStr,
1934
+ terminate_applied_coupon_request: TerminateAppliedCouponRequest,
1935
+ 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,
1936
+ _request_timeout: Union[
1937
+ None,
1938
+ Annotated[StrictFloat, Field(gt=0)],
1939
+ Tuple[
1940
+ Annotated[StrictFloat, Field(gt=0)],
1941
+ Annotated[StrictFloat, Field(gt=0)]
1942
+ ]
1943
+ ] = None,
1944
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1945
+ _content_type: Optional[StrictStr] = None,
1946
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1947
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1948
+ ) -> ApiWriteEnvelope:
1949
+ """Terminate one applied coupon
1950
+
1951
+
1952
+ :param applied_coupon_id: (required)
1953
+ :type applied_coupon_id: str
1954
+ :param environment: (required)
1955
+ :type environment: str
1956
+ :param merchant_account_id: (required)
1957
+ :type merchant_account_id: str
1958
+ :param terminate_applied_coupon_request: (required)
1959
+ :type terminate_applied_coupon_request: TerminateAppliedCouponRequest
1960
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1961
+ :type idempotency_key: str
1962
+ :param _request_timeout: timeout setting for this request. If one
1963
+ number provided, it will be total request
1964
+ timeout. It can also be a pair (tuple) of
1965
+ (connection, read) timeouts.
1966
+ :type _request_timeout: int, tuple(int, int), optional
1967
+ :param _request_auth: set to override the auth_settings for an a single
1968
+ request; this effectively ignores the
1969
+ authentication in the spec for a single request.
1970
+ :type _request_auth: dict, optional
1971
+ :param _content_type: force content-type for the request.
1972
+ :type _content_type: str, Optional
1973
+ :param _headers: set to override the headers for a single
1974
+ request; this effectively ignores the headers
1975
+ in the spec for a single request.
1976
+ :type _headers: dict, optional
1977
+ :param _host_index: set to override the host_index for a single
1978
+ request; this effectively ignores the host_index
1979
+ in the spec for a single request.
1980
+ :type _host_index: int, optional
1981
+ :return: Returns the result object.
1982
+ """ # noqa: E501
1983
+
1984
+ _param = self._terminate_applied_coupon_serialize(
1985
+ applied_coupon_id=applied_coupon_id,
1986
+ environment=environment,
1987
+ merchant_account_id=merchant_account_id,
1988
+ terminate_applied_coupon_request=terminate_applied_coupon_request,
1989
+ idempotency_key=idempotency_key,
1990
+ _request_auth=_request_auth,
1991
+ _content_type=_content_type,
1992
+ _headers=_headers,
1993
+ _host_index=_host_index
1994
+ )
1995
+
1996
+ _response_types_map: Dict[str, Optional[str]] = {
1997
+ '200': "ApiWriteEnvelope",
1998
+ '400': "ApiError",
1999
+ '401': "ApiError",
2000
+ '409': "ApiError",
2001
+ '422': "ApiError",
2002
+ '429': "ApiError",
2003
+ }
2004
+ response_data = self.api_client.call_api(
2005
+ *_param,
2006
+ _request_timeout=_request_timeout
2007
+ )
2008
+ response_data.read()
2009
+ return self.api_client.response_deserialize(
2010
+ response_data=response_data,
2011
+ response_types_map=_response_types_map,
2012
+ ).data
2013
+
2014
+
2015
+ @validate_call
2016
+ def terminate_applied_coupon_with_http_info(
2017
+ self,
2018
+ applied_coupon_id: StrictStr,
2019
+ environment: StrictStr,
2020
+ merchant_account_id: StrictStr,
2021
+ terminate_applied_coupon_request: TerminateAppliedCouponRequest,
2022
+ 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,
2023
+ _request_timeout: Union[
2024
+ None,
2025
+ Annotated[StrictFloat, Field(gt=0)],
2026
+ Tuple[
2027
+ Annotated[StrictFloat, Field(gt=0)],
2028
+ Annotated[StrictFloat, Field(gt=0)]
2029
+ ]
2030
+ ] = None,
2031
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2032
+ _content_type: Optional[StrictStr] = None,
2033
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2034
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2035
+ ) -> ApiResponse[ApiWriteEnvelope]:
2036
+ """Terminate one applied coupon
2037
+
2038
+
2039
+ :param applied_coupon_id: (required)
2040
+ :type applied_coupon_id: str
2041
+ :param environment: (required)
2042
+ :type environment: str
2043
+ :param merchant_account_id: (required)
2044
+ :type merchant_account_id: str
2045
+ :param terminate_applied_coupon_request: (required)
2046
+ :type terminate_applied_coupon_request: TerminateAppliedCouponRequest
2047
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
2048
+ :type idempotency_key: str
2049
+ :param _request_timeout: timeout setting for this request. If one
2050
+ number provided, it will be total request
2051
+ timeout. It can also be a pair (tuple) of
2052
+ (connection, read) timeouts.
2053
+ :type _request_timeout: int, tuple(int, int), optional
2054
+ :param _request_auth: set to override the auth_settings for an a single
2055
+ request; this effectively ignores the
2056
+ authentication in the spec for a single request.
2057
+ :type _request_auth: dict, optional
2058
+ :param _content_type: force content-type for the request.
2059
+ :type _content_type: str, Optional
2060
+ :param _headers: set to override the headers for a single
2061
+ request; this effectively ignores the headers
2062
+ in the spec for a single request.
2063
+ :type _headers: dict, optional
2064
+ :param _host_index: set to override the host_index for a single
2065
+ request; this effectively ignores the host_index
2066
+ in the spec for a single request.
2067
+ :type _host_index: int, optional
2068
+ :return: Returns the result object.
2069
+ """ # noqa: E501
2070
+
2071
+ _param = self._terminate_applied_coupon_serialize(
2072
+ applied_coupon_id=applied_coupon_id,
2073
+ environment=environment,
2074
+ merchant_account_id=merchant_account_id,
2075
+ terminate_applied_coupon_request=terminate_applied_coupon_request,
2076
+ idempotency_key=idempotency_key,
2077
+ _request_auth=_request_auth,
2078
+ _content_type=_content_type,
2079
+ _headers=_headers,
2080
+ _host_index=_host_index
2081
+ )
2082
+
2083
+ _response_types_map: Dict[str, Optional[str]] = {
2084
+ '200': "ApiWriteEnvelope",
2085
+ '400': "ApiError",
2086
+ '401': "ApiError",
2087
+ '409': "ApiError",
2088
+ '422': "ApiError",
2089
+ '429': "ApiError",
2090
+ }
2091
+ response_data = self.api_client.call_api(
2092
+ *_param,
2093
+ _request_timeout=_request_timeout
2094
+ )
2095
+ response_data.read()
2096
+ return self.api_client.response_deserialize(
2097
+ response_data=response_data,
2098
+ response_types_map=_response_types_map,
2099
+ )
2100
+
2101
+
2102
+ @validate_call
2103
+ def terminate_applied_coupon_without_preload_content(
2104
+ self,
2105
+ applied_coupon_id: StrictStr,
2106
+ environment: StrictStr,
2107
+ merchant_account_id: StrictStr,
2108
+ terminate_applied_coupon_request: TerminateAppliedCouponRequest,
2109
+ 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,
2110
+ _request_timeout: Union[
2111
+ None,
2112
+ Annotated[StrictFloat, Field(gt=0)],
2113
+ Tuple[
2114
+ Annotated[StrictFloat, Field(gt=0)],
2115
+ Annotated[StrictFloat, Field(gt=0)]
2116
+ ]
2117
+ ] = None,
2118
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2119
+ _content_type: Optional[StrictStr] = None,
2120
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2121
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2122
+ ) -> RESTResponseType:
2123
+ """Terminate one applied coupon
2124
+
2125
+
2126
+ :param applied_coupon_id: (required)
2127
+ :type applied_coupon_id: str
2128
+ :param environment: (required)
2129
+ :type environment: str
2130
+ :param merchant_account_id: (required)
2131
+ :type merchant_account_id: str
2132
+ :param terminate_applied_coupon_request: (required)
2133
+ :type terminate_applied_coupon_request: TerminateAppliedCouponRequest
2134
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
2135
+ :type idempotency_key: str
2136
+ :param _request_timeout: timeout setting for this request. If one
2137
+ number provided, it will be total request
2138
+ timeout. It can also be a pair (tuple) of
2139
+ (connection, read) timeouts.
2140
+ :type _request_timeout: int, tuple(int, int), optional
2141
+ :param _request_auth: set to override the auth_settings for an a single
2142
+ request; this effectively ignores the
2143
+ authentication in the spec for a single request.
2144
+ :type _request_auth: dict, optional
2145
+ :param _content_type: force content-type for the request.
2146
+ :type _content_type: str, Optional
2147
+ :param _headers: set to override the headers for a single
2148
+ request; this effectively ignores the headers
2149
+ in the spec for a single request.
2150
+ :type _headers: dict, optional
2151
+ :param _host_index: set to override the host_index for a single
2152
+ request; this effectively ignores the host_index
2153
+ in the spec for a single request.
2154
+ :type _host_index: int, optional
2155
+ :return: Returns the result object.
2156
+ """ # noqa: E501
2157
+
2158
+ _param = self._terminate_applied_coupon_serialize(
2159
+ applied_coupon_id=applied_coupon_id,
2160
+ environment=environment,
2161
+ merchant_account_id=merchant_account_id,
2162
+ terminate_applied_coupon_request=terminate_applied_coupon_request,
2163
+ idempotency_key=idempotency_key,
2164
+ _request_auth=_request_auth,
2165
+ _content_type=_content_type,
2166
+ _headers=_headers,
2167
+ _host_index=_host_index
2168
+ )
2169
+
2170
+ _response_types_map: Dict[str, Optional[str]] = {
2171
+ '200': "ApiWriteEnvelope",
2172
+ '400': "ApiError",
2173
+ '401': "ApiError",
2174
+ '409': "ApiError",
2175
+ '422': "ApiError",
2176
+ '429': "ApiError",
2177
+ }
2178
+ response_data = self.api_client.call_api(
2179
+ *_param,
2180
+ _request_timeout=_request_timeout
2181
+ )
2182
+ return response_data.response
2183
+
2184
+
2185
+ def _terminate_applied_coupon_serialize(
2186
+ self,
2187
+ applied_coupon_id,
2188
+ environment,
2189
+ merchant_account_id,
2190
+ terminate_applied_coupon_request,
2191
+ idempotency_key,
2192
+ _request_auth,
2193
+ _content_type,
2194
+ _headers,
2195
+ _host_index,
2196
+ ) -> RequestSerialized:
2197
+
2198
+ _host = None
2199
+
2200
+ _collection_formats: Dict[str, str] = {
2201
+ }
2202
+
2203
+ _path_params: Dict[str, str] = {}
2204
+ _query_params: List[Tuple[str, str]] = []
2205
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2206
+ _form_params: List[Tuple[str, str]] = []
2207
+ _files: Dict[
2208
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2209
+ ] = {}
2210
+ _body_params: Optional[bytes] = None
2211
+
2212
+ # process the path parameters
2213
+ if applied_coupon_id is not None:
2214
+ _path_params['appliedCouponId'] = applied_coupon_id
2215
+ # process the query parameters
2216
+ if environment is not None:
2217
+
2218
+ _query_params.append(('environment', environment))
2219
+
2220
+ if merchant_account_id is not None:
2221
+
2222
+ _query_params.append(('merchantAccountId', merchant_account_id))
2223
+
2224
+ # process the header parameters
2225
+ if idempotency_key is not None:
2226
+ _header_params['Idempotency-Key'] = idempotency_key
2227
+ # process the form parameters
2228
+ # process the body parameter
2229
+ if terminate_applied_coupon_request is not None:
2230
+ _body_params = terminate_applied_coupon_request
2231
+
2232
+
2233
+ # set the HTTP header `Accept`
2234
+ if 'Accept' not in _header_params:
2235
+ _header_params['Accept'] = self.api_client.select_header_accept(
2236
+ [
2237
+ 'application/json'
2238
+ ]
2239
+ )
2240
+
2241
+ # set the HTTP header `Content-Type`
2242
+ if _content_type:
2243
+ _header_params['Content-Type'] = _content_type
2244
+ else:
2245
+ _default_content_type = (
2246
+ self.api_client.select_header_content_type(
2247
+ [
2248
+ 'application/json'
2249
+ ]
2250
+ )
2251
+ )
2252
+ if _default_content_type is not None:
2253
+ _header_params['Content-Type'] = _default_content_type
2254
+
2255
+ # authentication setting
2256
+ _auth_settings: List[str] = [
2257
+ 'api-key'
2258
+ ]
2259
+
2260
+ return self.api_client.param_serialize(
2261
+ method='POST',
2262
+ resource_path='/v1/applied-coupons/{appliedCouponId}/terminate',
2263
+ path_params=_path_params,
2264
+ query_params=_query_params,
2265
+ header_params=_header_params,
2266
+ body=_body_params,
2267
+ post_params=_form_params,
2268
+ files=_files,
2269
+ auth_settings=_auth_settings,
2270
+ collection_formats=_collection_formats,
2271
+ _host=_host,
2272
+ _request_auth=_request_auth
2273
+ )
2274
+
2275
+
2276
+
2277
+
2278
+ @validate_call
2279
+ def terminate_coupon(
2280
+ self,
2281
+ coupon_id: StrictStr,
2282
+ environment: StrictStr,
2283
+ merchant_account_id: StrictStr,
2284
+ terminate_coupon_request: TerminateCouponRequest,
2285
+ 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,
2286
+ _request_timeout: Union[
2287
+ None,
2288
+ Annotated[StrictFloat, Field(gt=0)],
2289
+ Tuple[
2290
+ Annotated[StrictFloat, Field(gt=0)],
2291
+ Annotated[StrictFloat, Field(gt=0)]
2292
+ ]
2293
+ ] = None,
2294
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2295
+ _content_type: Optional[StrictStr] = None,
2296
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2297
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2298
+ ) -> ApiWriteEnvelope:
2299
+ """Terminate a coupon
2300
+
2301
+
2302
+ :param coupon_id: (required)
2303
+ :type coupon_id: str
2304
+ :param environment: (required)
2305
+ :type environment: str
2306
+ :param merchant_account_id: (required)
2307
+ :type merchant_account_id: str
2308
+ :param terminate_coupon_request: (required)
2309
+ :type terminate_coupon_request: TerminateCouponRequest
2310
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
2311
+ :type idempotency_key: str
2312
+ :param _request_timeout: timeout setting for this request. If one
2313
+ number provided, it will be total request
2314
+ timeout. It can also be a pair (tuple) of
2315
+ (connection, read) timeouts.
2316
+ :type _request_timeout: int, tuple(int, int), optional
2317
+ :param _request_auth: set to override the auth_settings for an a single
2318
+ request; this effectively ignores the
2319
+ authentication in the spec for a single request.
2320
+ :type _request_auth: dict, optional
2321
+ :param _content_type: force content-type for the request.
2322
+ :type _content_type: str, Optional
2323
+ :param _headers: set to override the headers for a single
2324
+ request; this effectively ignores the headers
2325
+ in the spec for a single request.
2326
+ :type _headers: dict, optional
2327
+ :param _host_index: set to override the host_index for a single
2328
+ request; this effectively ignores the host_index
2329
+ in the spec for a single request.
2330
+ :type _host_index: int, optional
2331
+ :return: Returns the result object.
2332
+ """ # noqa: E501
2333
+
2334
+ _param = self._terminate_coupon_serialize(
2335
+ coupon_id=coupon_id,
2336
+ environment=environment,
2337
+ merchant_account_id=merchant_account_id,
2338
+ terminate_coupon_request=terminate_coupon_request,
2339
+ idempotency_key=idempotency_key,
2340
+ _request_auth=_request_auth,
2341
+ _content_type=_content_type,
2342
+ _headers=_headers,
2343
+ _host_index=_host_index
2344
+ )
2345
+
2346
+ _response_types_map: Dict[str, Optional[str]] = {
2347
+ '200': "ApiWriteEnvelope",
2348
+ '400': "ApiError",
2349
+ '401': "ApiError",
2350
+ '409': "ApiError",
2351
+ '422': "ApiError",
2352
+ '429': "ApiError",
2353
+ }
2354
+ response_data = self.api_client.call_api(
2355
+ *_param,
2356
+ _request_timeout=_request_timeout
2357
+ )
2358
+ response_data.read()
2359
+ return self.api_client.response_deserialize(
2360
+ response_data=response_data,
2361
+ response_types_map=_response_types_map,
2362
+ ).data
2363
+
2364
+
2365
+ @validate_call
2366
+ def terminate_coupon_with_http_info(
2367
+ self,
2368
+ coupon_id: StrictStr,
2369
+ environment: StrictStr,
2370
+ merchant_account_id: StrictStr,
2371
+ terminate_coupon_request: TerminateCouponRequest,
2372
+ 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,
2373
+ _request_timeout: Union[
2374
+ None,
2375
+ Annotated[StrictFloat, Field(gt=0)],
2376
+ Tuple[
2377
+ Annotated[StrictFloat, Field(gt=0)],
2378
+ Annotated[StrictFloat, Field(gt=0)]
2379
+ ]
2380
+ ] = None,
2381
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2382
+ _content_type: Optional[StrictStr] = None,
2383
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2384
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2385
+ ) -> ApiResponse[ApiWriteEnvelope]:
2386
+ """Terminate a coupon
2387
+
2388
+
2389
+ :param coupon_id: (required)
2390
+ :type coupon_id: str
2391
+ :param environment: (required)
2392
+ :type environment: str
2393
+ :param merchant_account_id: (required)
2394
+ :type merchant_account_id: str
2395
+ :param terminate_coupon_request: (required)
2396
+ :type terminate_coupon_request: TerminateCouponRequest
2397
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
2398
+ :type idempotency_key: str
2399
+ :param _request_timeout: timeout setting for this request. If one
2400
+ number provided, it will be total request
2401
+ timeout. It can also be a pair (tuple) of
2402
+ (connection, read) timeouts.
2403
+ :type _request_timeout: int, tuple(int, int), optional
2404
+ :param _request_auth: set to override the auth_settings for an a single
2405
+ request; this effectively ignores the
2406
+ authentication in the spec for a single request.
2407
+ :type _request_auth: dict, optional
2408
+ :param _content_type: force content-type for the request.
2409
+ :type _content_type: str, Optional
2410
+ :param _headers: set to override the headers for a single
2411
+ request; this effectively ignores the headers
2412
+ in the spec for a single request.
2413
+ :type _headers: dict, optional
2414
+ :param _host_index: set to override the host_index for a single
2415
+ request; this effectively ignores the host_index
2416
+ in the spec for a single request.
2417
+ :type _host_index: int, optional
2418
+ :return: Returns the result object.
2419
+ """ # noqa: E501
2420
+
2421
+ _param = self._terminate_coupon_serialize(
2422
+ coupon_id=coupon_id,
2423
+ environment=environment,
2424
+ merchant_account_id=merchant_account_id,
2425
+ terminate_coupon_request=terminate_coupon_request,
2426
+ idempotency_key=idempotency_key,
2427
+ _request_auth=_request_auth,
2428
+ _content_type=_content_type,
2429
+ _headers=_headers,
2430
+ _host_index=_host_index
2431
+ )
2432
+
2433
+ _response_types_map: Dict[str, Optional[str]] = {
2434
+ '200': "ApiWriteEnvelope",
2435
+ '400': "ApiError",
2436
+ '401': "ApiError",
2437
+ '409': "ApiError",
2438
+ '422': "ApiError",
2439
+ '429': "ApiError",
2440
+ }
2441
+ response_data = self.api_client.call_api(
2442
+ *_param,
2443
+ _request_timeout=_request_timeout
2444
+ )
2445
+ response_data.read()
2446
+ return self.api_client.response_deserialize(
2447
+ response_data=response_data,
2448
+ response_types_map=_response_types_map,
2449
+ )
2450
+
2451
+
2452
+ @validate_call
2453
+ def terminate_coupon_without_preload_content(
2454
+ self,
2455
+ coupon_id: StrictStr,
2456
+ environment: StrictStr,
2457
+ merchant_account_id: StrictStr,
2458
+ terminate_coupon_request: TerminateCouponRequest,
2459
+ 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,
2460
+ _request_timeout: Union[
2461
+ None,
2462
+ Annotated[StrictFloat, Field(gt=0)],
2463
+ Tuple[
2464
+ Annotated[StrictFloat, Field(gt=0)],
2465
+ Annotated[StrictFloat, Field(gt=0)]
2466
+ ]
2467
+ ] = None,
2468
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2469
+ _content_type: Optional[StrictStr] = None,
2470
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2471
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2472
+ ) -> RESTResponseType:
2473
+ """Terminate a coupon
2474
+
2475
+
2476
+ :param coupon_id: (required)
2477
+ :type coupon_id: str
2478
+ :param environment: (required)
2479
+ :type environment: str
2480
+ :param merchant_account_id: (required)
2481
+ :type merchant_account_id: str
2482
+ :param terminate_coupon_request: (required)
2483
+ :type terminate_coupon_request: TerminateCouponRequest
2484
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
2485
+ :type idempotency_key: str
2486
+ :param _request_timeout: timeout setting for this request. If one
2487
+ number provided, it will be total request
2488
+ timeout. It can also be a pair (tuple) of
2489
+ (connection, read) timeouts.
2490
+ :type _request_timeout: int, tuple(int, int), optional
2491
+ :param _request_auth: set to override the auth_settings for an a single
2492
+ request; this effectively ignores the
2493
+ authentication in the spec for a single request.
2494
+ :type _request_auth: dict, optional
2495
+ :param _content_type: force content-type for the request.
2496
+ :type _content_type: str, Optional
2497
+ :param _headers: set to override the headers for a single
2498
+ request; this effectively ignores the headers
2499
+ in the spec for a single request.
2500
+ :type _headers: dict, optional
2501
+ :param _host_index: set to override the host_index for a single
2502
+ request; this effectively ignores the host_index
2503
+ in the spec for a single request.
2504
+ :type _host_index: int, optional
2505
+ :return: Returns the result object.
2506
+ """ # noqa: E501
2507
+
2508
+ _param = self._terminate_coupon_serialize(
2509
+ coupon_id=coupon_id,
2510
+ environment=environment,
2511
+ merchant_account_id=merchant_account_id,
2512
+ terminate_coupon_request=terminate_coupon_request,
2513
+ idempotency_key=idempotency_key,
2514
+ _request_auth=_request_auth,
2515
+ _content_type=_content_type,
2516
+ _headers=_headers,
2517
+ _host_index=_host_index
2518
+ )
2519
+
2520
+ _response_types_map: Dict[str, Optional[str]] = {
2521
+ '200': "ApiWriteEnvelope",
2522
+ '400': "ApiError",
2523
+ '401': "ApiError",
2524
+ '409': "ApiError",
2525
+ '422': "ApiError",
2526
+ '429': "ApiError",
2527
+ }
2528
+ response_data = self.api_client.call_api(
2529
+ *_param,
2530
+ _request_timeout=_request_timeout
2531
+ )
2532
+ return response_data.response
2533
+
2534
+
2535
+ def _terminate_coupon_serialize(
2536
+ self,
2537
+ coupon_id,
2538
+ environment,
2539
+ merchant_account_id,
2540
+ terminate_coupon_request,
2541
+ idempotency_key,
2542
+ _request_auth,
2543
+ _content_type,
2544
+ _headers,
2545
+ _host_index,
2546
+ ) -> RequestSerialized:
2547
+
2548
+ _host = None
2549
+
2550
+ _collection_formats: Dict[str, str] = {
2551
+ }
2552
+
2553
+ _path_params: Dict[str, str] = {}
2554
+ _query_params: List[Tuple[str, str]] = []
2555
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2556
+ _form_params: List[Tuple[str, str]] = []
2557
+ _files: Dict[
2558
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2559
+ ] = {}
2560
+ _body_params: Optional[bytes] = None
2561
+
2562
+ # process the path parameters
2563
+ if coupon_id is not None:
2564
+ _path_params['couponId'] = coupon_id
2565
+ # process the query parameters
2566
+ if environment is not None:
2567
+
2568
+ _query_params.append(('environment', environment))
2569
+
2570
+ if merchant_account_id is not None:
2571
+
2572
+ _query_params.append(('merchantAccountId', merchant_account_id))
2573
+
2574
+ # process the header parameters
2575
+ if idempotency_key is not None:
2576
+ _header_params['Idempotency-Key'] = idempotency_key
2577
+ # process the form parameters
2578
+ # process the body parameter
2579
+ if terminate_coupon_request is not None:
2580
+ _body_params = terminate_coupon_request
2581
+
2582
+
2583
+ # set the HTTP header `Accept`
2584
+ if 'Accept' not in _header_params:
2585
+ _header_params['Accept'] = self.api_client.select_header_accept(
2586
+ [
2587
+ 'application/json'
2588
+ ]
2589
+ )
2590
+
2591
+ # set the HTTP header `Content-Type`
2592
+ if _content_type:
2593
+ _header_params['Content-Type'] = _content_type
2594
+ else:
2595
+ _default_content_type = (
2596
+ self.api_client.select_header_content_type(
2597
+ [
2598
+ 'application/json'
2599
+ ]
2600
+ )
2601
+ )
2602
+ if _default_content_type is not None:
2603
+ _header_params['Content-Type'] = _default_content_type
2604
+
2605
+ # authentication setting
2606
+ _auth_settings: List[str] = [
2607
+ 'api-key'
2608
+ ]
2609
+
2610
+ return self.api_client.param_serialize(
2611
+ method='POST',
2612
+ resource_path='/v1/coupons/{couponId}/terminate',
2613
+ path_params=_path_params,
2614
+ query_params=_query_params,
2615
+ header_params=_header_params,
2616
+ body=_body_params,
2617
+ post_params=_form_params,
2618
+ files=_files,
2619
+ auth_settings=_auth_settings,
2620
+ collection_formats=_collection_formats,
2621
+ _host=_host,
2622
+ _request_auth=_request_auth
2623
+ )