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,162 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'api_test_base'
|
|
7
|
+
|
|
8
|
+
class CancelsApiTest < ApiTestBase
|
|
9
|
+
# Called only once for the class before any test has executed
|
|
10
|
+
def setup
|
|
11
|
+
setup_class
|
|
12
|
+
@controller = @client.cancels
|
|
13
|
+
@response_catcher = @controller.http_call_back
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Returns a paginated list of cancels for the specified charge.
|
|
17
|
+
def test_list_cancels
|
|
18
|
+
# Parameters for the API call
|
|
19
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
20
|
+
charge_id = '6efb4e5c-690a-40f3-a4f1-0e19c5f84e98'
|
|
21
|
+
limit = 10
|
|
22
|
+
cursor = '3541d4fa-596d-428e-8a36-f274e1b3d505'
|
|
23
|
+
cursor_direction = 'desc'
|
|
24
|
+
|
|
25
|
+
# Perform the API call through the SDK function
|
|
26
|
+
result = @controller.list_cancels(store_id, charge_id, limit: limit,
|
|
27
|
+
cursor: cursor,
|
|
28
|
+
cursor_direction: cursor_direction)
|
|
29
|
+
|
|
30
|
+
# Test response code
|
|
31
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
32
|
+
# Test headers
|
|
33
|
+
expected_headers = {}
|
|
34
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
35
|
+
|
|
36
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
37
|
+
|
|
38
|
+
# Test whether the captured response is as we expected
|
|
39
|
+
refute_nil(result)
|
|
40
|
+
expected_body = JSON.parse(
|
|
41
|
+
'{"items":[{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","charge_id":"6ef'\
|
|
42
|
+
'b4e5c-690a-40f3-a4f1-0e19c5f84e98","store_id":"76cf4a64-02bc-4cb3-9a28-'\
|
|
43
|
+
'74622e5928a1","status":"successful","error":{},"metadata":{"order_id":"'\
|
|
44
|
+
'ORD-987"},"mode":"live","created_on":"2026-04-09T07:35:50.000000Z","upd'\
|
|
45
|
+
'ated_on":"2026-04-09T07:36:00.000000Z"},{"id":"b2c3d4e5-f6a7-8901-bcde-'\
|
|
46
|
+
'f23456789012","charge_id":"7fac5f6d-7a1b-51e4-b5f2-1f2ad6f95fa9","store'\
|
|
47
|
+
'_id":"76cf4a64-02bc-4cb3-9a28-74622e5928a1","status":"successful","erro'\
|
|
48
|
+
'r":{},"metadata":{"order_id":"ORD-988"},"mode":"live","created_on":"202'\
|
|
49
|
+
'6-04-10T10:00:00.000000Z","updated_on":"2026-04-10T10:00:12.000000Z"},{'\
|
|
50
|
+
'"id":"c3d4e5f6-a7b8-9012-cdef-345678901234","charge_id":"80bd6a7e-8b2c-'\
|
|
51
|
+
'62f5-c6a3-2a3be7a06aba","store_id":"76cf4a64-02bc-4cb3-9a28-74622e5928a'\
|
|
52
|
+
'1","status":"pending","error":{},"metadata":{},"mode":"live","created_o'\
|
|
53
|
+
'n":"2026-04-11T14:22:08.000000Z","updated_on":"2026-04-11T14:22:08.0000'\
|
|
54
|
+
'00Z"}],"has_more":false}'
|
|
55
|
+
)
|
|
56
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
57
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Creates a new cancellation request for a charge. The charge must be in a cancellable state. Bank transfer and konbini charges that have already been paid cannot be cancelled
|
|
61
|
+
def test_create_cancel
|
|
62
|
+
# Parameters for the API call
|
|
63
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
64
|
+
charge_id = '6efb4e5c-690a-40f3-a4f1-0e19c5f84e98'
|
|
65
|
+
idempotency_key = 'f64be872-353d-4c3c-84cb-3dc617fe89f7'
|
|
66
|
+
body = CancelCreateRequest.from_hash(APIHelper.json_deserialize(
|
|
67
|
+
'{"metadata":{"order_id":"ORD-987"}}', false))
|
|
68
|
+
|
|
69
|
+
# Perform the API call through the SDK function
|
|
70
|
+
result = @controller.create_cancel(store_id, charge_id,
|
|
71
|
+
idempotency_key: idempotency_key,
|
|
72
|
+
body: body)
|
|
73
|
+
|
|
74
|
+
# Test response code
|
|
75
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
76
|
+
# Test headers
|
|
77
|
+
expected_headers = {}
|
|
78
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
79
|
+
|
|
80
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
81
|
+
|
|
82
|
+
# Test whether the captured response is as we expected
|
|
83
|
+
refute_nil(result)
|
|
84
|
+
expected_body = JSON.parse(
|
|
85
|
+
'{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","charge_id":"6efb4e5c-690a'\
|
|
86
|
+
'-40f3-a4f1-0e19c5f84e98","store_id":"76cf4a64-02bc-4cb3-9a28-74622e5928'\
|
|
87
|
+
'a1","status":"pending","error":null,"metadata":{},"mode":"live","create'\
|
|
88
|
+
'd_on":"2026-04-09T07:35:50.000000Z","updated_on":"2026-04-09T07:35:50.0'\
|
|
89
|
+
'00000Z"}'
|
|
90
|
+
)
|
|
91
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
92
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Retrieves a specific cancel by ID. Supports long-polling by appending `?polling=true` to wait for a status change (up to the server timeout). Requires a secret-bearing token.
|
|
96
|
+
def test_get_cancel
|
|
97
|
+
# Parameters for the API call
|
|
98
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
99
|
+
charge_id = '6efb4e5c-690a-40f3-a4f1-0e19c5f84e98'
|
|
100
|
+
id = 'c4e87129-cad4-47fb-8ded-b4c0a4ae0dd4'
|
|
101
|
+
polling = false
|
|
102
|
+
|
|
103
|
+
# Perform the API call through the SDK function
|
|
104
|
+
result = @controller.get_cancel(store_id, charge_id, id, polling: polling)
|
|
105
|
+
|
|
106
|
+
# Test response code
|
|
107
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
108
|
+
# Test headers
|
|
109
|
+
expected_headers = {}
|
|
110
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
111
|
+
|
|
112
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
113
|
+
|
|
114
|
+
# Test whether the captured response is as we expected
|
|
115
|
+
refute_nil(result)
|
|
116
|
+
expected_body = JSON.parse(
|
|
117
|
+
'{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","charge_id":"6efb4e5c-690a'\
|
|
118
|
+
'-40f3-a4f1-0e19c5f84e98","store_id":"76cf4a64-02bc-4cb3-9a28-74622e5928'\
|
|
119
|
+
'a1","status":"successful","error":null,"metadata":{},"mode":"live","cre'\
|
|
120
|
+
'ated_on":"2026-04-09T07:35:50.000000Z","updated_on":"2026-04-09T07:36:0'\
|
|
121
|
+
'0.000000Z"}'
|
|
122
|
+
)
|
|
123
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
124
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Updates metadata on an existing cancel. Requires a secret-bearing token.
|
|
128
|
+
def test_update_cancel
|
|
129
|
+
# Parameters for the API call
|
|
130
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
131
|
+
charge_id = '6efb4e5c-690a-40f3-a4f1-0e19c5f84e98'
|
|
132
|
+
id = 'c4e87129-cad4-47fb-8ded-b4c0a4ae0dd4'
|
|
133
|
+
body = CancelUpdateRequest.from_hash(APIHelper.json_deserialize(
|
|
134
|
+
'{"metadata":{"order_id":"12345"}}', false))
|
|
135
|
+
idempotency_key = 'f64be872-353d-4c3c-84cb-3dc617fe89f7'
|
|
136
|
+
|
|
137
|
+
# Perform the API call through the SDK function
|
|
138
|
+
result = @controller.update_cancel(store_id, charge_id, id, body,
|
|
139
|
+
idempotency_key: idempotency_key)
|
|
140
|
+
|
|
141
|
+
# Test response code
|
|
142
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
143
|
+
# Test headers
|
|
144
|
+
expected_headers = {}
|
|
145
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
146
|
+
|
|
147
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
148
|
+
|
|
149
|
+
# Test whether the captured response is as we expected
|
|
150
|
+
refute_nil(result)
|
|
151
|
+
expected_body = JSON.parse(
|
|
152
|
+
'{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","charge_id":"6efb4e5c-690a'\
|
|
153
|
+
'-40f3-a4f1-0e19c5f84e98","store_id":"76cf4a64-02bc-4cb3-9a28-74622e5928'\
|
|
154
|
+
'a1","status":"successful","error":null,"metadata":{"order_id":"12345"},'\
|
|
155
|
+
'"mode":"live","created_on":"2026-04-09T07:35:50.000000Z","updated_on":"'\
|
|
156
|
+
'2026-04-09T08:00:00.000000Z"}'
|
|
157
|
+
)
|
|
158
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
159
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
end
|