mollie-api-py 1.0.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.
- mollie/__init__.py +18 -0
- mollie/_hooks/__init__.py +5 -0
- mollie/_hooks/mollie_hooks.py +165 -0
- mollie/_hooks/registration.py +18 -0
- mollie/_hooks/sdkhooks.py +76 -0
- mollie/_hooks/types.py +113 -0
- mollie/_version.py +15 -0
- mollie/balance_transfers.py +651 -0
- mollie/balances.py +1105 -0
- mollie/basesdk.py +360 -0
- mollie/capabilities.py +209 -0
- mollie/captures.py +677 -0
- mollie/chargebacks_sdk.py +675 -0
- mollie/client_links.py +325 -0
- mollie/clients.py +409 -0
- mollie/customers.py +1563 -0
- mollie/delayed_routing.py +421 -0
- mollie/httpclient.py +125 -0
- mollie/invoices.py +429 -0
- mollie/mandates.py +895 -0
- mollie/methods.py +789 -0
- mollie/models/__init__.py +4002 -0
- mollie/models/address.py +29 -0
- mollie/models/amount.py +25 -0
- mollie/models/amount_nullable.py +24 -0
- mollie/models/apierror.py +40 -0
- mollie/models/balance_card_audience.py +10 -0
- mollie/models/balance_card_issuer.py +12 -0
- mollie/models/balance_card_region.py +12 -0
- mollie/models/balance_fee_type.py +43 -0
- mollie/models/balance_prepayment_part_type.py +13 -0
- mollie/models/balance_report_grouping.py +10 -0
- mollie/models/balance_transaction_type.py +47 -0
- mollie/models/balance_transfer_category.py +17 -0
- mollie/models/balance_transfer_category_response.py +18 -0
- mollie/models/balance_transfer_destination_type.py +14 -0
- mollie/models/balance_transfer_party_type.py +10 -0
- mollie/models/balance_transfer_party_type_response.py +11 -0
- mollie/models/balance_transfer_status.py +13 -0
- mollie/models/balance_transfer_status_reason_response.py +19 -0
- mollie/models/billingaddress.py +154 -0
- mollie/models/cancel_paymentop.py +93 -0
- mollie/models/cancel_refundop.py +86 -0
- mollie/models/cancel_subscriptionop.py +100 -0
- mollie/models/capability_requirement_status.py +15 -0
- mollie/models/capability_status.py +12 -0
- mollie/models/capability_status_reason.py +10 -0
- mollie/models/capture_mode.py +15 -0
- mollie/models/capture_mode_response.py +16 -0
- mollie/models/capture_response.py +265 -0
- mollie/models/client_link_request.py +210 -0
- mollie/models/client_link_response.py +56 -0
- mollie/models/clienterror.py +30 -0
- mollie/models/components_sub_totals.py +127 -0
- mollie/models/create_captureop.py +43 -0
- mollie/models/create_client_linkop.py +29 -0
- mollie/models/create_connect_balance_transferop.py +32 -0
- mollie/models/create_customer_paymentop.py +43 -0
- mollie/models/create_customerop.py +29 -0
- mollie/models/create_mandateop.py +43 -0
- mollie/models/create_payment_linkop.py +325 -0
- mollie/models/create_paymentop.py +73 -0
- mollie/models/create_profileop.py +29 -0
- mollie/models/create_refundop.py +43 -0
- mollie/models/create_sales_invoiceop.py +29 -0
- mollie/models/create_subscriptionop.py +43 -0
- mollie/models/create_webhook.py +123 -0
- mollie/models/create_webhookop.py +69 -0
- mollie/models/currencies.py +20 -0
- mollie/models/customer_response.py +169 -0
- mollie/models/delete_customerop.py +91 -0
- mollie/models/delete_payment_linkop.py +91 -0
- mollie/models/delete_profileop.py +29 -0
- mollie/models/delete_sales_invoiceop.py +44 -0
- mollie/models/delete_values_sales_invoice.py +54 -0
- mollie/models/delete_webhookop.py +56 -0
- mollie/models/entity_balance.py +325 -0
- mollie/models/entity_balance_report.py +541 -0
- mollie/models/entity_balance_transaction.py +1068 -0
- mollie/models/entity_balance_transfer.py +62 -0
- mollie/models/entity_balance_transfer_party.py +28 -0
- mollie/models/entity_balance_transfer_party_response.py +32 -0
- mollie/models/entity_balance_transfer_response.py +159 -0
- mollie/models/entity_capability.py +75 -0
- mollie/models/entity_capability_requirement.py +87 -0
- mollie/models/entity_capture.py +63 -0
- mollie/models/entity_chargeback.py +247 -0
- mollie/models/entity_customer.py +86 -0
- mollie/models/entity_event.py +46 -0
- mollie/models/entity_invoice.py +247 -0
- mollie/models/entity_method_get.py +329 -0
- mollie/models/entity_onboarding_status.py +95 -0
- mollie/models/entity_organization.py +178 -0
- mollie/models/entity_payment_route.py +111 -0
- mollie/models/entity_payment_route_response.py +140 -0
- mollie/models/entity_permission.py +61 -0
- mollie/models/entity_refund_response.py +361 -0
- mollie/models/entity_route.py +96 -0
- mollie/models/entity_settlement.py +467 -0
- mollie/models/entity_terminal.py +160 -0
- mollie/models/entity_webhook.py +122 -0
- mollie/models/entity_webhook_event.py +149 -0
- mollie/models/error_response.py +70 -0
- mollie/models/get_balance_reportop.py +126 -0
- mollie/models/get_balanceop.py +71 -0
- mollie/models/get_captureop.py +129 -0
- mollie/models/get_chargebackop.py +129 -0
- mollie/models/get_clientop.py +216 -0
- mollie/models/get_connect_balance_transferop.py +71 -0
- mollie/models/get_current_organizationop.py +22 -0
- mollie/models/get_current_profileop.py +22 -0
- mollie/models/get_customerop.py +286 -0
- mollie/models/get_invoiceop.py +29 -0
- mollie/models/get_mandateop.py +86 -0
- mollie/models/get_methodop.py +199 -0
- mollie/models/get_next_settlementop.py +22 -0
- mollie/models/get_onboarding_statusop.py +22 -0
- mollie/models/get_open_settlementop.py +22 -0
- mollie/models/get_organizationop.py +71 -0
- mollie/models/get_partner_statusop.py +231 -0
- mollie/models/get_payment_link_paymentsop.py +188 -0
- mollie/models/get_payment_linkop.py +77 -0
- mollie/models/get_paymentop.py +128 -0
- mollie/models/get_permissionop.py +73 -0
- mollie/models/get_primary_balanceop.py +22 -0
- mollie/models/get_profileop.py +71 -0
- mollie/models/get_refundop.py +129 -0
- mollie/models/get_sales_invoiceop.py +75 -0
- mollie/models/get_settlementop.py +29 -0
- mollie/models/get_subscriptionop.py +86 -0
- mollie/models/get_terminalop.py +77 -0
- mollie/models/get_webhook_eventop.py +71 -0
- mollie/models/get_webhookop.py +71 -0
- mollie/models/internal/__init__.py +54 -0
- mollie/models/internal/globals.py +59 -0
- mollie/models/line_categories.py +13 -0
- mollie/models/line_categories_response.py +14 -0
- mollie/models/list_all_chargebacksop.py +236 -0
- mollie/models/list_all_methodsop.py +249 -0
- mollie/models/list_all_refundsop.py +230 -0
- mollie/models/list_all_subscriptionsop.py +202 -0
- mollie/models/list_balance_transactionsop.py +174 -0
- mollie/models/list_balancesop.py +171 -0
- mollie/models/list_capabilitiesop.py +62 -0
- mollie/models/list_capture_response.py +264 -0
- mollie/models/list_capturesop.py +185 -0
- mollie/models/list_chargebacksop.py +185 -0
- mollie/models/list_clientsop.py +269 -0
- mollie/models/list_connect_balance_transfersop.py +177 -0
- mollie/models/list_customer_paymentsop.py +231 -0
- mollie/models/list_customer_response.py +164 -0
- mollie/models/list_customersop.py +172 -0
- mollie/models/list_entity_balance.py +322 -0
- mollie/models/list_entity_chargeback.py +244 -0
- mollie/models/list_entity_invoice.py +244 -0
- mollie/models/list_entity_method.py +315 -0
- mollie/models/list_entity_method_all.py +391 -0
- mollie/models/list_entity_permission.py +56 -0
- mollie/models/list_entity_refund.py +352 -0
- mollie/models/list_entity_settlement.py +457 -0
- mollie/models/list_entity_terminal.py +157 -0
- mollie/models/list_entity_webhook.py +117 -0
- mollie/models/list_invoicesop.py +175 -0
- mollie/models/list_links.py +68 -0
- mollie/models/list_mandate_response.py +261 -0
- mollie/models/list_mandatesop.py +186 -0
- mollie/models/list_methodsop.py +332 -0
- mollie/models/list_payment_linksop.py +159 -0
- mollie/models/list_payment_response.py +1953 -0
- mollie/models/list_paymentsop.py +217 -0
- mollie/models/list_permissionsop.py +85 -0
- mollie/models/list_profile_response.py +194 -0
- mollie/models/list_profilesop.py +118 -0
- mollie/models/list_refundsop.py +189 -0
- mollie/models/list_route_get_response.py +97 -0
- mollie/models/list_sales_invoice_response.py +505 -0
- mollie/models/list_sales_invoicesop.py +172 -0
- mollie/models/list_settlement_capturesop.py +187 -0
- mollie/models/list_settlement_chargebacksop.py +187 -0
- mollie/models/list_settlement_paymentsop.py +233 -0
- mollie/models/list_settlement_refundsop.py +191 -0
- mollie/models/list_settlementsop.py +178 -0
- mollie/models/list_subscription_paymentsop.py +242 -0
- mollie/models/list_subscription_response.py +344 -0
- mollie/models/list_subscriptionsop.py +189 -0
- mollie/models/list_terminalsop.py +172 -0
- mollie/models/list_webhooksop.py +189 -0
- mollie/models/locale.py +32 -0
- mollie/models/locale_response.py +33 -0
- mollie/models/mandate_details_card_label_response.py +22 -0
- mollie/models/mandate_method.py +15 -0
- mollie/models/mandate_method_response.py +16 -0
- mollie/models/mandate_request.py +160 -0
- mollie/models/mandate_response.py +264 -0
- mollie/models/metadata.py +19 -0
- mollie/models/method.py +50 -0
- mollie/models/method_include_wallets_parameter.py +8 -0
- mollie/models/method_resource_parameter.py +9 -0
- mollie/models/method_response.py +59 -0
- mollie/models/method_status.py +15 -0
- mollie/models/mode.py +12 -0
- mollie/models/no_response_error.py +17 -0
- mollie/models/onboarding_vat_regulation.py +16 -0
- mollie/models/organization_vat_regulation.py +17 -0
- mollie/models/payment_address.py +130 -0
- mollie/models/payment_create_routeop.py +43 -0
- mollie/models/payment_details_card_audition_response.py +12 -0
- mollie/models/payment_details_card_funding_response.py +14 -0
- mollie/models/payment_details_card_label_response.py +23 -0
- mollie/models/payment_details_card_security_response.py +12 -0
- mollie/models/payment_details_failure_reason_response.py +25 -0
- mollie/models/payment_details_fee_region_response.py +20 -0
- mollie/models/payment_details_receipt_card_read_method_response.py +17 -0
- mollie/models/payment_details_receipt_card_verification_method_response.py +21 -0
- mollie/models/payment_details_seller_protection_response.py +20 -0
- mollie/models/payment_details_wallet_response.py +11 -0
- mollie/models/payment_line_item.py +96 -0
- mollie/models/payment_line_item_response.py +104 -0
- mollie/models/payment_line_type.py +20 -0
- mollie/models/payment_line_type_response.py +21 -0
- mollie/models/payment_link_method.py +36 -0
- mollie/models/payment_link_method_response.py +37 -0
- mollie/models/payment_link_response.py +348 -0
- mollie/models/payment_link_sequence_type.py +9 -0
- mollie/models/payment_link_sequence_type_response.py +10 -0
- mollie/models/payment_list_routesop.py +140 -0
- mollie/models/payment_method.py +53 -0
- mollie/models/payment_request.py +919 -0
- mollie/models/payment_response.py +1953 -0
- mollie/models/profile_request.py +67 -0
- mollie/models/profile_response.py +197 -0
- mollie/models/profile_review_status_response.py +12 -0
- mollie/models/recurring_line_item.py +77 -0
- mollie/models/refund_external_reference_type.py +10 -0
- mollie/models/refund_external_reference_type_response.py +11 -0
- mollie/models/refund_request.py +200 -0
- mollie/models/release_authorizationop.py +108 -0
- mollie/models/request_apple_pay_payment_sessionop.py +76 -0
- mollie/models/responsevalidationerror.py +27 -0
- mollie/models/revoke_mandateop.py +100 -0
- mollie/models/route_create_response.py +97 -0
- mollie/models/route_destination_type.py +10 -0
- mollie/models/route_destination_type_response.py +11 -0
- mollie/models/sales_invoice_discount.py +21 -0
- mollie/models/sales_invoice_discount_response.py +25 -0
- mollie/models/sales_invoice_discount_type.py +11 -0
- mollie/models/sales_invoice_discount_type_response.py +12 -0
- mollie/models/sales_invoice_email_details.py +20 -0
- mollie/models/sales_invoice_line_item.py +67 -0
- mollie/models/sales_invoice_line_item_response.py +70 -0
- mollie/models/sales_invoice_payment_details.py +59 -0
- mollie/models/sales_invoice_payment_details_response.py +66 -0
- mollie/models/sales_invoice_payment_details_source.py +12 -0
- mollie/models/sales_invoice_payment_details_source_response.py +13 -0
- mollie/models/sales_invoice_payment_term.py +16 -0
- mollie/models/sales_invoice_payment_term_response.py +17 -0
- mollie/models/sales_invoice_recipient.py +176 -0
- mollie/models/sales_invoice_recipient_locale.py +18 -0
- mollie/models/sales_invoice_recipient_locale_response.py +19 -0
- mollie/models/sales_invoice_recipient_response.py +182 -0
- mollie/models/sales_invoice_recipient_type.py +13 -0
- mollie/models/sales_invoice_recipient_type_response.py +14 -0
- mollie/models/sales_invoice_request.py +256 -0
- mollie/models/sales_invoice_response.py +509 -0
- mollie/models/sales_invoice_status.py +25 -0
- mollie/models/sales_invoice_status_response.py +26 -0
- mollie/models/sales_invoice_vat_mode.py +13 -0
- mollie/models/sales_invoice_vat_mode_response.py +14 -0
- mollie/models/sales_invoice_vat_scheme.py +11 -0
- mollie/models/sales_invoice_vat_scheme_response.py +12 -0
- mollie/models/security.py +35 -0
- mollie/models/sequence_type.py +10 -0
- mollie/models/sequence_type_response.py +11 -0
- mollie/models/sorting.py +9 -0
- mollie/models/status_reason.py +168 -0
- mollie/models/sub_group.py +52 -0
- mollie/models/sub_totals.py +120 -0
- mollie/models/submit_onboarding_dataop.py +214 -0
- mollie/models/subscription_method.py +12 -0
- mollie/models/subscription_method_response.py +13 -0
- mollie/models/subscription_request.py +213 -0
- mollie/models/subscription_response.py +349 -0
- mollie/models/terminal_brand.py +12 -0
- mollie/models/terminal_model.py +16 -0
- mollie/models/test_webhookop.py +64 -0
- mollie/models/update_customerop.py +43 -0
- mollie/models/update_payment_linkop.py +172 -0
- mollie/models/update_paymentop.py +332 -0
- mollie/models/update_profileop.py +147 -0
- mollie/models/update_sales_invoiceop.py +44 -0
- mollie/models/update_subscriptionop.py +188 -0
- mollie/models/update_values_sales_invoice.py +176 -0
- mollie/models/update_webhookop.py +83 -0
- mollie/models/url.py +24 -0
- mollie/models/url_nullable.py +25 -0
- mollie/models/webhook_event_types.py +18 -0
- mollie/models/webhook_status.py +14 -0
- mollie/onboarding.py +403 -0
- mollie/organizations.py +579 -0
- mollie/payment_links.py +1323 -0
- mollie/payments_sdk.py +1385 -0
- mollie/permissions.py +397 -0
- mollie/profiles.py +1209 -0
- mollie/py.typed +1 -0
- mollie/refunds_sdk.py +1111 -0
- mollie/sales_invoices.py +1121 -0
- mollie/sdk.py +265 -0
- mollie/sdkconfiguration.py +50 -0
- mollie/settlements.py +1735 -0
- mollie/subscriptions.py +1617 -0
- mollie/terminals.py +427 -0
- mollie/types/__init__.py +21 -0
- mollie/types/basemodel.py +39 -0
- mollie/utils/__init__.py +200 -0
- mollie/utils/annotations.py +79 -0
- mollie/utils/datetimes.py +23 -0
- mollie/utils/enums.py +74 -0
- mollie/utils/eventstreaming.py +248 -0
- mollie/utils/forms.py +223 -0
- mollie/utils/headers.py +136 -0
- mollie/utils/logger.py +27 -0
- mollie/utils/metadata.py +118 -0
- mollie/utils/queryparams.py +205 -0
- mollie/utils/requestbodies.py +66 -0
- mollie/utils/retries.py +217 -0
- mollie/utils/security.py +195 -0
- mollie/utils/serializers.py +249 -0
- mollie/utils/unmarshal_json_response.py +24 -0
- mollie/utils/url.py +155 -0
- mollie/utils/values.py +137 -0
- mollie/wallets.py +263 -0
- mollie/webhook_events.py +211 -0
- mollie/webhooks.py +1305 -0
- mollie_api_py-1.0.0.dist-info/METADATA +834 -0
- mollie_api_py-1.0.0.dist-info/RECORD +337 -0
- mollie_api_py-1.0.0.dist-info/WHEEL +4 -0
- mollie_api_py-1.0.0.dist-info/licenses/LICENSE.md +24 -0
mollie/customers.py
ADDED
|
@@ -0,0 +1,1563 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from mollie import models, utils
|
|
5
|
+
from mollie._hooks import HookContext
|
|
6
|
+
from mollie.types import OptionalNullable, UNSET
|
|
7
|
+
from mollie.utils import get_security_from_env
|
|
8
|
+
from mollie.utils.unmarshal_json_response import unmarshal_json_response
|
|
9
|
+
from typing import Any, Mapping, Optional, Union
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Customers(BaseSDK):
|
|
13
|
+
def create(
|
|
14
|
+
self,
|
|
15
|
+
*,
|
|
16
|
+
idempotency_key: Optional[str] = None,
|
|
17
|
+
entity_customer: Optional[
|
|
18
|
+
Union[models.EntityCustomer, models.EntityCustomerTypedDict]
|
|
19
|
+
] = None,
|
|
20
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
21
|
+
server_url: Optional[str] = None,
|
|
22
|
+
timeout_ms: Optional[int] = None,
|
|
23
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
24
|
+
) -> models.CustomerResponse:
|
|
25
|
+
r"""Create customer
|
|
26
|
+
|
|
27
|
+
Creates a simple minimal representation of a customer. Payments, recurring mandates, and subscriptions can be linked
|
|
28
|
+
to this customer object, which simplifies management of recurring payments.
|
|
29
|
+
|
|
30
|
+
Once registered, customers will also appear in your Mollie dashboard.
|
|
31
|
+
|
|
32
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
33
|
+
:param entity_customer:
|
|
34
|
+
:param retries: Override the default retry configuration for this method
|
|
35
|
+
:param server_url: Override the default server URL for this method
|
|
36
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
37
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
38
|
+
"""
|
|
39
|
+
base_url = None
|
|
40
|
+
url_variables = None
|
|
41
|
+
if timeout_ms is None:
|
|
42
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
43
|
+
|
|
44
|
+
if server_url is not None:
|
|
45
|
+
base_url = server_url
|
|
46
|
+
else:
|
|
47
|
+
base_url = self._get_url(base_url, url_variables)
|
|
48
|
+
|
|
49
|
+
request = models.CreateCustomerRequest(
|
|
50
|
+
idempotency_key=idempotency_key,
|
|
51
|
+
entity_customer=utils.get_pydantic_model(
|
|
52
|
+
entity_customer, Optional[models.EntityCustomer]
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
req = self._build_request(
|
|
57
|
+
method="POST",
|
|
58
|
+
path="/customers",
|
|
59
|
+
base_url=base_url,
|
|
60
|
+
url_variables=url_variables,
|
|
61
|
+
request=request,
|
|
62
|
+
request_body_required=False,
|
|
63
|
+
request_has_path_params=False,
|
|
64
|
+
request_has_query_params=True,
|
|
65
|
+
user_agent_header="user-agent",
|
|
66
|
+
accept_header_value="application/hal+json",
|
|
67
|
+
http_headers=http_headers,
|
|
68
|
+
security=self.sdk_configuration.security,
|
|
69
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
70
|
+
request.entity_customer,
|
|
71
|
+
False,
|
|
72
|
+
True,
|
|
73
|
+
"json",
|
|
74
|
+
Optional[models.EntityCustomer],
|
|
75
|
+
),
|
|
76
|
+
timeout_ms=timeout_ms,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
if retries == UNSET:
|
|
80
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
81
|
+
retries = self.sdk_configuration.retry_config
|
|
82
|
+
else:
|
|
83
|
+
retries = utils.RetryConfig(
|
|
84
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
retry_config = None
|
|
88
|
+
if isinstance(retries, utils.RetryConfig):
|
|
89
|
+
retry_config = (retries, ["5xx"])
|
|
90
|
+
|
|
91
|
+
http_res = self.do_request(
|
|
92
|
+
hook_ctx=HookContext(
|
|
93
|
+
config=self.sdk_configuration,
|
|
94
|
+
base_url=base_url or "",
|
|
95
|
+
operation_id="create-customer",
|
|
96
|
+
oauth2_scopes=None,
|
|
97
|
+
security_source=get_security_from_env(
|
|
98
|
+
self.sdk_configuration.security, models.Security
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
request=req,
|
|
102
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
103
|
+
retry_config=retry_config,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response_data: Any = None
|
|
107
|
+
if utils.match_response(http_res, "201", "application/hal+json"):
|
|
108
|
+
return unmarshal_json_response(models.CustomerResponse, http_res)
|
|
109
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
110
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
111
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
112
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
113
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
114
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
115
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
116
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
117
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
118
|
+
|
|
119
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
120
|
+
|
|
121
|
+
async def create_async(
|
|
122
|
+
self,
|
|
123
|
+
*,
|
|
124
|
+
idempotency_key: Optional[str] = None,
|
|
125
|
+
entity_customer: Optional[
|
|
126
|
+
Union[models.EntityCustomer, models.EntityCustomerTypedDict]
|
|
127
|
+
] = None,
|
|
128
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
129
|
+
server_url: Optional[str] = None,
|
|
130
|
+
timeout_ms: Optional[int] = None,
|
|
131
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
132
|
+
) -> models.CustomerResponse:
|
|
133
|
+
r"""Create customer
|
|
134
|
+
|
|
135
|
+
Creates a simple minimal representation of a customer. Payments, recurring mandates, and subscriptions can be linked
|
|
136
|
+
to this customer object, which simplifies management of recurring payments.
|
|
137
|
+
|
|
138
|
+
Once registered, customers will also appear in your Mollie dashboard.
|
|
139
|
+
|
|
140
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
141
|
+
:param entity_customer:
|
|
142
|
+
:param retries: Override the default retry configuration for this method
|
|
143
|
+
:param server_url: Override the default server URL for this method
|
|
144
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
145
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
146
|
+
"""
|
|
147
|
+
base_url = None
|
|
148
|
+
url_variables = None
|
|
149
|
+
if timeout_ms is None:
|
|
150
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
151
|
+
|
|
152
|
+
if server_url is not None:
|
|
153
|
+
base_url = server_url
|
|
154
|
+
else:
|
|
155
|
+
base_url = self._get_url(base_url, url_variables)
|
|
156
|
+
|
|
157
|
+
request = models.CreateCustomerRequest(
|
|
158
|
+
idempotency_key=idempotency_key,
|
|
159
|
+
entity_customer=utils.get_pydantic_model(
|
|
160
|
+
entity_customer, Optional[models.EntityCustomer]
|
|
161
|
+
),
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
req = self._build_request_async(
|
|
165
|
+
method="POST",
|
|
166
|
+
path="/customers",
|
|
167
|
+
base_url=base_url,
|
|
168
|
+
url_variables=url_variables,
|
|
169
|
+
request=request,
|
|
170
|
+
request_body_required=False,
|
|
171
|
+
request_has_path_params=False,
|
|
172
|
+
request_has_query_params=True,
|
|
173
|
+
user_agent_header="user-agent",
|
|
174
|
+
accept_header_value="application/hal+json",
|
|
175
|
+
http_headers=http_headers,
|
|
176
|
+
security=self.sdk_configuration.security,
|
|
177
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
178
|
+
request.entity_customer,
|
|
179
|
+
False,
|
|
180
|
+
True,
|
|
181
|
+
"json",
|
|
182
|
+
Optional[models.EntityCustomer],
|
|
183
|
+
),
|
|
184
|
+
timeout_ms=timeout_ms,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
if retries == UNSET:
|
|
188
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
189
|
+
retries = self.sdk_configuration.retry_config
|
|
190
|
+
else:
|
|
191
|
+
retries = utils.RetryConfig(
|
|
192
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
retry_config = None
|
|
196
|
+
if isinstance(retries, utils.RetryConfig):
|
|
197
|
+
retry_config = (retries, ["5xx"])
|
|
198
|
+
|
|
199
|
+
http_res = await self.do_request_async(
|
|
200
|
+
hook_ctx=HookContext(
|
|
201
|
+
config=self.sdk_configuration,
|
|
202
|
+
base_url=base_url or "",
|
|
203
|
+
operation_id="create-customer",
|
|
204
|
+
oauth2_scopes=None,
|
|
205
|
+
security_source=get_security_from_env(
|
|
206
|
+
self.sdk_configuration.security, models.Security
|
|
207
|
+
),
|
|
208
|
+
),
|
|
209
|
+
request=req,
|
|
210
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
211
|
+
retry_config=retry_config,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
response_data: Any = None
|
|
215
|
+
if utils.match_response(http_res, "201", "application/hal+json"):
|
|
216
|
+
return unmarshal_json_response(models.CustomerResponse, http_res)
|
|
217
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
218
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
219
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
220
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
221
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
222
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
223
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
224
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
225
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
226
|
+
|
|
227
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
228
|
+
|
|
229
|
+
def list(
|
|
230
|
+
self,
|
|
231
|
+
*,
|
|
232
|
+
from_: Optional[str] = None,
|
|
233
|
+
limit: OptionalNullable[int] = UNSET,
|
|
234
|
+
sort: Optional[models.Sorting] = None,
|
|
235
|
+
testmode: Optional[bool] = None,
|
|
236
|
+
idempotency_key: Optional[str] = None,
|
|
237
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
238
|
+
server_url: Optional[str] = None,
|
|
239
|
+
timeout_ms: Optional[int] = None,
|
|
240
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
241
|
+
) -> models.ListCustomersResponse:
|
|
242
|
+
r"""List customers
|
|
243
|
+
|
|
244
|
+
Retrieve a list of all customers.
|
|
245
|
+
|
|
246
|
+
The results are paginated.
|
|
247
|
+
|
|
248
|
+
:param from_: Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
|
|
249
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
250
|
+
:param sort: Used for setting the direction of the result set. Defaults to descending order, meaning the results are ordered from newest to oldest.
|
|
251
|
+
:param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter can be omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
|
|
252
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
253
|
+
:param retries: Override the default retry configuration for this method
|
|
254
|
+
:param server_url: Override the default server URL for this method
|
|
255
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
256
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
257
|
+
"""
|
|
258
|
+
base_url = None
|
|
259
|
+
url_variables = None
|
|
260
|
+
if timeout_ms is None:
|
|
261
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
262
|
+
|
|
263
|
+
if server_url is not None:
|
|
264
|
+
base_url = server_url
|
|
265
|
+
else:
|
|
266
|
+
base_url = self._get_url(base_url, url_variables)
|
|
267
|
+
|
|
268
|
+
request = models.ListCustomersRequest(
|
|
269
|
+
from_=from_,
|
|
270
|
+
limit=limit,
|
|
271
|
+
sort=sort,
|
|
272
|
+
testmode=testmode,
|
|
273
|
+
idempotency_key=idempotency_key,
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
req = self._build_request(
|
|
277
|
+
method="GET",
|
|
278
|
+
path="/customers",
|
|
279
|
+
base_url=base_url,
|
|
280
|
+
url_variables=url_variables,
|
|
281
|
+
request=request,
|
|
282
|
+
request_body_required=False,
|
|
283
|
+
request_has_path_params=False,
|
|
284
|
+
request_has_query_params=True,
|
|
285
|
+
user_agent_header="user-agent",
|
|
286
|
+
accept_header_value="application/hal+json",
|
|
287
|
+
http_headers=http_headers,
|
|
288
|
+
_globals=models.ListCustomersGlobals(
|
|
289
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
290
|
+
),
|
|
291
|
+
security=self.sdk_configuration.security,
|
|
292
|
+
timeout_ms=timeout_ms,
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
if retries == UNSET:
|
|
296
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
297
|
+
retries = self.sdk_configuration.retry_config
|
|
298
|
+
else:
|
|
299
|
+
retries = utils.RetryConfig(
|
|
300
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
retry_config = None
|
|
304
|
+
if isinstance(retries, utils.RetryConfig):
|
|
305
|
+
retry_config = (retries, ["5xx"])
|
|
306
|
+
|
|
307
|
+
http_res = self.do_request(
|
|
308
|
+
hook_ctx=HookContext(
|
|
309
|
+
config=self.sdk_configuration,
|
|
310
|
+
base_url=base_url or "",
|
|
311
|
+
operation_id="list-customers",
|
|
312
|
+
oauth2_scopes=None,
|
|
313
|
+
security_source=get_security_from_env(
|
|
314
|
+
self.sdk_configuration.security, models.Security
|
|
315
|
+
),
|
|
316
|
+
),
|
|
317
|
+
request=req,
|
|
318
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
319
|
+
retry_config=retry_config,
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
response_data: Any = None
|
|
323
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
324
|
+
return unmarshal_json_response(models.ListCustomersResponse, http_res)
|
|
325
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
326
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
327
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
328
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
329
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
330
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
331
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
332
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
333
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
334
|
+
|
|
335
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
336
|
+
|
|
337
|
+
async def list_async(
|
|
338
|
+
self,
|
|
339
|
+
*,
|
|
340
|
+
from_: Optional[str] = None,
|
|
341
|
+
limit: OptionalNullable[int] = UNSET,
|
|
342
|
+
sort: Optional[models.Sorting] = None,
|
|
343
|
+
testmode: Optional[bool] = None,
|
|
344
|
+
idempotency_key: Optional[str] = None,
|
|
345
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
346
|
+
server_url: Optional[str] = None,
|
|
347
|
+
timeout_ms: Optional[int] = None,
|
|
348
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
349
|
+
) -> models.ListCustomersResponse:
|
|
350
|
+
r"""List customers
|
|
351
|
+
|
|
352
|
+
Retrieve a list of all customers.
|
|
353
|
+
|
|
354
|
+
The results are paginated.
|
|
355
|
+
|
|
356
|
+
:param from_: Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
|
|
357
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
358
|
+
:param sort: Used for setting the direction of the result set. Defaults to descending order, meaning the results are ordered from newest to oldest.
|
|
359
|
+
:param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter can be omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
|
|
360
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
361
|
+
:param retries: Override the default retry configuration for this method
|
|
362
|
+
:param server_url: Override the default server URL for this method
|
|
363
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
364
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
365
|
+
"""
|
|
366
|
+
base_url = None
|
|
367
|
+
url_variables = None
|
|
368
|
+
if timeout_ms is None:
|
|
369
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
370
|
+
|
|
371
|
+
if server_url is not None:
|
|
372
|
+
base_url = server_url
|
|
373
|
+
else:
|
|
374
|
+
base_url = self._get_url(base_url, url_variables)
|
|
375
|
+
|
|
376
|
+
request = models.ListCustomersRequest(
|
|
377
|
+
from_=from_,
|
|
378
|
+
limit=limit,
|
|
379
|
+
sort=sort,
|
|
380
|
+
testmode=testmode,
|
|
381
|
+
idempotency_key=idempotency_key,
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
req = self._build_request_async(
|
|
385
|
+
method="GET",
|
|
386
|
+
path="/customers",
|
|
387
|
+
base_url=base_url,
|
|
388
|
+
url_variables=url_variables,
|
|
389
|
+
request=request,
|
|
390
|
+
request_body_required=False,
|
|
391
|
+
request_has_path_params=False,
|
|
392
|
+
request_has_query_params=True,
|
|
393
|
+
user_agent_header="user-agent",
|
|
394
|
+
accept_header_value="application/hal+json",
|
|
395
|
+
http_headers=http_headers,
|
|
396
|
+
_globals=models.ListCustomersGlobals(
|
|
397
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
398
|
+
),
|
|
399
|
+
security=self.sdk_configuration.security,
|
|
400
|
+
timeout_ms=timeout_ms,
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
if retries == UNSET:
|
|
404
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
405
|
+
retries = self.sdk_configuration.retry_config
|
|
406
|
+
else:
|
|
407
|
+
retries = utils.RetryConfig(
|
|
408
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
retry_config = None
|
|
412
|
+
if isinstance(retries, utils.RetryConfig):
|
|
413
|
+
retry_config = (retries, ["5xx"])
|
|
414
|
+
|
|
415
|
+
http_res = await self.do_request_async(
|
|
416
|
+
hook_ctx=HookContext(
|
|
417
|
+
config=self.sdk_configuration,
|
|
418
|
+
base_url=base_url or "",
|
|
419
|
+
operation_id="list-customers",
|
|
420
|
+
oauth2_scopes=None,
|
|
421
|
+
security_source=get_security_from_env(
|
|
422
|
+
self.sdk_configuration.security, models.Security
|
|
423
|
+
),
|
|
424
|
+
),
|
|
425
|
+
request=req,
|
|
426
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
427
|
+
retry_config=retry_config,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
response_data: Any = None
|
|
431
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
432
|
+
return unmarshal_json_response(models.ListCustomersResponse, http_res)
|
|
433
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
434
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
435
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
436
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
437
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
438
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
439
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
440
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
441
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
442
|
+
|
|
443
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
444
|
+
|
|
445
|
+
def get(
|
|
446
|
+
self,
|
|
447
|
+
*,
|
|
448
|
+
customer_id: str,
|
|
449
|
+
include: OptionalNullable[str] = UNSET,
|
|
450
|
+
testmode: Optional[bool] = None,
|
|
451
|
+
idempotency_key: Optional[str] = None,
|
|
452
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
453
|
+
server_url: Optional[str] = None,
|
|
454
|
+
timeout_ms: Optional[int] = None,
|
|
455
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
456
|
+
) -> models.GetCustomerResponse:
|
|
457
|
+
r"""Get customer
|
|
458
|
+
|
|
459
|
+
Retrieve a single customer by its ID.
|
|
460
|
+
|
|
461
|
+
:param customer_id: Provide the ID of the related customer.
|
|
462
|
+
:param include: This endpoint allows you to include additional information via the `include` query string parameter.
|
|
463
|
+
:param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter can be omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
|
|
464
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
465
|
+
:param retries: Override the default retry configuration for this method
|
|
466
|
+
:param server_url: Override the default server URL for this method
|
|
467
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
468
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
469
|
+
"""
|
|
470
|
+
base_url = None
|
|
471
|
+
url_variables = None
|
|
472
|
+
if timeout_ms is None:
|
|
473
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
474
|
+
|
|
475
|
+
if server_url is not None:
|
|
476
|
+
base_url = server_url
|
|
477
|
+
else:
|
|
478
|
+
base_url = self._get_url(base_url, url_variables)
|
|
479
|
+
|
|
480
|
+
request = models.GetCustomerRequest(
|
|
481
|
+
customer_id=customer_id,
|
|
482
|
+
include=include,
|
|
483
|
+
testmode=testmode,
|
|
484
|
+
idempotency_key=idempotency_key,
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
req = self._build_request(
|
|
488
|
+
method="GET",
|
|
489
|
+
path="/customers/{customerId}",
|
|
490
|
+
base_url=base_url,
|
|
491
|
+
url_variables=url_variables,
|
|
492
|
+
request=request,
|
|
493
|
+
request_body_required=False,
|
|
494
|
+
request_has_path_params=True,
|
|
495
|
+
request_has_query_params=True,
|
|
496
|
+
user_agent_header="user-agent",
|
|
497
|
+
accept_header_value="application/hal+json",
|
|
498
|
+
http_headers=http_headers,
|
|
499
|
+
_globals=models.GetCustomerGlobals(
|
|
500
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
501
|
+
),
|
|
502
|
+
security=self.sdk_configuration.security,
|
|
503
|
+
timeout_ms=timeout_ms,
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
if retries == UNSET:
|
|
507
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
508
|
+
retries = self.sdk_configuration.retry_config
|
|
509
|
+
else:
|
|
510
|
+
retries = utils.RetryConfig(
|
|
511
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
retry_config = None
|
|
515
|
+
if isinstance(retries, utils.RetryConfig):
|
|
516
|
+
retry_config = (retries, ["5xx"])
|
|
517
|
+
|
|
518
|
+
http_res = self.do_request(
|
|
519
|
+
hook_ctx=HookContext(
|
|
520
|
+
config=self.sdk_configuration,
|
|
521
|
+
base_url=base_url or "",
|
|
522
|
+
operation_id="get-customer",
|
|
523
|
+
oauth2_scopes=None,
|
|
524
|
+
security_source=get_security_from_env(
|
|
525
|
+
self.sdk_configuration.security, models.Security
|
|
526
|
+
),
|
|
527
|
+
),
|
|
528
|
+
request=req,
|
|
529
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
530
|
+
retry_config=retry_config,
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
response_data: Any = None
|
|
534
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
535
|
+
return unmarshal_json_response(models.GetCustomerResponse, http_res)
|
|
536
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
537
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
538
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
539
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
540
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
541
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
542
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
543
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
544
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
545
|
+
|
|
546
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
547
|
+
|
|
548
|
+
async def get_async(
|
|
549
|
+
self,
|
|
550
|
+
*,
|
|
551
|
+
customer_id: str,
|
|
552
|
+
include: OptionalNullable[str] = UNSET,
|
|
553
|
+
testmode: Optional[bool] = None,
|
|
554
|
+
idempotency_key: Optional[str] = None,
|
|
555
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
556
|
+
server_url: Optional[str] = None,
|
|
557
|
+
timeout_ms: Optional[int] = None,
|
|
558
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
559
|
+
) -> models.GetCustomerResponse:
|
|
560
|
+
r"""Get customer
|
|
561
|
+
|
|
562
|
+
Retrieve a single customer by its ID.
|
|
563
|
+
|
|
564
|
+
:param customer_id: Provide the ID of the related customer.
|
|
565
|
+
:param include: This endpoint allows you to include additional information via the `include` query string parameter.
|
|
566
|
+
:param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter can be omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
|
|
567
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
568
|
+
:param retries: Override the default retry configuration for this method
|
|
569
|
+
:param server_url: Override the default server URL for this method
|
|
570
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
571
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
572
|
+
"""
|
|
573
|
+
base_url = None
|
|
574
|
+
url_variables = None
|
|
575
|
+
if timeout_ms is None:
|
|
576
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
577
|
+
|
|
578
|
+
if server_url is not None:
|
|
579
|
+
base_url = server_url
|
|
580
|
+
else:
|
|
581
|
+
base_url = self._get_url(base_url, url_variables)
|
|
582
|
+
|
|
583
|
+
request = models.GetCustomerRequest(
|
|
584
|
+
customer_id=customer_id,
|
|
585
|
+
include=include,
|
|
586
|
+
testmode=testmode,
|
|
587
|
+
idempotency_key=idempotency_key,
|
|
588
|
+
)
|
|
589
|
+
|
|
590
|
+
req = self._build_request_async(
|
|
591
|
+
method="GET",
|
|
592
|
+
path="/customers/{customerId}",
|
|
593
|
+
base_url=base_url,
|
|
594
|
+
url_variables=url_variables,
|
|
595
|
+
request=request,
|
|
596
|
+
request_body_required=False,
|
|
597
|
+
request_has_path_params=True,
|
|
598
|
+
request_has_query_params=True,
|
|
599
|
+
user_agent_header="user-agent",
|
|
600
|
+
accept_header_value="application/hal+json",
|
|
601
|
+
http_headers=http_headers,
|
|
602
|
+
_globals=models.GetCustomerGlobals(
|
|
603
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
604
|
+
),
|
|
605
|
+
security=self.sdk_configuration.security,
|
|
606
|
+
timeout_ms=timeout_ms,
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
if retries == UNSET:
|
|
610
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
611
|
+
retries = self.sdk_configuration.retry_config
|
|
612
|
+
else:
|
|
613
|
+
retries = utils.RetryConfig(
|
|
614
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
retry_config = None
|
|
618
|
+
if isinstance(retries, utils.RetryConfig):
|
|
619
|
+
retry_config = (retries, ["5xx"])
|
|
620
|
+
|
|
621
|
+
http_res = await self.do_request_async(
|
|
622
|
+
hook_ctx=HookContext(
|
|
623
|
+
config=self.sdk_configuration,
|
|
624
|
+
base_url=base_url or "",
|
|
625
|
+
operation_id="get-customer",
|
|
626
|
+
oauth2_scopes=None,
|
|
627
|
+
security_source=get_security_from_env(
|
|
628
|
+
self.sdk_configuration.security, models.Security
|
|
629
|
+
),
|
|
630
|
+
),
|
|
631
|
+
request=req,
|
|
632
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
633
|
+
retry_config=retry_config,
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
response_data: Any = None
|
|
637
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
638
|
+
return unmarshal_json_response(models.GetCustomerResponse, http_res)
|
|
639
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
640
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
641
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
642
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
643
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
644
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
645
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
646
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
647
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
648
|
+
|
|
649
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
650
|
+
|
|
651
|
+
def update(
|
|
652
|
+
self,
|
|
653
|
+
*,
|
|
654
|
+
customer_id: str,
|
|
655
|
+
idempotency_key: Optional[str] = None,
|
|
656
|
+
entity_customer: Optional[
|
|
657
|
+
Union[models.EntityCustomer, models.EntityCustomerTypedDict]
|
|
658
|
+
] = None,
|
|
659
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
660
|
+
server_url: Optional[str] = None,
|
|
661
|
+
timeout_ms: Optional[int] = None,
|
|
662
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
663
|
+
) -> models.CustomerResponse:
|
|
664
|
+
r"""Update customer
|
|
665
|
+
|
|
666
|
+
Update an existing customer.
|
|
667
|
+
|
|
668
|
+
For an in-depth explanation of each parameter, refer to the [Create customer](create-customer) endpoint.
|
|
669
|
+
|
|
670
|
+
:param customer_id: Provide the ID of the related customer.
|
|
671
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
672
|
+
:param entity_customer:
|
|
673
|
+
:param retries: Override the default retry configuration for this method
|
|
674
|
+
:param server_url: Override the default server URL for this method
|
|
675
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
676
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
677
|
+
"""
|
|
678
|
+
base_url = None
|
|
679
|
+
url_variables = None
|
|
680
|
+
if timeout_ms is None:
|
|
681
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
682
|
+
|
|
683
|
+
if server_url is not None:
|
|
684
|
+
base_url = server_url
|
|
685
|
+
else:
|
|
686
|
+
base_url = self._get_url(base_url, url_variables)
|
|
687
|
+
|
|
688
|
+
request = models.UpdateCustomerRequest(
|
|
689
|
+
customer_id=customer_id,
|
|
690
|
+
idempotency_key=idempotency_key,
|
|
691
|
+
entity_customer=utils.get_pydantic_model(
|
|
692
|
+
entity_customer, Optional[models.EntityCustomer]
|
|
693
|
+
),
|
|
694
|
+
)
|
|
695
|
+
|
|
696
|
+
req = self._build_request(
|
|
697
|
+
method="PATCH",
|
|
698
|
+
path="/customers/{customerId}",
|
|
699
|
+
base_url=base_url,
|
|
700
|
+
url_variables=url_variables,
|
|
701
|
+
request=request,
|
|
702
|
+
request_body_required=False,
|
|
703
|
+
request_has_path_params=True,
|
|
704
|
+
request_has_query_params=True,
|
|
705
|
+
user_agent_header="user-agent",
|
|
706
|
+
accept_header_value="application/hal+json",
|
|
707
|
+
http_headers=http_headers,
|
|
708
|
+
security=self.sdk_configuration.security,
|
|
709
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
710
|
+
request.entity_customer,
|
|
711
|
+
False,
|
|
712
|
+
True,
|
|
713
|
+
"json",
|
|
714
|
+
Optional[models.EntityCustomer],
|
|
715
|
+
),
|
|
716
|
+
timeout_ms=timeout_ms,
|
|
717
|
+
)
|
|
718
|
+
|
|
719
|
+
if retries == UNSET:
|
|
720
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
721
|
+
retries = self.sdk_configuration.retry_config
|
|
722
|
+
else:
|
|
723
|
+
retries = utils.RetryConfig(
|
|
724
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
725
|
+
)
|
|
726
|
+
|
|
727
|
+
retry_config = None
|
|
728
|
+
if isinstance(retries, utils.RetryConfig):
|
|
729
|
+
retry_config = (retries, ["5xx"])
|
|
730
|
+
|
|
731
|
+
http_res = self.do_request(
|
|
732
|
+
hook_ctx=HookContext(
|
|
733
|
+
config=self.sdk_configuration,
|
|
734
|
+
base_url=base_url or "",
|
|
735
|
+
operation_id="update-customer",
|
|
736
|
+
oauth2_scopes=None,
|
|
737
|
+
security_source=get_security_from_env(
|
|
738
|
+
self.sdk_configuration.security, models.Security
|
|
739
|
+
),
|
|
740
|
+
),
|
|
741
|
+
request=req,
|
|
742
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
743
|
+
retry_config=retry_config,
|
|
744
|
+
)
|
|
745
|
+
|
|
746
|
+
response_data: Any = None
|
|
747
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
748
|
+
return unmarshal_json_response(models.CustomerResponse, http_res)
|
|
749
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
750
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
751
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
752
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
753
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
754
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
755
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
756
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
757
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
758
|
+
|
|
759
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
760
|
+
|
|
761
|
+
async def update_async(
|
|
762
|
+
self,
|
|
763
|
+
*,
|
|
764
|
+
customer_id: str,
|
|
765
|
+
idempotency_key: Optional[str] = None,
|
|
766
|
+
entity_customer: Optional[
|
|
767
|
+
Union[models.EntityCustomer, models.EntityCustomerTypedDict]
|
|
768
|
+
] = None,
|
|
769
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
770
|
+
server_url: Optional[str] = None,
|
|
771
|
+
timeout_ms: Optional[int] = None,
|
|
772
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
773
|
+
) -> models.CustomerResponse:
|
|
774
|
+
r"""Update customer
|
|
775
|
+
|
|
776
|
+
Update an existing customer.
|
|
777
|
+
|
|
778
|
+
For an in-depth explanation of each parameter, refer to the [Create customer](create-customer) endpoint.
|
|
779
|
+
|
|
780
|
+
:param customer_id: Provide the ID of the related customer.
|
|
781
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
782
|
+
:param entity_customer:
|
|
783
|
+
:param retries: Override the default retry configuration for this method
|
|
784
|
+
:param server_url: Override the default server URL for this method
|
|
785
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
786
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
787
|
+
"""
|
|
788
|
+
base_url = None
|
|
789
|
+
url_variables = None
|
|
790
|
+
if timeout_ms is None:
|
|
791
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
792
|
+
|
|
793
|
+
if server_url is not None:
|
|
794
|
+
base_url = server_url
|
|
795
|
+
else:
|
|
796
|
+
base_url = self._get_url(base_url, url_variables)
|
|
797
|
+
|
|
798
|
+
request = models.UpdateCustomerRequest(
|
|
799
|
+
customer_id=customer_id,
|
|
800
|
+
idempotency_key=idempotency_key,
|
|
801
|
+
entity_customer=utils.get_pydantic_model(
|
|
802
|
+
entity_customer, Optional[models.EntityCustomer]
|
|
803
|
+
),
|
|
804
|
+
)
|
|
805
|
+
|
|
806
|
+
req = self._build_request_async(
|
|
807
|
+
method="PATCH",
|
|
808
|
+
path="/customers/{customerId}",
|
|
809
|
+
base_url=base_url,
|
|
810
|
+
url_variables=url_variables,
|
|
811
|
+
request=request,
|
|
812
|
+
request_body_required=False,
|
|
813
|
+
request_has_path_params=True,
|
|
814
|
+
request_has_query_params=True,
|
|
815
|
+
user_agent_header="user-agent",
|
|
816
|
+
accept_header_value="application/hal+json",
|
|
817
|
+
http_headers=http_headers,
|
|
818
|
+
security=self.sdk_configuration.security,
|
|
819
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
820
|
+
request.entity_customer,
|
|
821
|
+
False,
|
|
822
|
+
True,
|
|
823
|
+
"json",
|
|
824
|
+
Optional[models.EntityCustomer],
|
|
825
|
+
),
|
|
826
|
+
timeout_ms=timeout_ms,
|
|
827
|
+
)
|
|
828
|
+
|
|
829
|
+
if retries == UNSET:
|
|
830
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
831
|
+
retries = self.sdk_configuration.retry_config
|
|
832
|
+
else:
|
|
833
|
+
retries = utils.RetryConfig(
|
|
834
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
835
|
+
)
|
|
836
|
+
|
|
837
|
+
retry_config = None
|
|
838
|
+
if isinstance(retries, utils.RetryConfig):
|
|
839
|
+
retry_config = (retries, ["5xx"])
|
|
840
|
+
|
|
841
|
+
http_res = await self.do_request_async(
|
|
842
|
+
hook_ctx=HookContext(
|
|
843
|
+
config=self.sdk_configuration,
|
|
844
|
+
base_url=base_url or "",
|
|
845
|
+
operation_id="update-customer",
|
|
846
|
+
oauth2_scopes=None,
|
|
847
|
+
security_source=get_security_from_env(
|
|
848
|
+
self.sdk_configuration.security, models.Security
|
|
849
|
+
),
|
|
850
|
+
),
|
|
851
|
+
request=req,
|
|
852
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
853
|
+
retry_config=retry_config,
|
|
854
|
+
)
|
|
855
|
+
|
|
856
|
+
response_data: Any = None
|
|
857
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
858
|
+
return unmarshal_json_response(models.CustomerResponse, http_res)
|
|
859
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
860
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
861
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
862
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
863
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
864
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
865
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
866
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
867
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
868
|
+
|
|
869
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
870
|
+
|
|
871
|
+
def delete(
|
|
872
|
+
self,
|
|
873
|
+
*,
|
|
874
|
+
customer_id: str,
|
|
875
|
+
idempotency_key: Optional[str] = None,
|
|
876
|
+
request_body: Optional[
|
|
877
|
+
Union[
|
|
878
|
+
models.DeleteCustomerRequestBody,
|
|
879
|
+
models.DeleteCustomerRequestBodyTypedDict,
|
|
880
|
+
]
|
|
881
|
+
] = None,
|
|
882
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
883
|
+
server_url: Optional[str] = None,
|
|
884
|
+
timeout_ms: Optional[int] = None,
|
|
885
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
886
|
+
):
|
|
887
|
+
r"""Delete customer
|
|
888
|
+
|
|
889
|
+
Delete a customer. All mandates and subscriptions created for this customer will be canceled as well.
|
|
890
|
+
|
|
891
|
+
:param customer_id: Provide the ID of the related customer.
|
|
892
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
893
|
+
:param request_body:
|
|
894
|
+
:param retries: Override the default retry configuration for this method
|
|
895
|
+
:param server_url: Override the default server URL for this method
|
|
896
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
897
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
898
|
+
"""
|
|
899
|
+
base_url = None
|
|
900
|
+
url_variables = None
|
|
901
|
+
if timeout_ms is None:
|
|
902
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
903
|
+
|
|
904
|
+
if server_url is not None:
|
|
905
|
+
base_url = server_url
|
|
906
|
+
else:
|
|
907
|
+
base_url = self._get_url(base_url, url_variables)
|
|
908
|
+
|
|
909
|
+
request = models.DeleteCustomerRequest(
|
|
910
|
+
customer_id=customer_id,
|
|
911
|
+
idempotency_key=idempotency_key,
|
|
912
|
+
request_body=utils.get_pydantic_model(
|
|
913
|
+
request_body, Optional[models.DeleteCustomerRequestBody]
|
|
914
|
+
),
|
|
915
|
+
)
|
|
916
|
+
|
|
917
|
+
req = self._build_request(
|
|
918
|
+
method="DELETE",
|
|
919
|
+
path="/customers/{customerId}",
|
|
920
|
+
base_url=base_url,
|
|
921
|
+
url_variables=url_variables,
|
|
922
|
+
request=request,
|
|
923
|
+
request_body_required=False,
|
|
924
|
+
request_has_path_params=True,
|
|
925
|
+
request_has_query_params=True,
|
|
926
|
+
user_agent_header="user-agent",
|
|
927
|
+
accept_header_value="application/hal+json",
|
|
928
|
+
http_headers=http_headers,
|
|
929
|
+
security=self.sdk_configuration.security,
|
|
930
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
931
|
+
request.request_body,
|
|
932
|
+
False,
|
|
933
|
+
True,
|
|
934
|
+
"json",
|
|
935
|
+
Optional[models.DeleteCustomerRequestBody],
|
|
936
|
+
),
|
|
937
|
+
timeout_ms=timeout_ms,
|
|
938
|
+
)
|
|
939
|
+
|
|
940
|
+
if retries == UNSET:
|
|
941
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
942
|
+
retries = self.sdk_configuration.retry_config
|
|
943
|
+
else:
|
|
944
|
+
retries = utils.RetryConfig(
|
|
945
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
946
|
+
)
|
|
947
|
+
|
|
948
|
+
retry_config = None
|
|
949
|
+
if isinstance(retries, utils.RetryConfig):
|
|
950
|
+
retry_config = (retries, ["5xx"])
|
|
951
|
+
|
|
952
|
+
http_res = self.do_request(
|
|
953
|
+
hook_ctx=HookContext(
|
|
954
|
+
config=self.sdk_configuration,
|
|
955
|
+
base_url=base_url or "",
|
|
956
|
+
operation_id="delete-customer",
|
|
957
|
+
oauth2_scopes=None,
|
|
958
|
+
security_source=get_security_from_env(
|
|
959
|
+
self.sdk_configuration.security, models.Security
|
|
960
|
+
),
|
|
961
|
+
),
|
|
962
|
+
request=req,
|
|
963
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
964
|
+
retry_config=retry_config,
|
|
965
|
+
)
|
|
966
|
+
|
|
967
|
+
response_data: Any = None
|
|
968
|
+
if utils.match_response(http_res, "204", "*"):
|
|
969
|
+
return
|
|
970
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
971
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
972
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
973
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
974
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
975
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
976
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
977
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
978
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
979
|
+
|
|
980
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
981
|
+
|
|
982
|
+
async def delete_async(
|
|
983
|
+
self,
|
|
984
|
+
*,
|
|
985
|
+
customer_id: str,
|
|
986
|
+
idempotency_key: Optional[str] = None,
|
|
987
|
+
request_body: Optional[
|
|
988
|
+
Union[
|
|
989
|
+
models.DeleteCustomerRequestBody,
|
|
990
|
+
models.DeleteCustomerRequestBodyTypedDict,
|
|
991
|
+
]
|
|
992
|
+
] = None,
|
|
993
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
994
|
+
server_url: Optional[str] = None,
|
|
995
|
+
timeout_ms: Optional[int] = None,
|
|
996
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
997
|
+
):
|
|
998
|
+
r"""Delete customer
|
|
999
|
+
|
|
1000
|
+
Delete a customer. All mandates and subscriptions created for this customer will be canceled as well.
|
|
1001
|
+
|
|
1002
|
+
:param customer_id: Provide the ID of the related customer.
|
|
1003
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1004
|
+
:param request_body:
|
|
1005
|
+
:param retries: Override the default retry configuration for this method
|
|
1006
|
+
:param server_url: Override the default server URL for this method
|
|
1007
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1008
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1009
|
+
"""
|
|
1010
|
+
base_url = None
|
|
1011
|
+
url_variables = None
|
|
1012
|
+
if timeout_ms is None:
|
|
1013
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1014
|
+
|
|
1015
|
+
if server_url is not None:
|
|
1016
|
+
base_url = server_url
|
|
1017
|
+
else:
|
|
1018
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1019
|
+
|
|
1020
|
+
request = models.DeleteCustomerRequest(
|
|
1021
|
+
customer_id=customer_id,
|
|
1022
|
+
idempotency_key=idempotency_key,
|
|
1023
|
+
request_body=utils.get_pydantic_model(
|
|
1024
|
+
request_body, Optional[models.DeleteCustomerRequestBody]
|
|
1025
|
+
),
|
|
1026
|
+
)
|
|
1027
|
+
|
|
1028
|
+
req = self._build_request_async(
|
|
1029
|
+
method="DELETE",
|
|
1030
|
+
path="/customers/{customerId}",
|
|
1031
|
+
base_url=base_url,
|
|
1032
|
+
url_variables=url_variables,
|
|
1033
|
+
request=request,
|
|
1034
|
+
request_body_required=False,
|
|
1035
|
+
request_has_path_params=True,
|
|
1036
|
+
request_has_query_params=True,
|
|
1037
|
+
user_agent_header="user-agent",
|
|
1038
|
+
accept_header_value="application/hal+json",
|
|
1039
|
+
http_headers=http_headers,
|
|
1040
|
+
security=self.sdk_configuration.security,
|
|
1041
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1042
|
+
request.request_body,
|
|
1043
|
+
False,
|
|
1044
|
+
True,
|
|
1045
|
+
"json",
|
|
1046
|
+
Optional[models.DeleteCustomerRequestBody],
|
|
1047
|
+
),
|
|
1048
|
+
timeout_ms=timeout_ms,
|
|
1049
|
+
)
|
|
1050
|
+
|
|
1051
|
+
if retries == UNSET:
|
|
1052
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1053
|
+
retries = self.sdk_configuration.retry_config
|
|
1054
|
+
else:
|
|
1055
|
+
retries = utils.RetryConfig(
|
|
1056
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1057
|
+
)
|
|
1058
|
+
|
|
1059
|
+
retry_config = None
|
|
1060
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1061
|
+
retry_config = (retries, ["5xx"])
|
|
1062
|
+
|
|
1063
|
+
http_res = await self.do_request_async(
|
|
1064
|
+
hook_ctx=HookContext(
|
|
1065
|
+
config=self.sdk_configuration,
|
|
1066
|
+
base_url=base_url or "",
|
|
1067
|
+
operation_id="delete-customer",
|
|
1068
|
+
oauth2_scopes=None,
|
|
1069
|
+
security_source=get_security_from_env(
|
|
1070
|
+
self.sdk_configuration.security, models.Security
|
|
1071
|
+
),
|
|
1072
|
+
),
|
|
1073
|
+
request=req,
|
|
1074
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
1075
|
+
retry_config=retry_config,
|
|
1076
|
+
)
|
|
1077
|
+
|
|
1078
|
+
response_data: Any = None
|
|
1079
|
+
if utils.match_response(http_res, "204", "*"):
|
|
1080
|
+
return
|
|
1081
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
1082
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1083
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1084
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1085
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1086
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1087
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1088
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1089
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1090
|
+
|
|
1091
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1092
|
+
|
|
1093
|
+
def create_payment(
|
|
1094
|
+
self,
|
|
1095
|
+
*,
|
|
1096
|
+
customer_id: str,
|
|
1097
|
+
idempotency_key: Optional[str] = None,
|
|
1098
|
+
payment_request: Optional[
|
|
1099
|
+
Union[models.PaymentRequest, models.PaymentRequestTypedDict]
|
|
1100
|
+
] = None,
|
|
1101
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1102
|
+
server_url: Optional[str] = None,
|
|
1103
|
+
timeout_ms: Optional[int] = None,
|
|
1104
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1105
|
+
) -> models.PaymentResponse:
|
|
1106
|
+
r"""Create customer payment
|
|
1107
|
+
|
|
1108
|
+
Creates a payment for the customer.
|
|
1109
|
+
|
|
1110
|
+
Linking customers to payments enables you to:
|
|
1111
|
+
|
|
1112
|
+
* Keep track of payment preferences for your customers
|
|
1113
|
+
* Allow your customers to charge a previously used credit card with a single click in our hosted checkout
|
|
1114
|
+
* Improve payment insights in the Mollie dashboard
|
|
1115
|
+
* Use recurring payments
|
|
1116
|
+
|
|
1117
|
+
This endpoint is effectively an alias of the [Create payment endpoint](create-payment) with the `customerId`
|
|
1118
|
+
parameter predefined.
|
|
1119
|
+
|
|
1120
|
+
:param customer_id: Provide the ID of the related customer.
|
|
1121
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1122
|
+
:param payment_request:
|
|
1123
|
+
:param retries: Override the default retry configuration for this method
|
|
1124
|
+
:param server_url: Override the default server URL for this method
|
|
1125
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1126
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1127
|
+
"""
|
|
1128
|
+
base_url = None
|
|
1129
|
+
url_variables = None
|
|
1130
|
+
if timeout_ms is None:
|
|
1131
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1132
|
+
|
|
1133
|
+
if server_url is not None:
|
|
1134
|
+
base_url = server_url
|
|
1135
|
+
else:
|
|
1136
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1137
|
+
|
|
1138
|
+
request = models.CreateCustomerPaymentRequest(
|
|
1139
|
+
customer_id=customer_id,
|
|
1140
|
+
idempotency_key=idempotency_key,
|
|
1141
|
+
payment_request=utils.get_pydantic_model(
|
|
1142
|
+
payment_request, Optional[models.PaymentRequest]
|
|
1143
|
+
),
|
|
1144
|
+
)
|
|
1145
|
+
|
|
1146
|
+
req = self._build_request(
|
|
1147
|
+
method="POST",
|
|
1148
|
+
path="/customers/{customerId}/payments",
|
|
1149
|
+
base_url=base_url,
|
|
1150
|
+
url_variables=url_variables,
|
|
1151
|
+
request=request,
|
|
1152
|
+
request_body_required=False,
|
|
1153
|
+
request_has_path_params=True,
|
|
1154
|
+
request_has_query_params=True,
|
|
1155
|
+
user_agent_header="user-agent",
|
|
1156
|
+
accept_header_value="application/hal+json",
|
|
1157
|
+
http_headers=http_headers,
|
|
1158
|
+
security=self.sdk_configuration.security,
|
|
1159
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1160
|
+
request.payment_request,
|
|
1161
|
+
False,
|
|
1162
|
+
True,
|
|
1163
|
+
"json",
|
|
1164
|
+
Optional[models.PaymentRequest],
|
|
1165
|
+
),
|
|
1166
|
+
timeout_ms=timeout_ms,
|
|
1167
|
+
)
|
|
1168
|
+
|
|
1169
|
+
if retries == UNSET:
|
|
1170
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1171
|
+
retries = self.sdk_configuration.retry_config
|
|
1172
|
+
else:
|
|
1173
|
+
retries = utils.RetryConfig(
|
|
1174
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1175
|
+
)
|
|
1176
|
+
|
|
1177
|
+
retry_config = None
|
|
1178
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1179
|
+
retry_config = (retries, ["5xx"])
|
|
1180
|
+
|
|
1181
|
+
http_res = self.do_request(
|
|
1182
|
+
hook_ctx=HookContext(
|
|
1183
|
+
config=self.sdk_configuration,
|
|
1184
|
+
base_url=base_url or "",
|
|
1185
|
+
operation_id="create-customer-payment",
|
|
1186
|
+
oauth2_scopes=None,
|
|
1187
|
+
security_source=get_security_from_env(
|
|
1188
|
+
self.sdk_configuration.security, models.Security
|
|
1189
|
+
),
|
|
1190
|
+
),
|
|
1191
|
+
request=req,
|
|
1192
|
+
error_status_codes=["422", "4XX", "503", "5XX"],
|
|
1193
|
+
retry_config=retry_config,
|
|
1194
|
+
)
|
|
1195
|
+
|
|
1196
|
+
response_data: Any = None
|
|
1197
|
+
if utils.match_response(http_res, "201", "application/hal+json"):
|
|
1198
|
+
return unmarshal_json_response(models.PaymentResponse, http_res)
|
|
1199
|
+
if utils.match_response(http_res, "422", "application/hal+json"):
|
|
1200
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1201
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1202
|
+
if utils.match_response(http_res, "503", "application/hal+json"):
|
|
1203
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1204
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1205
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1206
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1207
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1208
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1209
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1210
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1211
|
+
|
|
1212
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1213
|
+
|
|
1214
|
+
async def create_payment_async(
|
|
1215
|
+
self,
|
|
1216
|
+
*,
|
|
1217
|
+
customer_id: str,
|
|
1218
|
+
idempotency_key: Optional[str] = None,
|
|
1219
|
+
payment_request: Optional[
|
|
1220
|
+
Union[models.PaymentRequest, models.PaymentRequestTypedDict]
|
|
1221
|
+
] = None,
|
|
1222
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1223
|
+
server_url: Optional[str] = None,
|
|
1224
|
+
timeout_ms: Optional[int] = None,
|
|
1225
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1226
|
+
) -> models.PaymentResponse:
|
|
1227
|
+
r"""Create customer payment
|
|
1228
|
+
|
|
1229
|
+
Creates a payment for the customer.
|
|
1230
|
+
|
|
1231
|
+
Linking customers to payments enables you to:
|
|
1232
|
+
|
|
1233
|
+
* Keep track of payment preferences for your customers
|
|
1234
|
+
* Allow your customers to charge a previously used credit card with a single click in our hosted checkout
|
|
1235
|
+
* Improve payment insights in the Mollie dashboard
|
|
1236
|
+
* Use recurring payments
|
|
1237
|
+
|
|
1238
|
+
This endpoint is effectively an alias of the [Create payment endpoint](create-payment) with the `customerId`
|
|
1239
|
+
parameter predefined.
|
|
1240
|
+
|
|
1241
|
+
:param customer_id: Provide the ID of the related customer.
|
|
1242
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1243
|
+
:param payment_request:
|
|
1244
|
+
:param retries: Override the default retry configuration for this method
|
|
1245
|
+
:param server_url: Override the default server URL for this method
|
|
1246
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1247
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1248
|
+
"""
|
|
1249
|
+
base_url = None
|
|
1250
|
+
url_variables = None
|
|
1251
|
+
if timeout_ms is None:
|
|
1252
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1253
|
+
|
|
1254
|
+
if server_url is not None:
|
|
1255
|
+
base_url = server_url
|
|
1256
|
+
else:
|
|
1257
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1258
|
+
|
|
1259
|
+
request = models.CreateCustomerPaymentRequest(
|
|
1260
|
+
customer_id=customer_id,
|
|
1261
|
+
idempotency_key=idempotency_key,
|
|
1262
|
+
payment_request=utils.get_pydantic_model(
|
|
1263
|
+
payment_request, Optional[models.PaymentRequest]
|
|
1264
|
+
),
|
|
1265
|
+
)
|
|
1266
|
+
|
|
1267
|
+
req = self._build_request_async(
|
|
1268
|
+
method="POST",
|
|
1269
|
+
path="/customers/{customerId}/payments",
|
|
1270
|
+
base_url=base_url,
|
|
1271
|
+
url_variables=url_variables,
|
|
1272
|
+
request=request,
|
|
1273
|
+
request_body_required=False,
|
|
1274
|
+
request_has_path_params=True,
|
|
1275
|
+
request_has_query_params=True,
|
|
1276
|
+
user_agent_header="user-agent",
|
|
1277
|
+
accept_header_value="application/hal+json",
|
|
1278
|
+
http_headers=http_headers,
|
|
1279
|
+
security=self.sdk_configuration.security,
|
|
1280
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1281
|
+
request.payment_request,
|
|
1282
|
+
False,
|
|
1283
|
+
True,
|
|
1284
|
+
"json",
|
|
1285
|
+
Optional[models.PaymentRequest],
|
|
1286
|
+
),
|
|
1287
|
+
timeout_ms=timeout_ms,
|
|
1288
|
+
)
|
|
1289
|
+
|
|
1290
|
+
if retries == UNSET:
|
|
1291
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1292
|
+
retries = self.sdk_configuration.retry_config
|
|
1293
|
+
else:
|
|
1294
|
+
retries = utils.RetryConfig(
|
|
1295
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1296
|
+
)
|
|
1297
|
+
|
|
1298
|
+
retry_config = None
|
|
1299
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1300
|
+
retry_config = (retries, ["5xx"])
|
|
1301
|
+
|
|
1302
|
+
http_res = await self.do_request_async(
|
|
1303
|
+
hook_ctx=HookContext(
|
|
1304
|
+
config=self.sdk_configuration,
|
|
1305
|
+
base_url=base_url or "",
|
|
1306
|
+
operation_id="create-customer-payment",
|
|
1307
|
+
oauth2_scopes=None,
|
|
1308
|
+
security_source=get_security_from_env(
|
|
1309
|
+
self.sdk_configuration.security, models.Security
|
|
1310
|
+
),
|
|
1311
|
+
),
|
|
1312
|
+
request=req,
|
|
1313
|
+
error_status_codes=["422", "4XX", "503", "5XX"],
|
|
1314
|
+
retry_config=retry_config,
|
|
1315
|
+
)
|
|
1316
|
+
|
|
1317
|
+
response_data: Any = None
|
|
1318
|
+
if utils.match_response(http_res, "201", "application/hal+json"):
|
|
1319
|
+
return unmarshal_json_response(models.PaymentResponse, http_res)
|
|
1320
|
+
if utils.match_response(http_res, "422", "application/hal+json"):
|
|
1321
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1322
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1323
|
+
if utils.match_response(http_res, "503", "application/hal+json"):
|
|
1324
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1325
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1326
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1327
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1328
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1329
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1330
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1331
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1332
|
+
|
|
1333
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1334
|
+
|
|
1335
|
+
def list_payments(
|
|
1336
|
+
self,
|
|
1337
|
+
*,
|
|
1338
|
+
customer_id: str,
|
|
1339
|
+
from_: Optional[str] = None,
|
|
1340
|
+
limit: OptionalNullable[int] = UNSET,
|
|
1341
|
+
sort: Optional[models.Sorting] = None,
|
|
1342
|
+
profile_id: Optional[str] = None,
|
|
1343
|
+
testmode: Optional[bool] = None,
|
|
1344
|
+
idempotency_key: Optional[str] = None,
|
|
1345
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1346
|
+
server_url: Optional[str] = None,
|
|
1347
|
+
timeout_ms: Optional[int] = None,
|
|
1348
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1349
|
+
) -> models.ListCustomerPaymentsResponse:
|
|
1350
|
+
r"""List customer payments
|
|
1351
|
+
|
|
1352
|
+
Retrieve all payments linked to the customer.
|
|
1353
|
+
|
|
1354
|
+
:param customer_id: Provide the ID of the related customer.
|
|
1355
|
+
:param from_: Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
|
|
1356
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
1357
|
+
:param sort: Used for setting the direction of the result set. Defaults to descending order, meaning the results are ordered from newest to oldest.
|
|
1358
|
+
:param profile_id: The identifier referring to the [profile](get-profile) you wish to retrieve the resources for. Most API credentials are linked to a single profile. In these cases the `profileId` can be omitted. For organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
|
|
1359
|
+
:param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter can be omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
|
|
1360
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1361
|
+
:param retries: Override the default retry configuration for this method
|
|
1362
|
+
:param server_url: Override the default server URL for this method
|
|
1363
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1364
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1365
|
+
"""
|
|
1366
|
+
base_url = None
|
|
1367
|
+
url_variables = None
|
|
1368
|
+
if timeout_ms is None:
|
|
1369
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1370
|
+
|
|
1371
|
+
if server_url is not None:
|
|
1372
|
+
base_url = server_url
|
|
1373
|
+
else:
|
|
1374
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1375
|
+
|
|
1376
|
+
request = models.ListCustomerPaymentsRequest(
|
|
1377
|
+
customer_id=customer_id,
|
|
1378
|
+
from_=from_,
|
|
1379
|
+
limit=limit,
|
|
1380
|
+
sort=sort,
|
|
1381
|
+
profile_id=profile_id,
|
|
1382
|
+
testmode=testmode,
|
|
1383
|
+
idempotency_key=idempotency_key,
|
|
1384
|
+
)
|
|
1385
|
+
|
|
1386
|
+
req = self._build_request(
|
|
1387
|
+
method="GET",
|
|
1388
|
+
path="/customers/{customerId}/payments",
|
|
1389
|
+
base_url=base_url,
|
|
1390
|
+
url_variables=url_variables,
|
|
1391
|
+
request=request,
|
|
1392
|
+
request_body_required=False,
|
|
1393
|
+
request_has_path_params=True,
|
|
1394
|
+
request_has_query_params=True,
|
|
1395
|
+
user_agent_header="user-agent",
|
|
1396
|
+
accept_header_value="application/hal+json",
|
|
1397
|
+
http_headers=http_headers,
|
|
1398
|
+
_globals=models.ListCustomerPaymentsGlobals(
|
|
1399
|
+
profile_id=self.sdk_configuration.globals.profile_id,
|
|
1400
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1401
|
+
),
|
|
1402
|
+
security=self.sdk_configuration.security,
|
|
1403
|
+
timeout_ms=timeout_ms,
|
|
1404
|
+
)
|
|
1405
|
+
|
|
1406
|
+
if retries == UNSET:
|
|
1407
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1408
|
+
retries = self.sdk_configuration.retry_config
|
|
1409
|
+
else:
|
|
1410
|
+
retries = utils.RetryConfig(
|
|
1411
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1412
|
+
)
|
|
1413
|
+
|
|
1414
|
+
retry_config = None
|
|
1415
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1416
|
+
retry_config = (retries, ["5xx"])
|
|
1417
|
+
|
|
1418
|
+
http_res = self.do_request(
|
|
1419
|
+
hook_ctx=HookContext(
|
|
1420
|
+
config=self.sdk_configuration,
|
|
1421
|
+
base_url=base_url or "",
|
|
1422
|
+
operation_id="list-customer-payments",
|
|
1423
|
+
oauth2_scopes=None,
|
|
1424
|
+
security_source=get_security_from_env(
|
|
1425
|
+
self.sdk_configuration.security, models.Security
|
|
1426
|
+
),
|
|
1427
|
+
),
|
|
1428
|
+
request=req,
|
|
1429
|
+
error_status_codes=["400", "4XX", "5XX"],
|
|
1430
|
+
retry_config=retry_config,
|
|
1431
|
+
)
|
|
1432
|
+
|
|
1433
|
+
response_data: Any = None
|
|
1434
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1435
|
+
return unmarshal_json_response(
|
|
1436
|
+
models.ListCustomerPaymentsResponse, http_res
|
|
1437
|
+
)
|
|
1438
|
+
if utils.match_response(http_res, "400", "application/hal+json"):
|
|
1439
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1440
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1441
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1442
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1443
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1444
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1445
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1446
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1447
|
+
|
|
1448
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1449
|
+
|
|
1450
|
+
async def list_payments_async(
|
|
1451
|
+
self,
|
|
1452
|
+
*,
|
|
1453
|
+
customer_id: str,
|
|
1454
|
+
from_: Optional[str] = None,
|
|
1455
|
+
limit: OptionalNullable[int] = UNSET,
|
|
1456
|
+
sort: Optional[models.Sorting] = None,
|
|
1457
|
+
profile_id: Optional[str] = None,
|
|
1458
|
+
testmode: Optional[bool] = None,
|
|
1459
|
+
idempotency_key: Optional[str] = None,
|
|
1460
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1461
|
+
server_url: Optional[str] = None,
|
|
1462
|
+
timeout_ms: Optional[int] = None,
|
|
1463
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1464
|
+
) -> models.ListCustomerPaymentsResponse:
|
|
1465
|
+
r"""List customer payments
|
|
1466
|
+
|
|
1467
|
+
Retrieve all payments linked to the customer.
|
|
1468
|
+
|
|
1469
|
+
:param customer_id: Provide the ID of the related customer.
|
|
1470
|
+
:param from_: Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
|
|
1471
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
1472
|
+
:param sort: Used for setting the direction of the result set. Defaults to descending order, meaning the results are ordered from newest to oldest.
|
|
1473
|
+
:param profile_id: The identifier referring to the [profile](get-profile) you wish to retrieve the resources for. Most API credentials are linked to a single profile. In these cases the `profileId` can be omitted. For organization-level credentials such as OAuth access tokens however, the `profileId` parameter is required.
|
|
1474
|
+
:param testmode: Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter can be omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
|
|
1475
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1476
|
+
:param retries: Override the default retry configuration for this method
|
|
1477
|
+
:param server_url: Override the default server URL for this method
|
|
1478
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1479
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1480
|
+
"""
|
|
1481
|
+
base_url = None
|
|
1482
|
+
url_variables = None
|
|
1483
|
+
if timeout_ms is None:
|
|
1484
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1485
|
+
|
|
1486
|
+
if server_url is not None:
|
|
1487
|
+
base_url = server_url
|
|
1488
|
+
else:
|
|
1489
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1490
|
+
|
|
1491
|
+
request = models.ListCustomerPaymentsRequest(
|
|
1492
|
+
customer_id=customer_id,
|
|
1493
|
+
from_=from_,
|
|
1494
|
+
limit=limit,
|
|
1495
|
+
sort=sort,
|
|
1496
|
+
profile_id=profile_id,
|
|
1497
|
+
testmode=testmode,
|
|
1498
|
+
idempotency_key=idempotency_key,
|
|
1499
|
+
)
|
|
1500
|
+
|
|
1501
|
+
req = self._build_request_async(
|
|
1502
|
+
method="GET",
|
|
1503
|
+
path="/customers/{customerId}/payments",
|
|
1504
|
+
base_url=base_url,
|
|
1505
|
+
url_variables=url_variables,
|
|
1506
|
+
request=request,
|
|
1507
|
+
request_body_required=False,
|
|
1508
|
+
request_has_path_params=True,
|
|
1509
|
+
request_has_query_params=True,
|
|
1510
|
+
user_agent_header="user-agent",
|
|
1511
|
+
accept_header_value="application/hal+json",
|
|
1512
|
+
http_headers=http_headers,
|
|
1513
|
+
_globals=models.ListCustomerPaymentsGlobals(
|
|
1514
|
+
profile_id=self.sdk_configuration.globals.profile_id,
|
|
1515
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1516
|
+
),
|
|
1517
|
+
security=self.sdk_configuration.security,
|
|
1518
|
+
timeout_ms=timeout_ms,
|
|
1519
|
+
)
|
|
1520
|
+
|
|
1521
|
+
if retries == UNSET:
|
|
1522
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1523
|
+
retries = self.sdk_configuration.retry_config
|
|
1524
|
+
else:
|
|
1525
|
+
retries = utils.RetryConfig(
|
|
1526
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1527
|
+
)
|
|
1528
|
+
|
|
1529
|
+
retry_config = None
|
|
1530
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1531
|
+
retry_config = (retries, ["5xx"])
|
|
1532
|
+
|
|
1533
|
+
http_res = await self.do_request_async(
|
|
1534
|
+
hook_ctx=HookContext(
|
|
1535
|
+
config=self.sdk_configuration,
|
|
1536
|
+
base_url=base_url or "",
|
|
1537
|
+
operation_id="list-customer-payments",
|
|
1538
|
+
oauth2_scopes=None,
|
|
1539
|
+
security_source=get_security_from_env(
|
|
1540
|
+
self.sdk_configuration.security, models.Security
|
|
1541
|
+
),
|
|
1542
|
+
),
|
|
1543
|
+
request=req,
|
|
1544
|
+
error_status_codes=["400", "4XX", "5XX"],
|
|
1545
|
+
retry_config=retry_config,
|
|
1546
|
+
)
|
|
1547
|
+
|
|
1548
|
+
response_data: Any = None
|
|
1549
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1550
|
+
return unmarshal_json_response(
|
|
1551
|
+
models.ListCustomerPaymentsResponse, http_res
|
|
1552
|
+
)
|
|
1553
|
+
if utils.match_response(http_res, "400", "application/hal+json"):
|
|
1554
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1555
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1556
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1557
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1558
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1559
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1560
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1561
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1562
|
+
|
|
1563
|
+
raise models.APIError("Unexpected response received", http_res)
|