univapay-apimatic-sdk 0.0.1
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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +224 -0
- data/bin/console +15 -0
- data/lib/univapay_client_sdk/api_helper.rb +10 -0
- data/lib/univapay_client_sdk/apis/base_api.rb +67 -0
- data/lib/univapay_client_sdk/apis/cancels_api.rb +293 -0
- data/lib/univapay_client_sdk/apis/charges_api.rb +903 -0
- data/lib/univapay_client_sdk/apis/merchants_api.rb +57 -0
- data/lib/univapay_client_sdk/apis/refunds_api.rb +298 -0
- data/lib/univapay_client_sdk/apis/stores_api.rb +126 -0
- data/lib/univapay_client_sdk/apis/subscriptions_api.rb +1014 -0
- data/lib/univapay_client_sdk/apis/transaction_tokens_api.rb +455 -0
- data/lib/univapay_client_sdk/apis/webhooks_api.rb +463 -0
- data/lib/univapay_client_sdk/client.rb +116 -0
- data/lib/univapay_client_sdk/configuration.rb +178 -0
- data/lib/univapay_client_sdk/events/unknown_event.rb +32 -0
- data/lib/univapay_client_sdk/events/webhooks/bank_transfer_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/cancel_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/charge_finished_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/charge_updated_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/customs_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/recurring_token_deleted_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/refund_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/subscription_canceled_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/subscription_completed_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/subscription_created_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/subscription_failure_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/subscription_payment_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/subscription_suspended_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/token_created_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/token_cvv_auth_check_updated_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/token_cvv_auth_updated_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/token_replaced_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/token_three_ds_updated_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/token_updated_handler.rb +37 -0
- data/lib/univapay_client_sdk/exceptions/api_error_exception.rb +199 -0
- data/lib/univapay_client_sdk/exceptions/api_exception.rb +21 -0
- data/lib/univapay_client_sdk/http/api_response.rb +19 -0
- data/lib/univapay_client_sdk/http/auth/oauth_2.rb +53 -0
- data/lib/univapay_client_sdk/http/http_call_back.rb +10 -0
- data/lib/univapay_client_sdk/http/http_method_enum.rb +10 -0
- data/lib/univapay_client_sdk/http/http_request.rb +10 -0
- data/lib/univapay_client_sdk/http/http_response.rb +10 -0
- data/lib/univapay_client_sdk/http/proxy_settings.rb +22 -0
- data/lib/univapay_client_sdk/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/univapay_client_sdk/logging/sdk_logger.rb +17 -0
- data/lib/univapay_client_sdk/models/api_error_detail.rb +87 -0
- data/lib/univapay_client_sdk/models/api_error_status.rb +26 -0
- data/lib/univapay_client_sdk/models/bank_transfer_event.rb +27 -0
- data/lib/univapay_client_sdk/models/bank_transfer_ledger.rb +199 -0
- data/lib/univapay_client_sdk/models/bank_transfer_ledger_bank_ledger_type.rb +36 -0
- data/lib/univapay_client_sdk/models/bank_transfer_ledger_list.rb +104 -0
- data/lib/univapay_client_sdk/models/bank_transfer_ledger_mode.rb +36 -0
- data/lib/univapay_client_sdk/models/bank_transfer_payment_status.rb +44 -0
- data/lib/univapay_client_sdk/models/bank_transfer_status_data.rb +229 -0
- data/lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback.rb +134 -0
- data/lib/univapay_client_sdk/models/bank_transfer_status_webhook_callback_extension.rb +75 -0
- data/lib/univapay_client_sdk/models/base_bank_transfer_data.rb +100 -0
- data/lib/univapay_client_sdk/models/base_konbini_data.rb +99 -0
- data/lib/univapay_client_sdk/models/base_konbini_data_convenience_store.rb +60 -0
- data/lib/univapay_client_sdk/models/base_model.rb +110 -0
- data/lib/univapay_client_sdk/models/base_online_data.rb +123 -0
- data/lib/univapay_client_sdk/models/base_online_data_brand.rb +48 -0
- data/lib/univapay_client_sdk/models/base_online_data_call_method.rb +52 -0
- data/lib/univapay_client_sdk/models/base_online_data_os_type.rb +36 -0
- data/lib/univapay_client_sdk/models/base_online_data_user_identifier_source.rb +36 -0
- data/lib/univapay_client_sdk/models/cancel.rb +183 -0
- data/lib/univapay_client_sdk/models/cancel_create_request.rb +77 -0
- data/lib/univapay_client_sdk/models/cancel_event.rb +26 -0
- data/lib/univapay_client_sdk/models/cancel_list.rb +94 -0
- data/lib/univapay_client_sdk/models/cancel_status.rb +44 -0
- data/lib/univapay_client_sdk/models/cancel_update_request.rb +76 -0
- data/lib/univapay_client_sdk/models/cancel_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/cancel_webhook_callback_extension.rb +74 -0
- data/lib/univapay_client_sdk/models/card_processor_installment_config.rb +89 -0
- data/lib/univapay_client_sdk/models/charge.rb +411 -0
- data/lib/univapay_client_sdk/models/charge_capture_request.rb +84 -0
- data/lib/univapay_client_sdk/models/charge_create_request.rb +179 -0
- data/lib/univapay_client_sdk/models/charge_create_request_client_metadata.rb +76 -0
- data/lib/univapay_client_sdk/models/charge_create_request_redirect.rb +75 -0
- data/lib/univapay_client_sdk/models/charge_create_request_three_ds.rb +88 -0
- data/lib/univapay_client_sdk/models/charge_create_request_three_ds_mode.rb +44 -0
- data/lib/univapay_client_sdk/models/charge_finished_webhook_callback.rb +131 -0
- data/lib/univapay_client_sdk/models/charge_list.rb +104 -0
- data/lib/univapay_client_sdk/models/charge_mode.rb +36 -0
- data/lib/univapay_client_sdk/models/charge_redirect.rb +96 -0
- data/lib/univapay_client_sdk/models/charge_status.rb +56 -0
- data/lib/univapay_client_sdk/models/charge_three_ds.rb +97 -0
- data/lib/univapay_client_sdk/models/charge_transaction_token_type.rb +40 -0
- data/lib/univapay_client_sdk/models/charge_update_request.rb +75 -0
- data/lib/univapay_client_sdk/models/charge_updated_webhook_callback.rb +131 -0
- data/lib/univapay_client_sdk/models/cursor_direction_query.rb +36 -0
- data/lib/univapay_client_sdk/models/customs_declaration_create_request.rb +106 -0
- data/lib/univapay_client_sdk/models/customs_declaration_event.rb +27 -0
- data/lib/univapay_client_sdk/models/customs_declaration_patch_request.rb +77 -0
- data/lib/univapay_client_sdk/models/customs_declaration_webhook_callback.rb +135 -0
- data/lib/univapay_client_sdk/models/customs_declaration_webhook_callback_extension.rb +76 -0
- data/lib/univapay_client_sdk/models/customs_declaration_webhook_data.rb +232 -0
- data/lib/univapay_client_sdk/models/customs_declaration_webhook_declaration.rb +121 -0
- data/lib/univapay_client_sdk/models/customs_declaration_webhook_error.rb +127 -0
- data/lib/univapay_client_sdk/models/customs_declaration_webhook_other_error.rb +120 -0
- data/lib/univapay_client_sdk/models/customs_declaration_webhook_result.rb +125 -0
- data/lib/univapay_client_sdk/models/customs_declaration_webhook_status.rb +44 -0
- data/lib/univapay_client_sdk/models/generic_metadata.rb +111 -0
- data/lib/univapay_client_sdk/models/installment_fixed_cycles.rb +70 -0
- data/lib/univapay_client_sdk/models/installment_plan_type.rb +36 -0
- data/lib/univapay_client_sdk/models/issuer_token.rb +177 -0
- data/lib/univapay_client_sdk/models/issuer_token_call_method.rb +51 -0
- data/lib/univapay_client_sdk/models/issuer_token_payload.rb +105 -0
- data/lib/univapay_client_sdk/models/issuer_token_payment_type.rb +36 -0
- data/lib/univapay_client_sdk/models/merchant.rb +179 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_bank_transfer_configuration.rb +342 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_card_brand_percent_fees.rb +167 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_card_configuration.rb +301 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_checkout_configuration.rb +87 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_checkout_toggle.rb +77 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_configuration.rb +505 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_convenience_configuration.rb +88 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_customer_management_configuration.rb +99 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_installment_plan_configuration.rb +139 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_limit_charge_by_card_configuration.rb +88 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_limit_refund_by_sales_configuration.rb +100 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_money_amount.rb +85 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_online_configuration.rb +77 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_paidy_configuration.rb +77 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_qr_merchant_configuration.rb +77 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_qr_scan_configuration.rb +93 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_recurring_cvv_confirmation_config.rb +97 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_recurring_token_configuration.rb +109 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_security_configuration.rb +234 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_subscription_configuration.rb +138 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_subscription_plan_configuration.rb +138 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_transfer_schedule_configuration.rb +159 -0
- data/lib/univapay_client_sdk/models/merchant_webhook_user_transactions_configuration.rb +349 -0
- data/lib/univapay_client_sdk/models/mode_query.rb +36 -0
- data/lib/univapay_client_sdk/models/payment_error.rb +178 -0
- data/lib/univapay_client_sdk/models/plan_settings_type.rb +36 -0
- data/lib/univapay_client_sdk/models/recurring_token_deleted_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/refund.rb +240 -0
- data/lib/univapay_client_sdk/models/refund_create_request.rb +118 -0
- data/lib/univapay_client_sdk/models/refund_event.rb +26 -0
- data/lib/univapay_client_sdk/models/refund_list.rb +104 -0
- data/lib/univapay_client_sdk/models/refund_reason_request.rb +42 -0
- data/lib/univapay_client_sdk/models/refund_reason_response.rb +62 -0
- data/lib/univapay_client_sdk/models/refund_status.rb +47 -0
- data/lib/univapay_client_sdk/models/refund_update_request.rb +99 -0
- data/lib/univapay_client_sdk/models/refund_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/refund_webhook_callback_extension.rb +74 -0
- data/lib/univapay_client_sdk/models/restrict_ip_after_failed_charge_config.rb +99 -0
- data/lib/univapay_client_sdk/models/store.rb +119 -0
- data/lib/univapay_client_sdk/models/store_list.rb +104 -0
- data/lib/univapay_client_sdk/models/store_list_item.rb +114 -0
- data/lib/univapay_client_sdk/models/subscription.rb +310 -0
- data/lib/univapay_client_sdk/models/subscription_canceled_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/subscription_completed_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/subscription_create_request.rb +216 -0
- data/lib/univapay_client_sdk/models/subscription_created_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/subscription_failure_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/subscription_installment_plan.rb +86 -0
- data/lib/univapay_client_sdk/models/subscription_list.rb +104 -0
- data/lib/univapay_client_sdk/models/subscription_list_item.rb +352 -0
- data/lib/univapay_client_sdk/models/subscription_next_payment.rb +222 -0
- data/lib/univapay_client_sdk/models/subscription_patch_payment_request.rb +117 -0
- data/lib/univapay_client_sdk/models/subscription_patch_token_request.rb +79 -0
- data/lib/univapay_client_sdk/models/subscription_payment.rb +185 -0
- data/lib/univapay_client_sdk/models/subscription_payment_list.rb +94 -0
- data/lib/univapay_client_sdk/models/subscription_payment_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/subscription_period.rb +56 -0
- data/lib/univapay_client_sdk/models/subscription_plan_settings.rb +98 -0
- data/lib/univapay_client_sdk/models/subscription_schedule_settings.rb +132 -0
- data/lib/univapay_client_sdk/models/subscription_status.rb +56 -0
- data/lib/univapay_client_sdk/models/subscription_suspend_request.rb +79 -0
- data/lib/univapay_client_sdk/models/subscription_suspended_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/subscription_terminate_with_status.rb +36 -0
- data/lib/univapay_client_sdk/models/subscription_termination_mode.rb +36 -0
- data/lib/univapay_client_sdk/models/subscription_update_next_payment.rb +104 -0
- data/lib/univapay_client_sdk/models/subscription_update_request.rb +134 -0
- data/lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb +110 -0
- data/lib/univapay_client_sdk/models/subscription_update_status.rb +37 -0
- data/lib/univapay_client_sdk/models/subscription_user_data.rb +134 -0
- data/lib/univapay_client_sdk/models/suspend_schedule_settings.rb +78 -0
- data/lib/univapay_client_sdk/models/three_ds_issuer_token.rb +116 -0
- data/lib/univapay_client_sdk/models/three_ds_issuer_token_call_method.rb +26 -0
- data/lib/univapay_client_sdk/models/three_ds_issuer_token_payment_type.rb +26 -0
- data/lib/univapay_client_sdk/models/token_create_bank_transfer_data.rb +122 -0
- data/lib/univapay_client_sdk/models/token_create_card_data.rb +231 -0
- data/lib/univapay_client_sdk/models/token_create_card_data_cvv_authorize.rb +95 -0
- data/lib/univapay_client_sdk/models/token_create_card_data_three_ds.rb +97 -0
- data/lib/univapay_client_sdk/models/token_create_konbini_data.rb +147 -0
- data/lib/univapay_client_sdk/models/token_create_online_data.rb +142 -0
- data/lib/univapay_client_sdk/models/token_create_phone_number.rb +104 -0
- data/lib/univapay_client_sdk/models/token_created_webhook_callback.rb +131 -0
- data/lib/univapay_client_sdk/models/token_cvv_auth_check_updated_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/token_cvv_auth_updated_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/token_replaced_webhook_callback.rb +131 -0
- data/lib/univapay_client_sdk/models/token_response_bank_transfer_data.rb +181 -0
- data/lib/univapay_client_sdk/models/token_response_card_data.rb +129 -0
- data/lib/univapay_client_sdk/models/token_response_card_data_billing.rb +153 -0
- data/lib/univapay_client_sdk/models/token_response_card_data_card.rb +187 -0
- data/lib/univapay_client_sdk/models/token_response_card_data_cvv_authorize.rb +132 -0
- data/lib/univapay_client_sdk/models/token_response_card_data_cvv_authorize_check.rb +118 -0
- data/lib/univapay_client_sdk/models/token_response_card_data_three_ds.rb +142 -0
- data/lib/univapay_client_sdk/models/token_response_card_data_three_ds_status.rb +48 -0
- data/lib/univapay_client_sdk/models/token_response_konbini_data.rb +135 -0
- data/lib/univapay_client_sdk/models/token_response_online_data.rb +158 -0
- data/lib/univapay_client_sdk/models/token_response_phone_number.rb +96 -0
- data/lib/univapay_client_sdk/models/token_three_ds_updated_webhook_callback.rb +132 -0
- data/lib/univapay_client_sdk/models/token_updated_webhook_callback.rb +131 -0
- data/lib/univapay_client_sdk/models/transaction_token.rb +250 -0
- data/lib/univapay_client_sdk/models/transaction_token_create_request.rb +161 -0
- data/lib/univapay_client_sdk/models/transaction_token_create_request_metadata.rb +124 -0
- data/lib/univapay_client_sdk/models/transaction_token_create_request_payment_type.rb +44 -0
- data/lib/univapay_client_sdk/models/transaction_token_create_request_type.rb +40 -0
- data/lib/univapay_client_sdk/models/transaction_token_list.rb +104 -0
- data/lib/univapay_client_sdk/models/transaction_token_list_item.rb +204 -0
- data/lib/univapay_client_sdk/models/transaction_token_list_item_user_data.rb +96 -0
- data/lib/univapay_client_sdk/models/transaction_token_mode.rb +36 -0
- data/lib/univapay_client_sdk/models/transaction_token_payment_type.rb +48 -0
- data/lib/univapay_client_sdk/models/transaction_token_type.rb +40 -0
- data/lib/univapay_client_sdk/models/transaction_token_update_request.rb +95 -0
- data/lib/univapay_client_sdk/models/transaction_token_update_request_data.rb +184 -0
- data/lib/univapay_client_sdk/models/transaction_token_update_request_data_phone_number.rb +86 -0
- data/lib/univapay_client_sdk/models/webhook.rb +191 -0
- data/lib/univapay_client_sdk/models/webhook_callback_envelope.rb +98 -0
- data/lib/univapay_client_sdk/models/webhook_create_request.rb +97 -0
- data/lib/univapay_client_sdk/models/webhook_event.rb +166 -0
- data/lib/univapay_client_sdk/models/webhook_event_list.rb +94 -0
- data/lib/univapay_client_sdk/models/webhook_list.rb +94 -0
- data/lib/univapay_client_sdk/models/webhook_trigger.rb +104 -0
- data/lib/univapay_client_sdk/models/webhook_update_request.rb +108 -0
- data/lib/univapay_client_sdk/utilities/date_time_helper.rb +11 -0
- data/lib/univapay_client_sdk/utilities/file_wrapper.rb +28 -0
- data/lib/univapay_client_sdk/utilities/union_type_lookup.rb +242 -0
- data/lib/univapay_client_sdk.rb +322 -0
- data/test/apis/api_test_base.rb +23 -0
- data/test/apis/test_cancels_api.rb +162 -0
- data/test/apis/test_charges_api.rb +564 -0
- data/test/apis/test_merchants_api.rb +50 -0
- data/test/apis/test_refunds_api.rb +172 -0
- data/test/apis/test_stores_api.rb +86 -0
- data/test/apis/test_subscriptions_api.rb +579 -0
- data/test/apis/test_transaction_tokens_api.rb +305 -0
- data/test/apis/test_webhooks_api.rb +245 -0
- data/test/events/webhooks/test_bank_transfer_handler.rb +95 -0
- data/test/events/webhooks/test_cancel_handler.rb +90 -0
- data/test/events/webhooks/test_charge_finished_handler.rb +95 -0
- data/test/events/webhooks/test_charge_updated_handler.rb +95 -0
- data/test/events/webhooks/test_customs_handler.rb +100 -0
- data/test/events/webhooks/test_recurring_token_deleted_handler.rb +92 -0
- data/test/events/webhooks/test_refund_handler.rb +95 -0
- data/test/events/webhooks/test_subscription_canceled_handler.rb +101 -0
- data/test/events/webhooks/test_subscription_completed_handler.rb +101 -0
- data/test/events/webhooks/test_subscription_created_handler.rb +101 -0
- data/test/events/webhooks/test_subscription_failure_handler.rb +101 -0
- data/test/events/webhooks/test_subscription_payment_handler.rb +101 -0
- data/test/events/webhooks/test_subscription_suspended_handler.rb +101 -0
- data/test/events/webhooks/test_token_created_handler.rb +92 -0
- data/test/events/webhooks/test_token_cvv_auth_check_updated_handler.rb +92 -0
- data/test/events/webhooks/test_token_cvv_auth_updated_handler.rb +92 -0
- data/test/events/webhooks/test_token_replaced_handler.rb +92 -0
- data/test/events/webhooks/test_token_three_ds_updated_handler.rb +92 -0
- data/test/events/webhooks/test_token_updated_handler.rb +92 -0
- data/test/framework_integrations/rails_app_test_helper.rb +14 -0
- data/test/framework_integrations/webhooks/apps/hanami_charge_updated_app.rb +61 -0
- data/test/framework_integrations/webhooks/apps/rails_charge_updated_app.rb +24 -0
- data/test/framework_integrations/webhooks/apps/sinatra_charge_updated_app.rb +27 -0
- data/test/framework_integrations/webhooks/test/test_hanami_charge_updated_app.rb +57 -0
- data/test/framework_integrations/webhooks/test/test_rails_charge_updated_app.rb +57 -0
- data/test/framework_integrations/webhooks/test/test_sinatra_charge_updated_app.rb +58 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +397 -0
|
@@ -0,0 +1,903 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# ChargesApi
|
|
8
|
+
class ChargesApi < BaseApi
|
|
9
|
+
# Creates a charge on a payment instrument (e.g. transaction token).
|
|
10
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
11
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
12
|
+
# recommend a randomly generated UUID (v4).
|
|
13
|
+
# @param [ChargeCreateRequest] body Optional parameter: Request payload for
|
|
14
|
+
# creating a charge.
|
|
15
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
16
|
+
def create_charge(idempotency_key: nil,
|
|
17
|
+
body: nil)
|
|
18
|
+
@api_call
|
|
19
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
20
|
+
'/charges',
|
|
21
|
+
Server::DEFAULT)
|
|
22
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
23
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
24
|
+
.body_param(new_parameter(body))
|
|
25
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
26
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
27
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
28
|
+
.response(new_response_handler
|
|
29
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
30
|
+
.deserialize_into(Charge.method(:from_hash))
|
|
31
|
+
.is_api_response(true)
|
|
32
|
+
.local_error_template('400',
|
|
33
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
34
|
+
ApiErrorException)
|
|
35
|
+
.local_error_template('401',
|
|
36
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
37
|
+
ApiErrorException)
|
|
38
|
+
.local_error_template('403',
|
|
39
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
40
|
+
ApiErrorException)
|
|
41
|
+
.local_error_template('429',
|
|
42
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
43
|
+
APIException)
|
|
44
|
+
.local_error_template('404',
|
|
45
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
46
|
+
APIException)
|
|
47
|
+
.local_error_template('409',
|
|
48
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
49
|
+
APIException)
|
|
50
|
+
.local_error_template('500',
|
|
51
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
52
|
+
APIException)
|
|
53
|
+
.local_error_template('503',
|
|
54
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
55
|
+
APIException)
|
|
56
|
+
.local_error_template('504',
|
|
57
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
58
|
+
APIException)
|
|
59
|
+
.local_error_template('default',
|
|
60
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
61
|
+
APIException))
|
|
62
|
+
.execute
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Lists all charges across all stores for the authenticated user.
|
|
66
|
+
# @param [Integer] limit Optional parameter: Maximum number of resources to
|
|
67
|
+
# return in one page.
|
|
68
|
+
# @param [UUID | String] cursor Optional parameter: Cursor pointing to the
|
|
69
|
+
# resource after which pagination should continue.
|
|
70
|
+
# @param [CursorDirectionQuery] cursor_direction Optional parameter:
|
|
71
|
+
# Pagination direction relative to the supplied cursor.
|
|
72
|
+
# @param [String] last_four Optional parameter: Filter by the last 4 digits
|
|
73
|
+
# of the card. **Note:** If specified, `name`, `exp_month`, and `exp_year`
|
|
74
|
+
# must also be included.
|
|
75
|
+
# @param [String] name Optional parameter: Filter by cardholder name.
|
|
76
|
+
# **Note:** If specified, `last_four`, `exp_month`, and `exp_year` must also
|
|
77
|
+
# be included.
|
|
78
|
+
# @param [Integer] exp_month Optional parameter: Filter by expiration month.
|
|
79
|
+
# **Note:** If specified, `last_four`, `name`, and `exp_year` must also be
|
|
80
|
+
# included.
|
|
81
|
+
# @param [Integer] exp_year Optional parameter: Filter by expiration year.
|
|
82
|
+
# **Note:** If specified, `last_four`, `name`, and `exp_month` must also be
|
|
83
|
+
# included.
|
|
84
|
+
# @param [String] from Optional parameter: Show charges created on or after
|
|
85
|
+
# this date (ISO-8601).
|
|
86
|
+
# @param [String] to Optional parameter: Show charges created before this
|
|
87
|
+
# date (ISO-8601).
|
|
88
|
+
# @param [String] email Optional parameter: Filter by email address.
|
|
89
|
+
# @param [String] phone Optional parameter: Filter by phone number.
|
|
90
|
+
# @param [Integer] amount_from Optional parameter: Show charges with an
|
|
91
|
+
# amount greater than or equal to this value.
|
|
92
|
+
# @param [Integer] amount_to Optional parameter: Show charges with an amount
|
|
93
|
+
# strictly less than this value.
|
|
94
|
+
# @param [String] currency Optional parameter: Filter by currency
|
|
95
|
+
# (ISO-4217).
|
|
96
|
+
# @param [ModeQuery] mode Optional parameter: Filter by environment mode.
|
|
97
|
+
# @param [String] metadata Optional parameter: Filter by metadata.
|
|
98
|
+
# @param [UUID | String] transaction_token_id Optional parameter: Filter by
|
|
99
|
+
# transaction token ID.
|
|
100
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
101
|
+
def list_all_charges(limit: 10,
|
|
102
|
+
cursor: nil,
|
|
103
|
+
cursor_direction: CursorDirectionQuery::DESC,
|
|
104
|
+
last_four: nil,
|
|
105
|
+
name: nil,
|
|
106
|
+
exp_month: nil,
|
|
107
|
+
exp_year: nil,
|
|
108
|
+
from: nil,
|
|
109
|
+
to: nil,
|
|
110
|
+
email: nil,
|
|
111
|
+
phone: nil,
|
|
112
|
+
amount_from: nil,
|
|
113
|
+
amount_to: nil,
|
|
114
|
+
currency: nil,
|
|
115
|
+
mode: nil,
|
|
116
|
+
metadata: nil,
|
|
117
|
+
transaction_token_id: nil)
|
|
118
|
+
@api_call
|
|
119
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
120
|
+
'/charges',
|
|
121
|
+
Server::DEFAULT)
|
|
122
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
123
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
|
124
|
+
.query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
|
|
125
|
+
.query_param(new_parameter(last_four, key: 'last_four'))
|
|
126
|
+
.query_param(new_parameter(name, key: 'name'))
|
|
127
|
+
.query_param(new_parameter(exp_month, key: 'exp_month'))
|
|
128
|
+
.query_param(new_parameter(exp_year, key: 'exp_year'))
|
|
129
|
+
.query_param(new_parameter(from, key: 'from'))
|
|
130
|
+
.query_param(new_parameter(to, key: 'to'))
|
|
131
|
+
.query_param(new_parameter(email, key: 'email'))
|
|
132
|
+
.query_param(new_parameter(phone, key: 'phone'))
|
|
133
|
+
.query_param(new_parameter(amount_from, key: 'amount_from'))
|
|
134
|
+
.query_param(new_parameter(amount_to, key: 'amount_to'))
|
|
135
|
+
.query_param(new_parameter(currency, key: 'currency'))
|
|
136
|
+
.query_param(new_parameter(mode, key: 'mode'))
|
|
137
|
+
.query_param(new_parameter(metadata, key: 'metadata'))
|
|
138
|
+
.query_param(new_parameter(transaction_token_id, key: 'transaction_token_id'))
|
|
139
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
140
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
141
|
+
.response(new_response_handler
|
|
142
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
143
|
+
.deserialize_into(ChargeList.method(:from_hash))
|
|
144
|
+
.is_api_response(true)
|
|
145
|
+
.local_error_template('400',
|
|
146
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
147
|
+
ApiErrorException)
|
|
148
|
+
.local_error_template('401',
|
|
149
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
150
|
+
ApiErrorException)
|
|
151
|
+
.local_error_template('403',
|
|
152
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
153
|
+
ApiErrorException)
|
|
154
|
+
.local_error_template('429',
|
|
155
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
156
|
+
APIException)
|
|
157
|
+
.local_error_template('404',
|
|
158
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
159
|
+
APIException)
|
|
160
|
+
.local_error_template('409',
|
|
161
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
162
|
+
APIException)
|
|
163
|
+
.local_error_template('500',
|
|
164
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
165
|
+
APIException)
|
|
166
|
+
.local_error_template('503',
|
|
167
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
168
|
+
APIException)
|
|
169
|
+
.local_error_template('504',
|
|
170
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
171
|
+
APIException)
|
|
172
|
+
.local_error_template('default',
|
|
173
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
174
|
+
APIException))
|
|
175
|
+
.execute
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Lists all charges for a specific store.
|
|
179
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
180
|
+
# of the store.
|
|
181
|
+
# @param [Integer] limit Optional parameter: Maximum number of resources to
|
|
182
|
+
# return in one page.
|
|
183
|
+
# @param [UUID | String] cursor Optional parameter: Cursor pointing to the
|
|
184
|
+
# resource after which pagination should continue.
|
|
185
|
+
# @param [CursorDirectionQuery] cursor_direction Optional parameter:
|
|
186
|
+
# Pagination direction relative to the supplied cursor.
|
|
187
|
+
# @param [String] last_four Optional parameter: Filter by the last 4 digits
|
|
188
|
+
# of the card. **Note:** If specified, `name`, `exp_month`, and `exp_year`
|
|
189
|
+
# must also be included.
|
|
190
|
+
# @param [String] name Optional parameter: Filter by cardholder name.
|
|
191
|
+
# **Note:** If specified, `last_four`, `exp_month`, and `exp_year` must also
|
|
192
|
+
# be included.
|
|
193
|
+
# @param [Integer] exp_month Optional parameter: Filter by expiration month.
|
|
194
|
+
# **Note:** If specified, `last_four`, `name`, and `exp_year` must also be
|
|
195
|
+
# included.
|
|
196
|
+
# @param [Integer] exp_year Optional parameter: Filter by expiration year.
|
|
197
|
+
# **Note:** If specified, `last_four`, `name`, and `exp_month` must also be
|
|
198
|
+
# included.
|
|
199
|
+
# @param [String] from Optional parameter: Show charges created on or after
|
|
200
|
+
# this date (ISO-8601).
|
|
201
|
+
# @param [String] to Optional parameter: Show charges created before this
|
|
202
|
+
# date (ISO-8601).
|
|
203
|
+
# @param [String] email Optional parameter: Filter by email address.
|
|
204
|
+
# @param [String] phone Optional parameter: Filter by phone number.
|
|
205
|
+
# @param [Integer] amount_from Optional parameter: Show charges with an
|
|
206
|
+
# amount greater than or equal to this value.
|
|
207
|
+
# @param [Integer] amount_to Optional parameter: Show charges with an amount
|
|
208
|
+
# strictly less than this value.
|
|
209
|
+
# @param [String] currency Optional parameter: Filter by currency
|
|
210
|
+
# (ISO-4217).
|
|
211
|
+
# @param [ModeQuery] mode Optional parameter: Filter by environment mode.
|
|
212
|
+
# @param [String] metadata Optional parameter: Filter by metadata.
|
|
213
|
+
# @param [UUID | String] transaction_token_id Optional parameter: Filter by
|
|
214
|
+
# transaction token ID.
|
|
215
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
216
|
+
def list_store_charges(store_id,
|
|
217
|
+
limit: 10,
|
|
218
|
+
cursor: nil,
|
|
219
|
+
cursor_direction: CursorDirectionQuery::DESC,
|
|
220
|
+
last_four: nil,
|
|
221
|
+
name: nil,
|
|
222
|
+
exp_month: nil,
|
|
223
|
+
exp_year: nil,
|
|
224
|
+
from: nil,
|
|
225
|
+
to: nil,
|
|
226
|
+
email: nil,
|
|
227
|
+
phone: nil,
|
|
228
|
+
amount_from: nil,
|
|
229
|
+
amount_to: nil,
|
|
230
|
+
currency: nil,
|
|
231
|
+
mode: nil,
|
|
232
|
+
metadata: nil,
|
|
233
|
+
transaction_token_id: nil)
|
|
234
|
+
@api_call
|
|
235
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
236
|
+
'/stores/{storeId}/charges',
|
|
237
|
+
Server::DEFAULT)
|
|
238
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
239
|
+
.is_required(true)
|
|
240
|
+
.should_encode(true))
|
|
241
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
242
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
|
243
|
+
.query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
|
|
244
|
+
.query_param(new_parameter(last_four, key: 'last_four'))
|
|
245
|
+
.query_param(new_parameter(name, key: 'name'))
|
|
246
|
+
.query_param(new_parameter(exp_month, key: 'exp_month'))
|
|
247
|
+
.query_param(new_parameter(exp_year, key: 'exp_year'))
|
|
248
|
+
.query_param(new_parameter(from, key: 'from'))
|
|
249
|
+
.query_param(new_parameter(to, key: 'to'))
|
|
250
|
+
.query_param(new_parameter(email, key: 'email'))
|
|
251
|
+
.query_param(new_parameter(phone, key: 'phone'))
|
|
252
|
+
.query_param(new_parameter(amount_from, key: 'amount_from'))
|
|
253
|
+
.query_param(new_parameter(amount_to, key: 'amount_to'))
|
|
254
|
+
.query_param(new_parameter(currency, key: 'currency'))
|
|
255
|
+
.query_param(new_parameter(mode, key: 'mode'))
|
|
256
|
+
.query_param(new_parameter(metadata, key: 'metadata'))
|
|
257
|
+
.query_param(new_parameter(transaction_token_id, key: 'transaction_token_id'))
|
|
258
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
259
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
260
|
+
.response(new_response_handler
|
|
261
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
262
|
+
.deserialize_into(ChargeList.method(:from_hash))
|
|
263
|
+
.is_api_response(true)
|
|
264
|
+
.local_error_template('400',
|
|
265
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
266
|
+
ApiErrorException)
|
|
267
|
+
.local_error_template('401',
|
|
268
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
269
|
+
ApiErrorException)
|
|
270
|
+
.local_error_template('403',
|
|
271
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
272
|
+
ApiErrorException)
|
|
273
|
+
.local_error_template('429',
|
|
274
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
275
|
+
APIException)
|
|
276
|
+
.local_error_template('404',
|
|
277
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
278
|
+
APIException)
|
|
279
|
+
.local_error_template('409',
|
|
280
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
281
|
+
APIException)
|
|
282
|
+
.local_error_template('500',
|
|
283
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
284
|
+
APIException)
|
|
285
|
+
.local_error_template('503',
|
|
286
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
287
|
+
APIException)
|
|
288
|
+
.local_error_template('504',
|
|
289
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
290
|
+
APIException)
|
|
291
|
+
.local_error_template('default',
|
|
292
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
293
|
+
APIException))
|
|
294
|
+
.execute
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
# Retrieves the details of an existing charge.
|
|
298
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
299
|
+
# of the store.
|
|
300
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
301
|
+
# resource.
|
|
302
|
+
# @param [TrueClass | FalseClass] polling Optional parameter: If set to
|
|
303
|
+
# true, instructs the API to internally poll the charge status until it
|
|
304
|
+
# changes from 'pending' (the initial status) to another status.
|
|
305
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
306
|
+
def get_charge(store_id,
|
|
307
|
+
id,
|
|
308
|
+
polling: nil)
|
|
309
|
+
@api_call
|
|
310
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
311
|
+
'/stores/{storeId}/charges/{id}',
|
|
312
|
+
Server::DEFAULT)
|
|
313
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
314
|
+
.is_required(true)
|
|
315
|
+
.should_encode(true))
|
|
316
|
+
.template_param(new_parameter(id, key: 'id')
|
|
317
|
+
.is_required(true)
|
|
318
|
+
.should_encode(true))
|
|
319
|
+
.query_param(new_parameter(polling, key: 'polling'))
|
|
320
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
321
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
322
|
+
.response(new_response_handler
|
|
323
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
324
|
+
.deserialize_into(Charge.method(:from_hash))
|
|
325
|
+
.is_api_response(true)
|
|
326
|
+
.local_error_template('400',
|
|
327
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
328
|
+
ApiErrorException)
|
|
329
|
+
.local_error_template('401',
|
|
330
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
331
|
+
ApiErrorException)
|
|
332
|
+
.local_error_template('403',
|
|
333
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
334
|
+
ApiErrorException)
|
|
335
|
+
.local_error_template('404',
|
|
336
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
337
|
+
ApiErrorException)
|
|
338
|
+
.local_error_template('429',
|
|
339
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
340
|
+
APIException)
|
|
341
|
+
.local_error_template('409',
|
|
342
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
343
|
+
APIException)
|
|
344
|
+
.local_error_template('500',
|
|
345
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
346
|
+
APIException)
|
|
347
|
+
.local_error_template('503',
|
|
348
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
349
|
+
APIException)
|
|
350
|
+
.local_error_template('504',
|
|
351
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
352
|
+
APIException)
|
|
353
|
+
.local_error_template('default',
|
|
354
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
355
|
+
APIException))
|
|
356
|
+
.execute
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# Use this request to add or modify arbitrary metadata on an existing
|
|
360
|
+
# charge.
|
|
361
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
362
|
+
# of the store.
|
|
363
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
364
|
+
# resource.
|
|
365
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
366
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
367
|
+
# recommend a randomly generated UUID (v4).
|
|
368
|
+
# @param [ChargeUpdateRequest] body Optional parameter: Request payload for
|
|
369
|
+
# updating charge metadata.
|
|
370
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
371
|
+
def update_charge(store_id,
|
|
372
|
+
id,
|
|
373
|
+
idempotency_key: nil,
|
|
374
|
+
body: nil)
|
|
375
|
+
@api_call
|
|
376
|
+
.request(new_request_builder(HttpMethodEnum::PATCH,
|
|
377
|
+
'/stores/{storeId}/charges/{id}',
|
|
378
|
+
Server::DEFAULT)
|
|
379
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
380
|
+
.is_required(true)
|
|
381
|
+
.should_encode(true))
|
|
382
|
+
.template_param(new_parameter(id, key: 'id')
|
|
383
|
+
.is_required(true)
|
|
384
|
+
.should_encode(true))
|
|
385
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
386
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
387
|
+
.body_param(new_parameter(body))
|
|
388
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
389
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
390
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
391
|
+
.response(new_response_handler
|
|
392
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
393
|
+
.deserialize_into(Charge.method(:from_hash))
|
|
394
|
+
.is_api_response(true)
|
|
395
|
+
.local_error_template('400',
|
|
396
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
397
|
+
ApiErrorException)
|
|
398
|
+
.local_error_template('401',
|
|
399
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
400
|
+
ApiErrorException)
|
|
401
|
+
.local_error_template('403',
|
|
402
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
403
|
+
ApiErrorException)
|
|
404
|
+
.local_error_template('404',
|
|
405
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
406
|
+
ApiErrorException)
|
|
407
|
+
.local_error_template('429',
|
|
408
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
409
|
+
APIException)
|
|
410
|
+
.local_error_template('409',
|
|
411
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
412
|
+
APIException)
|
|
413
|
+
.local_error_template('500',
|
|
414
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
415
|
+
APIException)
|
|
416
|
+
.local_error_template('503',
|
|
417
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
418
|
+
APIException)
|
|
419
|
+
.local_error_template('504',
|
|
420
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
421
|
+
APIException)
|
|
422
|
+
.local_error_template('default',
|
|
423
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
424
|
+
APIException))
|
|
425
|
+
.execute
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
# Captures a previously authorized charge (where `capture` was set to false
|
|
429
|
+
# during creation). The capture amount must be less than or equal to the
|
|
430
|
+
# authorized amount, and the currency must match.
|
|
431
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
432
|
+
# of the store.
|
|
433
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
434
|
+
# resource.
|
|
435
|
+
# @param [ChargeCaptureRequest] body Required parameter: Request payload for
|
|
436
|
+
# capturing an authorized charge.
|
|
437
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
438
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
439
|
+
# recommend a randomly generated UUID (v4).
|
|
440
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
441
|
+
def capture_charge(store_id,
|
|
442
|
+
id,
|
|
443
|
+
body,
|
|
444
|
+
idempotency_key: nil)
|
|
445
|
+
@api_call
|
|
446
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
447
|
+
'/stores/{storeId}/charges/{id}/capture',
|
|
448
|
+
Server::DEFAULT)
|
|
449
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
450
|
+
.is_required(true)
|
|
451
|
+
.should_encode(true))
|
|
452
|
+
.template_param(new_parameter(id, key: 'id')
|
|
453
|
+
.is_required(true)
|
|
454
|
+
.should_encode(true))
|
|
455
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
456
|
+
.body_param(new_parameter(body)
|
|
457
|
+
.is_required(true))
|
|
458
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
459
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
460
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
461
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
462
|
+
.response(new_response_handler
|
|
463
|
+
.deserializer(APIHelper.method(:json_deserialize))
|
|
464
|
+
.is_api_response(true)
|
|
465
|
+
.local_error_template('400',
|
|
466
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
467
|
+
ApiErrorException)
|
|
468
|
+
.local_error_template('401',
|
|
469
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
470
|
+
ApiErrorException)
|
|
471
|
+
.local_error_template('403',
|
|
472
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
473
|
+
ApiErrorException)
|
|
474
|
+
.local_error_template('404',
|
|
475
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
476
|
+
ApiErrorException)
|
|
477
|
+
.local_error_template('429',
|
|
478
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
479
|
+
APIException)
|
|
480
|
+
.local_error_template('409',
|
|
481
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
482
|
+
APIException)
|
|
483
|
+
.local_error_template('500',
|
|
484
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
485
|
+
APIException)
|
|
486
|
+
.local_error_template('503',
|
|
487
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
488
|
+
APIException)
|
|
489
|
+
.local_error_template('504',
|
|
490
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
491
|
+
APIException)
|
|
492
|
+
.local_error_template('default',
|
|
493
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
494
|
+
APIException))
|
|
495
|
+
.execute
|
|
496
|
+
end
|
|
497
|
+
|
|
498
|
+
# Retrieves the necessary payment execution URL (for online payments) or
|
|
499
|
+
# bank account details (for bank transfers).
|
|
500
|
+
# **⚠️ Prerequisite:** The charge `status` must be `awaiting` before
|
|
501
|
+
# requesting the issuer token. If requested while the charge is in any
|
|
502
|
+
# other status, an error will be returned.
|
|
503
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
504
|
+
# of the store.
|
|
505
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
506
|
+
# resource.
|
|
507
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
508
|
+
def get_charge_issuer_token(store_id,
|
|
509
|
+
id)
|
|
510
|
+
@api_call
|
|
511
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
512
|
+
'/stores/{storeId}/charges/{id}/issuer_token',
|
|
513
|
+
Server::DEFAULT)
|
|
514
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
515
|
+
.is_required(true)
|
|
516
|
+
.should_encode(true))
|
|
517
|
+
.template_param(new_parameter(id, key: 'id')
|
|
518
|
+
.is_required(true)
|
|
519
|
+
.should_encode(true))
|
|
520
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
521
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
522
|
+
.response(new_response_handler
|
|
523
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
524
|
+
.deserialize_into(IssuerToken.method(:from_hash))
|
|
525
|
+
.is_api_response(true)
|
|
526
|
+
.local_error_template('400',
|
|
527
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
528
|
+
ApiErrorException)
|
|
529
|
+
.local_error_template('401',
|
|
530
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
531
|
+
ApiErrorException)
|
|
532
|
+
.local_error_template('403',
|
|
533
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
534
|
+
ApiErrorException)
|
|
535
|
+
.local_error_template('404',
|
|
536
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
537
|
+
ApiErrorException)
|
|
538
|
+
.local_error_template('429',
|
|
539
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
540
|
+
APIException)
|
|
541
|
+
.local_error_template('409',
|
|
542
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
543
|
+
APIException)
|
|
544
|
+
.local_error_template('500',
|
|
545
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
546
|
+
APIException)
|
|
547
|
+
.local_error_template('503',
|
|
548
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
549
|
+
APIException)
|
|
550
|
+
.local_error_template('504',
|
|
551
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
552
|
+
APIException)
|
|
553
|
+
.local_error_template('default',
|
|
554
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
555
|
+
APIException))
|
|
556
|
+
.execute
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
# Retrieves the 3-D Secure issuer token details required to authenticate a
|
|
560
|
+
# card charge.
|
|
561
|
+
# **⚠️ Prerequisites:** 1. The charge must be created with `three_ds.mode`
|
|
562
|
+
# set to `normal` or `force`. 2. You must poll the charge until its `status`
|
|
563
|
+
# becomes `awaiting` before making this request.
|
|
564
|
+
# **Execution Flow:** Once retrieved, the client (browser) must execute an
|
|
565
|
+
# `http_post` request to the `issuer_token` URL. The `payload` object must
|
|
566
|
+
# be formatted according to the `content_type` (e.g., URL-encoded) and sent
|
|
567
|
+
# in the body. You can execute this via a redirect or inside an iframe. If
|
|
568
|
+
# using an iframe, continue polling the charge status in the background
|
|
569
|
+
# until it reaches `successful`, `failed`, or `error`.
|
|
570
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
571
|
+
# of the store.
|
|
572
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
573
|
+
# resource.
|
|
574
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
575
|
+
def get_charge_three_ds_issuer_token(store_id,
|
|
576
|
+
id)
|
|
577
|
+
@api_call
|
|
578
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
579
|
+
'/stores/{storeId}/charges/{id}/three_ds/issuer_token',
|
|
580
|
+
Server::DEFAULT)
|
|
581
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
582
|
+
.is_required(true)
|
|
583
|
+
.should_encode(true))
|
|
584
|
+
.template_param(new_parameter(id, key: 'id')
|
|
585
|
+
.is_required(true)
|
|
586
|
+
.should_encode(true))
|
|
587
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
588
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
589
|
+
.response(new_response_handler
|
|
590
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
591
|
+
.deserialize_into(ThreeDsIssuerToken.method(:from_hash))
|
|
592
|
+
.is_api_response(true)
|
|
593
|
+
.local_error_template('400',
|
|
594
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
595
|
+
ApiErrorException)
|
|
596
|
+
.local_error_template('401',
|
|
597
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
598
|
+
ApiErrorException)
|
|
599
|
+
.local_error_template('403',
|
|
600
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
601
|
+
ApiErrorException)
|
|
602
|
+
.local_error_template('404',
|
|
603
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
604
|
+
ApiErrorException)
|
|
605
|
+
.local_error_template('429',
|
|
606
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
607
|
+
APIException)
|
|
608
|
+
.local_error_template('409',
|
|
609
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
610
|
+
APIException)
|
|
611
|
+
.local_error_template('500',
|
|
612
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
613
|
+
APIException)
|
|
614
|
+
.local_error_template('503',
|
|
615
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
616
|
+
APIException)
|
|
617
|
+
.local_error_template('504',
|
|
618
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
619
|
+
APIException)
|
|
620
|
+
.local_error_template('default',
|
|
621
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
622
|
+
APIException))
|
|
623
|
+
.execute
|
|
624
|
+
end
|
|
625
|
+
|
|
626
|
+
# Retrieves bank transfer ledger entries associated with a charge.
|
|
627
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
628
|
+
# of the store.
|
|
629
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
630
|
+
# resource.
|
|
631
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
632
|
+
def list_bank_transfer_ledgers(store_id,
|
|
633
|
+
id)
|
|
634
|
+
@api_call
|
|
635
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
636
|
+
'/stores/{storeId}/charges/{id}/bank_transfer_ledgers',
|
|
637
|
+
Server::DEFAULT)
|
|
638
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
639
|
+
.is_required(true)
|
|
640
|
+
.should_encode(true))
|
|
641
|
+
.template_param(new_parameter(id, key: 'id')
|
|
642
|
+
.is_required(true)
|
|
643
|
+
.should_encode(true))
|
|
644
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
645
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
646
|
+
.response(new_response_handler
|
|
647
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
648
|
+
.deserialize_into(BankTransferLedgerList.method(:from_hash))
|
|
649
|
+
.is_api_response(true)
|
|
650
|
+
.local_error_template('400',
|
|
651
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
652
|
+
ApiErrorException)
|
|
653
|
+
.local_error_template('401',
|
|
654
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
655
|
+
ApiErrorException)
|
|
656
|
+
.local_error_template('403',
|
|
657
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
658
|
+
ApiErrorException)
|
|
659
|
+
.local_error_template('404',
|
|
660
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
661
|
+
ApiErrorException)
|
|
662
|
+
.local_error_template('429',
|
|
663
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
664
|
+
APIException)
|
|
665
|
+
.local_error_template('409',
|
|
666
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
667
|
+
APIException)
|
|
668
|
+
.local_error_template('500',
|
|
669
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
670
|
+
APIException)
|
|
671
|
+
.local_error_template('503',
|
|
672
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
673
|
+
APIException)
|
|
674
|
+
.local_error_template('504',
|
|
675
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
676
|
+
APIException)
|
|
677
|
+
.local_error_template('default',
|
|
678
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
679
|
+
APIException))
|
|
680
|
+
.execute
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
# Creates a customs declaration for a successful charge. Backend only
|
|
684
|
+
# accepts this request for WeChat Online and WeChat MPM charges. If a
|
|
685
|
+
# declaration already exists and is no longer pending, the backend updates
|
|
686
|
+
# its identity fields and restarts processing instead of creating a new
|
|
687
|
+
# record.
|
|
688
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
689
|
+
# of the store.
|
|
690
|
+
# @param [UUID | String] charge_id Required parameter: The unique identifier
|
|
691
|
+
# of the charge.
|
|
692
|
+
# @param [CustomsDeclarationCreateRequest] body Required parameter: Request
|
|
693
|
+
# payload for creating a customs declaration.
|
|
694
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
695
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
696
|
+
# recommend a randomly generated UUID (v4).
|
|
697
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
698
|
+
def create_customs_declaration(store_id,
|
|
699
|
+
charge_id,
|
|
700
|
+
body,
|
|
701
|
+
idempotency_key: nil)
|
|
702
|
+
@api_call
|
|
703
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
704
|
+
'/stores/{storeId}/charges/{chargeId}/customs',
|
|
705
|
+
Server::DEFAULT)
|
|
706
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
707
|
+
.is_required(true)
|
|
708
|
+
.should_encode(true))
|
|
709
|
+
.template_param(new_parameter(charge_id, key: 'chargeId')
|
|
710
|
+
.is_required(true)
|
|
711
|
+
.should_encode(true))
|
|
712
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
713
|
+
.body_param(new_parameter(body)
|
|
714
|
+
.is_required(true))
|
|
715
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
716
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
717
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
718
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
719
|
+
.response(new_response_handler
|
|
720
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
721
|
+
.deserialize_into(CustomsDeclarationWebhookData.method(:from_hash))
|
|
722
|
+
.is_api_response(true)
|
|
723
|
+
.local_error_template('400',
|
|
724
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
725
|
+
ApiErrorException)
|
|
726
|
+
.local_error_template('401',
|
|
727
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
728
|
+
ApiErrorException)
|
|
729
|
+
.local_error_template('403',
|
|
730
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
731
|
+
ApiErrorException)
|
|
732
|
+
.local_error_template('404',
|
|
733
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
734
|
+
ApiErrorException)
|
|
735
|
+
.local_error_template('429',
|
|
736
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
737
|
+
APIException)
|
|
738
|
+
.local_error_template('409',
|
|
739
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
740
|
+
APIException)
|
|
741
|
+
.local_error_template('500',
|
|
742
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
743
|
+
APIException)
|
|
744
|
+
.local_error_template('503',
|
|
745
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
746
|
+
APIException)
|
|
747
|
+
.local_error_template('504',
|
|
748
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
749
|
+
APIException)
|
|
750
|
+
.local_error_template('default',
|
|
751
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
752
|
+
APIException))
|
|
753
|
+
.execute
|
|
754
|
+
end
|
|
755
|
+
|
|
756
|
+
# Retrieves a customs declaration for a charge. Supports long polling when
|
|
757
|
+
# `polling=true`, returning once the declaration leaves its current state or
|
|
758
|
+
# the polling timeout is reached.
|
|
759
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
760
|
+
# of the store.
|
|
761
|
+
# @param [UUID | String] charge_id Required parameter: The unique identifier
|
|
762
|
+
# of the charge.
|
|
763
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
764
|
+
# customs declaration.
|
|
765
|
+
# @param [TrueClass | FalseClass] polling Optional parameter: Hold the
|
|
766
|
+
# request open while waiting for a status change.
|
|
767
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
768
|
+
def get_customs_declaration(store_id,
|
|
769
|
+
charge_id,
|
|
770
|
+
id,
|
|
771
|
+
polling: false)
|
|
772
|
+
@api_call
|
|
773
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
774
|
+
'/stores/{storeId}/charges/{chargeId}/customs/{id}',
|
|
775
|
+
Server::DEFAULT)
|
|
776
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
777
|
+
.is_required(true)
|
|
778
|
+
.should_encode(true))
|
|
779
|
+
.template_param(new_parameter(charge_id, key: 'chargeId')
|
|
780
|
+
.is_required(true)
|
|
781
|
+
.should_encode(true))
|
|
782
|
+
.template_param(new_parameter(id, key: 'id')
|
|
783
|
+
.is_required(true)
|
|
784
|
+
.should_encode(true))
|
|
785
|
+
.query_param(new_parameter(polling, key: 'polling'))
|
|
786
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
787
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
788
|
+
.response(new_response_handler
|
|
789
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
790
|
+
.deserialize_into(CustomsDeclarationWebhookData.method(:from_hash))
|
|
791
|
+
.is_api_response(true)
|
|
792
|
+
.local_error_template('401',
|
|
793
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
794
|
+
ApiErrorException)
|
|
795
|
+
.local_error_template('403',
|
|
796
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
797
|
+
ApiErrorException)
|
|
798
|
+
.local_error_template('404',
|
|
799
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
800
|
+
ApiErrorException)
|
|
801
|
+
.local_error_template('400',
|
|
802
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
803
|
+
APIException)
|
|
804
|
+
.local_error_template('409',
|
|
805
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
806
|
+
APIException)
|
|
807
|
+
.local_error_template('429',
|
|
808
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
809
|
+
APIException)
|
|
810
|
+
.local_error_template('500',
|
|
811
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
812
|
+
APIException)
|
|
813
|
+
.local_error_template('503',
|
|
814
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
815
|
+
APIException)
|
|
816
|
+
.local_error_template('504',
|
|
817
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
818
|
+
APIException)
|
|
819
|
+
.local_error_template('default',
|
|
820
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
821
|
+
APIException))
|
|
822
|
+
.execute
|
|
823
|
+
end
|
|
824
|
+
|
|
825
|
+
# Updates a customs declaration and requeues processing. Backend patching
|
|
826
|
+
# preserves the original `customs`, `certificate_id`, and `certificate_name`
|
|
827
|
+
# values and only accepts a new `merchant_customs_no`. Pending declarations
|
|
828
|
+
# cannot be patched.
|
|
829
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
830
|
+
# of the store.
|
|
831
|
+
# @param [UUID | String] charge_id Required parameter: The unique identifier
|
|
832
|
+
# of the charge.
|
|
833
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
834
|
+
# customs declaration.
|
|
835
|
+
# @param [CustomsDeclarationPatchRequest] body Required parameter: Request
|
|
836
|
+
# payload for patching a customs declaration.
|
|
837
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
838
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
839
|
+
# recommend a randomly generated UUID (v4).
|
|
840
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
841
|
+
def patch_customs_declaration(store_id,
|
|
842
|
+
charge_id,
|
|
843
|
+
id,
|
|
844
|
+
body,
|
|
845
|
+
idempotency_key: nil)
|
|
846
|
+
@api_call
|
|
847
|
+
.request(new_request_builder(HttpMethodEnum::PATCH,
|
|
848
|
+
'/stores/{storeId}/charges/{chargeId}/customs/{id}',
|
|
849
|
+
Server::DEFAULT)
|
|
850
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
851
|
+
.is_required(true)
|
|
852
|
+
.should_encode(true))
|
|
853
|
+
.template_param(new_parameter(charge_id, key: 'chargeId')
|
|
854
|
+
.is_required(true)
|
|
855
|
+
.should_encode(true))
|
|
856
|
+
.template_param(new_parameter(id, key: 'id')
|
|
857
|
+
.is_required(true)
|
|
858
|
+
.should_encode(true))
|
|
859
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
860
|
+
.body_param(new_parameter(body)
|
|
861
|
+
.is_required(true))
|
|
862
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
863
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
864
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
865
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
866
|
+
.response(new_response_handler
|
|
867
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
868
|
+
.deserialize_into(CustomsDeclarationWebhookData.method(:from_hash))
|
|
869
|
+
.is_api_response(true)
|
|
870
|
+
.local_error_template('400',
|
|
871
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
872
|
+
ApiErrorException)
|
|
873
|
+
.local_error_template('401',
|
|
874
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
875
|
+
ApiErrorException)
|
|
876
|
+
.local_error_template('403',
|
|
877
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
878
|
+
ApiErrorException)
|
|
879
|
+
.local_error_template('404',
|
|
880
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
881
|
+
ApiErrorException)
|
|
882
|
+
.local_error_template('429',
|
|
883
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
884
|
+
APIException)
|
|
885
|
+
.local_error_template('409',
|
|
886
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
887
|
+
APIException)
|
|
888
|
+
.local_error_template('500',
|
|
889
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
890
|
+
APIException)
|
|
891
|
+
.local_error_template('503',
|
|
892
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
893
|
+
APIException)
|
|
894
|
+
.local_error_template('504',
|
|
895
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
896
|
+
APIException)
|
|
897
|
+
.local_error_template('default',
|
|
898
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
899
|
+
APIException))
|
|
900
|
+
.execute
|
|
901
|
+
end
|
|
902
|
+
end
|
|
903
|
+
end
|