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,1747 @@
1
+ """
2
+ Vortex Payments API
3
+
4
+ Public Vortex Payments API for customers, subscriptions, invoices, payment requests, checkout, receipts, webhooks, tax.
5
+
6
+ The version of the OpenAPI document: 2026-08
7
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+
9
+ Do not edit the class manually.
10
+ """ # noqa: E501
11
+
12
+
13
+ import warnings
14
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
15
+ from typing import Any, Dict, List, Optional, Tuple, Union
16
+ from typing_extensions import Annotated
17
+
18
+ from pydantic import Field, StrictStr
19
+ from typing import Optional
20
+ from typing_extensions import Annotated
21
+ from vortex.models.api_write_envelope import ApiWriteEnvelope
22
+ from vortex.models.expire_customer_balance_request import ExpireCustomerBalanceRequest
23
+ from vortex.models.grant_customer_balance_from_payment_request import GrantCustomerBalanceFromPaymentRequest
24
+ from vortex.models.grant_customer_balance_request import GrantCustomerBalanceRequest
25
+ from vortex.models.reverse_customer_balance_request import ReverseCustomerBalanceRequest
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 CustomerBalanceApi:
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 expire_customer_balance(
47
+ self,
48
+ customer_id: StrictStr,
49
+ environment: StrictStr,
50
+ merchant_account_id: StrictStr,
51
+ expire_customer_balance_request: ExpireCustomerBalanceRequest,
52
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
53
+ _request_timeout: Union[
54
+ None,
55
+ Annotated[StrictFloat, Field(gt=0)],
56
+ Tuple[
57
+ Annotated[StrictFloat, Field(gt=0)],
58
+ Annotated[StrictFloat, Field(gt=0)]
59
+ ]
60
+ ] = None,
61
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
62
+ _content_type: Optional[StrictStr] = None,
63
+ _headers: Optional[Dict[StrictStr, Any]] = None,
64
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
65
+ ) -> ApiWriteEnvelope:
66
+ """Expire prepaid customer balance
67
+
68
+
69
+ :param customer_id: (required)
70
+ :type customer_id: str
71
+ :param environment: (required)
72
+ :type environment: str
73
+ :param merchant_account_id: (required)
74
+ :type merchant_account_id: str
75
+ :param expire_customer_balance_request: (required)
76
+ :type expire_customer_balance_request: ExpireCustomerBalanceRequest
77
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
78
+ :type idempotency_key: str
79
+ :param _request_timeout: timeout setting for this request. If one
80
+ number provided, it will be total request
81
+ timeout. It can also be a pair (tuple) of
82
+ (connection, read) timeouts.
83
+ :type _request_timeout: int, tuple(int, int), optional
84
+ :param _request_auth: set to override the auth_settings for an a single
85
+ request; this effectively ignores the
86
+ authentication in the spec for a single request.
87
+ :type _request_auth: dict, optional
88
+ :param _content_type: force content-type for the request.
89
+ :type _content_type: str, Optional
90
+ :param _headers: set to override the headers for a single
91
+ request; this effectively ignores the headers
92
+ in the spec for a single request.
93
+ :type _headers: dict, optional
94
+ :param _host_index: set to override the host_index for a single
95
+ request; this effectively ignores the host_index
96
+ in the spec for a single request.
97
+ :type _host_index: int, optional
98
+ :return: Returns the result object.
99
+ """ # noqa: E501
100
+
101
+ _param = self._expire_customer_balance_serialize(
102
+ customer_id=customer_id,
103
+ environment=environment,
104
+ merchant_account_id=merchant_account_id,
105
+ expire_customer_balance_request=expire_customer_balance_request,
106
+ idempotency_key=idempotency_key,
107
+ _request_auth=_request_auth,
108
+ _content_type=_content_type,
109
+ _headers=_headers,
110
+ _host_index=_host_index
111
+ )
112
+
113
+ _response_types_map: Dict[str, Optional[str]] = {
114
+ '201': "ApiWriteEnvelope",
115
+ '400': "ApiError",
116
+ '401': "ApiError",
117
+ '409': "ApiError",
118
+ '422': "ApiError",
119
+ '429': "ApiError",
120
+ }
121
+ response_data = self.api_client.call_api(
122
+ *_param,
123
+ _request_timeout=_request_timeout
124
+ )
125
+ response_data.read()
126
+ return self.api_client.response_deserialize(
127
+ response_data=response_data,
128
+ response_types_map=_response_types_map,
129
+ ).data
130
+
131
+
132
+ @validate_call
133
+ def expire_customer_balance_with_http_info(
134
+ self,
135
+ customer_id: StrictStr,
136
+ environment: StrictStr,
137
+ merchant_account_id: StrictStr,
138
+ expire_customer_balance_request: ExpireCustomerBalanceRequest,
139
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
140
+ _request_timeout: Union[
141
+ None,
142
+ Annotated[StrictFloat, Field(gt=0)],
143
+ Tuple[
144
+ Annotated[StrictFloat, Field(gt=0)],
145
+ Annotated[StrictFloat, Field(gt=0)]
146
+ ]
147
+ ] = None,
148
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
149
+ _content_type: Optional[StrictStr] = None,
150
+ _headers: Optional[Dict[StrictStr, Any]] = None,
151
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
152
+ ) -> ApiResponse[ApiWriteEnvelope]:
153
+ """Expire prepaid customer balance
154
+
155
+
156
+ :param customer_id: (required)
157
+ :type customer_id: str
158
+ :param environment: (required)
159
+ :type environment: str
160
+ :param merchant_account_id: (required)
161
+ :type merchant_account_id: str
162
+ :param expire_customer_balance_request: (required)
163
+ :type expire_customer_balance_request: ExpireCustomerBalanceRequest
164
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
165
+ :type idempotency_key: str
166
+ :param _request_timeout: timeout setting for this request. If one
167
+ number provided, it will be total request
168
+ timeout. It can also be a pair (tuple) of
169
+ (connection, read) timeouts.
170
+ :type _request_timeout: int, tuple(int, int), optional
171
+ :param _request_auth: set to override the auth_settings for an a single
172
+ request; this effectively ignores the
173
+ authentication in the spec for a single request.
174
+ :type _request_auth: dict, optional
175
+ :param _content_type: force content-type for the request.
176
+ :type _content_type: str, Optional
177
+ :param _headers: set to override the headers for a single
178
+ request; this effectively ignores the headers
179
+ in the spec for a single request.
180
+ :type _headers: dict, optional
181
+ :param _host_index: set to override the host_index for a single
182
+ request; this effectively ignores the host_index
183
+ in the spec for a single request.
184
+ :type _host_index: int, optional
185
+ :return: Returns the result object.
186
+ """ # noqa: E501
187
+
188
+ _param = self._expire_customer_balance_serialize(
189
+ customer_id=customer_id,
190
+ environment=environment,
191
+ merchant_account_id=merchant_account_id,
192
+ expire_customer_balance_request=expire_customer_balance_request,
193
+ idempotency_key=idempotency_key,
194
+ _request_auth=_request_auth,
195
+ _content_type=_content_type,
196
+ _headers=_headers,
197
+ _host_index=_host_index
198
+ )
199
+
200
+ _response_types_map: Dict[str, Optional[str]] = {
201
+ '201': "ApiWriteEnvelope",
202
+ '400': "ApiError",
203
+ '401': "ApiError",
204
+ '409': "ApiError",
205
+ '422': "ApiError",
206
+ '429': "ApiError",
207
+ }
208
+ response_data = self.api_client.call_api(
209
+ *_param,
210
+ _request_timeout=_request_timeout
211
+ )
212
+ response_data.read()
213
+ return self.api_client.response_deserialize(
214
+ response_data=response_data,
215
+ response_types_map=_response_types_map,
216
+ )
217
+
218
+
219
+ @validate_call
220
+ def expire_customer_balance_without_preload_content(
221
+ self,
222
+ customer_id: StrictStr,
223
+ environment: StrictStr,
224
+ merchant_account_id: StrictStr,
225
+ expire_customer_balance_request: ExpireCustomerBalanceRequest,
226
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
227
+ _request_timeout: Union[
228
+ None,
229
+ Annotated[StrictFloat, Field(gt=0)],
230
+ Tuple[
231
+ Annotated[StrictFloat, Field(gt=0)],
232
+ Annotated[StrictFloat, Field(gt=0)]
233
+ ]
234
+ ] = None,
235
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
236
+ _content_type: Optional[StrictStr] = None,
237
+ _headers: Optional[Dict[StrictStr, Any]] = None,
238
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
239
+ ) -> RESTResponseType:
240
+ """Expire prepaid customer balance
241
+
242
+
243
+ :param customer_id: (required)
244
+ :type customer_id: str
245
+ :param environment: (required)
246
+ :type environment: str
247
+ :param merchant_account_id: (required)
248
+ :type merchant_account_id: str
249
+ :param expire_customer_balance_request: (required)
250
+ :type expire_customer_balance_request: ExpireCustomerBalanceRequest
251
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
252
+ :type idempotency_key: str
253
+ :param _request_timeout: timeout setting for this request. If one
254
+ number provided, it will be total request
255
+ timeout. It can also be a pair (tuple) of
256
+ (connection, read) timeouts.
257
+ :type _request_timeout: int, tuple(int, int), optional
258
+ :param _request_auth: set to override the auth_settings for an a single
259
+ request; this effectively ignores the
260
+ authentication in the spec for a single request.
261
+ :type _request_auth: dict, optional
262
+ :param _content_type: force content-type for the request.
263
+ :type _content_type: str, Optional
264
+ :param _headers: set to override the headers for a single
265
+ request; this effectively ignores the headers
266
+ in the spec for a single request.
267
+ :type _headers: dict, optional
268
+ :param _host_index: set to override the host_index for a single
269
+ request; this effectively ignores the host_index
270
+ in the spec for a single request.
271
+ :type _host_index: int, optional
272
+ :return: Returns the result object.
273
+ """ # noqa: E501
274
+
275
+ _param = self._expire_customer_balance_serialize(
276
+ customer_id=customer_id,
277
+ environment=environment,
278
+ merchant_account_id=merchant_account_id,
279
+ expire_customer_balance_request=expire_customer_balance_request,
280
+ idempotency_key=idempotency_key,
281
+ _request_auth=_request_auth,
282
+ _content_type=_content_type,
283
+ _headers=_headers,
284
+ _host_index=_host_index
285
+ )
286
+
287
+ _response_types_map: Dict[str, Optional[str]] = {
288
+ '201': "ApiWriteEnvelope",
289
+ '400': "ApiError",
290
+ '401': "ApiError",
291
+ '409': "ApiError",
292
+ '422': "ApiError",
293
+ '429': "ApiError",
294
+ }
295
+ response_data = self.api_client.call_api(
296
+ *_param,
297
+ _request_timeout=_request_timeout
298
+ )
299
+ return response_data.response
300
+
301
+
302
+ def _expire_customer_balance_serialize(
303
+ self,
304
+ customer_id,
305
+ environment,
306
+ merchant_account_id,
307
+ expire_customer_balance_request,
308
+ idempotency_key,
309
+ _request_auth,
310
+ _content_type,
311
+ _headers,
312
+ _host_index,
313
+ ) -> RequestSerialized:
314
+
315
+ _host = None
316
+
317
+ _collection_formats: Dict[str, str] = {
318
+ }
319
+
320
+ _path_params: Dict[str, str] = {}
321
+ _query_params: List[Tuple[str, str]] = []
322
+ _header_params: Dict[str, Optional[str]] = _headers or {}
323
+ _form_params: List[Tuple[str, str]] = []
324
+ _files: Dict[
325
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
326
+ ] = {}
327
+ _body_params: Optional[bytes] = None
328
+
329
+ # process the path parameters
330
+ if customer_id is not None:
331
+ _path_params['customerId'] = customer_id
332
+ # process the query parameters
333
+ if environment is not None:
334
+
335
+ _query_params.append(('environment', environment))
336
+
337
+ if merchant_account_id is not None:
338
+
339
+ _query_params.append(('merchantAccountId', merchant_account_id))
340
+
341
+ # process the header parameters
342
+ if idempotency_key is not None:
343
+ _header_params['Idempotency-Key'] = idempotency_key
344
+ # process the form parameters
345
+ # process the body parameter
346
+ if expire_customer_balance_request is not None:
347
+ _body_params = expire_customer_balance_request
348
+
349
+
350
+ # set the HTTP header `Accept`
351
+ if 'Accept' not in _header_params:
352
+ _header_params['Accept'] = self.api_client.select_header_accept(
353
+ [
354
+ 'application/json'
355
+ ]
356
+ )
357
+
358
+ # set the HTTP header `Content-Type`
359
+ if _content_type:
360
+ _header_params['Content-Type'] = _content_type
361
+ else:
362
+ _default_content_type = (
363
+ self.api_client.select_header_content_type(
364
+ [
365
+ 'application/json'
366
+ ]
367
+ )
368
+ )
369
+ if _default_content_type is not None:
370
+ _header_params['Content-Type'] = _default_content_type
371
+
372
+ # authentication setting
373
+ _auth_settings: List[str] = [
374
+ 'api-key'
375
+ ]
376
+
377
+ return self.api_client.param_serialize(
378
+ method='POST',
379
+ resource_path='/v1/customers/{customerId}/balance/expire',
380
+ path_params=_path_params,
381
+ query_params=_query_params,
382
+ header_params=_header_params,
383
+ body=_body_params,
384
+ post_params=_form_params,
385
+ files=_files,
386
+ auth_settings=_auth_settings,
387
+ collection_formats=_collection_formats,
388
+ _host=_host,
389
+ _request_auth=_request_auth
390
+ )
391
+
392
+
393
+
394
+
395
+ @validate_call
396
+ def get_customer_balance(
397
+ self,
398
+ customer_id: StrictStr,
399
+ environment: StrictStr,
400
+ merchant_account_id: StrictStr,
401
+ _request_timeout: Union[
402
+ None,
403
+ Annotated[StrictFloat, Field(gt=0)],
404
+ Tuple[
405
+ Annotated[StrictFloat, Field(gt=0)],
406
+ Annotated[StrictFloat, Field(gt=0)]
407
+ ]
408
+ ] = None,
409
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
410
+ _content_type: Optional[StrictStr] = None,
411
+ _headers: Optional[Dict[StrictStr, Any]] = None,
412
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
413
+ ) -> ApiWriteEnvelope:
414
+ """Return a customer's prepaid balance ledger
415
+
416
+
417
+ :param customer_id: (required)
418
+ :type customer_id: str
419
+ :param environment: (required)
420
+ :type environment: str
421
+ :param merchant_account_id: (required)
422
+ :type merchant_account_id: str
423
+ :param _request_timeout: timeout setting for this request. If one
424
+ number provided, it will be total request
425
+ timeout. It can also be a pair (tuple) of
426
+ (connection, read) timeouts.
427
+ :type _request_timeout: int, tuple(int, int), optional
428
+ :param _request_auth: set to override the auth_settings for an a single
429
+ request; this effectively ignores the
430
+ authentication in the spec for a single request.
431
+ :type _request_auth: dict, optional
432
+ :param _content_type: force content-type for the request.
433
+ :type _content_type: str, Optional
434
+ :param _headers: set to override the headers for a single
435
+ request; this effectively ignores the headers
436
+ in the spec for a single request.
437
+ :type _headers: dict, optional
438
+ :param _host_index: set to override the host_index for a single
439
+ request; this effectively ignores the host_index
440
+ in the spec for a single request.
441
+ :type _host_index: int, optional
442
+ :return: Returns the result object.
443
+ """ # noqa: E501
444
+
445
+ _param = self._get_customer_balance_serialize(
446
+ customer_id=customer_id,
447
+ environment=environment,
448
+ merchant_account_id=merchant_account_id,
449
+ _request_auth=_request_auth,
450
+ _content_type=_content_type,
451
+ _headers=_headers,
452
+ _host_index=_host_index
453
+ )
454
+
455
+ _response_types_map: Dict[str, Optional[str]] = {
456
+ '200': "ApiWriteEnvelope",
457
+ '400': "ApiError",
458
+ '401': "ApiError",
459
+ '409': "ApiError",
460
+ '422': "ApiError",
461
+ '429': "ApiError",
462
+ }
463
+ response_data = self.api_client.call_api(
464
+ *_param,
465
+ _request_timeout=_request_timeout
466
+ )
467
+ response_data.read()
468
+ return self.api_client.response_deserialize(
469
+ response_data=response_data,
470
+ response_types_map=_response_types_map,
471
+ ).data
472
+
473
+
474
+ @validate_call
475
+ def get_customer_balance_with_http_info(
476
+ self,
477
+ customer_id: StrictStr,
478
+ environment: StrictStr,
479
+ merchant_account_id: StrictStr,
480
+ _request_timeout: Union[
481
+ None,
482
+ Annotated[StrictFloat, Field(gt=0)],
483
+ Tuple[
484
+ Annotated[StrictFloat, Field(gt=0)],
485
+ Annotated[StrictFloat, Field(gt=0)]
486
+ ]
487
+ ] = None,
488
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
489
+ _content_type: Optional[StrictStr] = None,
490
+ _headers: Optional[Dict[StrictStr, Any]] = None,
491
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
492
+ ) -> ApiResponse[ApiWriteEnvelope]:
493
+ """Return a customer's prepaid balance ledger
494
+
495
+
496
+ :param customer_id: (required)
497
+ :type customer_id: str
498
+ :param environment: (required)
499
+ :type environment: str
500
+ :param merchant_account_id: (required)
501
+ :type merchant_account_id: str
502
+ :param _request_timeout: timeout setting for this request. If one
503
+ number provided, it will be total request
504
+ timeout. It can also be a pair (tuple) of
505
+ (connection, read) timeouts.
506
+ :type _request_timeout: int, tuple(int, int), optional
507
+ :param _request_auth: set to override the auth_settings for an a single
508
+ request; this effectively ignores the
509
+ authentication in the spec for a single request.
510
+ :type _request_auth: dict, optional
511
+ :param _content_type: force content-type for the request.
512
+ :type _content_type: str, Optional
513
+ :param _headers: set to override the headers for a single
514
+ request; this effectively ignores the headers
515
+ in the spec for a single request.
516
+ :type _headers: dict, optional
517
+ :param _host_index: set to override the host_index for a single
518
+ request; this effectively ignores the host_index
519
+ in the spec for a single request.
520
+ :type _host_index: int, optional
521
+ :return: Returns the result object.
522
+ """ # noqa: E501
523
+
524
+ _param = self._get_customer_balance_serialize(
525
+ customer_id=customer_id,
526
+ environment=environment,
527
+ merchant_account_id=merchant_account_id,
528
+ _request_auth=_request_auth,
529
+ _content_type=_content_type,
530
+ _headers=_headers,
531
+ _host_index=_host_index
532
+ )
533
+
534
+ _response_types_map: Dict[str, Optional[str]] = {
535
+ '200': "ApiWriteEnvelope",
536
+ '400': "ApiError",
537
+ '401': "ApiError",
538
+ '409': "ApiError",
539
+ '422': "ApiError",
540
+ '429': "ApiError",
541
+ }
542
+ response_data = self.api_client.call_api(
543
+ *_param,
544
+ _request_timeout=_request_timeout
545
+ )
546
+ response_data.read()
547
+ return self.api_client.response_deserialize(
548
+ response_data=response_data,
549
+ response_types_map=_response_types_map,
550
+ )
551
+
552
+
553
+ @validate_call
554
+ def get_customer_balance_without_preload_content(
555
+ self,
556
+ customer_id: StrictStr,
557
+ environment: StrictStr,
558
+ merchant_account_id: StrictStr,
559
+ _request_timeout: Union[
560
+ None,
561
+ Annotated[StrictFloat, Field(gt=0)],
562
+ Tuple[
563
+ Annotated[StrictFloat, Field(gt=0)],
564
+ Annotated[StrictFloat, Field(gt=0)]
565
+ ]
566
+ ] = None,
567
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
568
+ _content_type: Optional[StrictStr] = None,
569
+ _headers: Optional[Dict[StrictStr, Any]] = None,
570
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
571
+ ) -> RESTResponseType:
572
+ """Return a customer's prepaid balance ledger
573
+
574
+
575
+ :param customer_id: (required)
576
+ :type customer_id: str
577
+ :param environment: (required)
578
+ :type environment: str
579
+ :param merchant_account_id: (required)
580
+ :type merchant_account_id: str
581
+ :param _request_timeout: timeout setting for this request. If one
582
+ number provided, it will be total request
583
+ timeout. It can also be a pair (tuple) of
584
+ (connection, read) timeouts.
585
+ :type _request_timeout: int, tuple(int, int), optional
586
+ :param _request_auth: set to override the auth_settings for an a single
587
+ request; this effectively ignores the
588
+ authentication in the spec for a single request.
589
+ :type _request_auth: dict, optional
590
+ :param _content_type: force content-type for the request.
591
+ :type _content_type: str, Optional
592
+ :param _headers: set to override the headers for a single
593
+ request; this effectively ignores the headers
594
+ in the spec for a single request.
595
+ :type _headers: dict, optional
596
+ :param _host_index: set to override the host_index for a single
597
+ request; this effectively ignores the host_index
598
+ in the spec for a single request.
599
+ :type _host_index: int, optional
600
+ :return: Returns the result object.
601
+ """ # noqa: E501
602
+
603
+ _param = self._get_customer_balance_serialize(
604
+ customer_id=customer_id,
605
+ environment=environment,
606
+ merchant_account_id=merchant_account_id,
607
+ _request_auth=_request_auth,
608
+ _content_type=_content_type,
609
+ _headers=_headers,
610
+ _host_index=_host_index
611
+ )
612
+
613
+ _response_types_map: Dict[str, Optional[str]] = {
614
+ '200': "ApiWriteEnvelope",
615
+ '400': "ApiError",
616
+ '401': "ApiError",
617
+ '409': "ApiError",
618
+ '422': "ApiError",
619
+ '429': "ApiError",
620
+ }
621
+ response_data = self.api_client.call_api(
622
+ *_param,
623
+ _request_timeout=_request_timeout
624
+ )
625
+ return response_data.response
626
+
627
+
628
+ def _get_customer_balance_serialize(
629
+ self,
630
+ customer_id,
631
+ environment,
632
+ merchant_account_id,
633
+ _request_auth,
634
+ _content_type,
635
+ _headers,
636
+ _host_index,
637
+ ) -> RequestSerialized:
638
+
639
+ _host = None
640
+
641
+ _collection_formats: Dict[str, str] = {
642
+ }
643
+
644
+ _path_params: Dict[str, str] = {}
645
+ _query_params: List[Tuple[str, str]] = []
646
+ _header_params: Dict[str, Optional[str]] = _headers or {}
647
+ _form_params: List[Tuple[str, str]] = []
648
+ _files: Dict[
649
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
650
+ ] = {}
651
+ _body_params: Optional[bytes] = None
652
+
653
+ # process the path parameters
654
+ if customer_id is not None:
655
+ _path_params['customerId'] = customer_id
656
+ # process the query parameters
657
+ if environment is not None:
658
+
659
+ _query_params.append(('environment', environment))
660
+
661
+ if merchant_account_id is not None:
662
+
663
+ _query_params.append(('merchantAccountId', merchant_account_id))
664
+
665
+ # process the header parameters
666
+ # process the form parameters
667
+ # process the body parameter
668
+
669
+
670
+ # set the HTTP header `Accept`
671
+ if 'Accept' not in _header_params:
672
+ _header_params['Accept'] = self.api_client.select_header_accept(
673
+ [
674
+ 'application/json'
675
+ ]
676
+ )
677
+
678
+
679
+ # authentication setting
680
+ _auth_settings: List[str] = [
681
+ 'api-key'
682
+ ]
683
+
684
+ return self.api_client.param_serialize(
685
+ method='GET',
686
+ resource_path='/v1/customers/{customerId}/balance',
687
+ path_params=_path_params,
688
+ query_params=_query_params,
689
+ header_params=_header_params,
690
+ body=_body_params,
691
+ post_params=_form_params,
692
+ files=_files,
693
+ auth_settings=_auth_settings,
694
+ collection_formats=_collection_formats,
695
+ _host=_host,
696
+ _request_auth=_request_auth
697
+ )
698
+
699
+
700
+
701
+
702
+ @validate_call
703
+ def grant_customer_balance(
704
+ self,
705
+ customer_id: StrictStr,
706
+ environment: StrictStr,
707
+ merchant_account_id: StrictStr,
708
+ grant_customer_balance_request: GrantCustomerBalanceRequest,
709
+ 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,
710
+ _request_timeout: Union[
711
+ None,
712
+ Annotated[StrictFloat, Field(gt=0)],
713
+ Tuple[
714
+ Annotated[StrictFloat, Field(gt=0)],
715
+ Annotated[StrictFloat, Field(gt=0)]
716
+ ]
717
+ ] = None,
718
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
719
+ _content_type: Optional[StrictStr] = None,
720
+ _headers: Optional[Dict[StrictStr, Any]] = None,
721
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
722
+ ) -> ApiWriteEnvelope:
723
+ """Grant prepaid customer balance
724
+
725
+
726
+ :param customer_id: (required)
727
+ :type customer_id: str
728
+ :param environment: (required)
729
+ :type environment: str
730
+ :param merchant_account_id: (required)
731
+ :type merchant_account_id: str
732
+ :param grant_customer_balance_request: (required)
733
+ :type grant_customer_balance_request: GrantCustomerBalanceRequest
734
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
735
+ :type idempotency_key: str
736
+ :param _request_timeout: timeout setting for this request. If one
737
+ number provided, it will be total request
738
+ timeout. It can also be a pair (tuple) of
739
+ (connection, read) timeouts.
740
+ :type _request_timeout: int, tuple(int, int), optional
741
+ :param _request_auth: set to override the auth_settings for an a single
742
+ request; this effectively ignores the
743
+ authentication in the spec for a single request.
744
+ :type _request_auth: dict, optional
745
+ :param _content_type: force content-type for the request.
746
+ :type _content_type: str, Optional
747
+ :param _headers: set to override the headers for a single
748
+ request; this effectively ignores the headers
749
+ in the spec for a single request.
750
+ :type _headers: dict, optional
751
+ :param _host_index: set to override the host_index for a single
752
+ request; this effectively ignores the host_index
753
+ in the spec for a single request.
754
+ :type _host_index: int, optional
755
+ :return: Returns the result object.
756
+ """ # noqa: E501
757
+
758
+ _param = self._grant_customer_balance_serialize(
759
+ customer_id=customer_id,
760
+ environment=environment,
761
+ merchant_account_id=merchant_account_id,
762
+ grant_customer_balance_request=grant_customer_balance_request,
763
+ idempotency_key=idempotency_key,
764
+ _request_auth=_request_auth,
765
+ _content_type=_content_type,
766
+ _headers=_headers,
767
+ _host_index=_host_index
768
+ )
769
+
770
+ _response_types_map: Dict[str, Optional[str]] = {
771
+ '201': "ApiWriteEnvelope",
772
+ '400': "ApiError",
773
+ '401': "ApiError",
774
+ '409': "ApiError",
775
+ '422': "ApiError",
776
+ '429': "ApiError",
777
+ }
778
+ response_data = self.api_client.call_api(
779
+ *_param,
780
+ _request_timeout=_request_timeout
781
+ )
782
+ response_data.read()
783
+ return self.api_client.response_deserialize(
784
+ response_data=response_data,
785
+ response_types_map=_response_types_map,
786
+ ).data
787
+
788
+
789
+ @validate_call
790
+ def grant_customer_balance_with_http_info(
791
+ self,
792
+ customer_id: StrictStr,
793
+ environment: StrictStr,
794
+ merchant_account_id: StrictStr,
795
+ grant_customer_balance_request: GrantCustomerBalanceRequest,
796
+ 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,
797
+ _request_timeout: Union[
798
+ None,
799
+ Annotated[StrictFloat, Field(gt=0)],
800
+ Tuple[
801
+ Annotated[StrictFloat, Field(gt=0)],
802
+ Annotated[StrictFloat, Field(gt=0)]
803
+ ]
804
+ ] = None,
805
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
806
+ _content_type: Optional[StrictStr] = None,
807
+ _headers: Optional[Dict[StrictStr, Any]] = None,
808
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
809
+ ) -> ApiResponse[ApiWriteEnvelope]:
810
+ """Grant prepaid customer balance
811
+
812
+
813
+ :param customer_id: (required)
814
+ :type customer_id: str
815
+ :param environment: (required)
816
+ :type environment: str
817
+ :param merchant_account_id: (required)
818
+ :type merchant_account_id: str
819
+ :param grant_customer_balance_request: (required)
820
+ :type grant_customer_balance_request: GrantCustomerBalanceRequest
821
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
822
+ :type idempotency_key: str
823
+ :param _request_timeout: timeout setting for this request. If one
824
+ number provided, it will be total request
825
+ timeout. It can also be a pair (tuple) of
826
+ (connection, read) timeouts.
827
+ :type _request_timeout: int, tuple(int, int), optional
828
+ :param _request_auth: set to override the auth_settings for an a single
829
+ request; this effectively ignores the
830
+ authentication in the spec for a single request.
831
+ :type _request_auth: dict, optional
832
+ :param _content_type: force content-type for the request.
833
+ :type _content_type: str, Optional
834
+ :param _headers: set to override the headers for a single
835
+ request; this effectively ignores the headers
836
+ in the spec for a single request.
837
+ :type _headers: dict, optional
838
+ :param _host_index: set to override the host_index for a single
839
+ request; this effectively ignores the host_index
840
+ in the spec for a single request.
841
+ :type _host_index: int, optional
842
+ :return: Returns the result object.
843
+ """ # noqa: E501
844
+
845
+ _param = self._grant_customer_balance_serialize(
846
+ customer_id=customer_id,
847
+ environment=environment,
848
+ merchant_account_id=merchant_account_id,
849
+ grant_customer_balance_request=grant_customer_balance_request,
850
+ idempotency_key=idempotency_key,
851
+ _request_auth=_request_auth,
852
+ _content_type=_content_type,
853
+ _headers=_headers,
854
+ _host_index=_host_index
855
+ )
856
+
857
+ _response_types_map: Dict[str, Optional[str]] = {
858
+ '201': "ApiWriteEnvelope",
859
+ '400': "ApiError",
860
+ '401': "ApiError",
861
+ '409': "ApiError",
862
+ '422': "ApiError",
863
+ '429': "ApiError",
864
+ }
865
+ response_data = self.api_client.call_api(
866
+ *_param,
867
+ _request_timeout=_request_timeout
868
+ )
869
+ response_data.read()
870
+ return self.api_client.response_deserialize(
871
+ response_data=response_data,
872
+ response_types_map=_response_types_map,
873
+ )
874
+
875
+
876
+ @validate_call
877
+ def grant_customer_balance_without_preload_content(
878
+ self,
879
+ customer_id: StrictStr,
880
+ environment: StrictStr,
881
+ merchant_account_id: StrictStr,
882
+ grant_customer_balance_request: GrantCustomerBalanceRequest,
883
+ 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,
884
+ _request_timeout: Union[
885
+ None,
886
+ Annotated[StrictFloat, Field(gt=0)],
887
+ Tuple[
888
+ Annotated[StrictFloat, Field(gt=0)],
889
+ Annotated[StrictFloat, Field(gt=0)]
890
+ ]
891
+ ] = None,
892
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
893
+ _content_type: Optional[StrictStr] = None,
894
+ _headers: Optional[Dict[StrictStr, Any]] = None,
895
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
896
+ ) -> RESTResponseType:
897
+ """Grant prepaid customer balance
898
+
899
+
900
+ :param customer_id: (required)
901
+ :type customer_id: str
902
+ :param environment: (required)
903
+ :type environment: str
904
+ :param merchant_account_id: (required)
905
+ :type merchant_account_id: str
906
+ :param grant_customer_balance_request: (required)
907
+ :type grant_customer_balance_request: GrantCustomerBalanceRequest
908
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
909
+ :type idempotency_key: str
910
+ :param _request_timeout: timeout setting for this request. If one
911
+ number provided, it will be total request
912
+ timeout. It can also be a pair (tuple) of
913
+ (connection, read) timeouts.
914
+ :type _request_timeout: int, tuple(int, int), optional
915
+ :param _request_auth: set to override the auth_settings for an a single
916
+ request; this effectively ignores the
917
+ authentication in the spec for a single request.
918
+ :type _request_auth: dict, optional
919
+ :param _content_type: force content-type for the request.
920
+ :type _content_type: str, Optional
921
+ :param _headers: set to override the headers for a single
922
+ request; this effectively ignores the headers
923
+ in the spec for a single request.
924
+ :type _headers: dict, optional
925
+ :param _host_index: set to override the host_index for a single
926
+ request; this effectively ignores the host_index
927
+ in the spec for a single request.
928
+ :type _host_index: int, optional
929
+ :return: Returns the result object.
930
+ """ # noqa: E501
931
+
932
+ _param = self._grant_customer_balance_serialize(
933
+ customer_id=customer_id,
934
+ environment=environment,
935
+ merchant_account_id=merchant_account_id,
936
+ grant_customer_balance_request=grant_customer_balance_request,
937
+ idempotency_key=idempotency_key,
938
+ _request_auth=_request_auth,
939
+ _content_type=_content_type,
940
+ _headers=_headers,
941
+ _host_index=_host_index
942
+ )
943
+
944
+ _response_types_map: Dict[str, Optional[str]] = {
945
+ '201': "ApiWriteEnvelope",
946
+ '400': "ApiError",
947
+ '401': "ApiError",
948
+ '409': "ApiError",
949
+ '422': "ApiError",
950
+ '429': "ApiError",
951
+ }
952
+ response_data = self.api_client.call_api(
953
+ *_param,
954
+ _request_timeout=_request_timeout
955
+ )
956
+ return response_data.response
957
+
958
+
959
+ def _grant_customer_balance_serialize(
960
+ self,
961
+ customer_id,
962
+ environment,
963
+ merchant_account_id,
964
+ grant_customer_balance_request,
965
+ idempotency_key,
966
+ _request_auth,
967
+ _content_type,
968
+ _headers,
969
+ _host_index,
970
+ ) -> RequestSerialized:
971
+
972
+ _host = None
973
+
974
+ _collection_formats: Dict[str, str] = {
975
+ }
976
+
977
+ _path_params: Dict[str, str] = {}
978
+ _query_params: List[Tuple[str, str]] = []
979
+ _header_params: Dict[str, Optional[str]] = _headers or {}
980
+ _form_params: List[Tuple[str, str]] = []
981
+ _files: Dict[
982
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
983
+ ] = {}
984
+ _body_params: Optional[bytes] = None
985
+
986
+ # process the path parameters
987
+ if customer_id is not None:
988
+ _path_params['customerId'] = customer_id
989
+ # process the query parameters
990
+ if environment is not None:
991
+
992
+ _query_params.append(('environment', environment))
993
+
994
+ if merchant_account_id is not None:
995
+
996
+ _query_params.append(('merchantAccountId', merchant_account_id))
997
+
998
+ # process the header parameters
999
+ if idempotency_key is not None:
1000
+ _header_params['Idempotency-Key'] = idempotency_key
1001
+ # process the form parameters
1002
+ # process the body parameter
1003
+ if grant_customer_balance_request is not None:
1004
+ _body_params = grant_customer_balance_request
1005
+
1006
+
1007
+ # set the HTTP header `Accept`
1008
+ if 'Accept' not in _header_params:
1009
+ _header_params['Accept'] = self.api_client.select_header_accept(
1010
+ [
1011
+ 'application/json'
1012
+ ]
1013
+ )
1014
+
1015
+ # set the HTTP header `Content-Type`
1016
+ if _content_type:
1017
+ _header_params['Content-Type'] = _content_type
1018
+ else:
1019
+ _default_content_type = (
1020
+ self.api_client.select_header_content_type(
1021
+ [
1022
+ 'application/json'
1023
+ ]
1024
+ )
1025
+ )
1026
+ if _default_content_type is not None:
1027
+ _header_params['Content-Type'] = _default_content_type
1028
+
1029
+ # authentication setting
1030
+ _auth_settings: List[str] = [
1031
+ 'api-key'
1032
+ ]
1033
+
1034
+ return self.api_client.param_serialize(
1035
+ method='POST',
1036
+ resource_path='/v1/customers/{customerId}/balance/grant',
1037
+ path_params=_path_params,
1038
+ query_params=_query_params,
1039
+ header_params=_header_params,
1040
+ body=_body_params,
1041
+ post_params=_form_params,
1042
+ files=_files,
1043
+ auth_settings=_auth_settings,
1044
+ collection_formats=_collection_formats,
1045
+ _host=_host,
1046
+ _request_auth=_request_auth
1047
+ )
1048
+
1049
+
1050
+
1051
+
1052
+ @validate_call
1053
+ def grant_customer_balance_from_payment(
1054
+ self,
1055
+ customer_id: StrictStr,
1056
+ environment: StrictStr,
1057
+ merchant_account_id: StrictStr,
1058
+ grant_customer_balance_from_payment_request: GrantCustomerBalanceFromPaymentRequest,
1059
+ 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,
1060
+ _request_timeout: Union[
1061
+ None,
1062
+ Annotated[StrictFloat, Field(gt=0)],
1063
+ Tuple[
1064
+ Annotated[StrictFloat, Field(gt=0)],
1065
+ Annotated[StrictFloat, Field(gt=0)]
1066
+ ]
1067
+ ] = None,
1068
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1069
+ _content_type: Optional[StrictStr] = None,
1070
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1071
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1072
+ ) -> ApiWriteEnvelope:
1073
+ """Grant prepaid customer balance from a captured payment
1074
+
1075
+
1076
+ :param customer_id: (required)
1077
+ :type customer_id: str
1078
+ :param environment: (required)
1079
+ :type environment: str
1080
+ :param merchant_account_id: (required)
1081
+ :type merchant_account_id: str
1082
+ :param grant_customer_balance_from_payment_request: (required)
1083
+ :type grant_customer_balance_from_payment_request: GrantCustomerBalanceFromPaymentRequest
1084
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1085
+ :type idempotency_key: str
1086
+ :param _request_timeout: timeout setting for this request. If one
1087
+ number provided, it will be total request
1088
+ timeout. It can also be a pair (tuple) of
1089
+ (connection, read) timeouts.
1090
+ :type _request_timeout: int, tuple(int, int), optional
1091
+ :param _request_auth: set to override the auth_settings for an a single
1092
+ request; this effectively ignores the
1093
+ authentication in the spec for a single request.
1094
+ :type _request_auth: dict, optional
1095
+ :param _content_type: force content-type for the request.
1096
+ :type _content_type: str, Optional
1097
+ :param _headers: set to override the headers for a single
1098
+ request; this effectively ignores the headers
1099
+ in the spec for a single request.
1100
+ :type _headers: dict, optional
1101
+ :param _host_index: set to override the host_index for a single
1102
+ request; this effectively ignores the host_index
1103
+ in the spec for a single request.
1104
+ :type _host_index: int, optional
1105
+ :return: Returns the result object.
1106
+ """ # noqa: E501
1107
+
1108
+ _param = self._grant_customer_balance_from_payment_serialize(
1109
+ customer_id=customer_id,
1110
+ environment=environment,
1111
+ merchant_account_id=merchant_account_id,
1112
+ grant_customer_balance_from_payment_request=grant_customer_balance_from_payment_request,
1113
+ idempotency_key=idempotency_key,
1114
+ _request_auth=_request_auth,
1115
+ _content_type=_content_type,
1116
+ _headers=_headers,
1117
+ _host_index=_host_index
1118
+ )
1119
+
1120
+ _response_types_map: Dict[str, Optional[str]] = {
1121
+ '201': "ApiWriteEnvelope",
1122
+ '400': "ApiError",
1123
+ '401': "ApiError",
1124
+ '409': "ApiError",
1125
+ '422': "ApiError",
1126
+ '429': "ApiError",
1127
+ }
1128
+ response_data = self.api_client.call_api(
1129
+ *_param,
1130
+ _request_timeout=_request_timeout
1131
+ )
1132
+ response_data.read()
1133
+ return self.api_client.response_deserialize(
1134
+ response_data=response_data,
1135
+ response_types_map=_response_types_map,
1136
+ ).data
1137
+
1138
+
1139
+ @validate_call
1140
+ def grant_customer_balance_from_payment_with_http_info(
1141
+ self,
1142
+ customer_id: StrictStr,
1143
+ environment: StrictStr,
1144
+ merchant_account_id: StrictStr,
1145
+ grant_customer_balance_from_payment_request: GrantCustomerBalanceFromPaymentRequest,
1146
+ 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,
1147
+ _request_timeout: Union[
1148
+ None,
1149
+ Annotated[StrictFloat, Field(gt=0)],
1150
+ Tuple[
1151
+ Annotated[StrictFloat, Field(gt=0)],
1152
+ Annotated[StrictFloat, Field(gt=0)]
1153
+ ]
1154
+ ] = None,
1155
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1156
+ _content_type: Optional[StrictStr] = None,
1157
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1158
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1159
+ ) -> ApiResponse[ApiWriteEnvelope]:
1160
+ """Grant prepaid customer balance from a captured payment
1161
+
1162
+
1163
+ :param customer_id: (required)
1164
+ :type customer_id: str
1165
+ :param environment: (required)
1166
+ :type environment: str
1167
+ :param merchant_account_id: (required)
1168
+ :type merchant_account_id: str
1169
+ :param grant_customer_balance_from_payment_request: (required)
1170
+ :type grant_customer_balance_from_payment_request: GrantCustomerBalanceFromPaymentRequest
1171
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1172
+ :type idempotency_key: str
1173
+ :param _request_timeout: timeout setting for this request. If one
1174
+ number provided, it will be total request
1175
+ timeout. It can also be a pair (tuple) of
1176
+ (connection, read) timeouts.
1177
+ :type _request_timeout: int, tuple(int, int), optional
1178
+ :param _request_auth: set to override the auth_settings for an a single
1179
+ request; this effectively ignores the
1180
+ authentication in the spec for a single request.
1181
+ :type _request_auth: dict, optional
1182
+ :param _content_type: force content-type for the request.
1183
+ :type _content_type: str, Optional
1184
+ :param _headers: set to override the headers for a single
1185
+ request; this effectively ignores the headers
1186
+ in the spec for a single request.
1187
+ :type _headers: dict, optional
1188
+ :param _host_index: set to override the host_index for a single
1189
+ request; this effectively ignores the host_index
1190
+ in the spec for a single request.
1191
+ :type _host_index: int, optional
1192
+ :return: Returns the result object.
1193
+ """ # noqa: E501
1194
+
1195
+ _param = self._grant_customer_balance_from_payment_serialize(
1196
+ customer_id=customer_id,
1197
+ environment=environment,
1198
+ merchant_account_id=merchant_account_id,
1199
+ grant_customer_balance_from_payment_request=grant_customer_balance_from_payment_request,
1200
+ idempotency_key=idempotency_key,
1201
+ _request_auth=_request_auth,
1202
+ _content_type=_content_type,
1203
+ _headers=_headers,
1204
+ _host_index=_host_index
1205
+ )
1206
+
1207
+ _response_types_map: Dict[str, Optional[str]] = {
1208
+ '201': "ApiWriteEnvelope",
1209
+ '400': "ApiError",
1210
+ '401': "ApiError",
1211
+ '409': "ApiError",
1212
+ '422': "ApiError",
1213
+ '429': "ApiError",
1214
+ }
1215
+ response_data = self.api_client.call_api(
1216
+ *_param,
1217
+ _request_timeout=_request_timeout
1218
+ )
1219
+ response_data.read()
1220
+ return self.api_client.response_deserialize(
1221
+ response_data=response_data,
1222
+ response_types_map=_response_types_map,
1223
+ )
1224
+
1225
+
1226
+ @validate_call
1227
+ def grant_customer_balance_from_payment_without_preload_content(
1228
+ self,
1229
+ customer_id: StrictStr,
1230
+ environment: StrictStr,
1231
+ merchant_account_id: StrictStr,
1232
+ grant_customer_balance_from_payment_request: GrantCustomerBalanceFromPaymentRequest,
1233
+ 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,
1234
+ _request_timeout: Union[
1235
+ None,
1236
+ Annotated[StrictFloat, Field(gt=0)],
1237
+ Tuple[
1238
+ Annotated[StrictFloat, Field(gt=0)],
1239
+ Annotated[StrictFloat, Field(gt=0)]
1240
+ ]
1241
+ ] = None,
1242
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1243
+ _content_type: Optional[StrictStr] = None,
1244
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1245
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1246
+ ) -> RESTResponseType:
1247
+ """Grant prepaid customer balance from a captured payment
1248
+
1249
+
1250
+ :param customer_id: (required)
1251
+ :type customer_id: str
1252
+ :param environment: (required)
1253
+ :type environment: str
1254
+ :param merchant_account_id: (required)
1255
+ :type merchant_account_id: str
1256
+ :param grant_customer_balance_from_payment_request: (required)
1257
+ :type grant_customer_balance_from_payment_request: GrantCustomerBalanceFromPaymentRequest
1258
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1259
+ :type idempotency_key: str
1260
+ :param _request_timeout: timeout setting for this request. If one
1261
+ number provided, it will be total request
1262
+ timeout. It can also be a pair (tuple) of
1263
+ (connection, read) timeouts.
1264
+ :type _request_timeout: int, tuple(int, int), optional
1265
+ :param _request_auth: set to override the auth_settings for an a single
1266
+ request; this effectively ignores the
1267
+ authentication in the spec for a single request.
1268
+ :type _request_auth: dict, optional
1269
+ :param _content_type: force content-type for the request.
1270
+ :type _content_type: str, Optional
1271
+ :param _headers: set to override the headers for a single
1272
+ request; this effectively ignores the headers
1273
+ in the spec for a single request.
1274
+ :type _headers: dict, optional
1275
+ :param _host_index: set to override the host_index for a single
1276
+ request; this effectively ignores the host_index
1277
+ in the spec for a single request.
1278
+ :type _host_index: int, optional
1279
+ :return: Returns the result object.
1280
+ """ # noqa: E501
1281
+
1282
+ _param = self._grant_customer_balance_from_payment_serialize(
1283
+ customer_id=customer_id,
1284
+ environment=environment,
1285
+ merchant_account_id=merchant_account_id,
1286
+ grant_customer_balance_from_payment_request=grant_customer_balance_from_payment_request,
1287
+ idempotency_key=idempotency_key,
1288
+ _request_auth=_request_auth,
1289
+ _content_type=_content_type,
1290
+ _headers=_headers,
1291
+ _host_index=_host_index
1292
+ )
1293
+
1294
+ _response_types_map: Dict[str, Optional[str]] = {
1295
+ '201': "ApiWriteEnvelope",
1296
+ '400': "ApiError",
1297
+ '401': "ApiError",
1298
+ '409': "ApiError",
1299
+ '422': "ApiError",
1300
+ '429': "ApiError",
1301
+ }
1302
+ response_data = self.api_client.call_api(
1303
+ *_param,
1304
+ _request_timeout=_request_timeout
1305
+ )
1306
+ return response_data.response
1307
+
1308
+
1309
+ def _grant_customer_balance_from_payment_serialize(
1310
+ self,
1311
+ customer_id,
1312
+ environment,
1313
+ merchant_account_id,
1314
+ grant_customer_balance_from_payment_request,
1315
+ idempotency_key,
1316
+ _request_auth,
1317
+ _content_type,
1318
+ _headers,
1319
+ _host_index,
1320
+ ) -> RequestSerialized:
1321
+
1322
+ _host = None
1323
+
1324
+ _collection_formats: Dict[str, str] = {
1325
+ }
1326
+
1327
+ _path_params: Dict[str, str] = {}
1328
+ _query_params: List[Tuple[str, str]] = []
1329
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1330
+ _form_params: List[Tuple[str, str]] = []
1331
+ _files: Dict[
1332
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1333
+ ] = {}
1334
+ _body_params: Optional[bytes] = None
1335
+
1336
+ # process the path parameters
1337
+ if customer_id is not None:
1338
+ _path_params['customerId'] = customer_id
1339
+ # process the query parameters
1340
+ if environment is not None:
1341
+
1342
+ _query_params.append(('environment', environment))
1343
+
1344
+ if merchant_account_id is not None:
1345
+
1346
+ _query_params.append(('merchantAccountId', merchant_account_id))
1347
+
1348
+ # process the header parameters
1349
+ if idempotency_key is not None:
1350
+ _header_params['Idempotency-Key'] = idempotency_key
1351
+ # process the form parameters
1352
+ # process the body parameter
1353
+ if grant_customer_balance_from_payment_request is not None:
1354
+ _body_params = grant_customer_balance_from_payment_request
1355
+
1356
+
1357
+ # set the HTTP header `Accept`
1358
+ if 'Accept' not in _header_params:
1359
+ _header_params['Accept'] = self.api_client.select_header_accept(
1360
+ [
1361
+ 'application/json'
1362
+ ]
1363
+ )
1364
+
1365
+ # set the HTTP header `Content-Type`
1366
+ if _content_type:
1367
+ _header_params['Content-Type'] = _content_type
1368
+ else:
1369
+ _default_content_type = (
1370
+ self.api_client.select_header_content_type(
1371
+ [
1372
+ 'application/json'
1373
+ ]
1374
+ )
1375
+ )
1376
+ if _default_content_type is not None:
1377
+ _header_params['Content-Type'] = _default_content_type
1378
+
1379
+ # authentication setting
1380
+ _auth_settings: List[str] = [
1381
+ 'api-key'
1382
+ ]
1383
+
1384
+ return self.api_client.param_serialize(
1385
+ method='POST',
1386
+ resource_path='/v1/customers/{customerId}/balance/grant-from-payment',
1387
+ path_params=_path_params,
1388
+ query_params=_query_params,
1389
+ header_params=_header_params,
1390
+ body=_body_params,
1391
+ post_params=_form_params,
1392
+ files=_files,
1393
+ auth_settings=_auth_settings,
1394
+ collection_formats=_collection_formats,
1395
+ _host=_host,
1396
+ _request_auth=_request_auth
1397
+ )
1398
+
1399
+
1400
+
1401
+
1402
+ @validate_call
1403
+ def reverse_customer_balance(
1404
+ self,
1405
+ customer_id: StrictStr,
1406
+ environment: StrictStr,
1407
+ merchant_account_id: StrictStr,
1408
+ reverse_customer_balance_request: ReverseCustomerBalanceRequest,
1409
+ 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,
1410
+ _request_timeout: Union[
1411
+ None,
1412
+ Annotated[StrictFloat, Field(gt=0)],
1413
+ Tuple[
1414
+ Annotated[StrictFloat, Field(gt=0)],
1415
+ Annotated[StrictFloat, Field(gt=0)]
1416
+ ]
1417
+ ] = None,
1418
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1419
+ _content_type: Optional[StrictStr] = None,
1420
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1421
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1422
+ ) -> ApiWriteEnvelope:
1423
+ """Reverse a prepaid customer balance ledger entry
1424
+
1425
+
1426
+ :param customer_id: (required)
1427
+ :type customer_id: str
1428
+ :param environment: (required)
1429
+ :type environment: str
1430
+ :param merchant_account_id: (required)
1431
+ :type merchant_account_id: str
1432
+ :param reverse_customer_balance_request: (required)
1433
+ :type reverse_customer_balance_request: ReverseCustomerBalanceRequest
1434
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1435
+ :type idempotency_key: str
1436
+ :param _request_timeout: timeout setting for this request. If one
1437
+ number provided, it will be total request
1438
+ timeout. It can also be a pair (tuple) of
1439
+ (connection, read) timeouts.
1440
+ :type _request_timeout: int, tuple(int, int), optional
1441
+ :param _request_auth: set to override the auth_settings for an a single
1442
+ request; this effectively ignores the
1443
+ authentication in the spec for a single request.
1444
+ :type _request_auth: dict, optional
1445
+ :param _content_type: force content-type for the request.
1446
+ :type _content_type: str, Optional
1447
+ :param _headers: set to override the headers for a single
1448
+ request; this effectively ignores the headers
1449
+ in the spec for a single request.
1450
+ :type _headers: dict, optional
1451
+ :param _host_index: set to override the host_index for a single
1452
+ request; this effectively ignores the host_index
1453
+ in the spec for a single request.
1454
+ :type _host_index: int, optional
1455
+ :return: Returns the result object.
1456
+ """ # noqa: E501
1457
+
1458
+ _param = self._reverse_customer_balance_serialize(
1459
+ customer_id=customer_id,
1460
+ environment=environment,
1461
+ merchant_account_id=merchant_account_id,
1462
+ reverse_customer_balance_request=reverse_customer_balance_request,
1463
+ idempotency_key=idempotency_key,
1464
+ _request_auth=_request_auth,
1465
+ _content_type=_content_type,
1466
+ _headers=_headers,
1467
+ _host_index=_host_index
1468
+ )
1469
+
1470
+ _response_types_map: Dict[str, Optional[str]] = {
1471
+ '201': "ApiWriteEnvelope",
1472
+ '400': "ApiError",
1473
+ '401': "ApiError",
1474
+ '409': "ApiError",
1475
+ '422': "ApiError",
1476
+ '429': "ApiError",
1477
+ }
1478
+ response_data = self.api_client.call_api(
1479
+ *_param,
1480
+ _request_timeout=_request_timeout
1481
+ )
1482
+ response_data.read()
1483
+ return self.api_client.response_deserialize(
1484
+ response_data=response_data,
1485
+ response_types_map=_response_types_map,
1486
+ ).data
1487
+
1488
+
1489
+ @validate_call
1490
+ def reverse_customer_balance_with_http_info(
1491
+ self,
1492
+ customer_id: StrictStr,
1493
+ environment: StrictStr,
1494
+ merchant_account_id: StrictStr,
1495
+ reverse_customer_balance_request: ReverseCustomerBalanceRequest,
1496
+ 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,
1497
+ _request_timeout: Union[
1498
+ None,
1499
+ Annotated[StrictFloat, Field(gt=0)],
1500
+ Tuple[
1501
+ Annotated[StrictFloat, Field(gt=0)],
1502
+ Annotated[StrictFloat, Field(gt=0)]
1503
+ ]
1504
+ ] = None,
1505
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1506
+ _content_type: Optional[StrictStr] = None,
1507
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1508
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1509
+ ) -> ApiResponse[ApiWriteEnvelope]:
1510
+ """Reverse a prepaid customer balance ledger entry
1511
+
1512
+
1513
+ :param customer_id: (required)
1514
+ :type customer_id: str
1515
+ :param environment: (required)
1516
+ :type environment: str
1517
+ :param merchant_account_id: (required)
1518
+ :type merchant_account_id: str
1519
+ :param reverse_customer_balance_request: (required)
1520
+ :type reverse_customer_balance_request: ReverseCustomerBalanceRequest
1521
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1522
+ :type idempotency_key: str
1523
+ :param _request_timeout: timeout setting for this request. If one
1524
+ number provided, it will be total request
1525
+ timeout. It can also be a pair (tuple) of
1526
+ (connection, read) timeouts.
1527
+ :type _request_timeout: int, tuple(int, int), optional
1528
+ :param _request_auth: set to override the auth_settings for an a single
1529
+ request; this effectively ignores the
1530
+ authentication in the spec for a single request.
1531
+ :type _request_auth: dict, optional
1532
+ :param _content_type: force content-type for the request.
1533
+ :type _content_type: str, Optional
1534
+ :param _headers: set to override the headers for a single
1535
+ request; this effectively ignores the headers
1536
+ in the spec for a single request.
1537
+ :type _headers: dict, optional
1538
+ :param _host_index: set to override the host_index for a single
1539
+ request; this effectively ignores the host_index
1540
+ in the spec for a single request.
1541
+ :type _host_index: int, optional
1542
+ :return: Returns the result object.
1543
+ """ # noqa: E501
1544
+
1545
+ _param = self._reverse_customer_balance_serialize(
1546
+ customer_id=customer_id,
1547
+ environment=environment,
1548
+ merchant_account_id=merchant_account_id,
1549
+ reverse_customer_balance_request=reverse_customer_balance_request,
1550
+ idempotency_key=idempotency_key,
1551
+ _request_auth=_request_auth,
1552
+ _content_type=_content_type,
1553
+ _headers=_headers,
1554
+ _host_index=_host_index
1555
+ )
1556
+
1557
+ _response_types_map: Dict[str, Optional[str]] = {
1558
+ '201': "ApiWriteEnvelope",
1559
+ '400': "ApiError",
1560
+ '401': "ApiError",
1561
+ '409': "ApiError",
1562
+ '422': "ApiError",
1563
+ '429': "ApiError",
1564
+ }
1565
+ response_data = self.api_client.call_api(
1566
+ *_param,
1567
+ _request_timeout=_request_timeout
1568
+ )
1569
+ response_data.read()
1570
+ return self.api_client.response_deserialize(
1571
+ response_data=response_data,
1572
+ response_types_map=_response_types_map,
1573
+ )
1574
+
1575
+
1576
+ @validate_call
1577
+ def reverse_customer_balance_without_preload_content(
1578
+ self,
1579
+ customer_id: StrictStr,
1580
+ environment: StrictStr,
1581
+ merchant_account_id: StrictStr,
1582
+ reverse_customer_balance_request: ReverseCustomerBalanceRequest,
1583
+ 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,
1584
+ _request_timeout: Union[
1585
+ None,
1586
+ Annotated[StrictFloat, Field(gt=0)],
1587
+ Tuple[
1588
+ Annotated[StrictFloat, Field(gt=0)],
1589
+ Annotated[StrictFloat, Field(gt=0)]
1590
+ ]
1591
+ ] = None,
1592
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1593
+ _content_type: Optional[StrictStr] = None,
1594
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1595
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1596
+ ) -> RESTResponseType:
1597
+ """Reverse a prepaid customer balance ledger entry
1598
+
1599
+
1600
+ :param customer_id: (required)
1601
+ :type customer_id: str
1602
+ :param environment: (required)
1603
+ :type environment: str
1604
+ :param merchant_account_id: (required)
1605
+ :type merchant_account_id: str
1606
+ :param reverse_customer_balance_request: (required)
1607
+ :type reverse_customer_balance_request: ReverseCustomerBalanceRequest
1608
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1609
+ :type idempotency_key: str
1610
+ :param _request_timeout: timeout setting for this request. If one
1611
+ number provided, it will be total request
1612
+ timeout. It can also be a pair (tuple) of
1613
+ (connection, read) timeouts.
1614
+ :type _request_timeout: int, tuple(int, int), optional
1615
+ :param _request_auth: set to override the auth_settings for an a single
1616
+ request; this effectively ignores the
1617
+ authentication in the spec for a single request.
1618
+ :type _request_auth: dict, optional
1619
+ :param _content_type: force content-type for the request.
1620
+ :type _content_type: str, Optional
1621
+ :param _headers: set to override the headers for a single
1622
+ request; this effectively ignores the headers
1623
+ in the spec for a single request.
1624
+ :type _headers: dict, optional
1625
+ :param _host_index: set to override the host_index for a single
1626
+ request; this effectively ignores the host_index
1627
+ in the spec for a single request.
1628
+ :type _host_index: int, optional
1629
+ :return: Returns the result object.
1630
+ """ # noqa: E501
1631
+
1632
+ _param = self._reverse_customer_balance_serialize(
1633
+ customer_id=customer_id,
1634
+ environment=environment,
1635
+ merchant_account_id=merchant_account_id,
1636
+ reverse_customer_balance_request=reverse_customer_balance_request,
1637
+ idempotency_key=idempotency_key,
1638
+ _request_auth=_request_auth,
1639
+ _content_type=_content_type,
1640
+ _headers=_headers,
1641
+ _host_index=_host_index
1642
+ )
1643
+
1644
+ _response_types_map: Dict[str, Optional[str]] = {
1645
+ '201': "ApiWriteEnvelope",
1646
+ '400': "ApiError",
1647
+ '401': "ApiError",
1648
+ '409': "ApiError",
1649
+ '422': "ApiError",
1650
+ '429': "ApiError",
1651
+ }
1652
+ response_data = self.api_client.call_api(
1653
+ *_param,
1654
+ _request_timeout=_request_timeout
1655
+ )
1656
+ return response_data.response
1657
+
1658
+
1659
+ def _reverse_customer_balance_serialize(
1660
+ self,
1661
+ customer_id,
1662
+ environment,
1663
+ merchant_account_id,
1664
+ reverse_customer_balance_request,
1665
+ idempotency_key,
1666
+ _request_auth,
1667
+ _content_type,
1668
+ _headers,
1669
+ _host_index,
1670
+ ) -> RequestSerialized:
1671
+
1672
+ _host = None
1673
+
1674
+ _collection_formats: Dict[str, str] = {
1675
+ }
1676
+
1677
+ _path_params: Dict[str, str] = {}
1678
+ _query_params: List[Tuple[str, str]] = []
1679
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1680
+ _form_params: List[Tuple[str, str]] = []
1681
+ _files: Dict[
1682
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1683
+ ] = {}
1684
+ _body_params: Optional[bytes] = None
1685
+
1686
+ # process the path parameters
1687
+ if customer_id is not None:
1688
+ _path_params['customerId'] = customer_id
1689
+ # process the query parameters
1690
+ if environment is not None:
1691
+
1692
+ _query_params.append(('environment', environment))
1693
+
1694
+ if merchant_account_id is not None:
1695
+
1696
+ _query_params.append(('merchantAccountId', merchant_account_id))
1697
+
1698
+ # process the header parameters
1699
+ if idempotency_key is not None:
1700
+ _header_params['Idempotency-Key'] = idempotency_key
1701
+ # process the form parameters
1702
+ # process the body parameter
1703
+ if reverse_customer_balance_request is not None:
1704
+ _body_params = reverse_customer_balance_request
1705
+
1706
+
1707
+ # set the HTTP header `Accept`
1708
+ if 'Accept' not in _header_params:
1709
+ _header_params['Accept'] = self.api_client.select_header_accept(
1710
+ [
1711
+ 'application/json'
1712
+ ]
1713
+ )
1714
+
1715
+ # set the HTTP header `Content-Type`
1716
+ if _content_type:
1717
+ _header_params['Content-Type'] = _content_type
1718
+ else:
1719
+ _default_content_type = (
1720
+ self.api_client.select_header_content_type(
1721
+ [
1722
+ 'application/json'
1723
+ ]
1724
+ )
1725
+ )
1726
+ if _default_content_type is not None:
1727
+ _header_params['Content-Type'] = _default_content_type
1728
+
1729
+ # authentication setting
1730
+ _auth_settings: List[str] = [
1731
+ 'api-key'
1732
+ ]
1733
+
1734
+ return self.api_client.param_serialize(
1735
+ method='POST',
1736
+ resource_path='/v1/customers/{customerId}/balance/reverse',
1737
+ path_params=_path_params,
1738
+ query_params=_query_params,
1739
+ header_params=_header_params,
1740
+ body=_body_params,
1741
+ post_params=_form_params,
1742
+ files=_files,
1743
+ auth_settings=_auth_settings,
1744
+ collection_formats=_collection_formats,
1745
+ _host=_host,
1746
+ _request_auth=_request_auth
1747
+ )