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/settlements.py
ADDED
|
@@ -0,0 +1,1735 @@
|
|
|
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
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Settlements(BaseSDK):
|
|
13
|
+
def list(
|
|
14
|
+
self,
|
|
15
|
+
*,
|
|
16
|
+
from_: OptionalNullable[str] = UNSET,
|
|
17
|
+
limit: OptionalNullable[int] = UNSET,
|
|
18
|
+
balance_id: Optional[str] = None,
|
|
19
|
+
year: OptionalNullable[str] = UNSET,
|
|
20
|
+
month: OptionalNullable[str] = UNSET,
|
|
21
|
+
currencies: Optional[models.Currencies] = None,
|
|
22
|
+
idempotency_key: Optional[str] = None,
|
|
23
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
24
|
+
server_url: Optional[str] = None,
|
|
25
|
+
timeout_ms: Optional[int] = None,
|
|
26
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
27
|
+
) -> models.ListSettlementsResponse:
|
|
28
|
+
r"""List settlements
|
|
29
|
+
|
|
30
|
+
Retrieve a list of all your settlements.
|
|
31
|
+
|
|
32
|
+
The results are paginated.
|
|
33
|
+
|
|
34
|
+
: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.
|
|
35
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
36
|
+
:param balance_id: Provide the token of the balance to filter the settlements by. This is the balance token that the settlement was settled to.
|
|
37
|
+
:param year: Provide the year to query the settlements. Must be used combined with `month` parameter
|
|
38
|
+
:param month: Provide the month to query the settlements. Must be used combined with `year` parameter
|
|
39
|
+
:param currencies: Provides the currencies to retrieve the settlements. It accepts multiple currencies in a comma-separated format.
|
|
40
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
41
|
+
:param retries: Override the default retry configuration for this method
|
|
42
|
+
:param server_url: Override the default server URL for this method
|
|
43
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
44
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
45
|
+
"""
|
|
46
|
+
base_url = None
|
|
47
|
+
url_variables = None
|
|
48
|
+
if timeout_ms is None:
|
|
49
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
50
|
+
|
|
51
|
+
if server_url is not None:
|
|
52
|
+
base_url = server_url
|
|
53
|
+
else:
|
|
54
|
+
base_url = self._get_url(base_url, url_variables)
|
|
55
|
+
|
|
56
|
+
request = models.ListSettlementsRequest(
|
|
57
|
+
from_=from_,
|
|
58
|
+
limit=limit,
|
|
59
|
+
balance_id=balance_id,
|
|
60
|
+
year=year,
|
|
61
|
+
month=month,
|
|
62
|
+
currencies=currencies,
|
|
63
|
+
idempotency_key=idempotency_key,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
req = self._build_request(
|
|
67
|
+
method="GET",
|
|
68
|
+
path="/settlements",
|
|
69
|
+
base_url=base_url,
|
|
70
|
+
url_variables=url_variables,
|
|
71
|
+
request=request,
|
|
72
|
+
request_body_required=False,
|
|
73
|
+
request_has_path_params=False,
|
|
74
|
+
request_has_query_params=True,
|
|
75
|
+
user_agent_header="user-agent",
|
|
76
|
+
accept_header_value="application/hal+json",
|
|
77
|
+
http_headers=http_headers,
|
|
78
|
+
security=self.sdk_configuration.security,
|
|
79
|
+
timeout_ms=timeout_ms,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
if retries == UNSET:
|
|
83
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
84
|
+
retries = self.sdk_configuration.retry_config
|
|
85
|
+
else:
|
|
86
|
+
retries = utils.RetryConfig(
|
|
87
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
retry_config = None
|
|
91
|
+
if isinstance(retries, utils.RetryConfig):
|
|
92
|
+
retry_config = (retries, ["5xx"])
|
|
93
|
+
|
|
94
|
+
http_res = self.do_request(
|
|
95
|
+
hook_ctx=HookContext(
|
|
96
|
+
config=self.sdk_configuration,
|
|
97
|
+
base_url=base_url or "",
|
|
98
|
+
operation_id="list-settlements",
|
|
99
|
+
oauth2_scopes=None,
|
|
100
|
+
security_source=get_security_from_env(
|
|
101
|
+
self.sdk_configuration.security, models.Security
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
request=req,
|
|
105
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
106
|
+
retry_config=retry_config,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
response_data: Any = None
|
|
110
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
111
|
+
return unmarshal_json_response(models.ListSettlementsResponse, http_res)
|
|
112
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
113
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
114
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
115
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
116
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
117
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
118
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
119
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
120
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
121
|
+
|
|
122
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
123
|
+
|
|
124
|
+
async def list_async(
|
|
125
|
+
self,
|
|
126
|
+
*,
|
|
127
|
+
from_: OptionalNullable[str] = UNSET,
|
|
128
|
+
limit: OptionalNullable[int] = UNSET,
|
|
129
|
+
balance_id: Optional[str] = None,
|
|
130
|
+
year: OptionalNullable[str] = UNSET,
|
|
131
|
+
month: OptionalNullable[str] = UNSET,
|
|
132
|
+
currencies: Optional[models.Currencies] = None,
|
|
133
|
+
idempotency_key: Optional[str] = None,
|
|
134
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
135
|
+
server_url: Optional[str] = None,
|
|
136
|
+
timeout_ms: Optional[int] = None,
|
|
137
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
138
|
+
) -> models.ListSettlementsResponse:
|
|
139
|
+
r"""List settlements
|
|
140
|
+
|
|
141
|
+
Retrieve a list of all your settlements.
|
|
142
|
+
|
|
143
|
+
The results are paginated.
|
|
144
|
+
|
|
145
|
+
: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.
|
|
146
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
147
|
+
:param balance_id: Provide the token of the balance to filter the settlements by. This is the balance token that the settlement was settled to.
|
|
148
|
+
:param year: Provide the year to query the settlements. Must be used combined with `month` parameter
|
|
149
|
+
:param month: Provide the month to query the settlements. Must be used combined with `year` parameter
|
|
150
|
+
:param currencies: Provides the currencies to retrieve the settlements. It accepts multiple currencies in a comma-separated format.
|
|
151
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
152
|
+
:param retries: Override the default retry configuration for this method
|
|
153
|
+
:param server_url: Override the default server URL for this method
|
|
154
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
155
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
156
|
+
"""
|
|
157
|
+
base_url = None
|
|
158
|
+
url_variables = None
|
|
159
|
+
if timeout_ms is None:
|
|
160
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
161
|
+
|
|
162
|
+
if server_url is not None:
|
|
163
|
+
base_url = server_url
|
|
164
|
+
else:
|
|
165
|
+
base_url = self._get_url(base_url, url_variables)
|
|
166
|
+
|
|
167
|
+
request = models.ListSettlementsRequest(
|
|
168
|
+
from_=from_,
|
|
169
|
+
limit=limit,
|
|
170
|
+
balance_id=balance_id,
|
|
171
|
+
year=year,
|
|
172
|
+
month=month,
|
|
173
|
+
currencies=currencies,
|
|
174
|
+
idempotency_key=idempotency_key,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
req = self._build_request_async(
|
|
178
|
+
method="GET",
|
|
179
|
+
path="/settlements",
|
|
180
|
+
base_url=base_url,
|
|
181
|
+
url_variables=url_variables,
|
|
182
|
+
request=request,
|
|
183
|
+
request_body_required=False,
|
|
184
|
+
request_has_path_params=False,
|
|
185
|
+
request_has_query_params=True,
|
|
186
|
+
user_agent_header="user-agent",
|
|
187
|
+
accept_header_value="application/hal+json",
|
|
188
|
+
http_headers=http_headers,
|
|
189
|
+
security=self.sdk_configuration.security,
|
|
190
|
+
timeout_ms=timeout_ms,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
if retries == UNSET:
|
|
194
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
195
|
+
retries = self.sdk_configuration.retry_config
|
|
196
|
+
else:
|
|
197
|
+
retries = utils.RetryConfig(
|
|
198
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
retry_config = None
|
|
202
|
+
if isinstance(retries, utils.RetryConfig):
|
|
203
|
+
retry_config = (retries, ["5xx"])
|
|
204
|
+
|
|
205
|
+
http_res = await self.do_request_async(
|
|
206
|
+
hook_ctx=HookContext(
|
|
207
|
+
config=self.sdk_configuration,
|
|
208
|
+
base_url=base_url or "",
|
|
209
|
+
operation_id="list-settlements",
|
|
210
|
+
oauth2_scopes=None,
|
|
211
|
+
security_source=get_security_from_env(
|
|
212
|
+
self.sdk_configuration.security, models.Security
|
|
213
|
+
),
|
|
214
|
+
),
|
|
215
|
+
request=req,
|
|
216
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
217
|
+
retry_config=retry_config,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
response_data: Any = None
|
|
221
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
222
|
+
return unmarshal_json_response(models.ListSettlementsResponse, http_res)
|
|
223
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
224
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
225
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
226
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
227
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
228
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
229
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
230
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
231
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
232
|
+
|
|
233
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
234
|
+
|
|
235
|
+
def get(
|
|
236
|
+
self,
|
|
237
|
+
*,
|
|
238
|
+
id: str,
|
|
239
|
+
idempotency_key: Optional[str] = None,
|
|
240
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
241
|
+
server_url: Optional[str] = None,
|
|
242
|
+
timeout_ms: Optional[int] = None,
|
|
243
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
244
|
+
) -> models.EntitySettlement:
|
|
245
|
+
r"""Get settlement
|
|
246
|
+
|
|
247
|
+
Retrieve a single settlement by its ID.
|
|
248
|
+
|
|
249
|
+
To lookup settlements by their bank reference, replace the ID in the URL by
|
|
250
|
+
a reference. For example: `1234567.2404.03`.
|
|
251
|
+
|
|
252
|
+
A settlement represents a transfer of your balance funds to your external bank account.
|
|
253
|
+
|
|
254
|
+
Settlements will typically include a report that details what balance transactions have taken place between this
|
|
255
|
+
settlement and the previous one.
|
|
256
|
+
|
|
257
|
+
For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the
|
|
258
|
+
[balance transactions](list-balance-transactions) endpoint.
|
|
259
|
+
|
|
260
|
+
:param id: Provide the ID of the item you want to perform this operation on.
|
|
261
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
262
|
+
:param retries: Override the default retry configuration for this method
|
|
263
|
+
:param server_url: Override the default server URL for this method
|
|
264
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
265
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
266
|
+
"""
|
|
267
|
+
base_url = None
|
|
268
|
+
url_variables = None
|
|
269
|
+
if timeout_ms is None:
|
|
270
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
271
|
+
|
|
272
|
+
if server_url is not None:
|
|
273
|
+
base_url = server_url
|
|
274
|
+
else:
|
|
275
|
+
base_url = self._get_url(base_url, url_variables)
|
|
276
|
+
|
|
277
|
+
request = models.GetSettlementRequest(
|
|
278
|
+
id=id,
|
|
279
|
+
idempotency_key=idempotency_key,
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
req = self._build_request(
|
|
283
|
+
method="GET",
|
|
284
|
+
path="/settlements/{id}",
|
|
285
|
+
base_url=base_url,
|
|
286
|
+
url_variables=url_variables,
|
|
287
|
+
request=request,
|
|
288
|
+
request_body_required=False,
|
|
289
|
+
request_has_path_params=True,
|
|
290
|
+
request_has_query_params=True,
|
|
291
|
+
user_agent_header="user-agent",
|
|
292
|
+
accept_header_value="application/hal+json",
|
|
293
|
+
http_headers=http_headers,
|
|
294
|
+
security=self.sdk_configuration.security,
|
|
295
|
+
timeout_ms=timeout_ms,
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
if retries == UNSET:
|
|
299
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
300
|
+
retries = self.sdk_configuration.retry_config
|
|
301
|
+
else:
|
|
302
|
+
retries = utils.RetryConfig(
|
|
303
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
retry_config = None
|
|
307
|
+
if isinstance(retries, utils.RetryConfig):
|
|
308
|
+
retry_config = (retries, ["5xx"])
|
|
309
|
+
|
|
310
|
+
http_res = self.do_request(
|
|
311
|
+
hook_ctx=HookContext(
|
|
312
|
+
config=self.sdk_configuration,
|
|
313
|
+
base_url=base_url or "",
|
|
314
|
+
operation_id="get-settlement",
|
|
315
|
+
oauth2_scopes=None,
|
|
316
|
+
security_source=get_security_from_env(
|
|
317
|
+
self.sdk_configuration.security, models.Security
|
|
318
|
+
),
|
|
319
|
+
),
|
|
320
|
+
request=req,
|
|
321
|
+
error_status_codes=["404", "4XX", "5XX"],
|
|
322
|
+
retry_config=retry_config,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
response_data: Any = None
|
|
326
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
327
|
+
return unmarshal_json_response(models.EntitySettlement, http_res)
|
|
328
|
+
if utils.match_response(http_res, "404", "application/hal+json"):
|
|
329
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
330
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
331
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
332
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
333
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
334
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
335
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
336
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
337
|
+
|
|
338
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
339
|
+
|
|
340
|
+
async def get_async(
|
|
341
|
+
self,
|
|
342
|
+
*,
|
|
343
|
+
id: str,
|
|
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.EntitySettlement:
|
|
350
|
+
r"""Get settlement
|
|
351
|
+
|
|
352
|
+
Retrieve a single settlement by its ID.
|
|
353
|
+
|
|
354
|
+
To lookup settlements by their bank reference, replace the ID in the URL by
|
|
355
|
+
a reference. For example: `1234567.2404.03`.
|
|
356
|
+
|
|
357
|
+
A settlement represents a transfer of your balance funds to your external bank account.
|
|
358
|
+
|
|
359
|
+
Settlements will typically include a report that details what balance transactions have taken place between this
|
|
360
|
+
settlement and the previous one.
|
|
361
|
+
|
|
362
|
+
For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the
|
|
363
|
+
[balance transactions](list-balance-transactions) endpoint.
|
|
364
|
+
|
|
365
|
+
:param id: Provide the ID of the item you want to perform this operation on.
|
|
366
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
367
|
+
:param retries: Override the default retry configuration for this method
|
|
368
|
+
:param server_url: Override the default server URL for this method
|
|
369
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
370
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
371
|
+
"""
|
|
372
|
+
base_url = None
|
|
373
|
+
url_variables = None
|
|
374
|
+
if timeout_ms is None:
|
|
375
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
376
|
+
|
|
377
|
+
if server_url is not None:
|
|
378
|
+
base_url = server_url
|
|
379
|
+
else:
|
|
380
|
+
base_url = self._get_url(base_url, url_variables)
|
|
381
|
+
|
|
382
|
+
request = models.GetSettlementRequest(
|
|
383
|
+
id=id,
|
|
384
|
+
idempotency_key=idempotency_key,
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
req = self._build_request_async(
|
|
388
|
+
method="GET",
|
|
389
|
+
path="/settlements/{id}",
|
|
390
|
+
base_url=base_url,
|
|
391
|
+
url_variables=url_variables,
|
|
392
|
+
request=request,
|
|
393
|
+
request_body_required=False,
|
|
394
|
+
request_has_path_params=True,
|
|
395
|
+
request_has_query_params=True,
|
|
396
|
+
user_agent_header="user-agent",
|
|
397
|
+
accept_header_value="application/hal+json",
|
|
398
|
+
http_headers=http_headers,
|
|
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="get-settlement",
|
|
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=["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.EntitySettlement, http_res)
|
|
433
|
+
if utils.match_response(http_res, "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_open(
|
|
446
|
+
self,
|
|
447
|
+
*,
|
|
448
|
+
idempotency_key: Optional[str] = None,
|
|
449
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
450
|
+
server_url: Optional[str] = None,
|
|
451
|
+
timeout_ms: Optional[int] = None,
|
|
452
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
453
|
+
) -> models.EntitySettlement:
|
|
454
|
+
r"""Get open settlement
|
|
455
|
+
|
|
456
|
+
Retrieve the details of the open balance of the organization. This will return a settlement object representing your
|
|
457
|
+
organization's balance.
|
|
458
|
+
|
|
459
|
+
For a complete reference of the settlement object, refer to the [Get settlement endpoint](get-settlement)
|
|
460
|
+
documentation.
|
|
461
|
+
|
|
462
|
+
For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the
|
|
463
|
+
[balance transactions](list-balance-transactions) endpoint.
|
|
464
|
+
|
|
465
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
466
|
+
:param retries: Override the default retry configuration for this method
|
|
467
|
+
:param server_url: Override the default server URL for this method
|
|
468
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
469
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
470
|
+
"""
|
|
471
|
+
base_url = None
|
|
472
|
+
url_variables = None
|
|
473
|
+
if timeout_ms is None:
|
|
474
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
475
|
+
|
|
476
|
+
if server_url is not None:
|
|
477
|
+
base_url = server_url
|
|
478
|
+
else:
|
|
479
|
+
base_url = self._get_url(base_url, url_variables)
|
|
480
|
+
|
|
481
|
+
request = models.GetOpenSettlementRequest(
|
|
482
|
+
idempotency_key=idempotency_key,
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
req = self._build_request(
|
|
486
|
+
method="GET",
|
|
487
|
+
path="/settlements/open",
|
|
488
|
+
base_url=base_url,
|
|
489
|
+
url_variables=url_variables,
|
|
490
|
+
request=request,
|
|
491
|
+
request_body_required=False,
|
|
492
|
+
request_has_path_params=False,
|
|
493
|
+
request_has_query_params=True,
|
|
494
|
+
user_agent_header="user-agent",
|
|
495
|
+
accept_header_value="application/hal+json",
|
|
496
|
+
http_headers=http_headers,
|
|
497
|
+
security=self.sdk_configuration.security,
|
|
498
|
+
timeout_ms=timeout_ms,
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
if retries == UNSET:
|
|
502
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
503
|
+
retries = self.sdk_configuration.retry_config
|
|
504
|
+
else:
|
|
505
|
+
retries = utils.RetryConfig(
|
|
506
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
retry_config = None
|
|
510
|
+
if isinstance(retries, utils.RetryConfig):
|
|
511
|
+
retry_config = (retries, ["5xx"])
|
|
512
|
+
|
|
513
|
+
http_res = self.do_request(
|
|
514
|
+
hook_ctx=HookContext(
|
|
515
|
+
config=self.sdk_configuration,
|
|
516
|
+
base_url=base_url or "",
|
|
517
|
+
operation_id="get-open-settlement",
|
|
518
|
+
oauth2_scopes=None,
|
|
519
|
+
security_source=get_security_from_env(
|
|
520
|
+
self.sdk_configuration.security, models.Security
|
|
521
|
+
),
|
|
522
|
+
),
|
|
523
|
+
request=req,
|
|
524
|
+
error_status_codes=["4XX", "5XX"],
|
|
525
|
+
retry_config=retry_config,
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
529
|
+
return unmarshal_json_response(models.EntitySettlement, http_res)
|
|
530
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
531
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
532
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
533
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
534
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
535
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
536
|
+
|
|
537
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
538
|
+
|
|
539
|
+
async def get_open_async(
|
|
540
|
+
self,
|
|
541
|
+
*,
|
|
542
|
+
idempotency_key: Optional[str] = None,
|
|
543
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
544
|
+
server_url: Optional[str] = None,
|
|
545
|
+
timeout_ms: Optional[int] = None,
|
|
546
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
547
|
+
) -> models.EntitySettlement:
|
|
548
|
+
r"""Get open settlement
|
|
549
|
+
|
|
550
|
+
Retrieve the details of the open balance of the organization. This will return a settlement object representing your
|
|
551
|
+
organization's balance.
|
|
552
|
+
|
|
553
|
+
For a complete reference of the settlement object, refer to the [Get settlement endpoint](get-settlement)
|
|
554
|
+
documentation.
|
|
555
|
+
|
|
556
|
+
For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the
|
|
557
|
+
[balance transactions](list-balance-transactions) endpoint.
|
|
558
|
+
|
|
559
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
560
|
+
:param retries: Override the default retry configuration for this method
|
|
561
|
+
:param server_url: Override the default server URL for this method
|
|
562
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
563
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
564
|
+
"""
|
|
565
|
+
base_url = None
|
|
566
|
+
url_variables = None
|
|
567
|
+
if timeout_ms is None:
|
|
568
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
569
|
+
|
|
570
|
+
if server_url is not None:
|
|
571
|
+
base_url = server_url
|
|
572
|
+
else:
|
|
573
|
+
base_url = self._get_url(base_url, url_variables)
|
|
574
|
+
|
|
575
|
+
request = models.GetOpenSettlementRequest(
|
|
576
|
+
idempotency_key=idempotency_key,
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
req = self._build_request_async(
|
|
580
|
+
method="GET",
|
|
581
|
+
path="/settlements/open",
|
|
582
|
+
base_url=base_url,
|
|
583
|
+
url_variables=url_variables,
|
|
584
|
+
request=request,
|
|
585
|
+
request_body_required=False,
|
|
586
|
+
request_has_path_params=False,
|
|
587
|
+
request_has_query_params=True,
|
|
588
|
+
user_agent_header="user-agent",
|
|
589
|
+
accept_header_value="application/hal+json",
|
|
590
|
+
http_headers=http_headers,
|
|
591
|
+
security=self.sdk_configuration.security,
|
|
592
|
+
timeout_ms=timeout_ms,
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
if retries == UNSET:
|
|
596
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
597
|
+
retries = self.sdk_configuration.retry_config
|
|
598
|
+
else:
|
|
599
|
+
retries = utils.RetryConfig(
|
|
600
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
retry_config = None
|
|
604
|
+
if isinstance(retries, utils.RetryConfig):
|
|
605
|
+
retry_config = (retries, ["5xx"])
|
|
606
|
+
|
|
607
|
+
http_res = await self.do_request_async(
|
|
608
|
+
hook_ctx=HookContext(
|
|
609
|
+
config=self.sdk_configuration,
|
|
610
|
+
base_url=base_url or "",
|
|
611
|
+
operation_id="get-open-settlement",
|
|
612
|
+
oauth2_scopes=None,
|
|
613
|
+
security_source=get_security_from_env(
|
|
614
|
+
self.sdk_configuration.security, models.Security
|
|
615
|
+
),
|
|
616
|
+
),
|
|
617
|
+
request=req,
|
|
618
|
+
error_status_codes=["4XX", "5XX"],
|
|
619
|
+
retry_config=retry_config,
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
623
|
+
return unmarshal_json_response(models.EntitySettlement, http_res)
|
|
624
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
625
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
626
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
627
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
628
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
629
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
630
|
+
|
|
631
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
632
|
+
|
|
633
|
+
def get_next(
|
|
634
|
+
self,
|
|
635
|
+
*,
|
|
636
|
+
idempotency_key: Optional[str] = None,
|
|
637
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
638
|
+
server_url: Optional[str] = None,
|
|
639
|
+
timeout_ms: Optional[int] = None,
|
|
640
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
641
|
+
) -> models.EntitySettlement:
|
|
642
|
+
r"""Get next settlement
|
|
643
|
+
|
|
644
|
+
Retrieve the details of the current settlement, that has not yet been paid out.
|
|
645
|
+
|
|
646
|
+
For a complete reference of the settlement object, refer to the [Get settlement endpoint](get-settlement)
|
|
647
|
+
documentation.
|
|
648
|
+
|
|
649
|
+
For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the
|
|
650
|
+
[balance transactions](list-balance-transactions) endpoint.
|
|
651
|
+
|
|
652
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
653
|
+
:param retries: Override the default retry configuration for this method
|
|
654
|
+
:param server_url: Override the default server URL for this method
|
|
655
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
656
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
657
|
+
"""
|
|
658
|
+
base_url = None
|
|
659
|
+
url_variables = None
|
|
660
|
+
if timeout_ms is None:
|
|
661
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
662
|
+
|
|
663
|
+
if server_url is not None:
|
|
664
|
+
base_url = server_url
|
|
665
|
+
else:
|
|
666
|
+
base_url = self._get_url(base_url, url_variables)
|
|
667
|
+
|
|
668
|
+
request = models.GetNextSettlementRequest(
|
|
669
|
+
idempotency_key=idempotency_key,
|
|
670
|
+
)
|
|
671
|
+
|
|
672
|
+
req = self._build_request(
|
|
673
|
+
method="GET",
|
|
674
|
+
path="/settlements/next",
|
|
675
|
+
base_url=base_url,
|
|
676
|
+
url_variables=url_variables,
|
|
677
|
+
request=request,
|
|
678
|
+
request_body_required=False,
|
|
679
|
+
request_has_path_params=False,
|
|
680
|
+
request_has_query_params=True,
|
|
681
|
+
user_agent_header="user-agent",
|
|
682
|
+
accept_header_value="application/hal+json",
|
|
683
|
+
http_headers=http_headers,
|
|
684
|
+
security=self.sdk_configuration.security,
|
|
685
|
+
timeout_ms=timeout_ms,
|
|
686
|
+
)
|
|
687
|
+
|
|
688
|
+
if retries == UNSET:
|
|
689
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
690
|
+
retries = self.sdk_configuration.retry_config
|
|
691
|
+
else:
|
|
692
|
+
retries = utils.RetryConfig(
|
|
693
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
694
|
+
)
|
|
695
|
+
|
|
696
|
+
retry_config = None
|
|
697
|
+
if isinstance(retries, utils.RetryConfig):
|
|
698
|
+
retry_config = (retries, ["5xx"])
|
|
699
|
+
|
|
700
|
+
http_res = self.do_request(
|
|
701
|
+
hook_ctx=HookContext(
|
|
702
|
+
config=self.sdk_configuration,
|
|
703
|
+
base_url=base_url or "",
|
|
704
|
+
operation_id="get-next-settlement",
|
|
705
|
+
oauth2_scopes=None,
|
|
706
|
+
security_source=get_security_from_env(
|
|
707
|
+
self.sdk_configuration.security, models.Security
|
|
708
|
+
),
|
|
709
|
+
),
|
|
710
|
+
request=req,
|
|
711
|
+
error_status_codes=["4XX", "5XX"],
|
|
712
|
+
retry_config=retry_config,
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
716
|
+
return unmarshal_json_response(models.EntitySettlement, http_res)
|
|
717
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
718
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
719
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
720
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
721
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
722
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
723
|
+
|
|
724
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
725
|
+
|
|
726
|
+
async def get_next_async(
|
|
727
|
+
self,
|
|
728
|
+
*,
|
|
729
|
+
idempotency_key: Optional[str] = None,
|
|
730
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
731
|
+
server_url: Optional[str] = None,
|
|
732
|
+
timeout_ms: Optional[int] = None,
|
|
733
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
734
|
+
) -> models.EntitySettlement:
|
|
735
|
+
r"""Get next settlement
|
|
736
|
+
|
|
737
|
+
Retrieve the details of the current settlement, that has not yet been paid out.
|
|
738
|
+
|
|
739
|
+
For a complete reference of the settlement object, refer to the [Get settlement endpoint](get-settlement)
|
|
740
|
+
documentation.
|
|
741
|
+
|
|
742
|
+
For more accurate bookkeeping, refer to the [balance report](get-balance-report) endpoint or the
|
|
743
|
+
[balance transactions](list-balance-transactions) endpoint.
|
|
744
|
+
|
|
745
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
746
|
+
:param retries: Override the default retry configuration for this method
|
|
747
|
+
:param server_url: Override the default server URL for this method
|
|
748
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
749
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
750
|
+
"""
|
|
751
|
+
base_url = None
|
|
752
|
+
url_variables = None
|
|
753
|
+
if timeout_ms is None:
|
|
754
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
755
|
+
|
|
756
|
+
if server_url is not None:
|
|
757
|
+
base_url = server_url
|
|
758
|
+
else:
|
|
759
|
+
base_url = self._get_url(base_url, url_variables)
|
|
760
|
+
|
|
761
|
+
request = models.GetNextSettlementRequest(
|
|
762
|
+
idempotency_key=idempotency_key,
|
|
763
|
+
)
|
|
764
|
+
|
|
765
|
+
req = self._build_request_async(
|
|
766
|
+
method="GET",
|
|
767
|
+
path="/settlements/next",
|
|
768
|
+
base_url=base_url,
|
|
769
|
+
url_variables=url_variables,
|
|
770
|
+
request=request,
|
|
771
|
+
request_body_required=False,
|
|
772
|
+
request_has_path_params=False,
|
|
773
|
+
request_has_query_params=True,
|
|
774
|
+
user_agent_header="user-agent",
|
|
775
|
+
accept_header_value="application/hal+json",
|
|
776
|
+
http_headers=http_headers,
|
|
777
|
+
security=self.sdk_configuration.security,
|
|
778
|
+
timeout_ms=timeout_ms,
|
|
779
|
+
)
|
|
780
|
+
|
|
781
|
+
if retries == UNSET:
|
|
782
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
783
|
+
retries = self.sdk_configuration.retry_config
|
|
784
|
+
else:
|
|
785
|
+
retries = utils.RetryConfig(
|
|
786
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
787
|
+
)
|
|
788
|
+
|
|
789
|
+
retry_config = None
|
|
790
|
+
if isinstance(retries, utils.RetryConfig):
|
|
791
|
+
retry_config = (retries, ["5xx"])
|
|
792
|
+
|
|
793
|
+
http_res = await self.do_request_async(
|
|
794
|
+
hook_ctx=HookContext(
|
|
795
|
+
config=self.sdk_configuration,
|
|
796
|
+
base_url=base_url or "",
|
|
797
|
+
operation_id="get-next-settlement",
|
|
798
|
+
oauth2_scopes=None,
|
|
799
|
+
security_source=get_security_from_env(
|
|
800
|
+
self.sdk_configuration.security, models.Security
|
|
801
|
+
),
|
|
802
|
+
),
|
|
803
|
+
request=req,
|
|
804
|
+
error_status_codes=["4XX", "5XX"],
|
|
805
|
+
retry_config=retry_config,
|
|
806
|
+
)
|
|
807
|
+
|
|
808
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
809
|
+
return unmarshal_json_response(models.EntitySettlement, http_res)
|
|
810
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
811
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
812
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
813
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
814
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
815
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
816
|
+
|
|
817
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
818
|
+
|
|
819
|
+
def list_payments(
|
|
820
|
+
self,
|
|
821
|
+
*,
|
|
822
|
+
settlement_id: str,
|
|
823
|
+
from_: Optional[str] = None,
|
|
824
|
+
limit: OptionalNullable[int] = UNSET,
|
|
825
|
+
sort: Optional[models.Sorting] = None,
|
|
826
|
+
profile_id: Optional[str] = None,
|
|
827
|
+
testmode: Optional[bool] = None,
|
|
828
|
+
idempotency_key: Optional[str] = None,
|
|
829
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
830
|
+
server_url: Optional[str] = None,
|
|
831
|
+
timeout_ms: Optional[int] = None,
|
|
832
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
833
|
+
) -> models.ListSettlementPaymentsResponse:
|
|
834
|
+
r"""List settlement payments
|
|
835
|
+
|
|
836
|
+
Retrieve all payments included in the given settlement.
|
|
837
|
+
|
|
838
|
+
The response is in the same format as the response of the [List payments endpoint](list-payments).
|
|
839
|
+
|
|
840
|
+
For capture-based payment methods such as Klarna, the payments are not listed here. Refer to the
|
|
841
|
+
[List captures endpoint](list-captures) endpoint instead.
|
|
842
|
+
|
|
843
|
+
:param settlement_id: Provide the ID of the related settlement.
|
|
844
|
+
: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.
|
|
845
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
846
|
+
:param sort: Used for setting the direction of the result set. Defaults to descending order, meaning the results are ordered from newest to oldest.
|
|
847
|
+
: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.
|
|
848
|
+
: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.
|
|
849
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
850
|
+
:param retries: Override the default retry configuration for this method
|
|
851
|
+
:param server_url: Override the default server URL for this method
|
|
852
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
853
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
854
|
+
"""
|
|
855
|
+
base_url = None
|
|
856
|
+
url_variables = None
|
|
857
|
+
if timeout_ms is None:
|
|
858
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
859
|
+
|
|
860
|
+
if server_url is not None:
|
|
861
|
+
base_url = server_url
|
|
862
|
+
else:
|
|
863
|
+
base_url = self._get_url(base_url, url_variables)
|
|
864
|
+
|
|
865
|
+
request = models.ListSettlementPaymentsRequest(
|
|
866
|
+
settlement_id=settlement_id,
|
|
867
|
+
from_=from_,
|
|
868
|
+
limit=limit,
|
|
869
|
+
sort=sort,
|
|
870
|
+
profile_id=profile_id,
|
|
871
|
+
testmode=testmode,
|
|
872
|
+
idempotency_key=idempotency_key,
|
|
873
|
+
)
|
|
874
|
+
|
|
875
|
+
req = self._build_request(
|
|
876
|
+
method="GET",
|
|
877
|
+
path="/settlements/{settlementId}/payments",
|
|
878
|
+
base_url=base_url,
|
|
879
|
+
url_variables=url_variables,
|
|
880
|
+
request=request,
|
|
881
|
+
request_body_required=False,
|
|
882
|
+
request_has_path_params=True,
|
|
883
|
+
request_has_query_params=True,
|
|
884
|
+
user_agent_header="user-agent",
|
|
885
|
+
accept_header_value="application/hal+json",
|
|
886
|
+
http_headers=http_headers,
|
|
887
|
+
_globals=models.ListSettlementPaymentsGlobals(
|
|
888
|
+
profile_id=self.sdk_configuration.globals.profile_id,
|
|
889
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
890
|
+
),
|
|
891
|
+
security=self.sdk_configuration.security,
|
|
892
|
+
timeout_ms=timeout_ms,
|
|
893
|
+
)
|
|
894
|
+
|
|
895
|
+
if retries == UNSET:
|
|
896
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
897
|
+
retries = self.sdk_configuration.retry_config
|
|
898
|
+
else:
|
|
899
|
+
retries = utils.RetryConfig(
|
|
900
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
901
|
+
)
|
|
902
|
+
|
|
903
|
+
retry_config = None
|
|
904
|
+
if isinstance(retries, utils.RetryConfig):
|
|
905
|
+
retry_config = (retries, ["5xx"])
|
|
906
|
+
|
|
907
|
+
http_res = self.do_request(
|
|
908
|
+
hook_ctx=HookContext(
|
|
909
|
+
config=self.sdk_configuration,
|
|
910
|
+
base_url=base_url or "",
|
|
911
|
+
operation_id="list-settlement-payments",
|
|
912
|
+
oauth2_scopes=None,
|
|
913
|
+
security_source=get_security_from_env(
|
|
914
|
+
self.sdk_configuration.security, models.Security
|
|
915
|
+
),
|
|
916
|
+
),
|
|
917
|
+
request=req,
|
|
918
|
+
error_status_codes=["400", "4XX", "5XX"],
|
|
919
|
+
retry_config=retry_config,
|
|
920
|
+
)
|
|
921
|
+
|
|
922
|
+
response_data: Any = None
|
|
923
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
924
|
+
return unmarshal_json_response(
|
|
925
|
+
models.ListSettlementPaymentsResponse, http_res
|
|
926
|
+
)
|
|
927
|
+
if utils.match_response(http_res, "400", "application/hal+json"):
|
|
928
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
929
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
930
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
931
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
932
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
933
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
934
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
935
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
936
|
+
|
|
937
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
938
|
+
|
|
939
|
+
async def list_payments_async(
|
|
940
|
+
self,
|
|
941
|
+
*,
|
|
942
|
+
settlement_id: str,
|
|
943
|
+
from_: Optional[str] = None,
|
|
944
|
+
limit: OptionalNullable[int] = UNSET,
|
|
945
|
+
sort: Optional[models.Sorting] = None,
|
|
946
|
+
profile_id: Optional[str] = None,
|
|
947
|
+
testmode: Optional[bool] = None,
|
|
948
|
+
idempotency_key: Optional[str] = None,
|
|
949
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
950
|
+
server_url: Optional[str] = None,
|
|
951
|
+
timeout_ms: Optional[int] = None,
|
|
952
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
953
|
+
) -> models.ListSettlementPaymentsResponse:
|
|
954
|
+
r"""List settlement payments
|
|
955
|
+
|
|
956
|
+
Retrieve all payments included in the given settlement.
|
|
957
|
+
|
|
958
|
+
The response is in the same format as the response of the [List payments endpoint](list-payments).
|
|
959
|
+
|
|
960
|
+
For capture-based payment methods such as Klarna, the payments are not listed here. Refer to the
|
|
961
|
+
[List captures endpoint](list-captures) endpoint instead.
|
|
962
|
+
|
|
963
|
+
:param settlement_id: Provide the ID of the related settlement.
|
|
964
|
+
: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.
|
|
965
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
966
|
+
:param sort: Used for setting the direction of the result set. Defaults to descending order, meaning the results are ordered from newest to oldest.
|
|
967
|
+
: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.
|
|
968
|
+
: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.
|
|
969
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
970
|
+
:param retries: Override the default retry configuration for this method
|
|
971
|
+
:param server_url: Override the default server URL for this method
|
|
972
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
973
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
974
|
+
"""
|
|
975
|
+
base_url = None
|
|
976
|
+
url_variables = None
|
|
977
|
+
if timeout_ms is None:
|
|
978
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
979
|
+
|
|
980
|
+
if server_url is not None:
|
|
981
|
+
base_url = server_url
|
|
982
|
+
else:
|
|
983
|
+
base_url = self._get_url(base_url, url_variables)
|
|
984
|
+
|
|
985
|
+
request = models.ListSettlementPaymentsRequest(
|
|
986
|
+
settlement_id=settlement_id,
|
|
987
|
+
from_=from_,
|
|
988
|
+
limit=limit,
|
|
989
|
+
sort=sort,
|
|
990
|
+
profile_id=profile_id,
|
|
991
|
+
testmode=testmode,
|
|
992
|
+
idempotency_key=idempotency_key,
|
|
993
|
+
)
|
|
994
|
+
|
|
995
|
+
req = self._build_request_async(
|
|
996
|
+
method="GET",
|
|
997
|
+
path="/settlements/{settlementId}/payments",
|
|
998
|
+
base_url=base_url,
|
|
999
|
+
url_variables=url_variables,
|
|
1000
|
+
request=request,
|
|
1001
|
+
request_body_required=False,
|
|
1002
|
+
request_has_path_params=True,
|
|
1003
|
+
request_has_query_params=True,
|
|
1004
|
+
user_agent_header="user-agent",
|
|
1005
|
+
accept_header_value="application/hal+json",
|
|
1006
|
+
http_headers=http_headers,
|
|
1007
|
+
_globals=models.ListSettlementPaymentsGlobals(
|
|
1008
|
+
profile_id=self.sdk_configuration.globals.profile_id,
|
|
1009
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1010
|
+
),
|
|
1011
|
+
security=self.sdk_configuration.security,
|
|
1012
|
+
timeout_ms=timeout_ms,
|
|
1013
|
+
)
|
|
1014
|
+
|
|
1015
|
+
if retries == UNSET:
|
|
1016
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1017
|
+
retries = self.sdk_configuration.retry_config
|
|
1018
|
+
else:
|
|
1019
|
+
retries = utils.RetryConfig(
|
|
1020
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1021
|
+
)
|
|
1022
|
+
|
|
1023
|
+
retry_config = None
|
|
1024
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1025
|
+
retry_config = (retries, ["5xx"])
|
|
1026
|
+
|
|
1027
|
+
http_res = await self.do_request_async(
|
|
1028
|
+
hook_ctx=HookContext(
|
|
1029
|
+
config=self.sdk_configuration,
|
|
1030
|
+
base_url=base_url or "",
|
|
1031
|
+
operation_id="list-settlement-payments",
|
|
1032
|
+
oauth2_scopes=None,
|
|
1033
|
+
security_source=get_security_from_env(
|
|
1034
|
+
self.sdk_configuration.security, models.Security
|
|
1035
|
+
),
|
|
1036
|
+
),
|
|
1037
|
+
request=req,
|
|
1038
|
+
error_status_codes=["400", "4XX", "5XX"],
|
|
1039
|
+
retry_config=retry_config,
|
|
1040
|
+
)
|
|
1041
|
+
|
|
1042
|
+
response_data: Any = None
|
|
1043
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1044
|
+
return unmarshal_json_response(
|
|
1045
|
+
models.ListSettlementPaymentsResponse, http_res
|
|
1046
|
+
)
|
|
1047
|
+
if utils.match_response(http_res, "400", "application/hal+json"):
|
|
1048
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1049
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1050
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1051
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1052
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1053
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1054
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1055
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1056
|
+
|
|
1057
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1058
|
+
|
|
1059
|
+
def list_captures(
|
|
1060
|
+
self,
|
|
1061
|
+
*,
|
|
1062
|
+
settlement_id: str,
|
|
1063
|
+
from_: Optional[str] = None,
|
|
1064
|
+
limit: OptionalNullable[int] = UNSET,
|
|
1065
|
+
embed: OptionalNullable[str] = UNSET,
|
|
1066
|
+
testmode: Optional[bool] = None,
|
|
1067
|
+
idempotency_key: Optional[str] = None,
|
|
1068
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1069
|
+
server_url: Optional[str] = None,
|
|
1070
|
+
timeout_ms: Optional[int] = None,
|
|
1071
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1072
|
+
) -> models.ListSettlementCapturesResponse:
|
|
1073
|
+
r"""List settlement captures
|
|
1074
|
+
|
|
1075
|
+
Retrieve all captures included in the given settlement.
|
|
1076
|
+
|
|
1077
|
+
The response is in the same format as the response of the [List captures endpoint](list-captures).
|
|
1078
|
+
|
|
1079
|
+
:param settlement_id: Provide the ID of the related settlement.
|
|
1080
|
+
: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.
|
|
1081
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
1082
|
+
:param embed: This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
|
|
1083
|
+
: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.
|
|
1084
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1085
|
+
:param retries: Override the default retry configuration for this method
|
|
1086
|
+
:param server_url: Override the default server URL for this method
|
|
1087
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1088
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1089
|
+
"""
|
|
1090
|
+
base_url = None
|
|
1091
|
+
url_variables = None
|
|
1092
|
+
if timeout_ms is None:
|
|
1093
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1094
|
+
|
|
1095
|
+
if server_url is not None:
|
|
1096
|
+
base_url = server_url
|
|
1097
|
+
else:
|
|
1098
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1099
|
+
|
|
1100
|
+
request = models.ListSettlementCapturesRequest(
|
|
1101
|
+
settlement_id=settlement_id,
|
|
1102
|
+
from_=from_,
|
|
1103
|
+
limit=limit,
|
|
1104
|
+
embed=embed,
|
|
1105
|
+
testmode=testmode,
|
|
1106
|
+
idempotency_key=idempotency_key,
|
|
1107
|
+
)
|
|
1108
|
+
|
|
1109
|
+
req = self._build_request(
|
|
1110
|
+
method="GET",
|
|
1111
|
+
path="/settlements/{settlementId}/captures",
|
|
1112
|
+
base_url=base_url,
|
|
1113
|
+
url_variables=url_variables,
|
|
1114
|
+
request=request,
|
|
1115
|
+
request_body_required=False,
|
|
1116
|
+
request_has_path_params=True,
|
|
1117
|
+
request_has_query_params=True,
|
|
1118
|
+
user_agent_header="user-agent",
|
|
1119
|
+
accept_header_value="application/hal+json",
|
|
1120
|
+
http_headers=http_headers,
|
|
1121
|
+
_globals=models.ListSettlementCapturesGlobals(
|
|
1122
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1123
|
+
),
|
|
1124
|
+
security=self.sdk_configuration.security,
|
|
1125
|
+
timeout_ms=timeout_ms,
|
|
1126
|
+
)
|
|
1127
|
+
|
|
1128
|
+
if retries == UNSET:
|
|
1129
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1130
|
+
retries = self.sdk_configuration.retry_config
|
|
1131
|
+
else:
|
|
1132
|
+
retries = utils.RetryConfig(
|
|
1133
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1134
|
+
)
|
|
1135
|
+
|
|
1136
|
+
retry_config = None
|
|
1137
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1138
|
+
retry_config = (retries, ["5xx"])
|
|
1139
|
+
|
|
1140
|
+
http_res = self.do_request(
|
|
1141
|
+
hook_ctx=HookContext(
|
|
1142
|
+
config=self.sdk_configuration,
|
|
1143
|
+
base_url=base_url or "",
|
|
1144
|
+
operation_id="list-settlement-captures",
|
|
1145
|
+
oauth2_scopes=None,
|
|
1146
|
+
security_source=get_security_from_env(
|
|
1147
|
+
self.sdk_configuration.security, models.Security
|
|
1148
|
+
),
|
|
1149
|
+
),
|
|
1150
|
+
request=req,
|
|
1151
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
1152
|
+
retry_config=retry_config,
|
|
1153
|
+
)
|
|
1154
|
+
|
|
1155
|
+
response_data: Any = None
|
|
1156
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1157
|
+
return unmarshal_json_response(
|
|
1158
|
+
models.ListSettlementCapturesResponse, http_res
|
|
1159
|
+
)
|
|
1160
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
1161
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1162
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1163
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1164
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1165
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1166
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1167
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1168
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1169
|
+
|
|
1170
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1171
|
+
|
|
1172
|
+
async def list_captures_async(
|
|
1173
|
+
self,
|
|
1174
|
+
*,
|
|
1175
|
+
settlement_id: str,
|
|
1176
|
+
from_: Optional[str] = None,
|
|
1177
|
+
limit: OptionalNullable[int] = UNSET,
|
|
1178
|
+
embed: OptionalNullable[str] = UNSET,
|
|
1179
|
+
testmode: Optional[bool] = None,
|
|
1180
|
+
idempotency_key: Optional[str] = None,
|
|
1181
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1182
|
+
server_url: Optional[str] = None,
|
|
1183
|
+
timeout_ms: Optional[int] = None,
|
|
1184
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1185
|
+
) -> models.ListSettlementCapturesResponse:
|
|
1186
|
+
r"""List settlement captures
|
|
1187
|
+
|
|
1188
|
+
Retrieve all captures included in the given settlement.
|
|
1189
|
+
|
|
1190
|
+
The response is in the same format as the response of the [List captures endpoint](list-captures).
|
|
1191
|
+
|
|
1192
|
+
:param settlement_id: Provide the ID of the related settlement.
|
|
1193
|
+
: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.
|
|
1194
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
1195
|
+
:param embed: This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
|
|
1196
|
+
: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.
|
|
1197
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1198
|
+
:param retries: Override the default retry configuration for this method
|
|
1199
|
+
:param server_url: Override the default server URL for this method
|
|
1200
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1201
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1202
|
+
"""
|
|
1203
|
+
base_url = None
|
|
1204
|
+
url_variables = None
|
|
1205
|
+
if timeout_ms is None:
|
|
1206
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1207
|
+
|
|
1208
|
+
if server_url is not None:
|
|
1209
|
+
base_url = server_url
|
|
1210
|
+
else:
|
|
1211
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1212
|
+
|
|
1213
|
+
request = models.ListSettlementCapturesRequest(
|
|
1214
|
+
settlement_id=settlement_id,
|
|
1215
|
+
from_=from_,
|
|
1216
|
+
limit=limit,
|
|
1217
|
+
embed=embed,
|
|
1218
|
+
testmode=testmode,
|
|
1219
|
+
idempotency_key=idempotency_key,
|
|
1220
|
+
)
|
|
1221
|
+
|
|
1222
|
+
req = self._build_request_async(
|
|
1223
|
+
method="GET",
|
|
1224
|
+
path="/settlements/{settlementId}/captures",
|
|
1225
|
+
base_url=base_url,
|
|
1226
|
+
url_variables=url_variables,
|
|
1227
|
+
request=request,
|
|
1228
|
+
request_body_required=False,
|
|
1229
|
+
request_has_path_params=True,
|
|
1230
|
+
request_has_query_params=True,
|
|
1231
|
+
user_agent_header="user-agent",
|
|
1232
|
+
accept_header_value="application/hal+json",
|
|
1233
|
+
http_headers=http_headers,
|
|
1234
|
+
_globals=models.ListSettlementCapturesGlobals(
|
|
1235
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1236
|
+
),
|
|
1237
|
+
security=self.sdk_configuration.security,
|
|
1238
|
+
timeout_ms=timeout_ms,
|
|
1239
|
+
)
|
|
1240
|
+
|
|
1241
|
+
if retries == UNSET:
|
|
1242
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1243
|
+
retries = self.sdk_configuration.retry_config
|
|
1244
|
+
else:
|
|
1245
|
+
retries = utils.RetryConfig(
|
|
1246
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1247
|
+
)
|
|
1248
|
+
|
|
1249
|
+
retry_config = None
|
|
1250
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1251
|
+
retry_config = (retries, ["5xx"])
|
|
1252
|
+
|
|
1253
|
+
http_res = await self.do_request_async(
|
|
1254
|
+
hook_ctx=HookContext(
|
|
1255
|
+
config=self.sdk_configuration,
|
|
1256
|
+
base_url=base_url or "",
|
|
1257
|
+
operation_id="list-settlement-captures",
|
|
1258
|
+
oauth2_scopes=None,
|
|
1259
|
+
security_source=get_security_from_env(
|
|
1260
|
+
self.sdk_configuration.security, models.Security
|
|
1261
|
+
),
|
|
1262
|
+
),
|
|
1263
|
+
request=req,
|
|
1264
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
1265
|
+
retry_config=retry_config,
|
|
1266
|
+
)
|
|
1267
|
+
|
|
1268
|
+
response_data: Any = None
|
|
1269
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1270
|
+
return unmarshal_json_response(
|
|
1271
|
+
models.ListSettlementCapturesResponse, http_res
|
|
1272
|
+
)
|
|
1273
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
1274
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1275
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1276
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1277
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1278
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1279
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1280
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1281
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1282
|
+
|
|
1283
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1284
|
+
|
|
1285
|
+
def list_refunds(
|
|
1286
|
+
self,
|
|
1287
|
+
*,
|
|
1288
|
+
settlement_id: str,
|
|
1289
|
+
from_: Optional[str] = None,
|
|
1290
|
+
limit: OptionalNullable[int] = UNSET,
|
|
1291
|
+
embed: OptionalNullable[str] = UNSET,
|
|
1292
|
+
testmode: Optional[bool] = None,
|
|
1293
|
+
idempotency_key: Optional[str] = None,
|
|
1294
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1295
|
+
server_url: Optional[str] = None,
|
|
1296
|
+
timeout_ms: Optional[int] = None,
|
|
1297
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1298
|
+
) -> models.ListSettlementRefundsResponse:
|
|
1299
|
+
r"""List settlement refunds
|
|
1300
|
+
|
|
1301
|
+
Retrieve all refunds 'deducted' from the given settlement.
|
|
1302
|
+
|
|
1303
|
+
The response is in the same format as the response of the [List refunds endpoint](list-refunds).
|
|
1304
|
+
|
|
1305
|
+
:param settlement_id: Provide the ID of the related settlement.
|
|
1306
|
+
: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.
|
|
1307
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
1308
|
+
:param embed: This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
|
|
1309
|
+
: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.
|
|
1310
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1311
|
+
:param retries: Override the default retry configuration for this method
|
|
1312
|
+
:param server_url: Override the default server URL for this method
|
|
1313
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1314
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1315
|
+
"""
|
|
1316
|
+
base_url = None
|
|
1317
|
+
url_variables = None
|
|
1318
|
+
if timeout_ms is None:
|
|
1319
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1320
|
+
|
|
1321
|
+
if server_url is not None:
|
|
1322
|
+
base_url = server_url
|
|
1323
|
+
else:
|
|
1324
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1325
|
+
|
|
1326
|
+
request = models.ListSettlementRefundsRequest(
|
|
1327
|
+
settlement_id=settlement_id,
|
|
1328
|
+
from_=from_,
|
|
1329
|
+
limit=limit,
|
|
1330
|
+
embed=embed,
|
|
1331
|
+
testmode=testmode,
|
|
1332
|
+
idempotency_key=idempotency_key,
|
|
1333
|
+
)
|
|
1334
|
+
|
|
1335
|
+
req = self._build_request(
|
|
1336
|
+
method="GET",
|
|
1337
|
+
path="/settlements/{settlementId}/refunds",
|
|
1338
|
+
base_url=base_url,
|
|
1339
|
+
url_variables=url_variables,
|
|
1340
|
+
request=request,
|
|
1341
|
+
request_body_required=False,
|
|
1342
|
+
request_has_path_params=True,
|
|
1343
|
+
request_has_query_params=True,
|
|
1344
|
+
user_agent_header="user-agent",
|
|
1345
|
+
accept_header_value="application/hal+json",
|
|
1346
|
+
http_headers=http_headers,
|
|
1347
|
+
_globals=models.ListSettlementRefundsGlobals(
|
|
1348
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1349
|
+
),
|
|
1350
|
+
security=self.sdk_configuration.security,
|
|
1351
|
+
timeout_ms=timeout_ms,
|
|
1352
|
+
)
|
|
1353
|
+
|
|
1354
|
+
if retries == UNSET:
|
|
1355
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1356
|
+
retries = self.sdk_configuration.retry_config
|
|
1357
|
+
else:
|
|
1358
|
+
retries = utils.RetryConfig(
|
|
1359
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1360
|
+
)
|
|
1361
|
+
|
|
1362
|
+
retry_config = None
|
|
1363
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1364
|
+
retry_config = (retries, ["5xx"])
|
|
1365
|
+
|
|
1366
|
+
http_res = self.do_request(
|
|
1367
|
+
hook_ctx=HookContext(
|
|
1368
|
+
config=self.sdk_configuration,
|
|
1369
|
+
base_url=base_url or "",
|
|
1370
|
+
operation_id="list-settlement-refunds",
|
|
1371
|
+
oauth2_scopes=None,
|
|
1372
|
+
security_source=get_security_from_env(
|
|
1373
|
+
self.sdk_configuration.security, models.Security
|
|
1374
|
+
),
|
|
1375
|
+
),
|
|
1376
|
+
request=req,
|
|
1377
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
1378
|
+
retry_config=retry_config,
|
|
1379
|
+
)
|
|
1380
|
+
|
|
1381
|
+
response_data: Any = None
|
|
1382
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1383
|
+
return unmarshal_json_response(
|
|
1384
|
+
models.ListSettlementRefundsResponse, http_res
|
|
1385
|
+
)
|
|
1386
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
1387
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1388
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1389
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1390
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1391
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1392
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1393
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1394
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1395
|
+
|
|
1396
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1397
|
+
|
|
1398
|
+
async def list_refunds_async(
|
|
1399
|
+
self,
|
|
1400
|
+
*,
|
|
1401
|
+
settlement_id: str,
|
|
1402
|
+
from_: Optional[str] = None,
|
|
1403
|
+
limit: OptionalNullable[int] = UNSET,
|
|
1404
|
+
embed: OptionalNullable[str] = UNSET,
|
|
1405
|
+
testmode: Optional[bool] = None,
|
|
1406
|
+
idempotency_key: Optional[str] = None,
|
|
1407
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1408
|
+
server_url: Optional[str] = None,
|
|
1409
|
+
timeout_ms: Optional[int] = None,
|
|
1410
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1411
|
+
) -> models.ListSettlementRefundsResponse:
|
|
1412
|
+
r"""List settlement refunds
|
|
1413
|
+
|
|
1414
|
+
Retrieve all refunds 'deducted' from the given settlement.
|
|
1415
|
+
|
|
1416
|
+
The response is in the same format as the response of the [List refunds endpoint](list-refunds).
|
|
1417
|
+
|
|
1418
|
+
:param settlement_id: Provide the ID of the related settlement.
|
|
1419
|
+
: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.
|
|
1420
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
1421
|
+
:param embed: This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
|
|
1422
|
+
: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.
|
|
1423
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1424
|
+
:param retries: Override the default retry configuration for this method
|
|
1425
|
+
:param server_url: Override the default server URL for this method
|
|
1426
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1427
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1428
|
+
"""
|
|
1429
|
+
base_url = None
|
|
1430
|
+
url_variables = None
|
|
1431
|
+
if timeout_ms is None:
|
|
1432
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1433
|
+
|
|
1434
|
+
if server_url is not None:
|
|
1435
|
+
base_url = server_url
|
|
1436
|
+
else:
|
|
1437
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1438
|
+
|
|
1439
|
+
request = models.ListSettlementRefundsRequest(
|
|
1440
|
+
settlement_id=settlement_id,
|
|
1441
|
+
from_=from_,
|
|
1442
|
+
limit=limit,
|
|
1443
|
+
embed=embed,
|
|
1444
|
+
testmode=testmode,
|
|
1445
|
+
idempotency_key=idempotency_key,
|
|
1446
|
+
)
|
|
1447
|
+
|
|
1448
|
+
req = self._build_request_async(
|
|
1449
|
+
method="GET",
|
|
1450
|
+
path="/settlements/{settlementId}/refunds",
|
|
1451
|
+
base_url=base_url,
|
|
1452
|
+
url_variables=url_variables,
|
|
1453
|
+
request=request,
|
|
1454
|
+
request_body_required=False,
|
|
1455
|
+
request_has_path_params=True,
|
|
1456
|
+
request_has_query_params=True,
|
|
1457
|
+
user_agent_header="user-agent",
|
|
1458
|
+
accept_header_value="application/hal+json",
|
|
1459
|
+
http_headers=http_headers,
|
|
1460
|
+
_globals=models.ListSettlementRefundsGlobals(
|
|
1461
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1462
|
+
),
|
|
1463
|
+
security=self.sdk_configuration.security,
|
|
1464
|
+
timeout_ms=timeout_ms,
|
|
1465
|
+
)
|
|
1466
|
+
|
|
1467
|
+
if retries == UNSET:
|
|
1468
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1469
|
+
retries = self.sdk_configuration.retry_config
|
|
1470
|
+
else:
|
|
1471
|
+
retries = utils.RetryConfig(
|
|
1472
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1473
|
+
)
|
|
1474
|
+
|
|
1475
|
+
retry_config = None
|
|
1476
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1477
|
+
retry_config = (retries, ["5xx"])
|
|
1478
|
+
|
|
1479
|
+
http_res = await self.do_request_async(
|
|
1480
|
+
hook_ctx=HookContext(
|
|
1481
|
+
config=self.sdk_configuration,
|
|
1482
|
+
base_url=base_url or "",
|
|
1483
|
+
operation_id="list-settlement-refunds",
|
|
1484
|
+
oauth2_scopes=None,
|
|
1485
|
+
security_source=get_security_from_env(
|
|
1486
|
+
self.sdk_configuration.security, models.Security
|
|
1487
|
+
),
|
|
1488
|
+
),
|
|
1489
|
+
request=req,
|
|
1490
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
1491
|
+
retry_config=retry_config,
|
|
1492
|
+
)
|
|
1493
|
+
|
|
1494
|
+
response_data: Any = None
|
|
1495
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1496
|
+
return unmarshal_json_response(
|
|
1497
|
+
models.ListSettlementRefundsResponse, http_res
|
|
1498
|
+
)
|
|
1499
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
1500
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1501
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1502
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1503
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1504
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1505
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1506
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1507
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1508
|
+
|
|
1509
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1510
|
+
|
|
1511
|
+
def list_chargebacks(
|
|
1512
|
+
self,
|
|
1513
|
+
*,
|
|
1514
|
+
settlement_id: str,
|
|
1515
|
+
from_: Optional[str] = None,
|
|
1516
|
+
limit: OptionalNullable[int] = UNSET,
|
|
1517
|
+
embed: OptionalNullable[str] = UNSET,
|
|
1518
|
+
testmode: Optional[bool] = None,
|
|
1519
|
+
idempotency_key: Optional[str] = None,
|
|
1520
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1521
|
+
server_url: Optional[str] = None,
|
|
1522
|
+
timeout_ms: Optional[int] = None,
|
|
1523
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1524
|
+
) -> models.ListSettlementChargebacksResponse:
|
|
1525
|
+
r"""List settlement chargebacks
|
|
1526
|
+
|
|
1527
|
+
Retrieve all chargebacks 'deducted' from the given settlement.
|
|
1528
|
+
|
|
1529
|
+
The response is in the same format as the response of the [List chargebacks endpoint](list-chargebacks).
|
|
1530
|
+
|
|
1531
|
+
:param settlement_id: Provide the ID of the related settlement.
|
|
1532
|
+
: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.
|
|
1533
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
1534
|
+
:param embed: This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
|
|
1535
|
+
: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.
|
|
1536
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1537
|
+
:param retries: Override the default retry configuration for this method
|
|
1538
|
+
:param server_url: Override the default server URL for this method
|
|
1539
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1540
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1541
|
+
"""
|
|
1542
|
+
base_url = None
|
|
1543
|
+
url_variables = None
|
|
1544
|
+
if timeout_ms is None:
|
|
1545
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1546
|
+
|
|
1547
|
+
if server_url is not None:
|
|
1548
|
+
base_url = server_url
|
|
1549
|
+
else:
|
|
1550
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1551
|
+
|
|
1552
|
+
request = models.ListSettlementChargebacksRequest(
|
|
1553
|
+
settlement_id=settlement_id,
|
|
1554
|
+
from_=from_,
|
|
1555
|
+
limit=limit,
|
|
1556
|
+
embed=embed,
|
|
1557
|
+
testmode=testmode,
|
|
1558
|
+
idempotency_key=idempotency_key,
|
|
1559
|
+
)
|
|
1560
|
+
|
|
1561
|
+
req = self._build_request(
|
|
1562
|
+
method="GET",
|
|
1563
|
+
path="/settlements/{settlementId}/chargebacks",
|
|
1564
|
+
base_url=base_url,
|
|
1565
|
+
url_variables=url_variables,
|
|
1566
|
+
request=request,
|
|
1567
|
+
request_body_required=False,
|
|
1568
|
+
request_has_path_params=True,
|
|
1569
|
+
request_has_query_params=True,
|
|
1570
|
+
user_agent_header="user-agent",
|
|
1571
|
+
accept_header_value="application/hal+json",
|
|
1572
|
+
http_headers=http_headers,
|
|
1573
|
+
_globals=models.ListSettlementChargebacksGlobals(
|
|
1574
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1575
|
+
),
|
|
1576
|
+
security=self.sdk_configuration.security,
|
|
1577
|
+
timeout_ms=timeout_ms,
|
|
1578
|
+
)
|
|
1579
|
+
|
|
1580
|
+
if retries == UNSET:
|
|
1581
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1582
|
+
retries = self.sdk_configuration.retry_config
|
|
1583
|
+
else:
|
|
1584
|
+
retries = utils.RetryConfig(
|
|
1585
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1586
|
+
)
|
|
1587
|
+
|
|
1588
|
+
retry_config = None
|
|
1589
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1590
|
+
retry_config = (retries, ["5xx"])
|
|
1591
|
+
|
|
1592
|
+
http_res = self.do_request(
|
|
1593
|
+
hook_ctx=HookContext(
|
|
1594
|
+
config=self.sdk_configuration,
|
|
1595
|
+
base_url=base_url or "",
|
|
1596
|
+
operation_id="list-settlement-chargebacks",
|
|
1597
|
+
oauth2_scopes=None,
|
|
1598
|
+
security_source=get_security_from_env(
|
|
1599
|
+
self.sdk_configuration.security, models.Security
|
|
1600
|
+
),
|
|
1601
|
+
),
|
|
1602
|
+
request=req,
|
|
1603
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
1604
|
+
retry_config=retry_config,
|
|
1605
|
+
)
|
|
1606
|
+
|
|
1607
|
+
response_data: Any = None
|
|
1608
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1609
|
+
return unmarshal_json_response(
|
|
1610
|
+
models.ListSettlementChargebacksResponse, http_res
|
|
1611
|
+
)
|
|
1612
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
1613
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1614
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1615
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1616
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1617
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1618
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1619
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1620
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1621
|
+
|
|
1622
|
+
raise models.APIError("Unexpected response received", http_res)
|
|
1623
|
+
|
|
1624
|
+
async def list_chargebacks_async(
|
|
1625
|
+
self,
|
|
1626
|
+
*,
|
|
1627
|
+
settlement_id: str,
|
|
1628
|
+
from_: Optional[str] = None,
|
|
1629
|
+
limit: OptionalNullable[int] = UNSET,
|
|
1630
|
+
embed: OptionalNullable[str] = UNSET,
|
|
1631
|
+
testmode: Optional[bool] = None,
|
|
1632
|
+
idempotency_key: Optional[str] = None,
|
|
1633
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1634
|
+
server_url: Optional[str] = None,
|
|
1635
|
+
timeout_ms: Optional[int] = None,
|
|
1636
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1637
|
+
) -> models.ListSettlementChargebacksResponse:
|
|
1638
|
+
r"""List settlement chargebacks
|
|
1639
|
+
|
|
1640
|
+
Retrieve all chargebacks 'deducted' from the given settlement.
|
|
1641
|
+
|
|
1642
|
+
The response is in the same format as the response of the [List chargebacks endpoint](list-chargebacks).
|
|
1643
|
+
|
|
1644
|
+
:param settlement_id: Provide the ID of the related settlement.
|
|
1645
|
+
: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.
|
|
1646
|
+
:param limit: The maximum number of items to return. Defaults to 50 items.
|
|
1647
|
+
:param embed: This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
|
|
1648
|
+
: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.
|
|
1649
|
+
:param idempotency_key: A unique key to ensure idempotent requests. This key should be a UUID v4 string.
|
|
1650
|
+
:param retries: Override the default retry configuration for this method
|
|
1651
|
+
:param server_url: Override the default server URL for this method
|
|
1652
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1653
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1654
|
+
"""
|
|
1655
|
+
base_url = None
|
|
1656
|
+
url_variables = None
|
|
1657
|
+
if timeout_ms is None:
|
|
1658
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1659
|
+
|
|
1660
|
+
if server_url is not None:
|
|
1661
|
+
base_url = server_url
|
|
1662
|
+
else:
|
|
1663
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1664
|
+
|
|
1665
|
+
request = models.ListSettlementChargebacksRequest(
|
|
1666
|
+
settlement_id=settlement_id,
|
|
1667
|
+
from_=from_,
|
|
1668
|
+
limit=limit,
|
|
1669
|
+
embed=embed,
|
|
1670
|
+
testmode=testmode,
|
|
1671
|
+
idempotency_key=idempotency_key,
|
|
1672
|
+
)
|
|
1673
|
+
|
|
1674
|
+
req = self._build_request_async(
|
|
1675
|
+
method="GET",
|
|
1676
|
+
path="/settlements/{settlementId}/chargebacks",
|
|
1677
|
+
base_url=base_url,
|
|
1678
|
+
url_variables=url_variables,
|
|
1679
|
+
request=request,
|
|
1680
|
+
request_body_required=False,
|
|
1681
|
+
request_has_path_params=True,
|
|
1682
|
+
request_has_query_params=True,
|
|
1683
|
+
user_agent_header="user-agent",
|
|
1684
|
+
accept_header_value="application/hal+json",
|
|
1685
|
+
http_headers=http_headers,
|
|
1686
|
+
_globals=models.ListSettlementChargebacksGlobals(
|
|
1687
|
+
testmode=self.sdk_configuration.globals.testmode,
|
|
1688
|
+
),
|
|
1689
|
+
security=self.sdk_configuration.security,
|
|
1690
|
+
timeout_ms=timeout_ms,
|
|
1691
|
+
)
|
|
1692
|
+
|
|
1693
|
+
if retries == UNSET:
|
|
1694
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1695
|
+
retries = self.sdk_configuration.retry_config
|
|
1696
|
+
else:
|
|
1697
|
+
retries = utils.RetryConfig(
|
|
1698
|
+
"backoff", utils.BackoffStrategy(500, 5000, 2, 7500), True
|
|
1699
|
+
)
|
|
1700
|
+
|
|
1701
|
+
retry_config = None
|
|
1702
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1703
|
+
retry_config = (retries, ["5xx"])
|
|
1704
|
+
|
|
1705
|
+
http_res = await self.do_request_async(
|
|
1706
|
+
hook_ctx=HookContext(
|
|
1707
|
+
config=self.sdk_configuration,
|
|
1708
|
+
base_url=base_url or "",
|
|
1709
|
+
operation_id="list-settlement-chargebacks",
|
|
1710
|
+
oauth2_scopes=None,
|
|
1711
|
+
security_source=get_security_from_env(
|
|
1712
|
+
self.sdk_configuration.security, models.Security
|
|
1713
|
+
),
|
|
1714
|
+
),
|
|
1715
|
+
request=req,
|
|
1716
|
+
error_status_codes=["400", "404", "4XX", "5XX"],
|
|
1717
|
+
retry_config=retry_config,
|
|
1718
|
+
)
|
|
1719
|
+
|
|
1720
|
+
response_data: Any = None
|
|
1721
|
+
if utils.match_response(http_res, "200", "application/hal+json"):
|
|
1722
|
+
return unmarshal_json_response(
|
|
1723
|
+
models.ListSettlementChargebacksResponse, http_res
|
|
1724
|
+
)
|
|
1725
|
+
if utils.match_response(http_res, ["400", "404"], "application/hal+json"):
|
|
1726
|
+
response_data = unmarshal_json_response(models.ErrorResponseData, http_res)
|
|
1727
|
+
raise models.ErrorResponse(response_data, http_res)
|
|
1728
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1729
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1730
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1731
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1732
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1733
|
+
raise models.APIError("API error occurred", http_res, http_res_text)
|
|
1734
|
+
|
|
1735
|
+
raise models.APIError("Unexpected response received", http_res)
|