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,1014 @@
|
|
|
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
|
+
# SubscriptionsApi
|
|
8
|
+
class SubscriptionsApi < BaseApi
|
|
9
|
+
# Creates a new subscription.
|
|
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 [SubscriptionCreateRequest] body Optional parameter: Create
|
|
14
|
+
# Subscription request
|
|
15
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
16
|
+
def create_subscription(idempotency_key: nil,
|
|
17
|
+
body: nil)
|
|
18
|
+
@api_call
|
|
19
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
20
|
+
'/subscriptions',
|
|
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(Subscription.method(:from_hash))
|
|
31
|
+
.is_api_response(true)
|
|
32
|
+
.local_error_template('400',
|
|
33
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
34
|
+
APIException)
|
|
35
|
+
.local_error_template('401',
|
|
36
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
37
|
+
APIException)
|
|
38
|
+
.local_error_template('403',
|
|
39
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
40
|
+
APIException)
|
|
41
|
+
.local_error_template('404',
|
|
42
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
43
|
+
APIException)
|
|
44
|
+
.local_error_template('409',
|
|
45
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
46
|
+
APIException)
|
|
47
|
+
.local_error_template('429',
|
|
48
|
+
'HTTP 429 Rate Limited: {$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 subscriptions across all stores.
|
|
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
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
73
|
+
def list_all_subscriptions(limit: 10,
|
|
74
|
+
cursor: nil,
|
|
75
|
+
cursor_direction: CursorDirectionQuery::DESC)
|
|
76
|
+
@api_call
|
|
77
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
78
|
+
'/subscriptions',
|
|
79
|
+
Server::DEFAULT)
|
|
80
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
81
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
|
82
|
+
.query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
|
|
83
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
84
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
85
|
+
.response(new_response_handler
|
|
86
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
87
|
+
.deserialize_into(SubscriptionList.method(:from_hash))
|
|
88
|
+
.is_api_response(true)
|
|
89
|
+
.local_error_template('400',
|
|
90
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
91
|
+
APIException)
|
|
92
|
+
.local_error_template('401',
|
|
93
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
94
|
+
APIException)
|
|
95
|
+
.local_error_template('403',
|
|
96
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
97
|
+
APIException)
|
|
98
|
+
.local_error_template('404',
|
|
99
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
100
|
+
APIException)
|
|
101
|
+
.local_error_template('409',
|
|
102
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
103
|
+
APIException)
|
|
104
|
+
.local_error_template('429',
|
|
105
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
106
|
+
APIException)
|
|
107
|
+
.local_error_template('500',
|
|
108
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
109
|
+
APIException)
|
|
110
|
+
.local_error_template('503',
|
|
111
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
112
|
+
APIException)
|
|
113
|
+
.local_error_template('504',
|
|
114
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
115
|
+
APIException)
|
|
116
|
+
.local_error_template('default',
|
|
117
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
118
|
+
APIException))
|
|
119
|
+
.execute
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Lists all subscriptions for a specific store.
|
|
123
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
124
|
+
# of the store.
|
|
125
|
+
# @param [String] search Optional parameter: Search by metadata values.
|
|
126
|
+
# @param [SubscriptionStatus] status Optional parameter: Filter
|
|
127
|
+
# subscriptions by current status.
|
|
128
|
+
# @param [ChargeMode] mode Optional parameter: Filter subscriptions by
|
|
129
|
+
# processing mode.
|
|
130
|
+
# @param [Integer] limit Optional parameter: Maximum number of resources to
|
|
131
|
+
# return in one page.
|
|
132
|
+
# @param [UUID | String] cursor Optional parameter: Cursor pointing to the
|
|
133
|
+
# resource after which pagination should continue.
|
|
134
|
+
# @param [CursorDirectionQuery] cursor_direction Optional parameter:
|
|
135
|
+
# Pagination direction relative to the supplied cursor.
|
|
136
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
137
|
+
def list_store_subscriptions(store_id,
|
|
138
|
+
search: nil,
|
|
139
|
+
status: nil,
|
|
140
|
+
mode: nil,
|
|
141
|
+
limit: 10,
|
|
142
|
+
cursor: nil,
|
|
143
|
+
cursor_direction: CursorDirectionQuery::DESC)
|
|
144
|
+
@api_call
|
|
145
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
146
|
+
'/stores/{storeId}/subscriptions',
|
|
147
|
+
Server::DEFAULT)
|
|
148
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
149
|
+
.is_required(true)
|
|
150
|
+
.should_encode(true))
|
|
151
|
+
.query_param(new_parameter(search, key: 'search'))
|
|
152
|
+
.query_param(new_parameter(status, key: 'status'))
|
|
153
|
+
.query_param(new_parameter(mode, key: 'mode'))
|
|
154
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
155
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
|
156
|
+
.query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
|
|
157
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
158
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
159
|
+
.response(new_response_handler
|
|
160
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
161
|
+
.deserialize_into(SubscriptionList.method(:from_hash))
|
|
162
|
+
.is_api_response(true)
|
|
163
|
+
.local_error_template('400',
|
|
164
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
165
|
+
APIException)
|
|
166
|
+
.local_error_template('401',
|
|
167
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
168
|
+
APIException)
|
|
169
|
+
.local_error_template('403',
|
|
170
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
171
|
+
APIException)
|
|
172
|
+
.local_error_template('404',
|
|
173
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
174
|
+
APIException)
|
|
175
|
+
.local_error_template('409',
|
|
176
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
177
|
+
APIException)
|
|
178
|
+
.local_error_template('429',
|
|
179
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
180
|
+
APIException)
|
|
181
|
+
.local_error_template('500',
|
|
182
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
183
|
+
APIException)
|
|
184
|
+
.local_error_template('503',
|
|
185
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
186
|
+
APIException)
|
|
187
|
+
.local_error_template('504',
|
|
188
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
189
|
+
APIException)
|
|
190
|
+
.local_error_template('default',
|
|
191
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
192
|
+
APIException))
|
|
193
|
+
.execute
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Retrieves the details of an existing subscription. Supports internal
|
|
197
|
+
# polling to wait for status changes.
|
|
198
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
199
|
+
# of the store.
|
|
200
|
+
# @param [UUID | String] id Required parameter: The Subscription ID.
|
|
201
|
+
# @param [TrueClass | FalseClass] polling Optional parameter: If set to
|
|
202
|
+
# true, instructs the API to internally poll the subscription status until
|
|
203
|
+
# it changes from 'unverified' (the initial status) to another status.
|
|
204
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
205
|
+
def get_subscription(store_id,
|
|
206
|
+
id,
|
|
207
|
+
polling: nil)
|
|
208
|
+
@api_call
|
|
209
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
210
|
+
'/stores/{storeId}/subscriptions/{id}',
|
|
211
|
+
Server::DEFAULT)
|
|
212
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
213
|
+
.is_required(true)
|
|
214
|
+
.should_encode(true))
|
|
215
|
+
.template_param(new_parameter(id, key: 'id')
|
|
216
|
+
.is_required(true)
|
|
217
|
+
.should_encode(true))
|
|
218
|
+
.query_param(new_parameter(polling, key: 'polling'))
|
|
219
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
220
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
221
|
+
.response(new_response_handler
|
|
222
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
223
|
+
.deserialize_into(Subscription.method(:from_hash))
|
|
224
|
+
.is_api_response(true)
|
|
225
|
+
.local_error_template('401',
|
|
226
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
227
|
+
ApiErrorException)
|
|
228
|
+
.local_error_template('404',
|
|
229
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
230
|
+
ApiErrorException)
|
|
231
|
+
.local_error_template('400',
|
|
232
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
233
|
+
APIException)
|
|
234
|
+
.local_error_template('403',
|
|
235
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
236
|
+
APIException)
|
|
237
|
+
.local_error_template('409',
|
|
238
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
239
|
+
APIException)
|
|
240
|
+
.local_error_template('429',
|
|
241
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
242
|
+
APIException)
|
|
243
|
+
.local_error_template('500',
|
|
244
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
245
|
+
APIException)
|
|
246
|
+
.local_error_template('503',
|
|
247
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
248
|
+
APIException)
|
|
249
|
+
.local_error_template('504',
|
|
250
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
251
|
+
APIException)
|
|
252
|
+
.local_error_template('default',
|
|
253
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
254
|
+
APIException))
|
|
255
|
+
.execute
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Updates the configuration, payment method, or schedule of a specific
|
|
259
|
+
# subscription.
|
|
260
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
261
|
+
# of the store.
|
|
262
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
263
|
+
# resource.
|
|
264
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
265
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
266
|
+
# recommend a randomly generated UUID (v4).
|
|
267
|
+
# @param [SubscriptionUpdateRequest] body Optional parameter: Properties to
|
|
268
|
+
# update on the subscription.
|
|
269
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
270
|
+
def update_subscription(store_id,
|
|
271
|
+
id,
|
|
272
|
+
idempotency_key: nil,
|
|
273
|
+
body: nil)
|
|
274
|
+
@api_call
|
|
275
|
+
.request(new_request_builder(HttpMethodEnum::PATCH,
|
|
276
|
+
'/stores/{storeId}/subscriptions/{id}',
|
|
277
|
+
Server::DEFAULT)
|
|
278
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
279
|
+
.is_required(true)
|
|
280
|
+
.should_encode(true))
|
|
281
|
+
.template_param(new_parameter(id, key: 'id')
|
|
282
|
+
.is_required(true)
|
|
283
|
+
.should_encode(true))
|
|
284
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
285
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
286
|
+
.body_param(new_parameter(body))
|
|
287
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
288
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
289
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
290
|
+
.response(new_response_handler
|
|
291
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
292
|
+
.deserialize_into(Subscription.method(:from_hash))
|
|
293
|
+
.is_api_response(true)
|
|
294
|
+
.local_error_template('400',
|
|
295
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
296
|
+
ApiErrorException)
|
|
297
|
+
.local_error_template('401',
|
|
298
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
299
|
+
ApiErrorException)
|
|
300
|
+
.local_error_template('404',
|
|
301
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
302
|
+
ApiErrorException)
|
|
303
|
+
.local_error_template('403',
|
|
304
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
305
|
+
APIException)
|
|
306
|
+
.local_error_template('409',
|
|
307
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
308
|
+
APIException)
|
|
309
|
+
.local_error_template('429',
|
|
310
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
311
|
+
APIException)
|
|
312
|
+
.local_error_template('500',
|
|
313
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
314
|
+
APIException)
|
|
315
|
+
.local_error_template('503',
|
|
316
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
317
|
+
APIException)
|
|
318
|
+
.local_error_template('504',
|
|
319
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
320
|
+
APIException)
|
|
321
|
+
.local_error_template('default',
|
|
322
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
323
|
+
APIException))
|
|
324
|
+
.execute
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
# Cancels an existing subscription. The subscription status will be
|
|
328
|
+
# permanently changed to `canceled` and it cannot be resumed. Please
|
|
329
|
+
# proceed with caution.
|
|
330
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
331
|
+
# of the store.
|
|
332
|
+
# @param [UUID | String] id Required parameter: The unique identifier of the
|
|
333
|
+
# resource.
|
|
334
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
335
|
+
def cancel_subscription(store_id,
|
|
336
|
+
id)
|
|
337
|
+
@api_call
|
|
338
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
339
|
+
'/stores/{storeId}/subscriptions/{id}',
|
|
340
|
+
Server::DEFAULT)
|
|
341
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
342
|
+
.is_required(true)
|
|
343
|
+
.should_encode(true))
|
|
344
|
+
.template_param(new_parameter(id, key: 'id')
|
|
345
|
+
.is_required(true)
|
|
346
|
+
.should_encode(true))
|
|
347
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
348
|
+
.response(new_response_handler
|
|
349
|
+
.is_response_void(true)
|
|
350
|
+
.is_api_response(true)
|
|
351
|
+
.local_error_template('400',
|
|
352
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
353
|
+
ApiErrorException)
|
|
354
|
+
.local_error_template('401',
|
|
355
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
356
|
+
ApiErrorException)
|
|
357
|
+
.local_error_template('403',
|
|
358
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
359
|
+
ApiErrorException)
|
|
360
|
+
.local_error_template('404',
|
|
361
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
362
|
+
ApiErrorException)
|
|
363
|
+
.local_error_template('429',
|
|
364
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
365
|
+
APIException)
|
|
366
|
+
.local_error_template('409',
|
|
367
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
368
|
+
APIException)
|
|
369
|
+
.local_error_template('500',
|
|
370
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
371
|
+
APIException)
|
|
372
|
+
.local_error_template('503',
|
|
373
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
374
|
+
APIException)
|
|
375
|
+
.local_error_template('504',
|
|
376
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
377
|
+
APIException)
|
|
378
|
+
.local_error_template('default',
|
|
379
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
380
|
+
APIException))
|
|
381
|
+
.execute
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
# Retrieves a list of all historical and scheduled payments for a specific
|
|
385
|
+
# subscription.
|
|
386
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
387
|
+
# of the store.
|
|
388
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
389
|
+
# identifier of the subscription.
|
|
390
|
+
# @param [Integer] limit Optional parameter: Maximum number of resources to
|
|
391
|
+
# return in one page.
|
|
392
|
+
# @param [UUID | String] cursor Optional parameter: Cursor pointing to the
|
|
393
|
+
# resource after which pagination should continue.
|
|
394
|
+
# @param [CursorDirectionQuery] cursor_direction Optional parameter:
|
|
395
|
+
# Pagination direction relative to the supplied cursor.
|
|
396
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
397
|
+
def list_subscription_payments(store_id,
|
|
398
|
+
subscription_id,
|
|
399
|
+
limit: 10,
|
|
400
|
+
cursor: nil,
|
|
401
|
+
cursor_direction: CursorDirectionQuery::DESC)
|
|
402
|
+
@api_call
|
|
403
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
404
|
+
'/stores/{storeId}/subscriptions/{subscriptionId}/payments',
|
|
405
|
+
Server::DEFAULT)
|
|
406
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
407
|
+
.is_required(true)
|
|
408
|
+
.should_encode(true))
|
|
409
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
410
|
+
.is_required(true)
|
|
411
|
+
.should_encode(true))
|
|
412
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
413
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
|
414
|
+
.query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
|
|
415
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
416
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
417
|
+
.response(new_response_handler
|
|
418
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
419
|
+
.deserialize_into(SubscriptionPaymentList.method(:from_hash))
|
|
420
|
+
.is_api_response(true)
|
|
421
|
+
.local_error_template('400',
|
|
422
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
423
|
+
ApiErrorException)
|
|
424
|
+
.local_error_template('401',
|
|
425
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
426
|
+
ApiErrorException)
|
|
427
|
+
.local_error_template('403',
|
|
428
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
429
|
+
ApiErrorException)
|
|
430
|
+
.local_error_template('404',
|
|
431
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
432
|
+
ApiErrorException)
|
|
433
|
+
.local_error_template('429',
|
|
434
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
435
|
+
APIException)
|
|
436
|
+
.local_error_template('409',
|
|
437
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
438
|
+
APIException)
|
|
439
|
+
.local_error_template('500',
|
|
440
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
441
|
+
APIException)
|
|
442
|
+
.local_error_template('503',
|
|
443
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
444
|
+
APIException)
|
|
445
|
+
.local_error_template('504',
|
|
446
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
447
|
+
APIException)
|
|
448
|
+
.local_error_template('default',
|
|
449
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
450
|
+
APIException))
|
|
451
|
+
.execute
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
# Retrieves the details of an individual payment associated with a specific
|
|
455
|
+
# subscription.
|
|
456
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
457
|
+
# of the store.
|
|
458
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
459
|
+
# identifier of the subscription.
|
|
460
|
+
# @param [UUID | String] payment_id Required parameter: The unique
|
|
461
|
+
# identifier of the scheduled payment of a subscription
|
|
462
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
463
|
+
def get_subscription_payment(store_id,
|
|
464
|
+
subscription_id,
|
|
465
|
+
payment_id)
|
|
466
|
+
@api_call
|
|
467
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
468
|
+
'/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}',
|
|
469
|
+
Server::DEFAULT)
|
|
470
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
471
|
+
.is_required(true)
|
|
472
|
+
.should_encode(true))
|
|
473
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
474
|
+
.is_required(true)
|
|
475
|
+
.should_encode(true))
|
|
476
|
+
.template_param(new_parameter(payment_id, key: 'paymentId')
|
|
477
|
+
.is_required(true)
|
|
478
|
+
.should_encode(true))
|
|
479
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
480
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
481
|
+
.response(new_response_handler
|
|
482
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
483
|
+
.deserialize_into(SubscriptionPayment.method(:from_hash))
|
|
484
|
+
.is_api_response(true)
|
|
485
|
+
.local_error_template('401',
|
|
486
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
487
|
+
ApiErrorException)
|
|
488
|
+
.local_error_template('404',
|
|
489
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
490
|
+
ApiErrorException)
|
|
491
|
+
.local_error_template('400',
|
|
492
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
493
|
+
APIException)
|
|
494
|
+
.local_error_template('403',
|
|
495
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
496
|
+
APIException)
|
|
497
|
+
.local_error_template('409',
|
|
498
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
499
|
+
APIException)
|
|
500
|
+
.local_error_template('429',
|
|
501
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
502
|
+
APIException)
|
|
503
|
+
.local_error_template('500',
|
|
504
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
505
|
+
APIException)
|
|
506
|
+
.local_error_template('503',
|
|
507
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
508
|
+
APIException)
|
|
509
|
+
.local_error_template('504',
|
|
510
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
511
|
+
APIException)
|
|
512
|
+
.local_error_template('default',
|
|
513
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
514
|
+
APIException))
|
|
515
|
+
.execute
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
# Updates properties of a specific scheduled payment for a subscription. Can
|
|
519
|
+
# be used to change the due date when permitted, mark the payment as paid,
|
|
520
|
+
# schedule a termination status, or set a retry interval.
|
|
521
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
522
|
+
# of the store.
|
|
523
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
524
|
+
# identifier of the subscription.
|
|
525
|
+
# @param [UUID | String] payment_id Required parameter: The unique
|
|
526
|
+
# identifier of the scheduled payment of a subscription
|
|
527
|
+
# @param [SubscriptionPatchPaymentRequest] body Required parameter: Request
|
|
528
|
+
# payload for updating a scheduled subscription payment.
|
|
529
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
530
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
531
|
+
# recommend a randomly generated UUID (v4).
|
|
532
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
533
|
+
def update_subscription_payment(store_id,
|
|
534
|
+
subscription_id,
|
|
535
|
+
payment_id,
|
|
536
|
+
body,
|
|
537
|
+
idempotency_key: nil)
|
|
538
|
+
@api_call
|
|
539
|
+
.request(new_request_builder(HttpMethodEnum::PATCH,
|
|
540
|
+
'/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}',
|
|
541
|
+
Server::DEFAULT)
|
|
542
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
543
|
+
.is_required(true)
|
|
544
|
+
.should_encode(true))
|
|
545
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
546
|
+
.is_required(true)
|
|
547
|
+
.should_encode(true))
|
|
548
|
+
.template_param(new_parameter(payment_id, key: 'paymentId')
|
|
549
|
+
.is_required(true)
|
|
550
|
+
.should_encode(true))
|
|
551
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
552
|
+
.body_param(new_parameter(body)
|
|
553
|
+
.is_required(true))
|
|
554
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
555
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
556
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
557
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
558
|
+
.response(new_response_handler
|
|
559
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
560
|
+
.deserialize_into(SubscriptionPayment.method(:from_hash))
|
|
561
|
+
.is_api_response(true)
|
|
562
|
+
.local_error_template('400',
|
|
563
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
564
|
+
ApiErrorException)
|
|
565
|
+
.local_error_template('401',
|
|
566
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
567
|
+
ApiErrorException)
|
|
568
|
+
.local_error_template('403',
|
|
569
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
570
|
+
ApiErrorException)
|
|
571
|
+
.local_error_template('404',
|
|
572
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
573
|
+
ApiErrorException)
|
|
574
|
+
.local_error_template('409',
|
|
575
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
576
|
+
APIException)
|
|
577
|
+
.local_error_template('429',
|
|
578
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
579
|
+
APIException)
|
|
580
|
+
.local_error_template('500',
|
|
581
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
582
|
+
APIException)
|
|
583
|
+
.local_error_template('503',
|
|
584
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
585
|
+
APIException)
|
|
586
|
+
.local_error_template('504',
|
|
587
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
588
|
+
APIException)
|
|
589
|
+
.local_error_template('default',
|
|
590
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
591
|
+
APIException))
|
|
592
|
+
.execute
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
# Retrieves the most recent charge created for a specific subscription.
|
|
596
|
+
# Returns 404 if no charges have been attempted yet.
|
|
597
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
598
|
+
# of the store.
|
|
599
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
600
|
+
# identifier of the subscription.
|
|
601
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
602
|
+
def get_subscription_latest_charge(store_id,
|
|
603
|
+
subscription_id)
|
|
604
|
+
@api_call
|
|
605
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
606
|
+
'/stores/{storeId}/subscriptions/{subscriptionId}/charges/latest',
|
|
607
|
+
Server::DEFAULT)
|
|
608
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
609
|
+
.is_required(true)
|
|
610
|
+
.should_encode(true))
|
|
611
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
612
|
+
.is_required(true)
|
|
613
|
+
.should_encode(true))
|
|
614
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
615
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
616
|
+
.response(new_response_handler
|
|
617
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
618
|
+
.deserialize_into(Charge.method(:from_hash))
|
|
619
|
+
.is_api_response(true)
|
|
620
|
+
.local_error_template('401',
|
|
621
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
622
|
+
ApiErrorException)
|
|
623
|
+
.local_error_template('404',
|
|
624
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
625
|
+
ApiErrorException)
|
|
626
|
+
.local_error_template('400',
|
|
627
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
628
|
+
APIException)
|
|
629
|
+
.local_error_template('403',
|
|
630
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
631
|
+
APIException)
|
|
632
|
+
.local_error_template('409',
|
|
633
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
634
|
+
APIException)
|
|
635
|
+
.local_error_template('429',
|
|
636
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
637
|
+
APIException)
|
|
638
|
+
.local_error_template('500',
|
|
639
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
640
|
+
APIException)
|
|
641
|
+
.local_error_template('503',
|
|
642
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
643
|
+
APIException)
|
|
644
|
+
.local_error_template('504',
|
|
645
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
646
|
+
APIException)
|
|
647
|
+
.local_error_template('default',
|
|
648
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
649
|
+
APIException))
|
|
650
|
+
.execute
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
# Retrieves a paginated list of charges linked to a subscription. Backend
|
|
654
|
+
# search uses the same charge search surface as normal charge listing and
|
|
655
|
+
# adds a subscription filter for the requested subscription.
|
|
656
|
+
# @param [UUID | String] merchant_id Required parameter: The unique
|
|
657
|
+
# identifier of the merchant.
|
|
658
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
659
|
+
# of the store.
|
|
660
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
661
|
+
# identifier of the subscription.
|
|
662
|
+
# @param [Integer] limit Optional parameter: Maximum number of resources to
|
|
663
|
+
# return in one page.
|
|
664
|
+
# @param [UUID | String] cursor Optional parameter: Cursor pointing to the
|
|
665
|
+
# resource after which pagination should continue.
|
|
666
|
+
# @param [CursorDirectionQuery] cursor_direction Optional parameter:
|
|
667
|
+
# Pagination direction relative to the supplied cursor.
|
|
668
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
669
|
+
def list_subscription_charges(merchant_id,
|
|
670
|
+
store_id,
|
|
671
|
+
subscription_id,
|
|
672
|
+
limit: 10,
|
|
673
|
+
cursor: nil,
|
|
674
|
+
cursor_direction: CursorDirectionQuery::DESC)
|
|
675
|
+
@api_call
|
|
676
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
677
|
+
'/merchants/{merchantId}/stores/{storeId}/subscriptions/{subscriptionId}/charges',
|
|
678
|
+
Server::DEFAULT)
|
|
679
|
+
.template_param(new_parameter(merchant_id, key: 'merchantId')
|
|
680
|
+
.is_required(true)
|
|
681
|
+
.should_encode(true))
|
|
682
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
683
|
+
.is_required(true)
|
|
684
|
+
.should_encode(true))
|
|
685
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
686
|
+
.is_required(true)
|
|
687
|
+
.should_encode(true))
|
|
688
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
689
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
|
690
|
+
.query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
|
|
691
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
692
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
693
|
+
.response(new_response_handler
|
|
694
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
695
|
+
.deserialize_into(ChargeList.method(:from_hash))
|
|
696
|
+
.is_api_response(true)
|
|
697
|
+
.local_error_template('400',
|
|
698
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
699
|
+
ApiErrorException)
|
|
700
|
+
.local_error_template('401',
|
|
701
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
702
|
+
ApiErrorException)
|
|
703
|
+
.local_error_template('403',
|
|
704
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
705
|
+
ApiErrorException)
|
|
706
|
+
.local_error_template('404',
|
|
707
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
708
|
+
ApiErrorException)
|
|
709
|
+
.local_error_template('409',
|
|
710
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
711
|
+
APIException)
|
|
712
|
+
.local_error_template('429',
|
|
713
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
714
|
+
APIException)
|
|
715
|
+
.local_error_template('500',
|
|
716
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
717
|
+
APIException)
|
|
718
|
+
.local_error_template('503',
|
|
719
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
720
|
+
APIException)
|
|
721
|
+
.local_error_template('504',
|
|
722
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
723
|
+
APIException)
|
|
724
|
+
.local_error_template('default',
|
|
725
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
726
|
+
APIException))
|
|
727
|
+
.execute
|
|
728
|
+
end
|
|
729
|
+
|
|
730
|
+
# Retrieves a paginated list of all charge attempts made for a specific
|
|
731
|
+
# scheduled payment of a subscription. Useful for inspecting retry history.
|
|
732
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
733
|
+
# of the store.
|
|
734
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
735
|
+
# identifier of the subscription.
|
|
736
|
+
# @param [UUID | String] payment_id Required parameter: The unique
|
|
737
|
+
# identifier of the scheduled payment of a subscription
|
|
738
|
+
# @param [Integer] limit Optional parameter: Maximum number of resources to
|
|
739
|
+
# return in one page.
|
|
740
|
+
# @param [UUID | String] cursor Optional parameter: Cursor pointing to the
|
|
741
|
+
# resource after which pagination should continue.
|
|
742
|
+
# @param [CursorDirectionQuery] cursor_direction Optional parameter:
|
|
743
|
+
# Pagination direction relative to the supplied cursor.
|
|
744
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
745
|
+
def list_charges_for_subscription_payment(store_id,
|
|
746
|
+
subscription_id,
|
|
747
|
+
payment_id,
|
|
748
|
+
limit: 10,
|
|
749
|
+
cursor: nil,
|
|
750
|
+
cursor_direction: CursorDirectionQuery::DESC)
|
|
751
|
+
@api_call
|
|
752
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
753
|
+
'/stores/{storeId}/subscriptions/{subscriptionId}/payments/{paymentId}/charges',
|
|
754
|
+
Server::DEFAULT)
|
|
755
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
756
|
+
.is_required(true)
|
|
757
|
+
.should_encode(true))
|
|
758
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
759
|
+
.is_required(true)
|
|
760
|
+
.should_encode(true))
|
|
761
|
+
.template_param(new_parameter(payment_id, key: 'paymentId')
|
|
762
|
+
.is_required(true)
|
|
763
|
+
.should_encode(true))
|
|
764
|
+
.query_param(new_parameter(limit, key: 'limit'))
|
|
765
|
+
.query_param(new_parameter(cursor, key: 'cursor'))
|
|
766
|
+
.query_param(new_parameter(cursor_direction, key: 'cursor_direction'))
|
|
767
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
768
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
769
|
+
.response(new_response_handler
|
|
770
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
771
|
+
.deserialize_into(ChargeList.method(:from_hash))
|
|
772
|
+
.is_api_response(true)
|
|
773
|
+
.local_error_template('401',
|
|
774
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
775
|
+
ApiErrorException)
|
|
776
|
+
.local_error_template('403',
|
|
777
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
778
|
+
ApiErrorException)
|
|
779
|
+
.local_error_template('404',
|
|
780
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
781
|
+
ApiErrorException)
|
|
782
|
+
.local_error_template('400',
|
|
783
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
784
|
+
APIException)
|
|
785
|
+
.local_error_template('409',
|
|
786
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
787
|
+
APIException)
|
|
788
|
+
.local_error_template('429',
|
|
789
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
790
|
+
APIException)
|
|
791
|
+
.local_error_template('500',
|
|
792
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
793
|
+
APIException)
|
|
794
|
+
.local_error_template('503',
|
|
795
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
796
|
+
APIException)
|
|
797
|
+
.local_error_template('504',
|
|
798
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
799
|
+
APIException)
|
|
800
|
+
.local_error_template('default',
|
|
801
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
802
|
+
APIException))
|
|
803
|
+
.execute
|
|
804
|
+
end
|
|
805
|
+
|
|
806
|
+
# Suspends a subscription that is currently `current` or `unpaid`. The
|
|
807
|
+
# `termination_mode` controls when the suspension takes effect: `immediate`
|
|
808
|
+
# (default) suspends right away, `on_next_payment` waits until the next
|
|
809
|
+
# scheduled payment date before suspending.
|
|
810
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
811
|
+
# of the store.
|
|
812
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
813
|
+
# identifier of the subscription.
|
|
814
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
815
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
816
|
+
# recommend a randomly generated UUID (v4).
|
|
817
|
+
# @param [SubscriptionSuspendRequest] body Optional parameter: Request
|
|
818
|
+
# payload for suspending a subscription.
|
|
819
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
820
|
+
def suspend_subscription(store_id,
|
|
821
|
+
subscription_id,
|
|
822
|
+
idempotency_key: nil,
|
|
823
|
+
body: nil)
|
|
824
|
+
@api_call
|
|
825
|
+
.request(new_request_builder(HttpMethodEnum::PATCH,
|
|
826
|
+
'/stores/{storeId}/subscriptions/{subscriptionId}/suspend',
|
|
827
|
+
Server::DEFAULT)
|
|
828
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
829
|
+
.is_required(true)
|
|
830
|
+
.should_encode(true))
|
|
831
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
832
|
+
.is_required(true)
|
|
833
|
+
.should_encode(true))
|
|
834
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
835
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
836
|
+
.body_param(new_parameter(body))
|
|
837
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
838
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
839
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
840
|
+
.response(new_response_handler
|
|
841
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
842
|
+
.deserialize_into(Subscription.method(:from_hash))
|
|
843
|
+
.is_api_response(true)
|
|
844
|
+
.local_error_template('400',
|
|
845
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
846
|
+
ApiErrorException)
|
|
847
|
+
.local_error_template('401',
|
|
848
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
849
|
+
ApiErrorException)
|
|
850
|
+
.local_error_template('403',
|
|
851
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
852
|
+
ApiErrorException)
|
|
853
|
+
.local_error_template('404',
|
|
854
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
855
|
+
ApiErrorException)
|
|
856
|
+
.local_error_template('429',
|
|
857
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
858
|
+
APIException)
|
|
859
|
+
.local_error_template('409',
|
|
860
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
861
|
+
APIException)
|
|
862
|
+
.local_error_template('500',
|
|
863
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
864
|
+
APIException)
|
|
865
|
+
.local_error_template('503',
|
|
866
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
867
|
+
APIException)
|
|
868
|
+
.local_error_template('504',
|
|
869
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
870
|
+
APIException)
|
|
871
|
+
.local_error_template('default',
|
|
872
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
873
|
+
APIException))
|
|
874
|
+
.execute
|
|
875
|
+
end
|
|
876
|
+
|
|
877
|
+
# Resumes a subscription that is currently `suspended`, setting its status
|
|
878
|
+
# back to `unpaid` and rescheduling the next payment. No request body is
|
|
879
|
+
# required.
|
|
880
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
881
|
+
# of the store.
|
|
882
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
883
|
+
# identifier of the subscription.
|
|
884
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
885
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
886
|
+
# recommend a randomly generated UUID (v4).
|
|
887
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
888
|
+
def unsuspend_subscription(store_id,
|
|
889
|
+
subscription_id,
|
|
890
|
+
idempotency_key: nil)
|
|
891
|
+
@api_call
|
|
892
|
+
.request(new_request_builder(HttpMethodEnum::PATCH,
|
|
893
|
+
'/stores/{storeId}/subscriptions/{subscriptionId}/unsuspend',
|
|
894
|
+
Server::DEFAULT)
|
|
895
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
896
|
+
.is_required(true)
|
|
897
|
+
.should_encode(true))
|
|
898
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
899
|
+
.is_required(true)
|
|
900
|
+
.should_encode(true))
|
|
901
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
902
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
903
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
904
|
+
.response(new_response_handler
|
|
905
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
906
|
+
.deserialize_into(Subscription.method(:from_hash))
|
|
907
|
+
.is_api_response(true)
|
|
908
|
+
.local_error_template('400',
|
|
909
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
910
|
+
ApiErrorException)
|
|
911
|
+
.local_error_template('401',
|
|
912
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
913
|
+
ApiErrorException)
|
|
914
|
+
.local_error_template('403',
|
|
915
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
916
|
+
ApiErrorException)
|
|
917
|
+
.local_error_template('404',
|
|
918
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
919
|
+
ApiErrorException)
|
|
920
|
+
.local_error_template('429',
|
|
921
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
922
|
+
APIException)
|
|
923
|
+
.local_error_template('409',
|
|
924
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
925
|
+
APIException)
|
|
926
|
+
.local_error_template('500',
|
|
927
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
928
|
+
APIException)
|
|
929
|
+
.local_error_template('503',
|
|
930
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
931
|
+
APIException)
|
|
932
|
+
.local_error_template('504',
|
|
933
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
934
|
+
APIException)
|
|
935
|
+
.local_error_template('default',
|
|
936
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
937
|
+
APIException))
|
|
938
|
+
.execute
|
|
939
|
+
end
|
|
940
|
+
|
|
941
|
+
# Replaces the payment method (transaction token) used for a subscription.
|
|
942
|
+
# Useful when a card expires or a customer wants to switch payment methods.
|
|
943
|
+
# The new token must belong to the same store, be active, and match the
|
|
944
|
+
# subscription's processing mode (live/test). One-time tokens are not
|
|
945
|
+
# accepted; use a recurring or subscription token.
|
|
946
|
+
# @param [UUID | String] store_id Required parameter: The unique identifier
|
|
947
|
+
# of the store.
|
|
948
|
+
# @param [UUID | String] subscription_id Required parameter: The unique
|
|
949
|
+
# identifier of the subscription.
|
|
950
|
+
# @param [SubscriptionPatchTokenRequest] body Required parameter: Request
|
|
951
|
+
# payload for replacing a subscription payment token.
|
|
952
|
+
# @param [String] idempotency_key Optional parameter: An optional
|
|
953
|
+
# idempotency key to prevent double charges and duplicate operations. We
|
|
954
|
+
# recommend a randomly generated UUID (v4).
|
|
955
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
956
|
+
def update_subscription_token(store_id,
|
|
957
|
+
subscription_id,
|
|
958
|
+
body,
|
|
959
|
+
idempotency_key: nil)
|
|
960
|
+
@api_call
|
|
961
|
+
.request(new_request_builder(HttpMethodEnum::PATCH,
|
|
962
|
+
'/stores/{storeId}/subscriptions/{subscriptionId}/token',
|
|
963
|
+
Server::DEFAULT)
|
|
964
|
+
.template_param(new_parameter(store_id, key: 'storeId')
|
|
965
|
+
.is_required(true)
|
|
966
|
+
.should_encode(true))
|
|
967
|
+
.template_param(new_parameter(subscription_id, key: 'subscriptionId')
|
|
968
|
+
.is_required(true)
|
|
969
|
+
.should_encode(true))
|
|
970
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
971
|
+
.body_param(new_parameter(body)
|
|
972
|
+
.is_required(true))
|
|
973
|
+
.header_param(new_parameter(idempotency_key, key: 'Idempotency-Key'))
|
|
974
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
975
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
976
|
+
.auth(Single.new('JWT_TOKEN')))
|
|
977
|
+
.response(new_response_handler
|
|
978
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
979
|
+
.deserialize_into(Subscription.method(:from_hash))
|
|
980
|
+
.is_api_response(true)
|
|
981
|
+
.local_error_template('400',
|
|
982
|
+
'HTTP 400 Bad Request: {$response.body#/code}',
|
|
983
|
+
ApiErrorException)
|
|
984
|
+
.local_error_template('401',
|
|
985
|
+
'HTTP 401 Unauthorized: {$response.body#/code}',
|
|
986
|
+
ApiErrorException)
|
|
987
|
+
.local_error_template('403',
|
|
988
|
+
'HTTP 403 Forbidden: {$response.body#/code}',
|
|
989
|
+
ApiErrorException)
|
|
990
|
+
.local_error_template('404',
|
|
991
|
+
'HTTP 404 Not Found: {$response.body#/code}',
|
|
992
|
+
ApiErrorException)
|
|
993
|
+
.local_error_template('429',
|
|
994
|
+
'HTTP 429 Rate Limited: {$response.body#/code}',
|
|
995
|
+
APIException)
|
|
996
|
+
.local_error_template('409',
|
|
997
|
+
'HTTP 409 Conflict: {$response.body#/code}',
|
|
998
|
+
APIException)
|
|
999
|
+
.local_error_template('500',
|
|
1000
|
+
'HTTP 500 Server Error: {$response.body#/code}',
|
|
1001
|
+
APIException)
|
|
1002
|
+
.local_error_template('503',
|
|
1003
|
+
'HTTP 503 Unavailable: {$response.body#/code}',
|
|
1004
|
+
APIException)
|
|
1005
|
+
.local_error_template('504',
|
|
1006
|
+
'HTTP 504 Timeout: {$response.body#/code}',
|
|
1007
|
+
APIException)
|
|
1008
|
+
.local_error_template('default',
|
|
1009
|
+
'HTTP {$statusCode}: {$response.body#/code}',
|
|
1010
|
+
APIException))
|
|
1011
|
+
.execute
|
|
1012
|
+
end
|
|
1013
|
+
end
|
|
1014
|
+
end
|