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