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,92 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
require 'json'
|
|
8
|
+
require 'rack'
|
|
9
|
+
require 'stringio'
|
|
10
|
+
require 'minitest/autorun'
|
|
11
|
+
require 'minitest/hell'
|
|
12
|
+
require 'minitest/pride'
|
|
13
|
+
require 'minitest/proveit'
|
|
14
|
+
require 'univapay_client_sdk'
|
|
15
|
+
class TestTokenCvvAuthUpdatedHandler < Minitest::Test
|
|
16
|
+
parallelize_me!
|
|
17
|
+
include UnivapayClientSdk
|
|
18
|
+
include CoreLibrary
|
|
19
|
+
|
|
20
|
+
def setup
|
|
21
|
+
@handler = TokenCvvAuthUpdatedHandler.new
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def json_bytes(obj)
|
|
25
|
+
JSON.generate(obj).encode('utf-8')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def make_request(body_obj, add_signature_header: true)
|
|
29
|
+
raw = json_bytes(body_obj)
|
|
30
|
+
env = {
|
|
31
|
+
'REQUEST_METHOD' => 'POST',
|
|
32
|
+
'PATH_INFO' => '/webhooks',
|
|
33
|
+
'rack.input' => StringIO.new(raw),
|
|
34
|
+
'CONTENT_TYPE' => 'application/json'
|
|
35
|
+
}
|
|
36
|
+
Rack::Request.new(env)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_token_cvv_auth_updated_from_token_cvv_auth_updated_handler
|
|
41
|
+
# Tests the `tokenCvvAuthUpdated` event from tokenCvvAuthUpdatedHandler.
|
|
42
|
+
# arrange
|
|
43
|
+
event_payload = {
|
|
44
|
+
:id => "11ef0000-0000-4000-8000-000000000001",
|
|
45
|
+
:event => "token_cvv_auth_updated",
|
|
46
|
+
:data => {
|
|
47
|
+
:id => "6426bbd2-17bd-41bf-883b-1fe970db48ee",
|
|
48
|
+
:store_id => "fc264608-9a9e-495e-844e-a08129a81af4",
|
|
49
|
+
:email => "test@univapay.com",
|
|
50
|
+
:payment_type => "card",
|
|
51
|
+
:active => true,
|
|
52
|
+
:mode => "live",
|
|
53
|
+
:type => "recurring",
|
|
54
|
+
:confirmed => true,
|
|
55
|
+
:metadata => {
|
|
56
|
+
:customer_id => "cust_12345"
|
|
57
|
+
},
|
|
58
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
59
|
+
:updated_on => "2026-04-09T07:35:50.000000Z",
|
|
60
|
+
:exampleAdditionalProperty => {
|
|
61
|
+
:key1 => "val1",
|
|
62
|
+
:key2 => "val2"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
66
|
+
:exampleAdditionalProperty => {
|
|
67
|
+
:key1 => "val1",
|
|
68
|
+
:key2 => "val2"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
rack_req = make_request(event_payload)
|
|
72
|
+
|
|
73
|
+
# act
|
|
74
|
+
event = @handler.parse_event(rack_req)
|
|
75
|
+
|
|
76
|
+
# assert
|
|
77
|
+
assert event.is_a?(TokenCvvAuthUpdatedWebhookCallback) && event.event == 'token_cvv_auth_updated'
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_unknown_event
|
|
81
|
+
# arrange
|
|
82
|
+
event_payload = 45.0
|
|
83
|
+
rake_req = make_request(event_payload)
|
|
84
|
+
|
|
85
|
+
# act
|
|
86
|
+
event = @handler.parse_event(rake_req)
|
|
87
|
+
|
|
88
|
+
# assert
|
|
89
|
+
assert event.is_a?(UnknownEvent)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
require 'json'
|
|
8
|
+
require 'rack'
|
|
9
|
+
require 'stringio'
|
|
10
|
+
require 'minitest/autorun'
|
|
11
|
+
require 'minitest/hell'
|
|
12
|
+
require 'minitest/pride'
|
|
13
|
+
require 'minitest/proveit'
|
|
14
|
+
require 'univapay_client_sdk'
|
|
15
|
+
class TestTokenReplacedHandler < Minitest::Test
|
|
16
|
+
parallelize_me!
|
|
17
|
+
include UnivapayClientSdk
|
|
18
|
+
include CoreLibrary
|
|
19
|
+
|
|
20
|
+
def setup
|
|
21
|
+
@handler = TokenReplacedHandler.new
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def json_bytes(obj)
|
|
25
|
+
JSON.generate(obj).encode('utf-8')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def make_request(body_obj, add_signature_header: true)
|
|
29
|
+
raw = json_bytes(body_obj)
|
|
30
|
+
env = {
|
|
31
|
+
'REQUEST_METHOD' => 'POST',
|
|
32
|
+
'PATH_INFO' => '/webhooks',
|
|
33
|
+
'rack.input' => StringIO.new(raw),
|
|
34
|
+
'CONTENT_TYPE' => 'application/json'
|
|
35
|
+
}
|
|
36
|
+
Rack::Request.new(env)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_token_replaced_from_token_replaced_handler
|
|
41
|
+
# Tests the `tokenReplaced` event from tokenReplacedHandler.
|
|
42
|
+
# arrange
|
|
43
|
+
event_payload = {
|
|
44
|
+
:id => "11ef0000-0000-4000-8000-000000000001",
|
|
45
|
+
:event => "token_replaced",
|
|
46
|
+
:data => {
|
|
47
|
+
:id => "6426bbd2-17bd-41bf-883b-1fe970db48ee",
|
|
48
|
+
:store_id => "fc264608-9a9e-495e-844e-a08129a81af4",
|
|
49
|
+
:email => "test@univapay.com",
|
|
50
|
+
:payment_type => "card",
|
|
51
|
+
:active => true,
|
|
52
|
+
:mode => "live",
|
|
53
|
+
:type => "recurring",
|
|
54
|
+
:confirmed => true,
|
|
55
|
+
:metadata => {
|
|
56
|
+
:customer_id => "cust_12345"
|
|
57
|
+
},
|
|
58
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
59
|
+
:updated_on => "2026-04-09T07:35:50.000000Z",
|
|
60
|
+
:exampleAdditionalProperty => {
|
|
61
|
+
:key1 => "val1",
|
|
62
|
+
:key2 => "val2"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
66
|
+
:exampleAdditionalProperty => {
|
|
67
|
+
:key1 => "val1",
|
|
68
|
+
:key2 => "val2"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
rack_req = make_request(event_payload)
|
|
72
|
+
|
|
73
|
+
# act
|
|
74
|
+
event = @handler.parse_event(rack_req)
|
|
75
|
+
|
|
76
|
+
# assert
|
|
77
|
+
assert event.is_a?(TokenReplacedWebhookCallback) && event.event == 'token_replaced'
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_unknown_event
|
|
81
|
+
# arrange
|
|
82
|
+
event_payload = 45.0
|
|
83
|
+
rake_req = make_request(event_payload)
|
|
84
|
+
|
|
85
|
+
# act
|
|
86
|
+
event = @handler.parse_event(rake_req)
|
|
87
|
+
|
|
88
|
+
# assert
|
|
89
|
+
assert event.is_a?(UnknownEvent)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
require 'json'
|
|
8
|
+
require 'rack'
|
|
9
|
+
require 'stringio'
|
|
10
|
+
require 'minitest/autorun'
|
|
11
|
+
require 'minitest/hell'
|
|
12
|
+
require 'minitest/pride'
|
|
13
|
+
require 'minitest/proveit'
|
|
14
|
+
require 'univapay_client_sdk'
|
|
15
|
+
class TestTokenThreeDsUpdatedHandler < Minitest::Test
|
|
16
|
+
parallelize_me!
|
|
17
|
+
include UnivapayClientSdk
|
|
18
|
+
include CoreLibrary
|
|
19
|
+
|
|
20
|
+
def setup
|
|
21
|
+
@handler = TokenThreeDsUpdatedHandler.new
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def json_bytes(obj)
|
|
25
|
+
JSON.generate(obj).encode('utf-8')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def make_request(body_obj, add_signature_header: true)
|
|
29
|
+
raw = json_bytes(body_obj)
|
|
30
|
+
env = {
|
|
31
|
+
'REQUEST_METHOD' => 'POST',
|
|
32
|
+
'PATH_INFO' => '/webhooks',
|
|
33
|
+
'rack.input' => StringIO.new(raw),
|
|
34
|
+
'CONTENT_TYPE' => 'application/json'
|
|
35
|
+
}
|
|
36
|
+
Rack::Request.new(env)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_token_three_ds_updated_from_token_three_ds_updated_handler
|
|
41
|
+
# Tests the `tokenThreeDsUpdated` event from tokenThreeDsUpdatedHandler.
|
|
42
|
+
# arrange
|
|
43
|
+
event_payload = {
|
|
44
|
+
:id => "11ef0000-0000-4000-8000-000000000001",
|
|
45
|
+
:event => "token_three_d_s_updated",
|
|
46
|
+
:data => {
|
|
47
|
+
:id => "6426bbd2-17bd-41bf-883b-1fe970db48ee",
|
|
48
|
+
:store_id => "fc264608-9a9e-495e-844e-a08129a81af4",
|
|
49
|
+
:email => "test@univapay.com",
|
|
50
|
+
:payment_type => "card",
|
|
51
|
+
:active => true,
|
|
52
|
+
:mode => "live",
|
|
53
|
+
:type => "recurring",
|
|
54
|
+
:confirmed => true,
|
|
55
|
+
:metadata => {
|
|
56
|
+
:customer_id => "cust_12345"
|
|
57
|
+
},
|
|
58
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
59
|
+
:updated_on => "2026-04-09T07:35:50.000000Z",
|
|
60
|
+
:exampleAdditionalProperty => {
|
|
61
|
+
:key1 => "val1",
|
|
62
|
+
:key2 => "val2"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
66
|
+
:exampleAdditionalProperty => {
|
|
67
|
+
:key1 => "val1",
|
|
68
|
+
:key2 => "val2"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
rack_req = make_request(event_payload)
|
|
72
|
+
|
|
73
|
+
# act
|
|
74
|
+
event = @handler.parse_event(rack_req)
|
|
75
|
+
|
|
76
|
+
# assert
|
|
77
|
+
assert event.is_a?(TokenThreeDsUpdatedWebhookCallback) && event.event == 'token_three_d_s_updated'
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_unknown_event
|
|
81
|
+
# arrange
|
|
82
|
+
event_payload = 45.0
|
|
83
|
+
rake_req = make_request(event_payload)
|
|
84
|
+
|
|
85
|
+
# act
|
|
86
|
+
event = @handler.parse_event(rake_req)
|
|
87
|
+
|
|
88
|
+
# assert
|
|
89
|
+
assert event.is_a?(UnknownEvent)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
require 'json'
|
|
8
|
+
require 'rack'
|
|
9
|
+
require 'stringio'
|
|
10
|
+
require 'minitest/autorun'
|
|
11
|
+
require 'minitest/hell'
|
|
12
|
+
require 'minitest/pride'
|
|
13
|
+
require 'minitest/proveit'
|
|
14
|
+
require 'univapay_client_sdk'
|
|
15
|
+
class TestTokenUpdatedHandler < Minitest::Test
|
|
16
|
+
parallelize_me!
|
|
17
|
+
include UnivapayClientSdk
|
|
18
|
+
include CoreLibrary
|
|
19
|
+
|
|
20
|
+
def setup
|
|
21
|
+
@handler = TokenUpdatedHandler.new
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def json_bytes(obj)
|
|
25
|
+
JSON.generate(obj).encode('utf-8')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def make_request(body_obj, add_signature_header: true)
|
|
29
|
+
raw = json_bytes(body_obj)
|
|
30
|
+
env = {
|
|
31
|
+
'REQUEST_METHOD' => 'POST',
|
|
32
|
+
'PATH_INFO' => '/webhooks',
|
|
33
|
+
'rack.input' => StringIO.new(raw),
|
|
34
|
+
'CONTENT_TYPE' => 'application/json'
|
|
35
|
+
}
|
|
36
|
+
Rack::Request.new(env)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_token_updated_from_token_updated_handler
|
|
41
|
+
# Tests the `tokenUpdated` event from tokenUpdatedHandler.
|
|
42
|
+
# arrange
|
|
43
|
+
event_payload = {
|
|
44
|
+
:id => "11ef0000-0000-4000-8000-000000000001",
|
|
45
|
+
:event => "token_updated",
|
|
46
|
+
:data => {
|
|
47
|
+
:id => "6426bbd2-17bd-41bf-883b-1fe970db48ee",
|
|
48
|
+
:store_id => "fc264608-9a9e-495e-844e-a08129a81af4",
|
|
49
|
+
:email => "test@univapay.com",
|
|
50
|
+
:payment_type => "card",
|
|
51
|
+
:active => true,
|
|
52
|
+
:mode => "live",
|
|
53
|
+
:type => "recurring",
|
|
54
|
+
:confirmed => true,
|
|
55
|
+
:metadata => {
|
|
56
|
+
:customer_id => "cust_12345"
|
|
57
|
+
},
|
|
58
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
59
|
+
:updated_on => "2026-04-09T07:35:50.000000Z",
|
|
60
|
+
:exampleAdditionalProperty => {
|
|
61
|
+
:key1 => "val1",
|
|
62
|
+
:key2 => "val2"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
66
|
+
:exampleAdditionalProperty => {
|
|
67
|
+
:key1 => "val1",
|
|
68
|
+
:key2 => "val2"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
rack_req = make_request(event_payload)
|
|
72
|
+
|
|
73
|
+
# act
|
|
74
|
+
event = @handler.parse_event(rack_req)
|
|
75
|
+
|
|
76
|
+
# assert
|
|
77
|
+
assert event.is_a?(TokenUpdatedWebhookCallback) && event.event == 'token_updated'
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_unknown_event
|
|
81
|
+
# arrange
|
|
82
|
+
event_payload = 45.0
|
|
83
|
+
rake_req = make_request(event_payload)
|
|
84
|
+
|
|
85
|
+
# act
|
|
86
|
+
event = @handler.parse_event(rake_req)
|
|
87
|
+
|
|
88
|
+
# assert
|
|
89
|
+
assert event.is_a?(UnknownEvent)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'rails'
|
|
2
|
+
require 'action_controller/railtie'
|
|
3
|
+
require 'univapay_client_sdk'
|
|
4
|
+
|
|
5
|
+
include UnivapayClientSdk
|
|
6
|
+
|
|
7
|
+
class RailsApp < Rails::Application
|
|
8
|
+
config.secret_key_base = "test"
|
|
9
|
+
config.eager_load = false
|
|
10
|
+
config.hosts.clear
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Rails.application = RailsApp
|
|
14
|
+
Rails.application.initialize!
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require "hanami/router"
|
|
2
|
+
require "hanami/controller"
|
|
3
|
+
require "json"
|
|
4
|
+
require 'univapay_client_sdk'
|
|
5
|
+
|
|
6
|
+
include UnivapayClientSdk
|
|
7
|
+
|
|
8
|
+
# Version handling for Hanami
|
|
9
|
+
if RUBY_VERSION < "3.0"
|
|
10
|
+
# Hanami 1.x
|
|
11
|
+
class HanamiChargeUpdatedApp
|
|
12
|
+
include Hanami::Action
|
|
13
|
+
|
|
14
|
+
def handle_event(request, response)
|
|
15
|
+
# Step 1: Create the handler.
|
|
16
|
+
handler = ChargeUpdatedHandler.new
|
|
17
|
+
|
|
18
|
+
# Step 2: Parse the request into a typed event.
|
|
19
|
+
event = handler.parse_event(request)
|
|
20
|
+
|
|
21
|
+
# Step 3: Pattern match on the event types and handle it.
|
|
22
|
+
if event.is_a?(ChargeUpdatedWebhookCallback) && event.event == 'charge_updated'
|
|
23
|
+
self.status = 200
|
|
24
|
+
self.body = { message: "ChargeUpdated callback received" }.to_json
|
|
25
|
+
elsif event.is_a?(UnknownEvent)
|
|
26
|
+
self.status = 400
|
|
27
|
+
self.body = { message: "Unknown event callback received" }.to_json
|
|
28
|
+
else
|
|
29
|
+
self.status = 400
|
|
30
|
+
self.body = { message: "default callback received" }.to_json
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
else
|
|
35
|
+
# Hanami 2.x
|
|
36
|
+
class HanamiChargeUpdatedApp < Hanami::Action
|
|
37
|
+
def handle_event(request, response)
|
|
38
|
+
# Step 1: Create the handler.
|
|
39
|
+
handler = ChargeUpdatedHandler.new
|
|
40
|
+
|
|
41
|
+
# Step 2: Parse the request into a typed event.
|
|
42
|
+
event = handler.parse_event(request)
|
|
43
|
+
|
|
44
|
+
# Step 3: Pattern match on the event types and handle it.
|
|
45
|
+
if event.is_a?(ChargeUpdatedWebhookCallback) && event.event == 'charge_updated'
|
|
46
|
+
self.status = 200
|
|
47
|
+
self.body = { message: "ChargeUpdated callback received" }.to_json
|
|
48
|
+
elsif event.is_a?(UnknownEvent)
|
|
49
|
+
self.status = 400
|
|
50
|
+
self.body = { message: "Unknown event callback received" }.to_json
|
|
51
|
+
else
|
|
52
|
+
self.status = 400
|
|
53
|
+
self.body = { message: "default callback received" }.to_json
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
ChargeUpdatedRouter = Hanami::Router.new do
|
|
60
|
+
post '/charge_updated', to: HanamiChargeUpdatedApp.new
|
|
61
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require_relative '../../rails_app_test_helper'
|
|
2
|
+
|
|
3
|
+
Rails.application.routes.draw do
|
|
4
|
+
post "/charge_updated", to: "charge_updated#receive"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class ChargeUpdatedController < ActionController::API
|
|
8
|
+
def receive
|
|
9
|
+
# Step 1: Create the handler.
|
|
10
|
+
handler = ChargeUpdatedHandler.new
|
|
11
|
+
|
|
12
|
+
# Step 2: Parse the request into a typed event.
|
|
13
|
+
event = handler.parse_event(request)
|
|
14
|
+
|
|
15
|
+
# Step 3: Pattern match on the event types and handle it.
|
|
16
|
+
if event.is_a?(ChargeUpdatedWebhookCallback) && event.event == 'charge_updated'
|
|
17
|
+
render json: { message: 'ChargeUpdated callback received' }, status: 200
|
|
18
|
+
elsif event.is_a?(UnknownEvent)
|
|
19
|
+
render json: { message: 'Unknown event callback received' }, status: 400
|
|
20
|
+
else
|
|
21
|
+
render json: { message: 'default callback received' }, status: 400
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'sinatra'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'univapay_client_sdk'
|
|
4
|
+
|
|
5
|
+
include UnivapayClientSdk
|
|
6
|
+
|
|
7
|
+
class SinatraChargeUpdatedApp < Sinatra::Base
|
|
8
|
+
post '/charge_updated' do
|
|
9
|
+
# Step 1: Create the handler.
|
|
10
|
+
handler = ChargeUpdatedHandler.new
|
|
11
|
+
|
|
12
|
+
# Step 2: Parse the request into a typed event.
|
|
13
|
+
event = handler.parse_event(request)
|
|
14
|
+
|
|
15
|
+
# Step 3: Pattern match on the event types and handle it.
|
|
16
|
+
if event.is_a?(ChargeUpdatedWebhookCallback) && event.event == 'charge_updated'
|
|
17
|
+
content_type :json
|
|
18
|
+
[200, { message: "ChargeUpdated callback received" }.to_json]
|
|
19
|
+
elsif event.is_a?(UnknownEvent)
|
|
20
|
+
content_type :json
|
|
21
|
+
[400, { message: "Unknown event callback received" }.to_json]
|
|
22
|
+
else
|
|
23
|
+
content_type :json
|
|
24
|
+
[400, { message: "default callback received" }.to_json]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require 'rack/test'
|
|
3
|
+
require_relative '../apps/hanami_charge_updated_app'
|
|
4
|
+
|
|
5
|
+
class ChargeUpdatedIntegrationTest < Minitest::Test
|
|
6
|
+
parallelize_me!
|
|
7
|
+
include Rack::Test::Methods
|
|
8
|
+
include UnivapayClientSdk
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
|
|
11
|
+
def app
|
|
12
|
+
ChargeUpdatedRouter
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_charge_updated_from_charge_updated_app
|
|
17
|
+
# Tests the `chargeUpdated` event from chargeUpdated application.
|
|
18
|
+
# arrange
|
|
19
|
+
event_payload = {
|
|
20
|
+
:id => "11ef0000-0000-4000-8000-000000000001",
|
|
21
|
+
:event => "charge_updated",
|
|
22
|
+
:data => {
|
|
23
|
+
:id => "6efb4e5c-690a-40f3-a4f1-0e19c5f84e98",
|
|
24
|
+
:store_id => "11edf541-c42d-653c-8c3d-dfe0a55f95c0",
|
|
25
|
+
:transaction_token_id => "11ef32a7-3a71-8662-803f-1bc27702eeec",
|
|
26
|
+
:transaction_token_type => "recurring",
|
|
27
|
+
:subscription_id => "11ef335e-9aa5-c54a-8313-7f9847da313a",
|
|
28
|
+
:requested_amount => 1250,
|
|
29
|
+
:requested_currency => "USD",
|
|
30
|
+
:requested_amount_formatted => 12.5,
|
|
31
|
+
:charged_amount => 1250,
|
|
32
|
+
:charged_currency => "USD",
|
|
33
|
+
:charged_amount_formatted => 12.5,
|
|
34
|
+
:only_direct_currency => false,
|
|
35
|
+
:status => "successful",
|
|
36
|
+
:error => nil,
|
|
37
|
+
:mode => "test",
|
|
38
|
+
:created_on => "2024-06-26T01:51:30.000000Z",
|
|
39
|
+
:exampleAdditionalProperty => {
|
|
40
|
+
:key1 => "val1",
|
|
41
|
+
:key2 => "val2"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
45
|
+
:exampleAdditionalProperty => {
|
|
46
|
+
:key1 => "val1",
|
|
47
|
+
:key2 => "val2"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# act
|
|
52
|
+
post '/charge_updated', event_payload.to_json, { 'CONTENT_TYPE' => 'application/json' }
|
|
53
|
+
|
|
54
|
+
# assert
|
|
55
|
+
assert_equal 200, last_response.status
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require 'rack/test'
|
|
3
|
+
require_relative '../apps/rails_charge_updated_app'
|
|
4
|
+
|
|
5
|
+
class ChargeUpdatedIntegrationTest < Minitest::Test
|
|
6
|
+
parallelize_me!
|
|
7
|
+
include Rack::Test::Methods
|
|
8
|
+
include UnivapayClientSdk
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
|
|
11
|
+
def app
|
|
12
|
+
Rails.application
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_charge_updated_from_charge_updated_app
|
|
17
|
+
# Tests the `chargeUpdated` event from chargeUpdated application.
|
|
18
|
+
|
|
19
|
+
# arrange
|
|
20
|
+
event_payload = {
|
|
21
|
+
:id => "11ef0000-0000-4000-8000-000000000001",
|
|
22
|
+
:event => "charge_updated",
|
|
23
|
+
:data => {
|
|
24
|
+
:id => "6efb4e5c-690a-40f3-a4f1-0e19c5f84e98",
|
|
25
|
+
:store_id => "11edf541-c42d-653c-8c3d-dfe0a55f95c0",
|
|
26
|
+
:transaction_token_id => "11ef32a7-3a71-8662-803f-1bc27702eeec",
|
|
27
|
+
:transaction_token_type => "recurring",
|
|
28
|
+
:subscription_id => "11ef335e-9aa5-c54a-8313-7f9847da313a",
|
|
29
|
+
:requested_amount => 1250,
|
|
30
|
+
:requested_currency => "USD",
|
|
31
|
+
:requested_amount_formatted => 12.5,
|
|
32
|
+
:charged_amount => 1250,
|
|
33
|
+
:charged_currency => "USD",
|
|
34
|
+
:charged_amount_formatted => 12.5,
|
|
35
|
+
:only_direct_currency => false,
|
|
36
|
+
:status => "successful",
|
|
37
|
+
:error => nil,
|
|
38
|
+
:mode => "test",
|
|
39
|
+
:created_on => "2024-06-26T01:51:30.000000Z",
|
|
40
|
+
:exampleAdditionalProperty => {
|
|
41
|
+
:key1 => "val1",
|
|
42
|
+
:key2 => "val2"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
46
|
+
:exampleAdditionalProperty => {
|
|
47
|
+
:key1 => "val1",
|
|
48
|
+
:key2 => "val2"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# act
|
|
53
|
+
post '/charge_updated', event_payload.to_json, { 'CONTENT_TYPE' => 'application/json' }
|
|
54
|
+
# assert
|
|
55
|
+
assert_equal 200, last_response.status
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require 'rack/test'
|
|
3
|
+
require_relative '../apps/sinatra_charge_updated_app'
|
|
4
|
+
|
|
5
|
+
class ChargeUpdatedIntegrationTest < Minitest::Test
|
|
6
|
+
parallelize_me!
|
|
7
|
+
include Rack::Test::Methods
|
|
8
|
+
include UnivapayClientSdk
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
|
|
11
|
+
def app
|
|
12
|
+
SinatraChargeUpdatedApp
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_charge_updated_from_charge_updated_app
|
|
17
|
+
# Tests the `chargeUpdated` event from chargeUpdated application.
|
|
18
|
+
# arrange
|
|
19
|
+
payload = {
|
|
20
|
+
:id => "11ef0000-0000-4000-8000-000000000001",
|
|
21
|
+
:event => "charge_updated",
|
|
22
|
+
:data => {
|
|
23
|
+
:id => "6efb4e5c-690a-40f3-a4f1-0e19c5f84e98",
|
|
24
|
+
:store_id => "11edf541-c42d-653c-8c3d-dfe0a55f95c0",
|
|
25
|
+
:transaction_token_id => "11ef32a7-3a71-8662-803f-1bc27702eeec",
|
|
26
|
+
:transaction_token_type => "recurring",
|
|
27
|
+
:subscription_id => "11ef335e-9aa5-c54a-8313-7f9847da313a",
|
|
28
|
+
:requested_amount => 1250,
|
|
29
|
+
:requested_currency => "USD",
|
|
30
|
+
:requested_amount_formatted => 12.5,
|
|
31
|
+
:charged_amount => 1250,
|
|
32
|
+
:charged_currency => "USD",
|
|
33
|
+
:charged_amount_formatted => 12.5,
|
|
34
|
+
:only_direct_currency => false,
|
|
35
|
+
:status => "successful",
|
|
36
|
+
:error => nil,
|
|
37
|
+
:mode => "test",
|
|
38
|
+
:created_on => "2024-06-26T01:51:30.000000Z",
|
|
39
|
+
:exampleAdditionalProperty => {
|
|
40
|
+
:key1 => "val1",
|
|
41
|
+
:key2 => "val2"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
:created_on => "2026-04-09T07:35:50.000000Z",
|
|
45
|
+
:exampleAdditionalProperty => {
|
|
46
|
+
:key1 => "val1",
|
|
47
|
+
:key2 => "val2"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# act
|
|
52
|
+
header 'Content-Type', 'application/json'
|
|
53
|
+
post '/charge_updated', payload.to_json
|
|
54
|
+
|
|
55
|
+
# assert
|
|
56
|
+
assert_equal 200, last_response.status
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
class HttpResponseCatcher < UnivapayClientSdk::HttpCallBack
|
|
7
|
+
attr_reader :response
|
|
8
|
+
|
|
9
|
+
def on_before_request(request)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Catching the response
|
|
13
|
+
def on_after_response(response)
|
|
14
|
+
@response = response
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|