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,2402 @@
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 Any, Dict, Optional
20
+ from typing_extensions import Annotated
21
+ from vortex.models.api_write_envelope import ApiWriteEnvelope
22
+ from vortex.models.invoice_create_request import InvoiceCreateRequest
23
+ from vortex.models.invoice_finalize_request import InvoiceFinalizeRequest
24
+ from vortex.models.invoice_mark_uncollectible_request import InvoiceMarkUncollectibleRequest
25
+ from vortex.models.invoice_void_request import InvoiceVoidRequest
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 InvoicesApi:
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 create_invoice(
47
+ self,
48
+ environment: StrictStr,
49
+ merchant_account_id: StrictStr,
50
+ invoice_create_request: InvoiceCreateRequest,
51
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
52
+ _request_timeout: Union[
53
+ None,
54
+ Annotated[StrictFloat, Field(gt=0)],
55
+ Tuple[
56
+ Annotated[StrictFloat, Field(gt=0)],
57
+ Annotated[StrictFloat, Field(gt=0)]
58
+ ]
59
+ ] = None,
60
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
61
+ _content_type: Optional[StrictStr] = None,
62
+ _headers: Optional[Dict[StrictStr, Any]] = None,
63
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
64
+ ) -> ApiWriteEnvelope:
65
+ """Create a draft invoice
66
+
67
+
68
+ :param environment: (required)
69
+ :type environment: str
70
+ :param merchant_account_id: (required)
71
+ :type merchant_account_id: str
72
+ :param invoice_create_request: (required)
73
+ :type invoice_create_request: InvoiceCreateRequest
74
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
75
+ :type idempotency_key: str
76
+ :param _request_timeout: timeout setting for this request. If one
77
+ number provided, it will be total request
78
+ timeout. It can also be a pair (tuple) of
79
+ (connection, read) timeouts.
80
+ :type _request_timeout: int, tuple(int, int), optional
81
+ :param _request_auth: set to override the auth_settings for an a single
82
+ request; this effectively ignores the
83
+ authentication in the spec for a single request.
84
+ :type _request_auth: dict, optional
85
+ :param _content_type: force content-type for the request.
86
+ :type _content_type: str, Optional
87
+ :param _headers: set to override the headers for a single
88
+ request; this effectively ignores the headers
89
+ in the spec for a single request.
90
+ :type _headers: dict, optional
91
+ :param _host_index: set to override the host_index for a single
92
+ request; this effectively ignores the host_index
93
+ in the spec for a single request.
94
+ :type _host_index: int, optional
95
+ :return: Returns the result object.
96
+ """ # noqa: E501
97
+
98
+ _param = self._create_invoice_serialize(
99
+ environment=environment,
100
+ merchant_account_id=merchant_account_id,
101
+ invoice_create_request=invoice_create_request,
102
+ idempotency_key=idempotency_key,
103
+ _request_auth=_request_auth,
104
+ _content_type=_content_type,
105
+ _headers=_headers,
106
+ _host_index=_host_index
107
+ )
108
+
109
+ _response_types_map: Dict[str, Optional[str]] = {
110
+ '200': "ApiWriteEnvelope",
111
+ '400': "ApiError",
112
+ '401': "ApiError",
113
+ '409': "ApiError",
114
+ '422': "ApiError",
115
+ '429': "ApiError",
116
+ }
117
+ response_data = self.api_client.call_api(
118
+ *_param,
119
+ _request_timeout=_request_timeout
120
+ )
121
+ response_data.read()
122
+ return self.api_client.response_deserialize(
123
+ response_data=response_data,
124
+ response_types_map=_response_types_map,
125
+ ).data
126
+
127
+
128
+ @validate_call
129
+ def create_invoice_with_http_info(
130
+ self,
131
+ environment: StrictStr,
132
+ merchant_account_id: StrictStr,
133
+ invoice_create_request: InvoiceCreateRequest,
134
+ 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,
135
+ _request_timeout: Union[
136
+ None,
137
+ Annotated[StrictFloat, Field(gt=0)],
138
+ Tuple[
139
+ Annotated[StrictFloat, Field(gt=0)],
140
+ Annotated[StrictFloat, Field(gt=0)]
141
+ ]
142
+ ] = None,
143
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
144
+ _content_type: Optional[StrictStr] = None,
145
+ _headers: Optional[Dict[StrictStr, Any]] = None,
146
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
147
+ ) -> ApiResponse[ApiWriteEnvelope]:
148
+ """Create a draft invoice
149
+
150
+
151
+ :param environment: (required)
152
+ :type environment: str
153
+ :param merchant_account_id: (required)
154
+ :type merchant_account_id: str
155
+ :param invoice_create_request: (required)
156
+ :type invoice_create_request: InvoiceCreateRequest
157
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
158
+ :type idempotency_key: str
159
+ :param _request_timeout: timeout setting for this request. If one
160
+ number provided, it will be total request
161
+ timeout. It can also be a pair (tuple) of
162
+ (connection, read) timeouts.
163
+ :type _request_timeout: int, tuple(int, int), optional
164
+ :param _request_auth: set to override the auth_settings for an a single
165
+ request; this effectively ignores the
166
+ authentication in the spec for a single request.
167
+ :type _request_auth: dict, optional
168
+ :param _content_type: force content-type for the request.
169
+ :type _content_type: str, Optional
170
+ :param _headers: set to override the headers for a single
171
+ request; this effectively ignores the headers
172
+ in the spec for a single request.
173
+ :type _headers: dict, optional
174
+ :param _host_index: set to override the host_index for a single
175
+ request; this effectively ignores the host_index
176
+ in the spec for a single request.
177
+ :type _host_index: int, optional
178
+ :return: Returns the result object.
179
+ """ # noqa: E501
180
+
181
+ _param = self._create_invoice_serialize(
182
+ environment=environment,
183
+ merchant_account_id=merchant_account_id,
184
+ invoice_create_request=invoice_create_request,
185
+ idempotency_key=idempotency_key,
186
+ _request_auth=_request_auth,
187
+ _content_type=_content_type,
188
+ _headers=_headers,
189
+ _host_index=_host_index
190
+ )
191
+
192
+ _response_types_map: Dict[str, Optional[str]] = {
193
+ '200': "ApiWriteEnvelope",
194
+ '400': "ApiError",
195
+ '401': "ApiError",
196
+ '409': "ApiError",
197
+ '422': "ApiError",
198
+ '429': "ApiError",
199
+ }
200
+ response_data = self.api_client.call_api(
201
+ *_param,
202
+ _request_timeout=_request_timeout
203
+ )
204
+ response_data.read()
205
+ return self.api_client.response_deserialize(
206
+ response_data=response_data,
207
+ response_types_map=_response_types_map,
208
+ )
209
+
210
+
211
+ @validate_call
212
+ def create_invoice_without_preload_content(
213
+ self,
214
+ environment: StrictStr,
215
+ merchant_account_id: StrictStr,
216
+ invoice_create_request: InvoiceCreateRequest,
217
+ 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,
218
+ _request_timeout: Union[
219
+ None,
220
+ Annotated[StrictFloat, Field(gt=0)],
221
+ Tuple[
222
+ Annotated[StrictFloat, Field(gt=0)],
223
+ Annotated[StrictFloat, Field(gt=0)]
224
+ ]
225
+ ] = None,
226
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
227
+ _content_type: Optional[StrictStr] = None,
228
+ _headers: Optional[Dict[StrictStr, Any]] = None,
229
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
230
+ ) -> RESTResponseType:
231
+ """Create a draft invoice
232
+
233
+
234
+ :param environment: (required)
235
+ :type environment: str
236
+ :param merchant_account_id: (required)
237
+ :type merchant_account_id: str
238
+ :param invoice_create_request: (required)
239
+ :type invoice_create_request: InvoiceCreateRequest
240
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
241
+ :type idempotency_key: str
242
+ :param _request_timeout: timeout setting for this request. If one
243
+ number provided, it will be total request
244
+ timeout. It can also be a pair (tuple) of
245
+ (connection, read) timeouts.
246
+ :type _request_timeout: int, tuple(int, int), optional
247
+ :param _request_auth: set to override the auth_settings for an a single
248
+ request; this effectively ignores the
249
+ authentication in the spec for a single request.
250
+ :type _request_auth: dict, optional
251
+ :param _content_type: force content-type for the request.
252
+ :type _content_type: str, Optional
253
+ :param _headers: set to override the headers for a single
254
+ request; this effectively ignores the headers
255
+ in the spec for a single request.
256
+ :type _headers: dict, optional
257
+ :param _host_index: set to override the host_index for a single
258
+ request; this effectively ignores the host_index
259
+ in the spec for a single request.
260
+ :type _host_index: int, optional
261
+ :return: Returns the result object.
262
+ """ # noqa: E501
263
+
264
+ _param = self._create_invoice_serialize(
265
+ environment=environment,
266
+ merchant_account_id=merchant_account_id,
267
+ invoice_create_request=invoice_create_request,
268
+ idempotency_key=idempotency_key,
269
+ _request_auth=_request_auth,
270
+ _content_type=_content_type,
271
+ _headers=_headers,
272
+ _host_index=_host_index
273
+ )
274
+
275
+ _response_types_map: Dict[str, Optional[str]] = {
276
+ '200': "ApiWriteEnvelope",
277
+ '400': "ApiError",
278
+ '401': "ApiError",
279
+ '409': "ApiError",
280
+ '422': "ApiError",
281
+ '429': "ApiError",
282
+ }
283
+ response_data = self.api_client.call_api(
284
+ *_param,
285
+ _request_timeout=_request_timeout
286
+ )
287
+ return response_data.response
288
+
289
+
290
+ def _create_invoice_serialize(
291
+ self,
292
+ environment,
293
+ merchant_account_id,
294
+ invoice_create_request,
295
+ idempotency_key,
296
+ _request_auth,
297
+ _content_type,
298
+ _headers,
299
+ _host_index,
300
+ ) -> RequestSerialized:
301
+
302
+ _host = None
303
+
304
+ _collection_formats: Dict[str, str] = {
305
+ }
306
+
307
+ _path_params: Dict[str, str] = {}
308
+ _query_params: List[Tuple[str, str]] = []
309
+ _header_params: Dict[str, Optional[str]] = _headers or {}
310
+ _form_params: List[Tuple[str, str]] = []
311
+ _files: Dict[
312
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
313
+ ] = {}
314
+ _body_params: Optional[bytes] = None
315
+
316
+ # process the path parameters
317
+ # process the query parameters
318
+ if environment is not None:
319
+
320
+ _query_params.append(('environment', environment))
321
+
322
+ if merchant_account_id is not None:
323
+
324
+ _query_params.append(('merchantAccountId', merchant_account_id))
325
+
326
+ # process the header parameters
327
+ if idempotency_key is not None:
328
+ _header_params['Idempotency-Key'] = idempotency_key
329
+ # process the form parameters
330
+ # process the body parameter
331
+ if invoice_create_request is not None:
332
+ _body_params = invoice_create_request
333
+
334
+
335
+ # set the HTTP header `Accept`
336
+ if 'Accept' not in _header_params:
337
+ _header_params['Accept'] = self.api_client.select_header_accept(
338
+ [
339
+ 'application/json'
340
+ ]
341
+ )
342
+
343
+ # set the HTTP header `Content-Type`
344
+ if _content_type:
345
+ _header_params['Content-Type'] = _content_type
346
+ else:
347
+ _default_content_type = (
348
+ self.api_client.select_header_content_type(
349
+ [
350
+ 'application/json'
351
+ ]
352
+ )
353
+ )
354
+ if _default_content_type is not None:
355
+ _header_params['Content-Type'] = _default_content_type
356
+
357
+ # authentication setting
358
+ _auth_settings: List[str] = [
359
+ 'api-key'
360
+ ]
361
+
362
+ return self.api_client.param_serialize(
363
+ method='POST',
364
+ resource_path='/v1/invoices',
365
+ path_params=_path_params,
366
+ query_params=_query_params,
367
+ header_params=_header_params,
368
+ body=_body_params,
369
+ post_params=_form_params,
370
+ files=_files,
371
+ auth_settings=_auth_settings,
372
+ collection_formats=_collection_formats,
373
+ _host=_host,
374
+ _request_auth=_request_auth
375
+ )
376
+
377
+
378
+
379
+
380
+ @validate_call
381
+ def finalize_invoice(
382
+ self,
383
+ invoice_id: StrictStr,
384
+ environment: StrictStr,
385
+ merchant_account_id: StrictStr,
386
+ invoice_finalize_request: InvoiceFinalizeRequest,
387
+ 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,
388
+ _request_timeout: Union[
389
+ None,
390
+ Annotated[StrictFloat, Field(gt=0)],
391
+ Tuple[
392
+ Annotated[StrictFloat, Field(gt=0)],
393
+ Annotated[StrictFloat, Field(gt=0)]
394
+ ]
395
+ ] = None,
396
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
397
+ _content_type: Optional[StrictStr] = None,
398
+ _headers: Optional[Dict[StrictStr, Any]] = None,
399
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
400
+ ) -> ApiWriteEnvelope:
401
+ """Finalize a draft invoice
402
+
403
+
404
+ :param invoice_id: (required)
405
+ :type invoice_id: str
406
+ :param environment: (required)
407
+ :type environment: str
408
+ :param merchant_account_id: (required)
409
+ :type merchant_account_id: str
410
+ :param invoice_finalize_request: (required)
411
+ :type invoice_finalize_request: InvoiceFinalizeRequest
412
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
413
+ :type idempotency_key: str
414
+ :param _request_timeout: timeout setting for this request. If one
415
+ number provided, it will be total request
416
+ timeout. It can also be a pair (tuple) of
417
+ (connection, read) timeouts.
418
+ :type _request_timeout: int, tuple(int, int), optional
419
+ :param _request_auth: set to override the auth_settings for an a single
420
+ request; this effectively ignores the
421
+ authentication in the spec for a single request.
422
+ :type _request_auth: dict, optional
423
+ :param _content_type: force content-type for the request.
424
+ :type _content_type: str, Optional
425
+ :param _headers: set to override the headers for a single
426
+ request; this effectively ignores the headers
427
+ in the spec for a single request.
428
+ :type _headers: dict, optional
429
+ :param _host_index: set to override the host_index for a single
430
+ request; this effectively ignores the host_index
431
+ in the spec for a single request.
432
+ :type _host_index: int, optional
433
+ :return: Returns the result object.
434
+ """ # noqa: E501
435
+
436
+ _param = self._finalize_invoice_serialize(
437
+ invoice_id=invoice_id,
438
+ environment=environment,
439
+ merchant_account_id=merchant_account_id,
440
+ invoice_finalize_request=invoice_finalize_request,
441
+ idempotency_key=idempotency_key,
442
+ _request_auth=_request_auth,
443
+ _content_type=_content_type,
444
+ _headers=_headers,
445
+ _host_index=_host_index
446
+ )
447
+
448
+ _response_types_map: Dict[str, Optional[str]] = {
449
+ '200': "ApiWriteEnvelope",
450
+ '400': "ApiError",
451
+ '401': "ApiError",
452
+ '409': "ApiError",
453
+ '422': "ApiError",
454
+ '429': "ApiError",
455
+ }
456
+ response_data = self.api_client.call_api(
457
+ *_param,
458
+ _request_timeout=_request_timeout
459
+ )
460
+ response_data.read()
461
+ return self.api_client.response_deserialize(
462
+ response_data=response_data,
463
+ response_types_map=_response_types_map,
464
+ ).data
465
+
466
+
467
+ @validate_call
468
+ def finalize_invoice_with_http_info(
469
+ self,
470
+ invoice_id: StrictStr,
471
+ environment: StrictStr,
472
+ merchant_account_id: StrictStr,
473
+ invoice_finalize_request: InvoiceFinalizeRequest,
474
+ 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,
475
+ _request_timeout: Union[
476
+ None,
477
+ Annotated[StrictFloat, Field(gt=0)],
478
+ Tuple[
479
+ Annotated[StrictFloat, Field(gt=0)],
480
+ Annotated[StrictFloat, Field(gt=0)]
481
+ ]
482
+ ] = None,
483
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
484
+ _content_type: Optional[StrictStr] = None,
485
+ _headers: Optional[Dict[StrictStr, Any]] = None,
486
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
487
+ ) -> ApiResponse[ApiWriteEnvelope]:
488
+ """Finalize a draft invoice
489
+
490
+
491
+ :param invoice_id: (required)
492
+ :type invoice_id: str
493
+ :param environment: (required)
494
+ :type environment: str
495
+ :param merchant_account_id: (required)
496
+ :type merchant_account_id: str
497
+ :param invoice_finalize_request: (required)
498
+ :type invoice_finalize_request: InvoiceFinalizeRequest
499
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
500
+ :type idempotency_key: str
501
+ :param _request_timeout: timeout setting for this request. If one
502
+ number provided, it will be total request
503
+ timeout. It can also be a pair (tuple) of
504
+ (connection, read) timeouts.
505
+ :type _request_timeout: int, tuple(int, int), optional
506
+ :param _request_auth: set to override the auth_settings for an a single
507
+ request; this effectively ignores the
508
+ authentication in the spec for a single request.
509
+ :type _request_auth: dict, optional
510
+ :param _content_type: force content-type for the request.
511
+ :type _content_type: str, Optional
512
+ :param _headers: set to override the headers for a single
513
+ request; this effectively ignores the headers
514
+ in the spec for a single request.
515
+ :type _headers: dict, optional
516
+ :param _host_index: set to override the host_index for a single
517
+ request; this effectively ignores the host_index
518
+ in the spec for a single request.
519
+ :type _host_index: int, optional
520
+ :return: Returns the result object.
521
+ """ # noqa: E501
522
+
523
+ _param = self._finalize_invoice_serialize(
524
+ invoice_id=invoice_id,
525
+ environment=environment,
526
+ merchant_account_id=merchant_account_id,
527
+ invoice_finalize_request=invoice_finalize_request,
528
+ idempotency_key=idempotency_key,
529
+ _request_auth=_request_auth,
530
+ _content_type=_content_type,
531
+ _headers=_headers,
532
+ _host_index=_host_index
533
+ )
534
+
535
+ _response_types_map: Dict[str, Optional[str]] = {
536
+ '200': "ApiWriteEnvelope",
537
+ '400': "ApiError",
538
+ '401': "ApiError",
539
+ '409': "ApiError",
540
+ '422': "ApiError",
541
+ '429': "ApiError",
542
+ }
543
+ response_data = self.api_client.call_api(
544
+ *_param,
545
+ _request_timeout=_request_timeout
546
+ )
547
+ response_data.read()
548
+ return self.api_client.response_deserialize(
549
+ response_data=response_data,
550
+ response_types_map=_response_types_map,
551
+ )
552
+
553
+
554
+ @validate_call
555
+ def finalize_invoice_without_preload_content(
556
+ self,
557
+ invoice_id: StrictStr,
558
+ environment: StrictStr,
559
+ merchant_account_id: StrictStr,
560
+ invoice_finalize_request: InvoiceFinalizeRequest,
561
+ 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,
562
+ _request_timeout: Union[
563
+ None,
564
+ Annotated[StrictFloat, Field(gt=0)],
565
+ Tuple[
566
+ Annotated[StrictFloat, Field(gt=0)],
567
+ Annotated[StrictFloat, Field(gt=0)]
568
+ ]
569
+ ] = None,
570
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
571
+ _content_type: Optional[StrictStr] = None,
572
+ _headers: Optional[Dict[StrictStr, Any]] = None,
573
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
574
+ ) -> RESTResponseType:
575
+ """Finalize a draft invoice
576
+
577
+
578
+ :param invoice_id: (required)
579
+ :type invoice_id: str
580
+ :param environment: (required)
581
+ :type environment: str
582
+ :param merchant_account_id: (required)
583
+ :type merchant_account_id: str
584
+ :param invoice_finalize_request: (required)
585
+ :type invoice_finalize_request: InvoiceFinalizeRequest
586
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
587
+ :type idempotency_key: str
588
+ :param _request_timeout: timeout setting for this request. If one
589
+ number provided, it will be total request
590
+ timeout. It can also be a pair (tuple) of
591
+ (connection, read) timeouts.
592
+ :type _request_timeout: int, tuple(int, int), optional
593
+ :param _request_auth: set to override the auth_settings for an a single
594
+ request; this effectively ignores the
595
+ authentication in the spec for a single request.
596
+ :type _request_auth: dict, optional
597
+ :param _content_type: force content-type for the request.
598
+ :type _content_type: str, Optional
599
+ :param _headers: set to override the headers for a single
600
+ request; this effectively ignores the headers
601
+ in the spec for a single request.
602
+ :type _headers: dict, optional
603
+ :param _host_index: set to override the host_index for a single
604
+ request; this effectively ignores the host_index
605
+ in the spec for a single request.
606
+ :type _host_index: int, optional
607
+ :return: Returns the result object.
608
+ """ # noqa: E501
609
+
610
+ _param = self._finalize_invoice_serialize(
611
+ invoice_id=invoice_id,
612
+ environment=environment,
613
+ merchant_account_id=merchant_account_id,
614
+ invoice_finalize_request=invoice_finalize_request,
615
+ idempotency_key=idempotency_key,
616
+ _request_auth=_request_auth,
617
+ _content_type=_content_type,
618
+ _headers=_headers,
619
+ _host_index=_host_index
620
+ )
621
+
622
+ _response_types_map: Dict[str, Optional[str]] = {
623
+ '200': "ApiWriteEnvelope",
624
+ '400': "ApiError",
625
+ '401': "ApiError",
626
+ '409': "ApiError",
627
+ '422': "ApiError",
628
+ '429': "ApiError",
629
+ }
630
+ response_data = self.api_client.call_api(
631
+ *_param,
632
+ _request_timeout=_request_timeout
633
+ )
634
+ return response_data.response
635
+
636
+
637
+ def _finalize_invoice_serialize(
638
+ self,
639
+ invoice_id,
640
+ environment,
641
+ merchant_account_id,
642
+ invoice_finalize_request,
643
+ idempotency_key,
644
+ _request_auth,
645
+ _content_type,
646
+ _headers,
647
+ _host_index,
648
+ ) -> RequestSerialized:
649
+
650
+ _host = None
651
+
652
+ _collection_formats: Dict[str, str] = {
653
+ }
654
+
655
+ _path_params: Dict[str, str] = {}
656
+ _query_params: List[Tuple[str, str]] = []
657
+ _header_params: Dict[str, Optional[str]] = _headers or {}
658
+ _form_params: List[Tuple[str, str]] = []
659
+ _files: Dict[
660
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
661
+ ] = {}
662
+ _body_params: Optional[bytes] = None
663
+
664
+ # process the path parameters
665
+ if invoice_id is not None:
666
+ _path_params['invoiceId'] = invoice_id
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 invoice_finalize_request is not None:
682
+ _body_params = invoice_finalize_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/invoices/{invoiceId}/finalize',
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_invoice(
732
+ self,
733
+ invoice_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 an invoice
750
+
751
+
752
+ :param invoice_id: (required)
753
+ :type invoice_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_invoice_serialize(
781
+ invoice_id=invoice_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_invoice_with_http_info(
811
+ self,
812
+ invoice_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 an invoice
829
+
830
+
831
+ :param invoice_id: (required)
832
+ :type invoice_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_invoice_serialize(
860
+ invoice_id=invoice_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_invoice_without_preload_content(
890
+ self,
891
+ invoice_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 an invoice
908
+
909
+
910
+ :param invoice_id: (required)
911
+ :type invoice_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_invoice_serialize(
939
+ invoice_id=invoice_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_invoice_serialize(
964
+ self,
965
+ invoice_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 invoice_id is not None:
990
+ _path_params['invoiceId'] = invoice_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/invoices/{invoiceId}',
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 mark_invoice_uncollectible(
1039
+ self,
1040
+ invoice_id: StrictStr,
1041
+ environment: StrictStr,
1042
+ merchant_account_id: StrictStr,
1043
+ invoice_mark_uncollectible_request: InvoiceMarkUncollectibleRequest,
1044
+ 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,
1045
+ _request_timeout: Union[
1046
+ None,
1047
+ Annotated[StrictFloat, Field(gt=0)],
1048
+ Tuple[
1049
+ Annotated[StrictFloat, Field(gt=0)],
1050
+ Annotated[StrictFloat, Field(gt=0)]
1051
+ ]
1052
+ ] = None,
1053
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1054
+ _content_type: Optional[StrictStr] = None,
1055
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1056
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1057
+ ) -> ApiWriteEnvelope:
1058
+ """Mark an invoice uncollectible
1059
+
1060
+
1061
+ :param invoice_id: (required)
1062
+ :type invoice_id: str
1063
+ :param environment: (required)
1064
+ :type environment: str
1065
+ :param merchant_account_id: (required)
1066
+ :type merchant_account_id: str
1067
+ :param invoice_mark_uncollectible_request: (required)
1068
+ :type invoice_mark_uncollectible_request: InvoiceMarkUncollectibleRequest
1069
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1070
+ :type idempotency_key: str
1071
+ :param _request_timeout: timeout setting for this request. If one
1072
+ number provided, it will be total request
1073
+ timeout. It can also be a pair (tuple) of
1074
+ (connection, read) timeouts.
1075
+ :type _request_timeout: int, tuple(int, int), optional
1076
+ :param _request_auth: set to override the auth_settings for an a single
1077
+ request; this effectively ignores the
1078
+ authentication in the spec for a single request.
1079
+ :type _request_auth: dict, optional
1080
+ :param _content_type: force content-type for the request.
1081
+ :type _content_type: str, Optional
1082
+ :param _headers: set to override the headers for a single
1083
+ request; this effectively ignores the headers
1084
+ in the spec for a single request.
1085
+ :type _headers: dict, optional
1086
+ :param _host_index: set to override the host_index for a single
1087
+ request; this effectively ignores the host_index
1088
+ in the spec for a single request.
1089
+ :type _host_index: int, optional
1090
+ :return: Returns the result object.
1091
+ """ # noqa: E501
1092
+
1093
+ _param = self._mark_invoice_uncollectible_serialize(
1094
+ invoice_id=invoice_id,
1095
+ environment=environment,
1096
+ merchant_account_id=merchant_account_id,
1097
+ invoice_mark_uncollectible_request=invoice_mark_uncollectible_request,
1098
+ idempotency_key=idempotency_key,
1099
+ _request_auth=_request_auth,
1100
+ _content_type=_content_type,
1101
+ _headers=_headers,
1102
+ _host_index=_host_index
1103
+ )
1104
+
1105
+ _response_types_map: Dict[str, Optional[str]] = {
1106
+ '200': "ApiWriteEnvelope",
1107
+ '400': "ApiError",
1108
+ '401': "ApiError",
1109
+ '409': "ApiError",
1110
+ '422': "ApiError",
1111
+ '429': "ApiError",
1112
+ }
1113
+ response_data = self.api_client.call_api(
1114
+ *_param,
1115
+ _request_timeout=_request_timeout
1116
+ )
1117
+ response_data.read()
1118
+ return self.api_client.response_deserialize(
1119
+ response_data=response_data,
1120
+ response_types_map=_response_types_map,
1121
+ ).data
1122
+
1123
+
1124
+ @validate_call
1125
+ def mark_invoice_uncollectible_with_http_info(
1126
+ self,
1127
+ invoice_id: StrictStr,
1128
+ environment: StrictStr,
1129
+ merchant_account_id: StrictStr,
1130
+ invoice_mark_uncollectible_request: InvoiceMarkUncollectibleRequest,
1131
+ 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,
1132
+ _request_timeout: Union[
1133
+ None,
1134
+ Annotated[StrictFloat, Field(gt=0)],
1135
+ Tuple[
1136
+ Annotated[StrictFloat, Field(gt=0)],
1137
+ Annotated[StrictFloat, Field(gt=0)]
1138
+ ]
1139
+ ] = None,
1140
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1141
+ _content_type: Optional[StrictStr] = None,
1142
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1143
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1144
+ ) -> ApiResponse[ApiWriteEnvelope]:
1145
+ """Mark an invoice uncollectible
1146
+
1147
+
1148
+ :param invoice_id: (required)
1149
+ :type invoice_id: str
1150
+ :param environment: (required)
1151
+ :type environment: str
1152
+ :param merchant_account_id: (required)
1153
+ :type merchant_account_id: str
1154
+ :param invoice_mark_uncollectible_request: (required)
1155
+ :type invoice_mark_uncollectible_request: InvoiceMarkUncollectibleRequest
1156
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1157
+ :type idempotency_key: str
1158
+ :param _request_timeout: timeout setting for this request. If one
1159
+ number provided, it will be total request
1160
+ timeout. It can also be a pair (tuple) of
1161
+ (connection, read) timeouts.
1162
+ :type _request_timeout: int, tuple(int, int), optional
1163
+ :param _request_auth: set to override the auth_settings for an a single
1164
+ request; this effectively ignores the
1165
+ authentication in the spec for a single request.
1166
+ :type _request_auth: dict, optional
1167
+ :param _content_type: force content-type for the request.
1168
+ :type _content_type: str, Optional
1169
+ :param _headers: set to override the headers for a single
1170
+ request; this effectively ignores the headers
1171
+ in the spec for a single request.
1172
+ :type _headers: dict, optional
1173
+ :param _host_index: set to override the host_index for a single
1174
+ request; this effectively ignores the host_index
1175
+ in the spec for a single request.
1176
+ :type _host_index: int, optional
1177
+ :return: Returns the result object.
1178
+ """ # noqa: E501
1179
+
1180
+ _param = self._mark_invoice_uncollectible_serialize(
1181
+ invoice_id=invoice_id,
1182
+ environment=environment,
1183
+ merchant_account_id=merchant_account_id,
1184
+ invoice_mark_uncollectible_request=invoice_mark_uncollectible_request,
1185
+ idempotency_key=idempotency_key,
1186
+ _request_auth=_request_auth,
1187
+ _content_type=_content_type,
1188
+ _headers=_headers,
1189
+ _host_index=_host_index
1190
+ )
1191
+
1192
+ _response_types_map: Dict[str, Optional[str]] = {
1193
+ '200': "ApiWriteEnvelope",
1194
+ '400': "ApiError",
1195
+ '401': "ApiError",
1196
+ '409': "ApiError",
1197
+ '422': "ApiError",
1198
+ '429': "ApiError",
1199
+ }
1200
+ response_data = self.api_client.call_api(
1201
+ *_param,
1202
+ _request_timeout=_request_timeout
1203
+ )
1204
+ response_data.read()
1205
+ return self.api_client.response_deserialize(
1206
+ response_data=response_data,
1207
+ response_types_map=_response_types_map,
1208
+ )
1209
+
1210
+
1211
+ @validate_call
1212
+ def mark_invoice_uncollectible_without_preload_content(
1213
+ self,
1214
+ invoice_id: StrictStr,
1215
+ environment: StrictStr,
1216
+ merchant_account_id: StrictStr,
1217
+ invoice_mark_uncollectible_request: InvoiceMarkUncollectibleRequest,
1218
+ 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,
1219
+ _request_timeout: Union[
1220
+ None,
1221
+ Annotated[StrictFloat, Field(gt=0)],
1222
+ Tuple[
1223
+ Annotated[StrictFloat, Field(gt=0)],
1224
+ Annotated[StrictFloat, Field(gt=0)]
1225
+ ]
1226
+ ] = None,
1227
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1228
+ _content_type: Optional[StrictStr] = None,
1229
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1230
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1231
+ ) -> RESTResponseType:
1232
+ """Mark an invoice uncollectible
1233
+
1234
+
1235
+ :param invoice_id: (required)
1236
+ :type invoice_id: str
1237
+ :param environment: (required)
1238
+ :type environment: str
1239
+ :param merchant_account_id: (required)
1240
+ :type merchant_account_id: str
1241
+ :param invoice_mark_uncollectible_request: (required)
1242
+ :type invoice_mark_uncollectible_request: InvoiceMarkUncollectibleRequest
1243
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1244
+ :type idempotency_key: str
1245
+ :param _request_timeout: timeout setting for this request. If one
1246
+ number provided, it will be total request
1247
+ timeout. It can also be a pair (tuple) of
1248
+ (connection, read) timeouts.
1249
+ :type _request_timeout: int, tuple(int, int), optional
1250
+ :param _request_auth: set to override the auth_settings for an a single
1251
+ request; this effectively ignores the
1252
+ authentication in the spec for a single request.
1253
+ :type _request_auth: dict, optional
1254
+ :param _content_type: force content-type for the request.
1255
+ :type _content_type: str, Optional
1256
+ :param _headers: set to override the headers for a single
1257
+ request; this effectively ignores the headers
1258
+ in the spec for a single request.
1259
+ :type _headers: dict, optional
1260
+ :param _host_index: set to override the host_index for a single
1261
+ request; this effectively ignores the host_index
1262
+ in the spec for a single request.
1263
+ :type _host_index: int, optional
1264
+ :return: Returns the result object.
1265
+ """ # noqa: E501
1266
+
1267
+ _param = self._mark_invoice_uncollectible_serialize(
1268
+ invoice_id=invoice_id,
1269
+ environment=environment,
1270
+ merchant_account_id=merchant_account_id,
1271
+ invoice_mark_uncollectible_request=invoice_mark_uncollectible_request,
1272
+ idempotency_key=idempotency_key,
1273
+ _request_auth=_request_auth,
1274
+ _content_type=_content_type,
1275
+ _headers=_headers,
1276
+ _host_index=_host_index
1277
+ )
1278
+
1279
+ _response_types_map: Dict[str, Optional[str]] = {
1280
+ '200': "ApiWriteEnvelope",
1281
+ '400': "ApiError",
1282
+ '401': "ApiError",
1283
+ '409': "ApiError",
1284
+ '422': "ApiError",
1285
+ '429': "ApiError",
1286
+ }
1287
+ response_data = self.api_client.call_api(
1288
+ *_param,
1289
+ _request_timeout=_request_timeout
1290
+ )
1291
+ return response_data.response
1292
+
1293
+
1294
+ def _mark_invoice_uncollectible_serialize(
1295
+ self,
1296
+ invoice_id,
1297
+ environment,
1298
+ merchant_account_id,
1299
+ invoice_mark_uncollectible_request,
1300
+ idempotency_key,
1301
+ _request_auth,
1302
+ _content_type,
1303
+ _headers,
1304
+ _host_index,
1305
+ ) -> RequestSerialized:
1306
+
1307
+ _host = None
1308
+
1309
+ _collection_formats: Dict[str, str] = {
1310
+ }
1311
+
1312
+ _path_params: Dict[str, str] = {}
1313
+ _query_params: List[Tuple[str, str]] = []
1314
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1315
+ _form_params: List[Tuple[str, str]] = []
1316
+ _files: Dict[
1317
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1318
+ ] = {}
1319
+ _body_params: Optional[bytes] = None
1320
+
1321
+ # process the path parameters
1322
+ if invoice_id is not None:
1323
+ _path_params['invoiceId'] = invoice_id
1324
+ # process the query parameters
1325
+ if environment is not None:
1326
+
1327
+ _query_params.append(('environment', environment))
1328
+
1329
+ if merchant_account_id is not None:
1330
+
1331
+ _query_params.append(('merchantAccountId', merchant_account_id))
1332
+
1333
+ # process the header parameters
1334
+ if idempotency_key is not None:
1335
+ _header_params['Idempotency-Key'] = idempotency_key
1336
+ # process the form parameters
1337
+ # process the body parameter
1338
+ if invoice_mark_uncollectible_request is not None:
1339
+ _body_params = invoice_mark_uncollectible_request
1340
+
1341
+
1342
+ # set the HTTP header `Accept`
1343
+ if 'Accept' not in _header_params:
1344
+ _header_params['Accept'] = self.api_client.select_header_accept(
1345
+ [
1346
+ 'application/json'
1347
+ ]
1348
+ )
1349
+
1350
+ # set the HTTP header `Content-Type`
1351
+ if _content_type:
1352
+ _header_params['Content-Type'] = _content_type
1353
+ else:
1354
+ _default_content_type = (
1355
+ self.api_client.select_header_content_type(
1356
+ [
1357
+ 'application/json'
1358
+ ]
1359
+ )
1360
+ )
1361
+ if _default_content_type is not None:
1362
+ _header_params['Content-Type'] = _default_content_type
1363
+
1364
+ # authentication setting
1365
+ _auth_settings: List[str] = [
1366
+ 'api-key'
1367
+ ]
1368
+
1369
+ return self.api_client.param_serialize(
1370
+ method='POST',
1371
+ resource_path='/v1/invoices/{invoiceId}/mark-uncollectible',
1372
+ path_params=_path_params,
1373
+ query_params=_query_params,
1374
+ header_params=_header_params,
1375
+ body=_body_params,
1376
+ post_params=_form_params,
1377
+ files=_files,
1378
+ auth_settings=_auth_settings,
1379
+ collection_formats=_collection_formats,
1380
+ _host=_host,
1381
+ _request_auth=_request_auth
1382
+ )
1383
+
1384
+
1385
+
1386
+
1387
+ @validate_call
1388
+ def preview_invoice(
1389
+ self,
1390
+ environment: StrictStr,
1391
+ merchant_account_id: StrictStr,
1392
+ invoice_create_request: InvoiceCreateRequest,
1393
+ _request_timeout: Union[
1394
+ None,
1395
+ Annotated[StrictFloat, Field(gt=0)],
1396
+ Tuple[
1397
+ Annotated[StrictFloat, Field(gt=0)],
1398
+ Annotated[StrictFloat, Field(gt=0)]
1399
+ ]
1400
+ ] = None,
1401
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1402
+ _content_type: Optional[StrictStr] = None,
1403
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1404
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1405
+ ) -> ApiWriteEnvelope:
1406
+ """Preview an invoice
1407
+
1408
+
1409
+ :param environment: (required)
1410
+ :type environment: str
1411
+ :param merchant_account_id: (required)
1412
+ :type merchant_account_id: str
1413
+ :param invoice_create_request: (required)
1414
+ :type invoice_create_request: InvoiceCreateRequest
1415
+ :param _request_timeout: timeout setting for this request. If one
1416
+ number provided, it will be total request
1417
+ timeout. It can also be a pair (tuple) of
1418
+ (connection, read) timeouts.
1419
+ :type _request_timeout: int, tuple(int, int), optional
1420
+ :param _request_auth: set to override the auth_settings for an a single
1421
+ request; this effectively ignores the
1422
+ authentication in the spec for a single request.
1423
+ :type _request_auth: dict, optional
1424
+ :param _content_type: force content-type for the request.
1425
+ :type _content_type: str, Optional
1426
+ :param _headers: set to override the headers for a single
1427
+ request; this effectively ignores the headers
1428
+ in the spec for a single request.
1429
+ :type _headers: dict, optional
1430
+ :param _host_index: set to override the host_index for a single
1431
+ request; this effectively ignores the host_index
1432
+ in the spec for a single request.
1433
+ :type _host_index: int, optional
1434
+ :return: Returns the result object.
1435
+ """ # noqa: E501
1436
+
1437
+ _param = self._preview_invoice_serialize(
1438
+ environment=environment,
1439
+ merchant_account_id=merchant_account_id,
1440
+ invoice_create_request=invoice_create_request,
1441
+ _request_auth=_request_auth,
1442
+ _content_type=_content_type,
1443
+ _headers=_headers,
1444
+ _host_index=_host_index
1445
+ )
1446
+
1447
+ _response_types_map: Dict[str, Optional[str]] = {
1448
+ '200': "ApiWriteEnvelope",
1449
+ '400': "ApiError",
1450
+ '401': "ApiError",
1451
+ '409': "ApiError",
1452
+ '422': "ApiError",
1453
+ '429': "ApiError",
1454
+ }
1455
+ response_data = self.api_client.call_api(
1456
+ *_param,
1457
+ _request_timeout=_request_timeout
1458
+ )
1459
+ response_data.read()
1460
+ return self.api_client.response_deserialize(
1461
+ response_data=response_data,
1462
+ response_types_map=_response_types_map,
1463
+ ).data
1464
+
1465
+
1466
+ @validate_call
1467
+ def preview_invoice_with_http_info(
1468
+ self,
1469
+ environment: StrictStr,
1470
+ merchant_account_id: StrictStr,
1471
+ invoice_create_request: InvoiceCreateRequest,
1472
+ _request_timeout: Union[
1473
+ None,
1474
+ Annotated[StrictFloat, Field(gt=0)],
1475
+ Tuple[
1476
+ Annotated[StrictFloat, Field(gt=0)],
1477
+ Annotated[StrictFloat, Field(gt=0)]
1478
+ ]
1479
+ ] = None,
1480
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1481
+ _content_type: Optional[StrictStr] = None,
1482
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1483
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1484
+ ) -> ApiResponse[ApiWriteEnvelope]:
1485
+ """Preview an invoice
1486
+
1487
+
1488
+ :param environment: (required)
1489
+ :type environment: str
1490
+ :param merchant_account_id: (required)
1491
+ :type merchant_account_id: str
1492
+ :param invoice_create_request: (required)
1493
+ :type invoice_create_request: InvoiceCreateRequest
1494
+ :param _request_timeout: timeout setting for this request. If one
1495
+ number provided, it will be total request
1496
+ timeout. It can also be a pair (tuple) of
1497
+ (connection, read) timeouts.
1498
+ :type _request_timeout: int, tuple(int, int), optional
1499
+ :param _request_auth: set to override the auth_settings for an a single
1500
+ request; this effectively ignores the
1501
+ authentication in the spec for a single request.
1502
+ :type _request_auth: dict, optional
1503
+ :param _content_type: force content-type for the request.
1504
+ :type _content_type: str, Optional
1505
+ :param _headers: set to override the headers for a single
1506
+ request; this effectively ignores the headers
1507
+ in the spec for a single request.
1508
+ :type _headers: dict, optional
1509
+ :param _host_index: set to override the host_index for a single
1510
+ request; this effectively ignores the host_index
1511
+ in the spec for a single request.
1512
+ :type _host_index: int, optional
1513
+ :return: Returns the result object.
1514
+ """ # noqa: E501
1515
+
1516
+ _param = self._preview_invoice_serialize(
1517
+ environment=environment,
1518
+ merchant_account_id=merchant_account_id,
1519
+ invoice_create_request=invoice_create_request,
1520
+ _request_auth=_request_auth,
1521
+ _content_type=_content_type,
1522
+ _headers=_headers,
1523
+ _host_index=_host_index
1524
+ )
1525
+
1526
+ _response_types_map: Dict[str, Optional[str]] = {
1527
+ '200': "ApiWriteEnvelope",
1528
+ '400': "ApiError",
1529
+ '401': "ApiError",
1530
+ '409': "ApiError",
1531
+ '422': "ApiError",
1532
+ '429': "ApiError",
1533
+ }
1534
+ response_data = self.api_client.call_api(
1535
+ *_param,
1536
+ _request_timeout=_request_timeout
1537
+ )
1538
+ response_data.read()
1539
+ return self.api_client.response_deserialize(
1540
+ response_data=response_data,
1541
+ response_types_map=_response_types_map,
1542
+ )
1543
+
1544
+
1545
+ @validate_call
1546
+ def preview_invoice_without_preload_content(
1547
+ self,
1548
+ environment: StrictStr,
1549
+ merchant_account_id: StrictStr,
1550
+ invoice_create_request: InvoiceCreateRequest,
1551
+ _request_timeout: Union[
1552
+ None,
1553
+ Annotated[StrictFloat, Field(gt=0)],
1554
+ Tuple[
1555
+ Annotated[StrictFloat, Field(gt=0)],
1556
+ Annotated[StrictFloat, Field(gt=0)]
1557
+ ]
1558
+ ] = None,
1559
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1560
+ _content_type: Optional[StrictStr] = None,
1561
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1562
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1563
+ ) -> RESTResponseType:
1564
+ """Preview an invoice
1565
+
1566
+
1567
+ :param environment: (required)
1568
+ :type environment: str
1569
+ :param merchant_account_id: (required)
1570
+ :type merchant_account_id: str
1571
+ :param invoice_create_request: (required)
1572
+ :type invoice_create_request: InvoiceCreateRequest
1573
+ :param _request_timeout: timeout setting for this request. If one
1574
+ number provided, it will be total request
1575
+ timeout. It can also be a pair (tuple) of
1576
+ (connection, read) timeouts.
1577
+ :type _request_timeout: int, tuple(int, int), optional
1578
+ :param _request_auth: set to override the auth_settings for an a single
1579
+ request; this effectively ignores the
1580
+ authentication in the spec for a single request.
1581
+ :type _request_auth: dict, optional
1582
+ :param _content_type: force content-type for the request.
1583
+ :type _content_type: str, Optional
1584
+ :param _headers: set to override the headers for a single
1585
+ request; this effectively ignores the headers
1586
+ in the spec for a single request.
1587
+ :type _headers: dict, optional
1588
+ :param _host_index: set to override the host_index for a single
1589
+ request; this effectively ignores the host_index
1590
+ in the spec for a single request.
1591
+ :type _host_index: int, optional
1592
+ :return: Returns the result object.
1593
+ """ # noqa: E501
1594
+
1595
+ _param = self._preview_invoice_serialize(
1596
+ environment=environment,
1597
+ merchant_account_id=merchant_account_id,
1598
+ invoice_create_request=invoice_create_request,
1599
+ _request_auth=_request_auth,
1600
+ _content_type=_content_type,
1601
+ _headers=_headers,
1602
+ _host_index=_host_index
1603
+ )
1604
+
1605
+ _response_types_map: Dict[str, Optional[str]] = {
1606
+ '200': "ApiWriteEnvelope",
1607
+ '400': "ApiError",
1608
+ '401': "ApiError",
1609
+ '409': "ApiError",
1610
+ '422': "ApiError",
1611
+ '429': "ApiError",
1612
+ }
1613
+ response_data = self.api_client.call_api(
1614
+ *_param,
1615
+ _request_timeout=_request_timeout
1616
+ )
1617
+ return response_data.response
1618
+
1619
+
1620
+ def _preview_invoice_serialize(
1621
+ self,
1622
+ environment,
1623
+ merchant_account_id,
1624
+ invoice_create_request,
1625
+ _request_auth,
1626
+ _content_type,
1627
+ _headers,
1628
+ _host_index,
1629
+ ) -> RequestSerialized:
1630
+
1631
+ _host = None
1632
+
1633
+ _collection_formats: Dict[str, str] = {
1634
+ }
1635
+
1636
+ _path_params: Dict[str, str] = {}
1637
+ _query_params: List[Tuple[str, str]] = []
1638
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1639
+ _form_params: List[Tuple[str, str]] = []
1640
+ _files: Dict[
1641
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1642
+ ] = {}
1643
+ _body_params: Optional[bytes] = None
1644
+
1645
+ # process the path parameters
1646
+ # process the query parameters
1647
+ if environment is not None:
1648
+
1649
+ _query_params.append(('environment', environment))
1650
+
1651
+ if merchant_account_id is not None:
1652
+
1653
+ _query_params.append(('merchantAccountId', merchant_account_id))
1654
+
1655
+ # process the header parameters
1656
+ # process the form parameters
1657
+ # process the body parameter
1658
+ if invoice_create_request is not None:
1659
+ _body_params = invoice_create_request
1660
+
1661
+
1662
+ # set the HTTP header `Accept`
1663
+ if 'Accept' not in _header_params:
1664
+ _header_params['Accept'] = self.api_client.select_header_accept(
1665
+ [
1666
+ 'application/json'
1667
+ ]
1668
+ )
1669
+
1670
+ # set the HTTP header `Content-Type`
1671
+ if _content_type:
1672
+ _header_params['Content-Type'] = _content_type
1673
+ else:
1674
+ _default_content_type = (
1675
+ self.api_client.select_header_content_type(
1676
+ [
1677
+ 'application/json'
1678
+ ]
1679
+ )
1680
+ )
1681
+ if _default_content_type is not None:
1682
+ _header_params['Content-Type'] = _default_content_type
1683
+
1684
+ # authentication setting
1685
+ _auth_settings: List[str] = [
1686
+ 'api-key'
1687
+ ]
1688
+
1689
+ return self.api_client.param_serialize(
1690
+ method='POST',
1691
+ resource_path='/v1/invoices/preview',
1692
+ path_params=_path_params,
1693
+ query_params=_query_params,
1694
+ header_params=_header_params,
1695
+ body=_body_params,
1696
+ post_params=_form_params,
1697
+ files=_files,
1698
+ auth_settings=_auth_settings,
1699
+ collection_formats=_collection_formats,
1700
+ _host=_host,
1701
+ _request_auth=_request_auth
1702
+ )
1703
+
1704
+
1705
+
1706
+
1707
+ @validate_call
1708
+ def refresh_invoice(
1709
+ self,
1710
+ invoice_id: StrictStr,
1711
+ environment: StrictStr,
1712
+ merchant_account_id: StrictStr,
1713
+ body: Dict[str, Any],
1714
+ 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,
1715
+ _request_timeout: Union[
1716
+ None,
1717
+ Annotated[StrictFloat, Field(gt=0)],
1718
+ Tuple[
1719
+ Annotated[StrictFloat, Field(gt=0)],
1720
+ Annotated[StrictFloat, Field(gt=0)]
1721
+ ]
1722
+ ] = None,
1723
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1724
+ _content_type: Optional[StrictStr] = None,
1725
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1726
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1727
+ ) -> ApiWriteEnvelope:
1728
+ """Refresh a draft invoice
1729
+
1730
+
1731
+ :param invoice_id: (required)
1732
+ :type invoice_id: str
1733
+ :param environment: (required)
1734
+ :type environment: str
1735
+ :param merchant_account_id: (required)
1736
+ :type merchant_account_id: str
1737
+ :param body: (required)
1738
+ :type body: object
1739
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1740
+ :type idempotency_key: str
1741
+ :param _request_timeout: timeout setting for this request. If one
1742
+ number provided, it will be total request
1743
+ timeout. It can also be a pair (tuple) of
1744
+ (connection, read) timeouts.
1745
+ :type _request_timeout: int, tuple(int, int), optional
1746
+ :param _request_auth: set to override the auth_settings for an a single
1747
+ request; this effectively ignores the
1748
+ authentication in the spec for a single request.
1749
+ :type _request_auth: dict, optional
1750
+ :param _content_type: force content-type for the request.
1751
+ :type _content_type: str, Optional
1752
+ :param _headers: set to override the headers for a single
1753
+ request; this effectively ignores the headers
1754
+ in the spec for a single request.
1755
+ :type _headers: dict, optional
1756
+ :param _host_index: set to override the host_index for a single
1757
+ request; this effectively ignores the host_index
1758
+ in the spec for a single request.
1759
+ :type _host_index: int, optional
1760
+ :return: Returns the result object.
1761
+ """ # noqa: E501
1762
+
1763
+ _param = self._refresh_invoice_serialize(
1764
+ invoice_id=invoice_id,
1765
+ environment=environment,
1766
+ merchant_account_id=merchant_account_id,
1767
+ body=body,
1768
+ idempotency_key=idempotency_key,
1769
+ _request_auth=_request_auth,
1770
+ _content_type=_content_type,
1771
+ _headers=_headers,
1772
+ _host_index=_host_index
1773
+ )
1774
+
1775
+ _response_types_map: Dict[str, Optional[str]] = {
1776
+ '200': "ApiWriteEnvelope",
1777
+ '400': "ApiError",
1778
+ '401': "ApiError",
1779
+ '409': "ApiError",
1780
+ '422': "ApiError",
1781
+ '429': "ApiError",
1782
+ }
1783
+ response_data = self.api_client.call_api(
1784
+ *_param,
1785
+ _request_timeout=_request_timeout
1786
+ )
1787
+ response_data.read()
1788
+ return self.api_client.response_deserialize(
1789
+ response_data=response_data,
1790
+ response_types_map=_response_types_map,
1791
+ ).data
1792
+
1793
+
1794
+ @validate_call
1795
+ def refresh_invoice_with_http_info(
1796
+ self,
1797
+ invoice_id: StrictStr,
1798
+ environment: StrictStr,
1799
+ merchant_account_id: StrictStr,
1800
+ body: Dict[str, Any],
1801
+ 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,
1802
+ _request_timeout: Union[
1803
+ None,
1804
+ Annotated[StrictFloat, Field(gt=0)],
1805
+ Tuple[
1806
+ Annotated[StrictFloat, Field(gt=0)],
1807
+ Annotated[StrictFloat, Field(gt=0)]
1808
+ ]
1809
+ ] = None,
1810
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1811
+ _content_type: Optional[StrictStr] = None,
1812
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1813
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1814
+ ) -> ApiResponse[ApiWriteEnvelope]:
1815
+ """Refresh a draft invoice
1816
+
1817
+
1818
+ :param invoice_id: (required)
1819
+ :type invoice_id: str
1820
+ :param environment: (required)
1821
+ :type environment: str
1822
+ :param merchant_account_id: (required)
1823
+ :type merchant_account_id: str
1824
+ :param body: (required)
1825
+ :type body: object
1826
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1827
+ :type idempotency_key: str
1828
+ :param _request_timeout: timeout setting for this request. If one
1829
+ number provided, it will be total request
1830
+ timeout. It can also be a pair (tuple) of
1831
+ (connection, read) timeouts.
1832
+ :type _request_timeout: int, tuple(int, int), optional
1833
+ :param _request_auth: set to override the auth_settings for an a single
1834
+ request; this effectively ignores the
1835
+ authentication in the spec for a single request.
1836
+ :type _request_auth: dict, optional
1837
+ :param _content_type: force content-type for the request.
1838
+ :type _content_type: str, Optional
1839
+ :param _headers: set to override the headers for a single
1840
+ request; this effectively ignores the headers
1841
+ in the spec for a single request.
1842
+ :type _headers: dict, optional
1843
+ :param _host_index: set to override the host_index for a single
1844
+ request; this effectively ignores the host_index
1845
+ in the spec for a single request.
1846
+ :type _host_index: int, optional
1847
+ :return: Returns the result object.
1848
+ """ # noqa: E501
1849
+
1850
+ _param = self._refresh_invoice_serialize(
1851
+ invoice_id=invoice_id,
1852
+ environment=environment,
1853
+ merchant_account_id=merchant_account_id,
1854
+ body=body,
1855
+ idempotency_key=idempotency_key,
1856
+ _request_auth=_request_auth,
1857
+ _content_type=_content_type,
1858
+ _headers=_headers,
1859
+ _host_index=_host_index
1860
+ )
1861
+
1862
+ _response_types_map: Dict[str, Optional[str]] = {
1863
+ '200': "ApiWriteEnvelope",
1864
+ '400': "ApiError",
1865
+ '401': "ApiError",
1866
+ '409': "ApiError",
1867
+ '422': "ApiError",
1868
+ '429': "ApiError",
1869
+ }
1870
+ response_data = self.api_client.call_api(
1871
+ *_param,
1872
+ _request_timeout=_request_timeout
1873
+ )
1874
+ response_data.read()
1875
+ return self.api_client.response_deserialize(
1876
+ response_data=response_data,
1877
+ response_types_map=_response_types_map,
1878
+ )
1879
+
1880
+
1881
+ @validate_call
1882
+ def refresh_invoice_without_preload_content(
1883
+ self,
1884
+ invoice_id: StrictStr,
1885
+ environment: StrictStr,
1886
+ merchant_account_id: StrictStr,
1887
+ body: Dict[str, Any],
1888
+ 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,
1889
+ _request_timeout: Union[
1890
+ None,
1891
+ Annotated[StrictFloat, Field(gt=0)],
1892
+ Tuple[
1893
+ Annotated[StrictFloat, Field(gt=0)],
1894
+ Annotated[StrictFloat, Field(gt=0)]
1895
+ ]
1896
+ ] = None,
1897
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1898
+ _content_type: Optional[StrictStr] = None,
1899
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1900
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1901
+ ) -> RESTResponseType:
1902
+ """Refresh a draft invoice
1903
+
1904
+
1905
+ :param invoice_id: (required)
1906
+ :type invoice_id: str
1907
+ :param environment: (required)
1908
+ :type environment: str
1909
+ :param merchant_account_id: (required)
1910
+ :type merchant_account_id: str
1911
+ :param body: (required)
1912
+ :type body: object
1913
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1914
+ :type idempotency_key: str
1915
+ :param _request_timeout: timeout setting for this request. If one
1916
+ number provided, it will be total request
1917
+ timeout. It can also be a pair (tuple) of
1918
+ (connection, read) timeouts.
1919
+ :type _request_timeout: int, tuple(int, int), optional
1920
+ :param _request_auth: set to override the auth_settings for an a single
1921
+ request; this effectively ignores the
1922
+ authentication in the spec for a single request.
1923
+ :type _request_auth: dict, optional
1924
+ :param _content_type: force content-type for the request.
1925
+ :type _content_type: str, Optional
1926
+ :param _headers: set to override the headers for a single
1927
+ request; this effectively ignores the headers
1928
+ in the spec for a single request.
1929
+ :type _headers: dict, optional
1930
+ :param _host_index: set to override the host_index for a single
1931
+ request; this effectively ignores the host_index
1932
+ in the spec for a single request.
1933
+ :type _host_index: int, optional
1934
+ :return: Returns the result object.
1935
+ """ # noqa: E501
1936
+
1937
+ _param = self._refresh_invoice_serialize(
1938
+ invoice_id=invoice_id,
1939
+ environment=environment,
1940
+ merchant_account_id=merchant_account_id,
1941
+ body=body,
1942
+ idempotency_key=idempotency_key,
1943
+ _request_auth=_request_auth,
1944
+ _content_type=_content_type,
1945
+ _headers=_headers,
1946
+ _host_index=_host_index
1947
+ )
1948
+
1949
+ _response_types_map: Dict[str, Optional[str]] = {
1950
+ '200': "ApiWriteEnvelope",
1951
+ '400': "ApiError",
1952
+ '401': "ApiError",
1953
+ '409': "ApiError",
1954
+ '422': "ApiError",
1955
+ '429': "ApiError",
1956
+ }
1957
+ response_data = self.api_client.call_api(
1958
+ *_param,
1959
+ _request_timeout=_request_timeout
1960
+ )
1961
+ return response_data.response
1962
+
1963
+
1964
+ def _refresh_invoice_serialize(
1965
+ self,
1966
+ invoice_id,
1967
+ environment,
1968
+ merchant_account_id,
1969
+ body,
1970
+ idempotency_key,
1971
+ _request_auth,
1972
+ _content_type,
1973
+ _headers,
1974
+ _host_index,
1975
+ ) -> RequestSerialized:
1976
+
1977
+ _host = None
1978
+
1979
+ _collection_formats: Dict[str, str] = {
1980
+ }
1981
+
1982
+ _path_params: Dict[str, str] = {}
1983
+ _query_params: List[Tuple[str, str]] = []
1984
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1985
+ _form_params: List[Tuple[str, str]] = []
1986
+ _files: Dict[
1987
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1988
+ ] = {}
1989
+ _body_params: Optional[bytes] = None
1990
+
1991
+ # process the path parameters
1992
+ if invoice_id is not None:
1993
+ _path_params['invoiceId'] = invoice_id
1994
+ # process the query parameters
1995
+ if environment is not None:
1996
+
1997
+ _query_params.append(('environment', environment))
1998
+
1999
+ if merchant_account_id is not None:
2000
+
2001
+ _query_params.append(('merchantAccountId', merchant_account_id))
2002
+
2003
+ # process the header parameters
2004
+ if idempotency_key is not None:
2005
+ _header_params['Idempotency-Key'] = idempotency_key
2006
+ # process the form parameters
2007
+ # process the body parameter
2008
+ if body is not None:
2009
+ _body_params = body
2010
+
2011
+
2012
+ # set the HTTP header `Accept`
2013
+ if 'Accept' not in _header_params:
2014
+ _header_params['Accept'] = self.api_client.select_header_accept(
2015
+ [
2016
+ 'application/json'
2017
+ ]
2018
+ )
2019
+
2020
+ # set the HTTP header `Content-Type`
2021
+ if _content_type:
2022
+ _header_params['Content-Type'] = _content_type
2023
+ else:
2024
+ _default_content_type = (
2025
+ self.api_client.select_header_content_type(
2026
+ [
2027
+ 'application/json'
2028
+ ]
2029
+ )
2030
+ )
2031
+ if _default_content_type is not None:
2032
+ _header_params['Content-Type'] = _default_content_type
2033
+
2034
+ # authentication setting
2035
+ _auth_settings: List[str] = [
2036
+ 'api-key'
2037
+ ]
2038
+
2039
+ return self.api_client.param_serialize(
2040
+ method='POST',
2041
+ resource_path='/v1/invoices/{invoiceId}/refresh',
2042
+ path_params=_path_params,
2043
+ query_params=_query_params,
2044
+ header_params=_header_params,
2045
+ body=_body_params,
2046
+ post_params=_form_params,
2047
+ files=_files,
2048
+ auth_settings=_auth_settings,
2049
+ collection_formats=_collection_formats,
2050
+ _host=_host,
2051
+ _request_auth=_request_auth
2052
+ )
2053
+
2054
+
2055
+
2056
+
2057
+ @validate_call
2058
+ def void_invoice(
2059
+ self,
2060
+ invoice_id: StrictStr,
2061
+ environment: StrictStr,
2062
+ merchant_account_id: StrictStr,
2063
+ invoice_void_request: InvoiceVoidRequest,
2064
+ 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,
2065
+ _request_timeout: Union[
2066
+ None,
2067
+ Annotated[StrictFloat, Field(gt=0)],
2068
+ Tuple[
2069
+ Annotated[StrictFloat, Field(gt=0)],
2070
+ Annotated[StrictFloat, Field(gt=0)]
2071
+ ]
2072
+ ] = None,
2073
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2074
+ _content_type: Optional[StrictStr] = None,
2075
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2076
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2077
+ ) -> ApiWriteEnvelope:
2078
+ """Void a draft or open invoice
2079
+
2080
+
2081
+ :param invoice_id: (required)
2082
+ :type invoice_id: str
2083
+ :param environment: (required)
2084
+ :type environment: str
2085
+ :param merchant_account_id: (required)
2086
+ :type merchant_account_id: str
2087
+ :param invoice_void_request: (required)
2088
+ :type invoice_void_request: InvoiceVoidRequest
2089
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
2090
+ :type idempotency_key: str
2091
+ :param _request_timeout: timeout setting for this request. If one
2092
+ number provided, it will be total request
2093
+ timeout. It can also be a pair (tuple) of
2094
+ (connection, read) timeouts.
2095
+ :type _request_timeout: int, tuple(int, int), optional
2096
+ :param _request_auth: set to override the auth_settings for an a single
2097
+ request; this effectively ignores the
2098
+ authentication in the spec for a single request.
2099
+ :type _request_auth: dict, optional
2100
+ :param _content_type: force content-type for the request.
2101
+ :type _content_type: str, Optional
2102
+ :param _headers: set to override the headers for a single
2103
+ request; this effectively ignores the headers
2104
+ in the spec for a single request.
2105
+ :type _headers: dict, optional
2106
+ :param _host_index: set to override the host_index for a single
2107
+ request; this effectively ignores the host_index
2108
+ in the spec for a single request.
2109
+ :type _host_index: int, optional
2110
+ :return: Returns the result object.
2111
+ """ # noqa: E501
2112
+
2113
+ _param = self._void_invoice_serialize(
2114
+ invoice_id=invoice_id,
2115
+ environment=environment,
2116
+ merchant_account_id=merchant_account_id,
2117
+ invoice_void_request=invoice_void_request,
2118
+ idempotency_key=idempotency_key,
2119
+ _request_auth=_request_auth,
2120
+ _content_type=_content_type,
2121
+ _headers=_headers,
2122
+ _host_index=_host_index
2123
+ )
2124
+
2125
+ _response_types_map: Dict[str, Optional[str]] = {
2126
+ '200': "ApiWriteEnvelope",
2127
+ '400': "ApiError",
2128
+ '401': "ApiError",
2129
+ '409': "ApiError",
2130
+ '422': "ApiError",
2131
+ '429': "ApiError",
2132
+ }
2133
+ response_data = self.api_client.call_api(
2134
+ *_param,
2135
+ _request_timeout=_request_timeout
2136
+ )
2137
+ response_data.read()
2138
+ return self.api_client.response_deserialize(
2139
+ response_data=response_data,
2140
+ response_types_map=_response_types_map,
2141
+ ).data
2142
+
2143
+
2144
+ @validate_call
2145
+ def void_invoice_with_http_info(
2146
+ self,
2147
+ invoice_id: StrictStr,
2148
+ environment: StrictStr,
2149
+ merchant_account_id: StrictStr,
2150
+ invoice_void_request: InvoiceVoidRequest,
2151
+ 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,
2152
+ _request_timeout: Union[
2153
+ None,
2154
+ Annotated[StrictFloat, Field(gt=0)],
2155
+ Tuple[
2156
+ Annotated[StrictFloat, Field(gt=0)],
2157
+ Annotated[StrictFloat, Field(gt=0)]
2158
+ ]
2159
+ ] = None,
2160
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2161
+ _content_type: Optional[StrictStr] = None,
2162
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2163
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2164
+ ) -> ApiResponse[ApiWriteEnvelope]:
2165
+ """Void a draft or open invoice
2166
+
2167
+
2168
+ :param invoice_id: (required)
2169
+ :type invoice_id: str
2170
+ :param environment: (required)
2171
+ :type environment: str
2172
+ :param merchant_account_id: (required)
2173
+ :type merchant_account_id: str
2174
+ :param invoice_void_request: (required)
2175
+ :type invoice_void_request: InvoiceVoidRequest
2176
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
2177
+ :type idempotency_key: str
2178
+ :param _request_timeout: timeout setting for this request. If one
2179
+ number provided, it will be total request
2180
+ timeout. It can also be a pair (tuple) of
2181
+ (connection, read) timeouts.
2182
+ :type _request_timeout: int, tuple(int, int), optional
2183
+ :param _request_auth: set to override the auth_settings for an a single
2184
+ request; this effectively ignores the
2185
+ authentication in the spec for a single request.
2186
+ :type _request_auth: dict, optional
2187
+ :param _content_type: force content-type for the request.
2188
+ :type _content_type: str, Optional
2189
+ :param _headers: set to override the headers for a single
2190
+ request; this effectively ignores the headers
2191
+ in the spec for a single request.
2192
+ :type _headers: dict, optional
2193
+ :param _host_index: set to override the host_index for a single
2194
+ request; this effectively ignores the host_index
2195
+ in the spec for a single request.
2196
+ :type _host_index: int, optional
2197
+ :return: Returns the result object.
2198
+ """ # noqa: E501
2199
+
2200
+ _param = self._void_invoice_serialize(
2201
+ invoice_id=invoice_id,
2202
+ environment=environment,
2203
+ merchant_account_id=merchant_account_id,
2204
+ invoice_void_request=invoice_void_request,
2205
+ idempotency_key=idempotency_key,
2206
+ _request_auth=_request_auth,
2207
+ _content_type=_content_type,
2208
+ _headers=_headers,
2209
+ _host_index=_host_index
2210
+ )
2211
+
2212
+ _response_types_map: Dict[str, Optional[str]] = {
2213
+ '200': "ApiWriteEnvelope",
2214
+ '400': "ApiError",
2215
+ '401': "ApiError",
2216
+ '409': "ApiError",
2217
+ '422': "ApiError",
2218
+ '429': "ApiError",
2219
+ }
2220
+ response_data = self.api_client.call_api(
2221
+ *_param,
2222
+ _request_timeout=_request_timeout
2223
+ )
2224
+ response_data.read()
2225
+ return self.api_client.response_deserialize(
2226
+ response_data=response_data,
2227
+ response_types_map=_response_types_map,
2228
+ )
2229
+
2230
+
2231
+ @validate_call
2232
+ def void_invoice_without_preload_content(
2233
+ self,
2234
+ invoice_id: StrictStr,
2235
+ environment: StrictStr,
2236
+ merchant_account_id: StrictStr,
2237
+ invoice_void_request: InvoiceVoidRequest,
2238
+ 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,
2239
+ _request_timeout: Union[
2240
+ None,
2241
+ Annotated[StrictFloat, Field(gt=0)],
2242
+ Tuple[
2243
+ Annotated[StrictFloat, Field(gt=0)],
2244
+ Annotated[StrictFloat, Field(gt=0)]
2245
+ ]
2246
+ ] = None,
2247
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2248
+ _content_type: Optional[StrictStr] = None,
2249
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2250
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2251
+ ) -> RESTResponseType:
2252
+ """Void a draft or open invoice
2253
+
2254
+
2255
+ :param invoice_id: (required)
2256
+ :type invoice_id: str
2257
+ :param environment: (required)
2258
+ :type environment: str
2259
+ :param merchant_account_id: (required)
2260
+ :type merchant_account_id: str
2261
+ :param invoice_void_request: (required)
2262
+ :type invoice_void_request: InvoiceVoidRequest
2263
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
2264
+ :type idempotency_key: str
2265
+ :param _request_timeout: timeout setting for this request. If one
2266
+ number provided, it will be total request
2267
+ timeout. It can also be a pair (tuple) of
2268
+ (connection, read) timeouts.
2269
+ :type _request_timeout: int, tuple(int, int), optional
2270
+ :param _request_auth: set to override the auth_settings for an a single
2271
+ request; this effectively ignores the
2272
+ authentication in the spec for a single request.
2273
+ :type _request_auth: dict, optional
2274
+ :param _content_type: force content-type for the request.
2275
+ :type _content_type: str, Optional
2276
+ :param _headers: set to override the headers for a single
2277
+ request; this effectively ignores the headers
2278
+ in the spec for a single request.
2279
+ :type _headers: dict, optional
2280
+ :param _host_index: set to override the host_index for a single
2281
+ request; this effectively ignores the host_index
2282
+ in the spec for a single request.
2283
+ :type _host_index: int, optional
2284
+ :return: Returns the result object.
2285
+ """ # noqa: E501
2286
+
2287
+ _param = self._void_invoice_serialize(
2288
+ invoice_id=invoice_id,
2289
+ environment=environment,
2290
+ merchant_account_id=merchant_account_id,
2291
+ invoice_void_request=invoice_void_request,
2292
+ idempotency_key=idempotency_key,
2293
+ _request_auth=_request_auth,
2294
+ _content_type=_content_type,
2295
+ _headers=_headers,
2296
+ _host_index=_host_index
2297
+ )
2298
+
2299
+ _response_types_map: Dict[str, Optional[str]] = {
2300
+ '200': "ApiWriteEnvelope",
2301
+ '400': "ApiError",
2302
+ '401': "ApiError",
2303
+ '409': "ApiError",
2304
+ '422': "ApiError",
2305
+ '429': "ApiError",
2306
+ }
2307
+ response_data = self.api_client.call_api(
2308
+ *_param,
2309
+ _request_timeout=_request_timeout
2310
+ )
2311
+ return response_data.response
2312
+
2313
+
2314
+ def _void_invoice_serialize(
2315
+ self,
2316
+ invoice_id,
2317
+ environment,
2318
+ merchant_account_id,
2319
+ invoice_void_request,
2320
+ idempotency_key,
2321
+ _request_auth,
2322
+ _content_type,
2323
+ _headers,
2324
+ _host_index,
2325
+ ) -> RequestSerialized:
2326
+
2327
+ _host = None
2328
+
2329
+ _collection_formats: Dict[str, str] = {
2330
+ }
2331
+
2332
+ _path_params: Dict[str, str] = {}
2333
+ _query_params: List[Tuple[str, str]] = []
2334
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2335
+ _form_params: List[Tuple[str, str]] = []
2336
+ _files: Dict[
2337
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2338
+ ] = {}
2339
+ _body_params: Optional[bytes] = None
2340
+
2341
+ # process the path parameters
2342
+ if invoice_id is not None:
2343
+ _path_params['invoiceId'] = invoice_id
2344
+ # process the query parameters
2345
+ if environment is not None:
2346
+
2347
+ _query_params.append(('environment', environment))
2348
+
2349
+ if merchant_account_id is not None:
2350
+
2351
+ _query_params.append(('merchantAccountId', merchant_account_id))
2352
+
2353
+ # process the header parameters
2354
+ if idempotency_key is not None:
2355
+ _header_params['Idempotency-Key'] = idempotency_key
2356
+ # process the form parameters
2357
+ # process the body parameter
2358
+ if invoice_void_request is not None:
2359
+ _body_params = invoice_void_request
2360
+
2361
+
2362
+ # set the HTTP header `Accept`
2363
+ if 'Accept' not in _header_params:
2364
+ _header_params['Accept'] = self.api_client.select_header_accept(
2365
+ [
2366
+ 'application/json'
2367
+ ]
2368
+ )
2369
+
2370
+ # set the HTTP header `Content-Type`
2371
+ if _content_type:
2372
+ _header_params['Content-Type'] = _content_type
2373
+ else:
2374
+ _default_content_type = (
2375
+ self.api_client.select_header_content_type(
2376
+ [
2377
+ 'application/json'
2378
+ ]
2379
+ )
2380
+ )
2381
+ if _default_content_type is not None:
2382
+ _header_params['Content-Type'] = _default_content_type
2383
+
2384
+ # authentication setting
2385
+ _auth_settings: List[str] = [
2386
+ 'api-key'
2387
+ ]
2388
+
2389
+ return self.api_client.param_serialize(
2390
+ method='DELETE',
2391
+ resource_path='/v1/invoices/{invoiceId}/void',
2392
+ path_params=_path_params,
2393
+ query_params=_query_params,
2394
+ header_params=_header_params,
2395
+ body=_body_params,
2396
+ post_params=_form_params,
2397
+ files=_files,
2398
+ auth_settings=_auth_settings,
2399
+ collection_formats=_collection_formats,
2400
+ _host=_host,
2401
+ _request_auth=_request_auth
2402
+ )