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,564 @@
|
|
|
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 ChargesApiTest < ApiTestBase
|
|
9
|
+
# Called only once for the class before any test has executed
|
|
10
|
+
def setup
|
|
11
|
+
setup_class
|
|
12
|
+
@controller = @client.charges
|
|
13
|
+
@response_catcher = @controller.http_call_back
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Creates a charge on a payment instrument (e.g. transaction token).
|
|
17
|
+
def test_create_charge
|
|
18
|
+
# Parameters for the API call
|
|
19
|
+
idempotency_key = 'f64be872-353d-4c3c-84cb-3dc617fe89f7'
|
|
20
|
+
body = ChargeCreateRequest.from_hash(APIHelper.json_deserialize(
|
|
21
|
+
'{"transaction_token_id":"11ef32a7-3a71-8662-803f-1bc27702eeec","amount"'\
|
|
22
|
+
':1000,"currency":"JPY","metadata":{"order_id":"12345"},"redirect":{"end'\
|
|
23
|
+
'point":"https://test.url/"}}', false))
|
|
24
|
+
|
|
25
|
+
# Perform the API call through the SDK function
|
|
26
|
+
result = @controller.create_charge(idempotency_key: idempotency_key,
|
|
27
|
+
body: body)
|
|
28
|
+
|
|
29
|
+
# Test response code
|
|
30
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
31
|
+
# Test headers
|
|
32
|
+
expected_headers = {}
|
|
33
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
34
|
+
|
|
35
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
36
|
+
|
|
37
|
+
# Test whether the captured response is as we expected
|
|
38
|
+
refute_nil(result)
|
|
39
|
+
expected_body = JSON.parse(
|
|
40
|
+
'{"id":"11ef32c2-4010-a312-aaff-4b63e4d5f92d","store_id":"11edf541-c42d-'\
|
|
41
|
+
'653c-8c3d-dfe0a55f95c0","transaction_token_id":"11ef32a7-3a71-8662-803f'\
|
|
42
|
+
'-1bc27702eeec","transaction_token_type":"recurring","subscription_id":n'\
|
|
43
|
+
'ull,"merchant_transaction_id":null,"requested_amount":1000,"requested_c'\
|
|
44
|
+
'urrency":"JPY","requested_amount_formatted":1000,"charged_amount":null,'\
|
|
45
|
+
'"charged_currency":null,"charged_amount_formatted":null,"fee_amount":nu'\
|
|
46
|
+
'll,"fee_currency":null,"fee_amount_formatted":null,"only_direct_currenc'\
|
|
47
|
+
'y":false,"capture_at":null,"descriptor":null,"descriptor_phone_number":'\
|
|
48
|
+
'null,"status":"pending","error":null,"metadata":{"order_id":"12345"},"m'\
|
|
49
|
+
'ode":"test","created_on":"2024-06-25T07:12:15.16452Z","redirect":{"endp'\
|
|
50
|
+
'oint":"https://test.url/","redirect_id":"11ef32c2-40cf-f772-8325-1798ab'\
|
|
51
|
+
'b1110d"}}'
|
|
52
|
+
)
|
|
53
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
54
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Lists all charges across all stores for the authenticated user.
|
|
58
|
+
def test_list_all_charges
|
|
59
|
+
# Parameters for the API call
|
|
60
|
+
limit = 10
|
|
61
|
+
cursor = '3541d4fa-596d-428e-8a36-f274e1b3d505'
|
|
62
|
+
cursor_direction = 'desc'
|
|
63
|
+
last_four = '4242'
|
|
64
|
+
name = 'TARO YAMADA'
|
|
65
|
+
exp_month = 12
|
|
66
|
+
exp_year = 2026
|
|
67
|
+
from = '2026-04-01T00:00:00Z'
|
|
68
|
+
to = '2026-04-30T23:59:59.999Z'
|
|
69
|
+
email = 'user@example.com'
|
|
70
|
+
phone = '+8108012341234'
|
|
71
|
+
amount_from = 1000
|
|
72
|
+
amount_to = 5000
|
|
73
|
+
currency = 'JPY'
|
|
74
|
+
mode = 'live'
|
|
75
|
+
metadata = 'order_id: 12345'
|
|
76
|
+
transaction_token_id = 'f33b673e-564c-4645-ae17-ca03846a86b7'
|
|
77
|
+
|
|
78
|
+
# Perform the API call through the SDK function
|
|
79
|
+
result = @controller.list_all_charges(
|
|
80
|
+
limit: limit, cursor: cursor, cursor_direction: cursor_direction,
|
|
81
|
+
last_four: last_four, name: name, exp_month: exp_month,
|
|
82
|
+
exp_year: exp_year, from: from, to: to, email: email, phone: phone,
|
|
83
|
+
amount_from: amount_from, amount_to: amount_to, currency: currency,
|
|
84
|
+
mode: mode, metadata: metadata,
|
|
85
|
+
transaction_token_id: transaction_token_id
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# Test response code
|
|
89
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
90
|
+
# Test headers
|
|
91
|
+
expected_headers = {}
|
|
92
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
93
|
+
|
|
94
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
95
|
+
|
|
96
|
+
# Test whether the captured response is as we expected
|
|
97
|
+
refute_nil(result)
|
|
98
|
+
expected_body = JSON.parse(
|
|
99
|
+
'{"items":[{"id":"11ef3500-1a2b-4c3d-8e4f-a1b2c3d4e5f0","store_id":"11ed'\
|
|
100
|
+
'f541-c42d-653c-8c3d-dfe0a55f95c0","transaction_token_id":"11ef3501-2b3c'\
|
|
101
|
+
'-4d5e-9f60-b2c3d4e5f011","transaction_token_type":"one_time","subscript'\
|
|
102
|
+
'ion_id":null,"merchant_transaction_id":null,"requested_amount":1000,"re'\
|
|
103
|
+
'quested_currency":"JPY","requested_amount_formatted":1000,"charged_amou'\
|
|
104
|
+
'nt":1000,"charged_currency":"JPY","charged_amount_formatted":1000,"fee_'\
|
|
105
|
+
'amount":null,"fee_currency":null,"fee_amount_formatted":null,"only_dire'\
|
|
106
|
+
'ct_currency":false,"capture_at":null,"descriptor":null,"descriptor_phon'\
|
|
107
|
+
'e_number":null,"status":"successful","error":{},"metadata":{"order_id":'\
|
|
108
|
+
'"ORD-2001"},"mode":"live","created_on":"2026-04-09T07:35:50.000000Z","r'\
|
|
109
|
+
'edirect":{},"merchant_name":"管理画面ガイド","store_name":"管理画面ガイド_TEST店舗"},{"'\
|
|
110
|
+
'id":"11ef3502-3c4d-5e6f-a071-c3d4e5f01122","store_id":"22af6520-d53e-76'\
|
|
111
|
+
'4d-9d4e-ef01b66fa6d1","transaction_token_id":"11ef3503-4d5e-6f70-b182-d'\
|
|
112
|
+
'4e5f0112233","transaction_token_type":"recurring","subscription_id":nul'\
|
|
113
|
+
'l,"merchant_transaction_id":null,"requested_amount":1250,"requested_cur'\
|
|
114
|
+
'rency":"USD","requested_amount_formatted":12.5,"charged_amount":1250,"c'\
|
|
115
|
+
'harged_currency":"USD","charged_amount_formatted":12.5,"fee_amount":nul'\
|
|
116
|
+
'l,"fee_currency":null,"fee_amount_formatted":null,"only_direct_currency'\
|
|
117
|
+
'":false,"capture_at":null,"descriptor":null,"descriptor_phone_number":n'\
|
|
118
|
+
'ull,"status":"successful","error":{},"metadata":{"order_id":"ORD-2002"}'\
|
|
119
|
+
',"mode":"live","created_on":"2026-04-10T10:20:11.000000Z","redirect":{}'\
|
|
120
|
+
',"merchant_name":"管理画面ガイド","store_name":"管理画面ガイド_Online店舗"},{"id":"11ef'\
|
|
121
|
+
'3504-5e6f-7081-c293-e5f001223344","store_id":"33af7631-e64f-875e-ae5f-f'\
|
|
122
|
+
'012c77fb7e2","transaction_token_id":"11ef3505-6f70-8192-d3a4-f001122334'\
|
|
123
|
+
'55","transaction_token_type":"one_time","subscription_id":null,"merchan'\
|
|
124
|
+
't_transaction_id":null,"requested_amount":5000,"requested_currency":"JP'\
|
|
125
|
+
'Y","requested_amount_formatted":5000,"charged_amount":5000,"charged_cur'\
|
|
126
|
+
'rency":"JPY","charged_amount_formatted":5000,"fee_amount":null,"fee_cur'\
|
|
127
|
+
'rency":null,"fee_amount_formatted":null,"only_direct_currency":false,"c'\
|
|
128
|
+
'apture_at":null,"descriptor":null,"descriptor_phone_number":null,"statu'\
|
|
129
|
+
's":"successful","error":{},"metadata":{"order_id":"ORD-2003"},"mode":"l'\
|
|
130
|
+
'ive","created_on":"2026-04-11T14:22:08.000000Z","redirect":{},"merchant'\
|
|
131
|
+
'_name":"管理画面ガイド","store_name":"管理画面ガイド_Osaka店舗"}],"has_more":false,"tot'\
|
|
132
|
+
'al_hits":3}'
|
|
133
|
+
)
|
|
134
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
135
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Lists all charges for a specific store.
|
|
139
|
+
def test_list_store_charges
|
|
140
|
+
# Parameters for the API call
|
|
141
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
142
|
+
limit = 10
|
|
143
|
+
cursor = '3541d4fa-596d-428e-8a36-f274e1b3d505'
|
|
144
|
+
cursor_direction = 'desc'
|
|
145
|
+
last_four = '4242'
|
|
146
|
+
name = 'TARO YAMADA'
|
|
147
|
+
exp_month = 12
|
|
148
|
+
exp_year = 2026
|
|
149
|
+
from = '2026-04-01T00:00:00Z'
|
|
150
|
+
to = '2026-04-30T23:59:59.999Z'
|
|
151
|
+
email = 'user@example.com'
|
|
152
|
+
phone = '+8108012341234'
|
|
153
|
+
amount_from = 1000
|
|
154
|
+
amount_to = 5000
|
|
155
|
+
currency = 'JPY'
|
|
156
|
+
mode = 'live'
|
|
157
|
+
metadata = 'order_id: 12345'
|
|
158
|
+
transaction_token_id = 'f33b673e-564c-4645-ae17-ca03846a86b7'
|
|
159
|
+
|
|
160
|
+
# Perform the API call through the SDK function
|
|
161
|
+
result = @controller.list_store_charges(
|
|
162
|
+
store_id, limit: limit, cursor: cursor,
|
|
163
|
+
cursor_direction: cursor_direction, last_four: last_four, name: name,
|
|
164
|
+
exp_month: exp_month, exp_year: exp_year, from: from, to: to,
|
|
165
|
+
email: email, phone: phone, amount_from: amount_from,
|
|
166
|
+
amount_to: amount_to, currency: currency, mode: mode, metadata: metadata,
|
|
167
|
+
transaction_token_id: transaction_token_id
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
# Test response code
|
|
171
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
172
|
+
# Test headers
|
|
173
|
+
expected_headers = {}
|
|
174
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
175
|
+
|
|
176
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
177
|
+
|
|
178
|
+
# Test whether the captured response is as we expected
|
|
179
|
+
refute_nil(result)
|
|
180
|
+
expected_body = JSON.parse(
|
|
181
|
+
'{"items":[{"id":"11ef32c4-9ea8-169c-a6c8-bfc29867a226","store_id":"11ed'\
|
|
182
|
+
'f541-c42d-653c-8c3d-dfe0a55f95c0","transaction_token_id":"11ef32c4-9e89'\
|
|
183
|
+
'-0cac-bd63-17b9a26af61b","transaction_token_type":"one_time","subscript'\
|
|
184
|
+
'ion_id":null,"merchant_transaction_id":null,"requested_amount":1000,"re'\
|
|
185
|
+
'quested_currency":"JPY","requested_amount_formatted":1000,"charged_amou'\
|
|
186
|
+
'nt":1000,"charged_currency":"JPY","charged_amount_formatted":1000,"fee_'\
|
|
187
|
+
'amount":null,"fee_currency":null,"fee_amount_formatted":null,"only_dire'\
|
|
188
|
+
'ct_currency":false,"capture_at":null,"descriptor":null,"descriptor_phon'\
|
|
189
|
+
'e_number":null,"status":"successful","error":{},"metadata":{"univapay-n'\
|
|
190
|
+
'ame":"taro yamada","univapay-phone-number":"8029854583"},"mode":"test",'\
|
|
191
|
+
'"created_on":"2024-06-25T07:29:12.854865Z","redirect":{},"merchant_name'\
|
|
192
|
+
'":"管理画面ガイド","store_name":"管理画面ガイド_TEST店舗"},{"id":"11ef32c3-3cfe-3bc0-ab'\
|
|
193
|
+
'ed-0bb96f792078","store_id":"11edf541-c42d-653c-8c3d-dfe0a55f95c0","tra'\
|
|
194
|
+
'nsaction_token_id":"11ef32c3-3cdd-df92-9dce-c346b9fdf088","transaction_'\
|
|
195
|
+
'token_type":"one_time","subscription_id":null,"merchant_transaction_id"'\
|
|
196
|
+
':null,"requested_amount":1000,"requested_currency":"JPY","requested_amo'\
|
|
197
|
+
'unt_formatted":1000,"charged_amount":1000,"charged_currency":"JPY","cha'\
|
|
198
|
+
'rged_amount_formatted":1000,"fee_amount":null,"fee_currency":null,"fee_'\
|
|
199
|
+
'amount_formatted":null,"only_direct_currency":false,"capture_at":null,"'\
|
|
200
|
+
'descriptor":null,"descriptor_phone_number":null,"status":"successful","'\
|
|
201
|
+
'error":{},"metadata":{"order_id":"12345"},"mode":"test","created_on":"2'\
|
|
202
|
+
'024-06-25T07:19:19.507637Z","redirect":{},"merchant_name":"管理画面ガイド","st'\
|
|
203
|
+
'ore_name":"管理画面ガイド_TEST店舗"}],"has_more":false,"total_hits":2}'
|
|
204
|
+
)
|
|
205
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
206
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Retrieves the details of an existing charge.
|
|
210
|
+
def test_get_charge
|
|
211
|
+
# Parameters for the API call
|
|
212
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
213
|
+
id = 'c4e87129-cad4-47fb-8ded-b4c0a4ae0dd4'
|
|
214
|
+
polling = true
|
|
215
|
+
|
|
216
|
+
# Perform the API call through the SDK function
|
|
217
|
+
result = @controller.get_charge(store_id, id, polling: polling)
|
|
218
|
+
|
|
219
|
+
# Test response code
|
|
220
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
221
|
+
# Test headers
|
|
222
|
+
expected_headers = {}
|
|
223
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
224
|
+
|
|
225
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
226
|
+
|
|
227
|
+
# Test whether the captured response is as we expected
|
|
228
|
+
refute_nil(result)
|
|
229
|
+
expected_body = JSON.parse(
|
|
230
|
+
'{"id":"11ef32c2-4010-a312-aaff-4b63e4d5f92d","store_id":"11edf541-c42d-'\
|
|
231
|
+
'653c-8c3d-dfe0a55f95c0","transaction_token_id":"11ef32a7-3a71-8662-803f'\
|
|
232
|
+
'-1bc27702eeec","transaction_token_type":"recurring","subscription_id":n'\
|
|
233
|
+
'ull,"merchant_transaction_id":null,"requested_amount":1000,"requested_c'\
|
|
234
|
+
'urrency":"JPY","requested_amount_formatted":1000,"charged_amount":1000,'\
|
|
235
|
+
'"charged_currency":"JPY","charged_amount_formatted":1000,"fee_amount":n'\
|
|
236
|
+
'ull,"fee_currency":null,"fee_amount_formatted":null,"only_direct_curren'\
|
|
237
|
+
'cy":false,"capture_at":null,"descriptor":null,"descriptor_phone_number"'\
|
|
238
|
+
':null,"status":"successful","error":null,"metadata":{"order_id":"12345"'\
|
|
239
|
+
'},"mode":"test","created_on":"2024-06-25T07:12:15.16452Z","redirect":{"'\
|
|
240
|
+
'endpoint":"https://test.url/","redirect_id":"11ef32c2-40cf-f772-8325-17'\
|
|
241
|
+
'98abb1110d"}}'
|
|
242
|
+
)
|
|
243
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
244
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Use this request to add or modify arbitrary metadata on an existing charge.
|
|
248
|
+
def test_update_charge
|
|
249
|
+
# Parameters for the API call
|
|
250
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
251
|
+
id = 'c4e87129-cad4-47fb-8ded-b4c0a4ae0dd4'
|
|
252
|
+
idempotency_key = 'f64be872-353d-4c3c-84cb-3dc617fe89f7'
|
|
253
|
+
body = ChargeUpdateRequest.from_hash(APIHelper.json_deserialize(
|
|
254
|
+
'{"metadata":{"order_id":"1234"}}', false))
|
|
255
|
+
|
|
256
|
+
# Perform the API call through the SDK function
|
|
257
|
+
result = @controller.update_charge(store_id, id,
|
|
258
|
+
idempotency_key: idempotency_key,
|
|
259
|
+
body: body)
|
|
260
|
+
|
|
261
|
+
# Test response code
|
|
262
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
263
|
+
# Test headers
|
|
264
|
+
expected_headers = {}
|
|
265
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
266
|
+
|
|
267
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
268
|
+
|
|
269
|
+
# Test whether the captured response is as we expected
|
|
270
|
+
refute_nil(result)
|
|
271
|
+
expected_body = JSON.parse(
|
|
272
|
+
'{"id":"11ef32c2-4010-a312-aaff-4b63e4d5f92d","store_id":"11edf541-c42d-'\
|
|
273
|
+
'653c-8c3d-dfe0a55f95c0","transaction_token_id":"11ef32a7-3a71-8662-803f'\
|
|
274
|
+
'-1bc27702eeec","transaction_token_type":"recurring","subscription_id":n'\
|
|
275
|
+
'ull,"merchant_transaction_id":null,"requested_amount":1000,"requested_c'\
|
|
276
|
+
'urrency":"JPY","requested_amount_formatted":1000,"charged_amount":1000,'\
|
|
277
|
+
'"charged_currency":"JPY","charged_amount_formatted":1000,"fee_amount":n'\
|
|
278
|
+
'ull,"fee_currency":null,"fee_amount_formatted":null,"only_direct_curren'\
|
|
279
|
+
'cy":false,"capture_at":null,"descriptor":null,"descriptor_phone_number"'\
|
|
280
|
+
':null,"status":"successful","error":null,"metadata":{"order_id":"1234"}'\
|
|
281
|
+
',"mode":"test","created_on":"2024-06-25T07:12:15.16452Z","redirect":{"e'\
|
|
282
|
+
'ndpoint":"https://test.url/","redirect_id":"11ef32c2-40cf-f772-8325-179'\
|
|
283
|
+
'8abb1110d"}}'
|
|
284
|
+
)
|
|
285
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
286
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
# Captures a previously authorized charge (where `capture` was set to false during creation). The capture amount must be less than or equal to the authorized amount, and the currency must match.
|
|
290
|
+
def test_capture_charge
|
|
291
|
+
# Parameters for the API call
|
|
292
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
293
|
+
id = 'c4e87129-cad4-47fb-8ded-b4c0a4ae0dd4'
|
|
294
|
+
body = ChargeCaptureRequest.from_hash(APIHelper.json_deserialize(
|
|
295
|
+
'{"amount":1000,"currency":"JPY"}', false))
|
|
296
|
+
idempotency_key = 'f64be872-353d-4c3c-84cb-3dc617fe89f7'
|
|
297
|
+
|
|
298
|
+
# Perform the API call through the SDK function
|
|
299
|
+
result = @controller.capture_charge(store_id, id, body,
|
|
300
|
+
idempotency_key: idempotency_key)
|
|
301
|
+
|
|
302
|
+
# Test response code
|
|
303
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
304
|
+
# Test headers
|
|
305
|
+
expected_headers = {}
|
|
306
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
307
|
+
|
|
308
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
309
|
+
|
|
310
|
+
# Test whether the captured response is as we expected
|
|
311
|
+
refute_nil(result)
|
|
312
|
+
expected_body = JSON.parse(
|
|
313
|
+
'{}'
|
|
314
|
+
)
|
|
315
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
316
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Retrieves the necessary payment execution URL (for online payments) or bank account details (for bank transfers).
|
|
320
|
+
#**⚠️ Prerequisite:** The charge `status` must be `awaiting` before requesting the issuer token. If requested while the charge is in any other status, an error will be returned.
|
|
321
|
+
def test_get_charge_issuer_token
|
|
322
|
+
# Parameters for the API call
|
|
323
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
324
|
+
id = 'c4e87129-cad4-47fb-8ded-b4c0a4ae0dd4'
|
|
325
|
+
|
|
326
|
+
# Perform the API call through the SDK function
|
|
327
|
+
result = @controller.get_charge_issuer_token(store_id, id)
|
|
328
|
+
|
|
329
|
+
# Test response code
|
|
330
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
331
|
+
# Test headers
|
|
332
|
+
expected_headers = {}
|
|
333
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
334
|
+
|
|
335
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
336
|
+
|
|
337
|
+
# Test whether the captured response is as we expected
|
|
338
|
+
refute_nil(result)
|
|
339
|
+
expected_body = JSON.parse(
|
|
340
|
+
'{"issuer_token":"http://test.com/action","call_method":"http_post","pay'\
|
|
341
|
+
'load":{"request_data":"example_value"},"payment_type":"online"}'
|
|
342
|
+
)
|
|
343
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
344
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# Retrieves the 3-D Secure issuer token details required to authenticate a card charge.
|
|
348
|
+
#**⚠️ Prerequisites:** 1. The charge must be created with `three_ds.mode` set to `normal` or `force`. 2. You must poll the charge until its `status` becomes `awaiting` before making this request.
|
|
349
|
+
#**Execution Flow:** Once retrieved, the client (browser) must execute an `http_post` request to the `issuer_token` URL. The `payload` object must be formatted according to the `content_type` (e.g., URL-encoded) and sent in the body. You can execute this via a redirect or inside an iframe. If using an iframe, continue polling the charge status in the background until it reaches `successful`, `failed`, or `error`.
|
|
350
|
+
def test_get_charge_three_ds_issuer_token
|
|
351
|
+
# Parameters for the API call
|
|
352
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
353
|
+
id = 'c4e87129-cad4-47fb-8ded-b4c0a4ae0dd4'
|
|
354
|
+
|
|
355
|
+
# Perform the API call through the SDK function
|
|
356
|
+
result = @controller.get_charge_three_ds_issuer_token(store_id, id)
|
|
357
|
+
|
|
358
|
+
# Test response code
|
|
359
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
360
|
+
# Test headers
|
|
361
|
+
expected_headers = {}
|
|
362
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
363
|
+
|
|
364
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
365
|
+
|
|
366
|
+
# Test whether the captured response is as we expected
|
|
367
|
+
refute_nil(result)
|
|
368
|
+
expected_body = JSON.parse(
|
|
369
|
+
'{"issuer_token":"http://test.com/action","call_method":"http_post","pay'\
|
|
370
|
+
'load":{"request_data":"example_value"},"payment_type":"card","content_t'\
|
|
371
|
+
'ype":"application/x-www-form-urlencoded; charset=UTF-8"}'
|
|
372
|
+
)
|
|
373
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
374
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
# Retrieves bank transfer ledger entries associated with a charge.
|
|
378
|
+
def test_list_bank_transfer_ledgers
|
|
379
|
+
# Parameters for the API call
|
|
380
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
381
|
+
id = 'c4e87129-cad4-47fb-8ded-b4c0a4ae0dd4'
|
|
382
|
+
|
|
383
|
+
# Perform the API call through the SDK function
|
|
384
|
+
result = @controller.list_bank_transfer_ledgers(store_id, id)
|
|
385
|
+
|
|
386
|
+
# Test response code
|
|
387
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
388
|
+
# Test headers
|
|
389
|
+
expected_headers = {}
|
|
390
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
391
|
+
|
|
392
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
393
|
+
|
|
394
|
+
# Test whether the captured response is as we expected
|
|
395
|
+
refute_nil(result)
|
|
396
|
+
expected_body = JSON.parse(
|
|
397
|
+
'{"items":[{"bank_ledger_type":"payment","amount":1000,"balance":0,"virt'\
|
|
398
|
+
'ual_bank_account_holder_name":"test holder name","virtual_bank_account_'\
|
|
399
|
+
'number":"1234567","virtual_account_id":"test account id","transaction_d'\
|
|
400
|
+
'ate":"2024-06-25","transaction_timestamp":"2024-06-25T07:29:16.367347Z"'\
|
|
401
|
+
',"mode":"test","created_on":"2024-06-25T07:29:16.373181Z"},{"bank_ledge'\
|
|
402
|
+
'r_type":"deposit","amount":1000,"balance":1000,"virtual_bank_account_ho'\
|
|
403
|
+
'lder_name":"test holder name","virtual_bank_account_number":"1234567","'\
|
|
404
|
+
'virtual_account_id":"test account id","transaction_date":"2024-06-25","'\
|
|
405
|
+
'transaction_timestamp":"2024-06-25T07:29:16.36731Z","mode":"test","crea'\
|
|
406
|
+
'ted_on":"2024-06-25T07:29:16.368093Z"}],"has_more":false,"total_hits":2'\
|
|
407
|
+
'}'
|
|
408
|
+
)
|
|
409
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
410
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
# Creates a customs declaration for a successful charge. Backend only accepts this request for WeChat Online and WeChat MPM charges. If a declaration already exists and is no longer pending, the backend updates its identity fields and restarts processing instead of creating a new record.
|
|
414
|
+
def test_create_customs_declaration
|
|
415
|
+
# Parameters for the API call
|
|
416
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
417
|
+
charge_id = '6efb4e5c-690a-40f3-a4f1-0e19c5f84e98'
|
|
418
|
+
body = CustomsDeclarationCreateRequest.from_hash(APIHelper.json_deserialize(
|
|
419
|
+
'{"customs":"TOKYO","merchant_customs_no":"1234567890","certificate_id":'\
|
|
420
|
+
'"AB1234567","certificate_name":"TARO YAMADA"}', false))
|
|
421
|
+
idempotency_key = 'f64be872-353d-4c3c-84cb-3dc617fe89f7'
|
|
422
|
+
|
|
423
|
+
# Perform the API call through the SDK function
|
|
424
|
+
result = @controller.create_customs_declaration(
|
|
425
|
+
store_id, charge_id, body, idempotency_key: idempotency_key
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
# Test response code
|
|
429
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
430
|
+
# Test headers
|
|
431
|
+
expected_headers = {}
|
|
432
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
433
|
+
|
|
434
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
435
|
+
|
|
436
|
+
# Test whether the captured response is as we expected
|
|
437
|
+
refute_nil(result)
|
|
438
|
+
expected_body = JSON.parse(
|
|
439
|
+
'{"id":"11ef0000-0000-4000-8000-000000000040","charge_id":"11ef0000-0000'\
|
|
440
|
+
'-4000-8000-000000000001","merchant_id":"11ef0000-0000-4000-8000-0000000'\
|
|
441
|
+
'00020","store_id":"11ef0000-0000-4000-8000-000000000022","mode":"test",'\
|
|
442
|
+
'"gateway":"wechat_online","declaration":{"customs":"TOKYO","merchant_cu'\
|
|
443
|
+
'stoms_no":"1234567890","certificate_id":"AB1234567","certificate_name":'\
|
|
444
|
+
'"TARO YAMADA"},"declaration_result":{},"status":"pending","error":null,'\
|
|
445
|
+
'"created_on":"2026-04-09T07:35:50.000000Z"}'
|
|
446
|
+
)
|
|
447
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
448
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# Creates a customs declaration for a successful charge. Backend only accepts this request for WeChat Online and WeChat MPM charges. If a declaration already exists and is no longer pending, the backend updates its identity fields and restarts processing instead of creating a new record.
|
|
452
|
+
def test_create_customs_declaration1
|
|
453
|
+
# Parameters for the API call
|
|
454
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
455
|
+
charge_id = '6efb4e5c-690a-40f3-a4f1-0e19c5f84e98'
|
|
456
|
+
body = CustomsDeclarationCreateRequest.from_hash(APIHelper.json_deserialize(
|
|
457
|
+
'{"customs":"TOKYO","merchant_customs_no":"1234567890","certificate_id":'\
|
|
458
|
+
'"AB1234567","certificate_name":"TARO YAMADA"}', false))
|
|
459
|
+
idempotency_key = 'f64be872-353d-4c3c-84cb-3dc617fe89f7'
|
|
460
|
+
|
|
461
|
+
# Perform the API call through the SDK function
|
|
462
|
+
result = @controller.create_customs_declaration(
|
|
463
|
+
store_id, charge_id, body, idempotency_key: idempotency_key
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
# Test response code
|
|
467
|
+
assert_equal(201, @response_catcher.response.status_code)
|
|
468
|
+
# Test headers
|
|
469
|
+
expected_headers = {}
|
|
470
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
471
|
+
|
|
472
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
473
|
+
|
|
474
|
+
# Test whether the captured response is as we expected
|
|
475
|
+
refute_nil(result)
|
|
476
|
+
expected_body = JSON.parse(
|
|
477
|
+
'{"id":"11ef0000-0000-4000-8000-000000000040","charge_id":"11ef0000-0000'\
|
|
478
|
+
'-4000-8000-000000000001","merchant_id":"11ef0000-0000-4000-8000-0000000'\
|
|
479
|
+
'00020","store_id":"11ef0000-0000-4000-8000-000000000022","mode":"test",'\
|
|
480
|
+
'"gateway":"wechat_online","declaration":{"customs":"TOKYO","merchant_cu'\
|
|
481
|
+
'stoms_no":"1234567890","certificate_id":"AB1234567","certificate_name":'\
|
|
482
|
+
'"TARO YAMADA"},"declaration_result":{},"status":"pending","error":null,'\
|
|
483
|
+
'"created_on":"2026-04-09T07:35:50.000000Z"}'
|
|
484
|
+
)
|
|
485
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
486
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
# Retrieves a customs declaration for a charge. Supports long polling when `polling=true`, returning once the declaration leaves its current state or the polling timeout is reached.
|
|
490
|
+
def test_get_customs_declaration
|
|
491
|
+
# Parameters for the API call
|
|
492
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
493
|
+
charge_id = '6efb4e5c-690a-40f3-a4f1-0e19c5f84e98'
|
|
494
|
+
id = '11ef0000-0000-4000-8000-000000000040'
|
|
495
|
+
polling = false
|
|
496
|
+
|
|
497
|
+
# Perform the API call through the SDK function
|
|
498
|
+
result = @controller.get_customs_declaration(store_id, charge_id, id,
|
|
499
|
+
polling: polling)
|
|
500
|
+
|
|
501
|
+
# Test response code
|
|
502
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
503
|
+
# Test headers
|
|
504
|
+
expected_headers = {}
|
|
505
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
506
|
+
|
|
507
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
508
|
+
|
|
509
|
+
# Test whether the captured response is as we expected
|
|
510
|
+
refute_nil(result)
|
|
511
|
+
expected_body = JSON.parse(
|
|
512
|
+
'{"id":"11ef0000-0000-4000-8000-000000000040","charge_id":"11ef0000-0000'\
|
|
513
|
+
'-4000-8000-000000000001","merchant_id":"11ef0000-0000-4000-8000-0000000'\
|
|
514
|
+
'00020","store_id":"11ef0000-0000-4000-8000-000000000022","mode":"test",'\
|
|
515
|
+
'"gateway":"wechat_online","declaration":{"customs":"TOKYO","merchant_cu'\
|
|
516
|
+
'stoms_no":"1234567890","certificate_id":"AB1234567","certificate_name":'\
|
|
517
|
+
'"TARO YAMADA"},"declaration_result":{"approving_authority":"TOKYO","tra'\
|
|
518
|
+
'de_id":"wx_trade_12345","transaction_id":"wx_txn_12345","charge_transac'\
|
|
519
|
+
'tion_id":"wx_charge_12345"},"status":"successful","error":null,"created'\
|
|
520
|
+
'_on":"2026-04-09T07:35:50.000000Z"}'
|
|
521
|
+
)
|
|
522
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
523
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
# Updates a customs declaration and requeues processing. Backend patching preserves the original `customs`, `certificate_id`, and `certificate_name` values and only accepts a new `merchant_customs_no`. Pending declarations cannot be patched.
|
|
527
|
+
def test_patch_customs_declaration
|
|
528
|
+
# Parameters for the API call
|
|
529
|
+
store_id = '0cab399b-5621-425b-993b-f8507eba1e78'
|
|
530
|
+
charge_id = '6efb4e5c-690a-40f3-a4f1-0e19c5f84e98'
|
|
531
|
+
id = '11ef0000-0000-4000-8000-000000000040'
|
|
532
|
+
body = CustomsDeclarationPatchRequest.from_hash(APIHelper.json_deserialize(
|
|
533
|
+
'{"merchant_customs_no":"1234567891"}', false))
|
|
534
|
+
idempotency_key = 'f64be872-353d-4c3c-84cb-3dc617fe89f7'
|
|
535
|
+
|
|
536
|
+
# Perform the API call through the SDK function
|
|
537
|
+
result = @controller.patch_customs_declaration(
|
|
538
|
+
store_id, charge_id, id, body, idempotency_key: idempotency_key
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
# Test response code
|
|
542
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
543
|
+
# Test headers
|
|
544
|
+
expected_headers = {}
|
|
545
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
546
|
+
|
|
547
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
548
|
+
|
|
549
|
+
# Test whether the captured response is as we expected
|
|
550
|
+
refute_nil(result)
|
|
551
|
+
expected_body = JSON.parse(
|
|
552
|
+
'{"id":"11ef0000-0000-4000-8000-000000000040","charge_id":"11ef0000-0000'\
|
|
553
|
+
'-4000-8000-000000000001","merchant_id":"11ef0000-0000-4000-8000-0000000'\
|
|
554
|
+
'00020","store_id":"11ef0000-0000-4000-8000-000000000022","mode":"test",'\
|
|
555
|
+
'"gateway":"wechat_online","declaration":{"customs":"TOKYO","merchant_cu'\
|
|
556
|
+
'stoms_no":"1234567891","certificate_id":"AB1234567","certificate_name":'\
|
|
557
|
+
'"TARO YAMADA"},"declaration_result":{},"status":"pending","error":null,'\
|
|
558
|
+
'"created_on":"2026-04-09T07:35:50.000000Z"}'
|
|
559
|
+
)
|
|
560
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
561
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
562
|
+
end
|
|
563
|
+
|
|
564
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
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 MerchantsApiTest < ApiTestBase
|
|
9
|
+
# Called only once for the class before any test has executed
|
|
10
|
+
def setup
|
|
11
|
+
setup_class
|
|
12
|
+
@controller = @client.merchants
|
|
13
|
+
@response_catcher = @controller.http_call_back
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Returns merchant identity and the effective configuration resolved from bearer credentials. Treat this as the canonical introspection endpoint for merchant integrations.
|
|
17
|
+
def test_get_current_merchant
|
|
18
|
+
|
|
19
|
+
# Perform the API call through the SDK function
|
|
20
|
+
result = @controller.get_current_merchant()
|
|
21
|
+
|
|
22
|
+
# Test response code
|
|
23
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
24
|
+
# Test headers
|
|
25
|
+
expected_headers = {}
|
|
26
|
+
expected_headers['content-type'] = 'application/json; charset=utf-8'
|
|
27
|
+
|
|
28
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
29
|
+
|
|
30
|
+
# Test whether the captured response is as we expected
|
|
31
|
+
refute_nil(result)
|
|
32
|
+
expected_body = JSON.parse(
|
|
33
|
+
'{"id":"11ef0000-0000-4000-8000-000000000020","verification_data_id":"11'\
|
|
34
|
+
'ef0000-0000-4000-8000-000000000021","name":"Example Merchant","email":"'\
|
|
35
|
+
'owner@example.com","notification_email":"alerts@example.com","finance_n'\
|
|
36
|
+
'otification_email":"finance@example.com","verified":true,"configuration'\
|
|
37
|
+
'":{"percent_fee":3.6,"country":"JP","language":"ja","minimum_charge_amo'\
|
|
38
|
+
'unts":[{"amount":100,"currency":"JPY"}],"maximum_charge_amounts":[{"amo'\
|
|
39
|
+
'unt":100000,"currency":"JPY"}],"user_transactions_configuration":{"enab'\
|
|
40
|
+
'led":true,"notify_customer":true,"notify_on_webhook_failure":true},"car'\
|
|
41
|
+
'd_configuration":{"enabled":true,"debit_enabled":true,"prepaid_enabled"'\
|
|
42
|
+
':false,"three_ds_required":true},"online_configuration":{"enabled":true'\
|
|
43
|
+
'},"bank_transfer_configuration":{"enabled":true,"match_amount":true,"ex'\
|
|
44
|
+
'piration":"P7D"}},"created_on":"2026-04-09T07:35:50.000000Z"}'
|
|
45
|
+
)
|
|
46
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
47
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|