univapay-client-sdk 1.0.0
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 +212 -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 +909 -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 +128 -0
- data/lib/univapay_client_sdk/configuration.rb +179 -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_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/customs_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/refund_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/subscription_handler.rb +37 -0
- data/lib/univapay_client_sdk/events/webhooks/token_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/extensions.rb +127 -0
- data/lib/univapay_client_sdk/http/api_response.rb +19 -0
- data/lib/univapay_client_sdk/http/auth/oauth_2.rb +58 -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_event.rb +36 -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_webhook_event.rb +138 -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/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_create_request.rb +216 -0
- data/lib/univapay_client_sdk/models/subscription_event.rb +54 -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_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_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/subscription_webhook_event.rb +143 -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 +230 -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 +146 -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_event.rb +59 -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_webhook_event.rb +144 -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 +182 -0
- data/lib/univapay_client_sdk.rb +285 -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 +565 -0
- data/test/apis/test_error_messages.rb +38 -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_handler.rb +138 -0
- data/test/events/webhooks/test_customs_handler.rb +100 -0
- data/test/events/webhooks/test_refund_handler.rb +95 -0
- data/test/events/webhooks/test_subscription_handler.rb +346 -0
- data/test/events/webhooks/test_token_handler.rb +332 -0
- data/test/framework_integrations/rails_app_test_helper.rb +14 -0
- data/test/framework_integrations/webhooks/apps/hanami_charge_app.rb +61 -0
- data/test/framework_integrations/webhooks/apps/rails_charge_app.rb +24 -0
- data/test/framework_integrations/webhooks/apps/sinatra_charge_app.rb +27 -0
- data/test/framework_integrations/webhooks/test/test_hanami_charge_app.rb +57 -0
- data/test/framework_integrations/webhooks/test/test_rails_charge_app.rb +57 -0
- data/test/framework_integrations/webhooks/test/test_sinatra_charge_app.rb +58 -0
- data/test/http_response_catcher.rb +32 -0
- metadata +366 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# An enum for SDK environments.
|
|
8
|
+
class Environment
|
|
9
|
+
# PRODUCTION: Production Server
|
|
10
|
+
ENVIRONMENT = [
|
|
11
|
+
PRODUCTION = 'production'.freeze
|
|
12
|
+
].freeze
|
|
13
|
+
|
|
14
|
+
# Converts a string or symbol into a valid Environment constant.
|
|
15
|
+
def self.from_value(value, default_value = PRODUCTION)
|
|
16
|
+
return default_value if value.nil?
|
|
17
|
+
|
|
18
|
+
default_value
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# An enum for API servers.
|
|
23
|
+
class Server
|
|
24
|
+
SERVER = [
|
|
25
|
+
DEFAULT = 'default'.freeze
|
|
26
|
+
].freeze
|
|
27
|
+
|
|
28
|
+
# Converts a string or symbol into a valid Server constant.
|
|
29
|
+
def self.from_value(value, default_value = DEFAULT)
|
|
30
|
+
return default_value if value.nil?
|
|
31
|
+
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# All configuration including auth info and base URI for the API access
|
|
37
|
+
# are configured in this class.
|
|
38
|
+
class Configuration < CoreLibrary::HttpClientConfiguration
|
|
39
|
+
# The attribute readers for properties.
|
|
40
|
+
attr_reader :environment, :base_url, :bearer_auth_credentials
|
|
41
|
+
|
|
42
|
+
class << self
|
|
43
|
+
attr_reader :environments
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def initialize(
|
|
47
|
+
connection: nil, adapter: :net_http_persistent, timeout: 30,
|
|
48
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
49
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
50
|
+
retry_methods: %i[get put get put], http_callback: nil,
|
|
51
|
+
proxy_settings: nil, logging_configuration: nil,
|
|
52
|
+
environment: Environment::PRODUCTION,
|
|
53
|
+
base_url: 'https://api.univapay.com', bearer_auth_credentials: nil
|
|
54
|
+
)
|
|
55
|
+
super connection: connection, adapter: adapter, timeout: timeout,
|
|
56
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
57
|
+
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
58
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
59
|
+
proxy_settings: proxy_settings,
|
|
60
|
+
logging_configuration: logging_configuration
|
|
61
|
+
|
|
62
|
+
# Current API environment
|
|
63
|
+
@environment = String(environment)
|
|
64
|
+
|
|
65
|
+
# Base URL for the API
|
|
66
|
+
@base_url = base_url
|
|
67
|
+
|
|
68
|
+
# The object holding OAuth 2 Bearer token credentials
|
|
69
|
+
@bearer_auth_credentials = bearer_auth_credentials
|
|
70
|
+
|
|
71
|
+
# Initializing OAuth 2 Bearer token credentials with the provided auth parameters
|
|
72
|
+
@bearer_auth_credentials = bearer_auth_credentials
|
|
73
|
+
|
|
74
|
+
# The Http Client to use for making requests.
|
|
75
|
+
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
|
79
|
+
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
|
80
|
+
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
81
|
+
proxy_settings: nil, logging_configuration: nil,
|
|
82
|
+
environment: nil, base_url: nil,
|
|
83
|
+
bearer_auth_credentials: nil)
|
|
84
|
+
connection ||= self.connection
|
|
85
|
+
adapter ||= self.adapter
|
|
86
|
+
timeout ||= self.timeout
|
|
87
|
+
max_retries ||= self.max_retries
|
|
88
|
+
retry_interval ||= self.retry_interval
|
|
89
|
+
backoff_factor ||= self.backoff_factor
|
|
90
|
+
retry_statuses ||= self.retry_statuses
|
|
91
|
+
retry_methods ||= self.retry_methods
|
|
92
|
+
http_callback ||= self.http_callback
|
|
93
|
+
proxy_settings ||= self.proxy_settings
|
|
94
|
+
logging_configuration ||= self.logging_configuration
|
|
95
|
+
environment ||= self.environment
|
|
96
|
+
base_url ||= self.base_url
|
|
97
|
+
bearer_auth_credentials ||= self.bearer_auth_credentials
|
|
98
|
+
|
|
99
|
+
Configuration.new(connection: connection, adapter: adapter,
|
|
100
|
+
timeout: timeout, max_retries: max_retries,
|
|
101
|
+
retry_interval: retry_interval,
|
|
102
|
+
backoff_factor: backoff_factor,
|
|
103
|
+
retry_statuses: retry_statuses,
|
|
104
|
+
retry_methods: retry_methods,
|
|
105
|
+
http_callback: http_callback,
|
|
106
|
+
proxy_settings: proxy_settings,
|
|
107
|
+
logging_configuration: logging_configuration,
|
|
108
|
+
environment: environment, base_url: base_url,
|
|
109
|
+
bearer_auth_credentials: bearer_auth_credentials)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# All the environments the SDK can run in.
|
|
114
|
+
ENVIRONMENTS = {
|
|
115
|
+
Environment::PRODUCTION => {
|
|
116
|
+
Server::DEFAULT => '{baseUrl}'
|
|
117
|
+
}
|
|
118
|
+
}.freeze
|
|
119
|
+
|
|
120
|
+
# Generates the appropriate base URI for the environment and the server.
|
|
121
|
+
# @param [Configuration::Server] server The server enum for which the base URI is
|
|
122
|
+
# required.
|
|
123
|
+
# @return [String] The base URI.
|
|
124
|
+
def get_base_uri(server = Server::DEFAULT)
|
|
125
|
+
parameters = {
|
|
126
|
+
'baseUrl' => { 'value' => base_url, 'encode' => false }
|
|
127
|
+
}
|
|
128
|
+
APIHelper.append_url_with_template_parameters(
|
|
129
|
+
ENVIRONMENTS[environment][server], parameters
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Builds a Configuration instance using environment variables.
|
|
134
|
+
def self.build_default_config_from_env
|
|
135
|
+
# === Core environment ===
|
|
136
|
+
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
|
|
137
|
+
base_url = ENV.fetch('BASE_URL', 'https://api.univapay.com')
|
|
138
|
+
timeout = (ENV['TIMEOUT'] || 30).to_f
|
|
139
|
+
max_retries = (ENV['MAX_RETRIES'] || 0).to_i
|
|
140
|
+
retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
|
|
141
|
+
backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
|
|
142
|
+
retry_statuses = ENV.fetch('RETRY_STATUSES',
|
|
143
|
+
'[408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
|
|
144
|
+
.split(',')
|
|
145
|
+
.map(&:strip)
|
|
146
|
+
.map do |item|
|
|
147
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
148
|
+
end
|
|
149
|
+
retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put get put]').gsub(/[\[\]]/, '')
|
|
150
|
+
.split(',')
|
|
151
|
+
.map(&:strip)
|
|
152
|
+
.map do |item|
|
|
153
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# === Authentication credentials ===
|
|
157
|
+
bearer_auth_credentials = BearerAuthCredentials.from_env
|
|
158
|
+
|
|
159
|
+
# === Proxy settings ===
|
|
160
|
+
proxy_settings = ProxySettings.from_env
|
|
161
|
+
# === Logging Configuration ===
|
|
162
|
+
logging_configuration = LoggingConfiguration.from_env if LoggingConfiguration.any_logging_configured?
|
|
163
|
+
|
|
164
|
+
Configuration.new(
|
|
165
|
+
environment: environment,
|
|
166
|
+
base_url: base_url,
|
|
167
|
+
timeout: timeout,
|
|
168
|
+
max_retries: max_retries,
|
|
169
|
+
retry_interval: retry_interval,
|
|
170
|
+
backoff_factor: backoff_factor,
|
|
171
|
+
retry_statuses: retry_statuses,
|
|
172
|
+
retry_methods: retry_methods,
|
|
173
|
+
bearer_auth_credentials: bearer_auth_credentials,
|
|
174
|
+
proxy_settings: proxy_settings,
|
|
175
|
+
logging_configuration: logging_configuration
|
|
176
|
+
)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# Represents an unrecognized or unsupported event during processing.
|
|
8
|
+
class UnknownEvent
|
|
9
|
+
# @return [Array<String>]
|
|
10
|
+
attr_reader :errors
|
|
11
|
+
|
|
12
|
+
# Initialize with the errors that caused the failure.
|
|
13
|
+
# @param errors [Array<String>] A list of error messages describing the reasons for verification failure.
|
|
14
|
+
def initialize(errors)
|
|
15
|
+
@errors = errors
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Provides a user-friendly string representation of the failure.
|
|
19
|
+
# @return [String]
|
|
20
|
+
def to_s
|
|
21
|
+
class_name = self.class.name.split('::').last
|
|
22
|
+
"<#{class_name} errors: #{@errors}>"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
26
|
+
# @return [String]
|
|
27
|
+
def inspect
|
|
28
|
+
class_name = self.class.name.split('::').last
|
|
29
|
+
"<#{class_name} errors: #{@errors.inspect}>"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# BankTransferHandler is responsible for verifying request signatures
|
|
8
|
+
# and parsing incoming bank-transfer events into strongly typed objects.
|
|
9
|
+
class BankTransferHandler
|
|
10
|
+
include CoreLibrary
|
|
11
|
+
# Creates a new instance of the BankTransferHandler.
|
|
12
|
+
def initialize; end
|
|
13
|
+
|
|
14
|
+
# Parse the event.
|
|
15
|
+
#
|
|
16
|
+
# @param [Rack::Request] request The incoming HTTP request containing the event payload.
|
|
17
|
+
# @return[BankTransferStatusWebhookCallback, UnknownEvent]
|
|
18
|
+
# BankTransferStatusWebhookCallback for successful parsing;
|
|
19
|
+
#
|
|
20
|
+
# UnknownEvent for unknown events.
|
|
21
|
+
def parse_event(request)
|
|
22
|
+
return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash)
|
|
23
|
+
|
|
24
|
+
raw_body = RackRequestHelper.read_raw_body(request)
|
|
25
|
+
return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
|
|
26
|
+
|
|
27
|
+
# Deserialize payload
|
|
28
|
+
begin
|
|
29
|
+
union = UnionTypeLookUp.get(:BankTransfer)
|
|
30
|
+
raw = RackRequestHelper.read_raw_body(request)
|
|
31
|
+
APIHelper.deserialize_union_type(union, raw, false, true)
|
|
32
|
+
rescue StandardError => e
|
|
33
|
+
UnknownEvent.new(['Deserialization failed.', e.message])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# CancelHandler is responsible for verifying request signatures
|
|
8
|
+
# and parsing incoming cancel events into strongly typed objects.
|
|
9
|
+
class CancelHandler
|
|
10
|
+
include CoreLibrary
|
|
11
|
+
# Creates a new instance of the CancelHandler.
|
|
12
|
+
def initialize; end
|
|
13
|
+
|
|
14
|
+
# Parse the event.
|
|
15
|
+
#
|
|
16
|
+
# @param [Rack::Request] request The incoming HTTP request containing the event payload.
|
|
17
|
+
# @return[CancelWebhookCallback, UnknownEvent]
|
|
18
|
+
# CancelWebhookCallback for successful parsing;
|
|
19
|
+
# UnknownEvent for
|
|
20
|
+
# unknown events.
|
|
21
|
+
def parse_event(request)
|
|
22
|
+
return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash)
|
|
23
|
+
|
|
24
|
+
raw_body = RackRequestHelper.read_raw_body(request)
|
|
25
|
+
return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
|
|
26
|
+
|
|
27
|
+
# Deserialize payload
|
|
28
|
+
begin
|
|
29
|
+
union = UnionTypeLookUp.get(:Cancel)
|
|
30
|
+
raw = RackRequestHelper.read_raw_body(request)
|
|
31
|
+
APIHelper.deserialize_union_type(union, raw, false, true)
|
|
32
|
+
rescue StandardError => e
|
|
33
|
+
UnknownEvent.new(['Deserialization failed.', e.message])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# ChargeHandler is responsible for verifying request signatures
|
|
8
|
+
# and parsing incoming charge events into strongly typed objects.
|
|
9
|
+
class ChargeHandler
|
|
10
|
+
include CoreLibrary
|
|
11
|
+
# Creates a new instance of the ChargeHandler.
|
|
12
|
+
def initialize; end
|
|
13
|
+
|
|
14
|
+
# Parse the event.
|
|
15
|
+
#
|
|
16
|
+
# @param [Rack::Request] request The incoming HTTP request containing the event payload.
|
|
17
|
+
# @return[ChargeWebhookEvent, UnknownEvent]
|
|
18
|
+
# ChargeWebhookEvent for successful parsing;
|
|
19
|
+
# UnknownEvent for unknown
|
|
20
|
+
# events.
|
|
21
|
+
def parse_event(request)
|
|
22
|
+
return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash)
|
|
23
|
+
|
|
24
|
+
raw_body = RackRequestHelper.read_raw_body(request)
|
|
25
|
+
return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
|
|
26
|
+
|
|
27
|
+
# Deserialize payload
|
|
28
|
+
begin
|
|
29
|
+
union = UnionTypeLookUp.get(:Charge)
|
|
30
|
+
raw = RackRequestHelper.read_raw_body(request)
|
|
31
|
+
APIHelper.deserialize_union_type(union, raw, false, true)
|
|
32
|
+
rescue StandardError => e
|
|
33
|
+
UnknownEvent.new(['Deserialization failed.', e.message])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# CustomsHandler is responsible for verifying request signatures
|
|
8
|
+
# and parsing incoming customs events into strongly typed objects.
|
|
9
|
+
class CustomsHandler
|
|
10
|
+
include CoreLibrary
|
|
11
|
+
# Creates a new instance of the CustomsHandler.
|
|
12
|
+
def initialize; end
|
|
13
|
+
|
|
14
|
+
# Parse the event.
|
|
15
|
+
#
|
|
16
|
+
# @param [Rack::Request] request The incoming HTTP request containing the event payload.
|
|
17
|
+
# @return[CustomsDeclarationWebhookCallback, UnknownEvent]
|
|
18
|
+
# CustomsDeclarationWebhookCallback for successful parsing;
|
|
19
|
+
#
|
|
20
|
+
# UnknownEvent for unknown events.
|
|
21
|
+
def parse_event(request)
|
|
22
|
+
return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash)
|
|
23
|
+
|
|
24
|
+
raw_body = RackRequestHelper.read_raw_body(request)
|
|
25
|
+
return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
|
|
26
|
+
|
|
27
|
+
# Deserialize payload
|
|
28
|
+
begin
|
|
29
|
+
union = UnionTypeLookUp.get(:Customs)
|
|
30
|
+
raw = RackRequestHelper.read_raw_body(request)
|
|
31
|
+
APIHelper.deserialize_union_type(union, raw, false, true)
|
|
32
|
+
rescue StandardError => e
|
|
33
|
+
UnknownEvent.new(['Deserialization failed.', e.message])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# RefundHandler is responsible for verifying request signatures
|
|
8
|
+
# and parsing incoming refund events into strongly typed objects.
|
|
9
|
+
class RefundHandler
|
|
10
|
+
include CoreLibrary
|
|
11
|
+
# Creates a new instance of the RefundHandler.
|
|
12
|
+
def initialize; end
|
|
13
|
+
|
|
14
|
+
# Parse the event.
|
|
15
|
+
#
|
|
16
|
+
# @param [Rack::Request] request The incoming HTTP request containing the event payload.
|
|
17
|
+
# @return[RefundWebhookCallback, UnknownEvent]
|
|
18
|
+
# RefundWebhookCallback for successful parsing;
|
|
19
|
+
# UnknownEvent for
|
|
20
|
+
# unknown events.
|
|
21
|
+
def parse_event(request)
|
|
22
|
+
return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash)
|
|
23
|
+
|
|
24
|
+
raw_body = RackRequestHelper.read_raw_body(request)
|
|
25
|
+
return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
|
|
26
|
+
|
|
27
|
+
# Deserialize payload
|
|
28
|
+
begin
|
|
29
|
+
union = UnionTypeLookUp.get(:Refund)
|
|
30
|
+
raw = RackRequestHelper.read_raw_body(request)
|
|
31
|
+
APIHelper.deserialize_union_type(union, raw, false, true)
|
|
32
|
+
rescue StandardError => e
|
|
33
|
+
UnknownEvent.new(['Deserialization failed.', e.message])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# SubscriptionHandler is responsible for verifying request signatures
|
|
8
|
+
# and parsing incoming subscription events into strongly typed objects.
|
|
9
|
+
class SubscriptionHandler
|
|
10
|
+
include CoreLibrary
|
|
11
|
+
# Creates a new instance of the SubscriptionHandler.
|
|
12
|
+
def initialize; end
|
|
13
|
+
|
|
14
|
+
# Parse the event.
|
|
15
|
+
#
|
|
16
|
+
# @param [Rack::Request] request The incoming HTTP request containing the event payload.
|
|
17
|
+
# @return[SubscriptionWebhookEvent, UnknownEvent]
|
|
18
|
+
# SubscriptionWebhookEvent for successful parsing;
|
|
19
|
+
# UnknownEvent for
|
|
20
|
+
# unknown events.
|
|
21
|
+
def parse_event(request)
|
|
22
|
+
return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash)
|
|
23
|
+
|
|
24
|
+
raw_body = RackRequestHelper.read_raw_body(request)
|
|
25
|
+
return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
|
|
26
|
+
|
|
27
|
+
# Deserialize payload
|
|
28
|
+
begin
|
|
29
|
+
union = UnionTypeLookUp.get(:Subscription)
|
|
30
|
+
raw = RackRequestHelper.read_raw_body(request)
|
|
31
|
+
APIHelper.deserialize_union_type(union, raw, false, true)
|
|
32
|
+
rescue StandardError => e
|
|
33
|
+
UnknownEvent.new(['Deserialization failed.', e.message])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# TokenHandler is responsible for verifying request signatures
|
|
8
|
+
# and parsing incoming token events into strongly typed objects.
|
|
9
|
+
class TokenHandler
|
|
10
|
+
include CoreLibrary
|
|
11
|
+
# Creates a new instance of the TokenHandler.
|
|
12
|
+
def initialize; end
|
|
13
|
+
|
|
14
|
+
# Parse the event.
|
|
15
|
+
#
|
|
16
|
+
# @param [Rack::Request] request The incoming HTTP request containing the event payload.
|
|
17
|
+
# @return[TokenWebhookEvent, UnknownEvent]
|
|
18
|
+
# TokenWebhookEvent for successful parsing;
|
|
19
|
+
# UnknownEvent for unknown
|
|
20
|
+
# events.
|
|
21
|
+
def parse_event(request)
|
|
22
|
+
return UnknownEvent.new(['Invalid request env.']) unless request.respond_to?(:env) && request.env.is_a?(Hash)
|
|
23
|
+
|
|
24
|
+
raw_body = RackRequestHelper.read_raw_body(request)
|
|
25
|
+
return UnknownEvent.new(['Invalid request body.']) if raw_body.nil? || raw_body.empty?
|
|
26
|
+
|
|
27
|
+
# Deserialize payload
|
|
28
|
+
begin
|
|
29
|
+
union = UnionTypeLookUp.get(:Token)
|
|
30
|
+
raw = RackRequestHelper.read_raw_body(request)
|
|
31
|
+
APIHelper.deserialize_union_type(union, raw, false, true)
|
|
32
|
+
rescue StandardError => e
|
|
33
|
+
UnknownEvent.new(['Deserialization failed.', e.message])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# univapay_client_sdk
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated for Univapay
|
|
4
|
+
# by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module UnivapayClientSdk
|
|
7
|
+
# Standard API error response payload.
|
|
8
|
+
class ApiErrorException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Always returns 'error'.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_reader :status
|
|
15
|
+
|
|
16
|
+
# API Request Error Codes.
|
|
17
|
+
# | HTTP | Error Code | Description |
|
|
18
|
+
# | :--- | :--- | :--- |
|
|
19
|
+
# | 400 | ALREADY_CAPTURED | The target charge is already captured or
|
|
20
|
+
# authorization is incomplete. |
|
|
21
|
+
# | 400 | AUTH_NOT_SUPPORTED | The configured gateway does not support
|
|
22
|
+
# authorization. |
|
|
23
|
+
# | 400 | CANCEL_NOT_ALLOWED | This payment method does not support
|
|
24
|
+
# cancellation, or the charge status cannot be canceled. |
|
|
25
|
+
# | 400 | CANNOT_CHANGE_CANCELED_SUBSCRIPTION | A canceled subscription
|
|
26
|
+
# cannot be modified. |
|
|
27
|
+
# | 400 | CANNOT_CHANGE_TOKEN | The transaction token for a subscription in
|
|
28
|
+
# this state cannot be changed. |
|
|
29
|
+
# | 400 | CANNOT_REFUND_UNSUCCESSFUL_CHARGE | Charges in a state other than
|
|
30
|
+
# 'successful' cannot be refunded. |
|
|
31
|
+
# | 400 | CAPTURE_AMOUNT_TOO_LARGE | The capture amount exceeds the
|
|
32
|
+
# authorized amount. |
|
|
33
|
+
# | 400 | CARD_BRAND_NOT_SUPPORTED | The configured gateway does not support
|
|
34
|
+
# the specified card brand. |
|
|
35
|
+
# | 400 | CARD_COUNTRY_NOT_SUPPORTED | The configured gateway does not
|
|
36
|
+
# support the specified card issuing country. |
|
|
37
|
+
# | 400 | CARD_PROCESSING_DISABLED | Card processing is disabled for this
|
|
38
|
+
# payment method. |
|
|
39
|
+
# | 400 | CHARGE_TOO_QUICK | Attempted to create multiple charges with the
|
|
40
|
+
# same amount within 30 seconds for the same card or recurring token. |
|
|
41
|
+
# | 400 | CONVENIENCE_PROCESSING_DISABLED | Konbini processing is disabled
|
|
42
|
+
# for this payment method. |
|
|
43
|
+
# | 400 | CURRENCY_MUST_MATCH_CHARGE | The refund currency must match the
|
|
44
|
+
# original charge currency. |
|
|
45
|
+
# | 400 | CVV_REQUIRED | CVV is required. |
|
|
46
|
+
# | 400 | CVV_AUTHORIZATION_NOT_COMPLETED | CVV authorization failed. |
|
|
47
|
+
# | 400 | FILE_INVALID_TYPE | The uploaded file has an incorrect MIME type.
|
|
48
|
+
# |
|
|
49
|
+
# | 400 | FILE_MAX_SIZE_EXCEEDED | The uploaded file size is too large. |
|
|
50
|
+
# | 400 | FORBIDDEN_IP | The country determined by the request's IP address
|
|
51
|
+
# is not permitted. |
|
|
52
|
+
# | 400 | INSTALLMENT_MAX_PAYOUT_PERIOD_EXCEEDED | The installment payment
|
|
53
|
+
# period exceeds the maximum allowed period. |
|
|
54
|
+
# | 400 | INSTALLMENT_PAYMENT_TYPE_NOT_ALLOWED_FOR_PLAN | The payment method
|
|
55
|
+
# is not allowed for this installment plan. |
|
|
56
|
+
# | 400 | INSTALLMENT_INVALID_CYCLES_COUNT | The number of installment
|
|
57
|
+
# cycles is unavailable. |
|
|
58
|
+
# | 400 | INSTALLMENT_INVALID_PLAN | Unsupported installment plan. |
|
|
59
|
+
# | 400 | INVALID_PLATFORM | Invalid platform specified. |
|
|
60
|
+
# | 400 | INVALID_TOKEN_TYPE | Invalid transaction token type. |
|
|
61
|
+
# | 400 | INVALID_QR_SCAN_GATEWAY | The QR code scanning gateway is not
|
|
62
|
+
# configured or not active. |
|
|
63
|
+
# | 400 | LAST_NAME_REQUIRED | A space-separated last name is required for
|
|
64
|
+
# the cardholder. |
|
|
65
|
+
# | 400 | LIVE_MODE_NOT_ENABLED_WHEN_UNVERIFIED | Account review must be
|
|
66
|
+
# completed to use live mode. |
|
|
67
|
+
# | 400 | NO_DIRECT_CURRENCY_GATEWAY | No gateway available to process the
|
|
68
|
+
# payment without currency conversion. |
|
|
69
|
+
# | 400 | NO_GATEWAYS_AVAILABLE | No available gateways found. |
|
|
70
|
+
# | 400 | NO_TEST_CARD_IN_LIVE_MODE | Test cards cannot be used in live
|
|
71
|
+
# mode. |
|
|
72
|
+
# | 400 | NON_SUBSCRIPTION_PAYMENT | Please specify a one-time token or
|
|
73
|
+
# recurring token to create a charge. |
|
|
74
|
+
# | 400 | NOT_ONE_TIME_TOKEN | Only one-time tokens are supported. |
|
|
75
|
+
# | 400 | NOT_SUBSCRIPTION_TOKEN | Please specify a subscription or
|
|
76
|
+
# recurring token. |
|
|
77
|
+
# | 400 | PARTIAL_CAPTURE_NOT_SUPPORTED | Partial capture is not supported.
|
|
78
|
+
# |
|
|
79
|
+
# | 400 | PAYMENT_EXPIRATION_EXCEEDS_PERIOD | Payment expiration date
|
|
80
|
+
# exceeds the allowed cycle. |
|
|
81
|
+
# | 400 | PROCESSING_MODE_MISMATCH | Application token and transaction token
|
|
82
|
+
# modes do not match (e.g., live vs. test). |
|
|
83
|
+
# | 400 | QR_PROCESSING_DISABLED | QR processing is disabled for this
|
|
84
|
+
# payment method. |
|
|
85
|
+
# | 400 | RECURRING_TOKEN_DISABLED | Transaction token is disabled or the
|
|
86
|
+
# account lacks permission to use recurring tokens. |
|
|
87
|
+
# | 400 | RECURRING_USAGE_LIMIT_REQUIRED | The `usage_limit` parameter is
|
|
88
|
+
# required. |
|
|
89
|
+
# | 400 | RECURRING_USAGE_REQUIRES_CVV | CVV is required for recurring
|
|
90
|
+
# usage. |
|
|
91
|
+
# | 400 | REFUND_EXCEEDS_CHARGE_AMOUNT | The refund amount exceeds the
|
|
92
|
+
# charge amount. |
|
|
93
|
+
# | 400 | REFUND_NOT_ALLOWED | The payment method does not support refunds,
|
|
94
|
+
# or the refund was declined. |
|
|
95
|
+
# | 400 | REFUND_EXCEEDS_SALES | The refund amount exceeds the merchant's
|
|
96
|
+
# available balance limit. |
|
|
97
|
+
# | 400 | REFUND_NOT_WITHIN_BOUNDS | The combined partial refund amounts
|
|
98
|
+
# exceed the total charge amount. |
|
|
99
|
+
# | 400 | RESOURCE_LIMIT_REACHED | Resource limit reached. |
|
|
100
|
+
# | 400 | SUBSCRIPTION_ALREADY_ENDED | The subscription has already ended. |
|
|
101
|
+
# | 400 | TOKEN_FOR_WRONG_STORE | The transaction token's store differs from
|
|
102
|
+
# the subscription's store. |
|
|
103
|
+
# | 400 | TRANSACTION_ALREADY_PROCESSED | Used transaction tokens cannot be
|
|
104
|
+
# specified again. |
|
|
105
|
+
# | 400 | TRANSACTION_TOKEN_EXPIRED | The transaction token has expired. |
|
|
106
|
+
# | 400 | USAGE_LIMIT_NOT_APPLICABLE | `usage_limit` cannot be specified
|
|
107
|
+
# here. |
|
|
108
|
+
# | 400 | VALIDATION_ERROR | There is a validation error in the request
|
|
109
|
+
# parameters. Check `errors` for details. |
|
|
110
|
+
# | 400 | CHARGE_AMOUNT_TOO_HIGH | The charge amount exceeds the maximum
|
|
111
|
+
# allowed limit. |
|
|
112
|
+
# | 400 | NOT_SUPPORTED_BY_PROCESSOR | The gateway does not support this
|
|
113
|
+
# request. |
|
|
114
|
+
# | 401 | AUTH_HEADER_MISSING | The `Authorization` header is missing. |
|
|
115
|
+
# | 401 | EXPIRED_LOGIN_TOKEN | The login token has expired. |
|
|
116
|
+
# | 401 | INVALID_APP_TOKEN | The specified application token is invalid. |
|
|
117
|
+
# | 401 | INVALID_CREDENTIALS | Authentication credentials are invalid. |
|
|
118
|
+
# | 401 | INVALID_DOMAIN | The requested `Origin` domain is not registered
|
|
119
|
+
# for the specified application token. |
|
|
120
|
+
# | 401 | INVALID_LOGIN_TOKEN | The login token is invalid. |
|
|
121
|
+
# | 401 | DIRECT_CARD_TOKEN_CREATION_DISABLED | Cannot send raw card data
|
|
122
|
+
# due to lack of PCI DSS compliance. |
|
|
123
|
+
# | 403 | CARD_LOCKED | This card is temporarily locked due to exceeding the
|
|
124
|
+
# failure threshold within a certain period. |
|
|
125
|
+
# | 403 | INVALID_PERMISSIONS | The application token type is incorrect or
|
|
126
|
+
# the account lacks sufficient permissions. |
|
|
127
|
+
# | 403 | INSTALLMENT_PROCESSOR_INITIAL_AMOUNTS_NOT_SUPPORTED | Initial
|
|
128
|
+
# installment amount specification is not supported by this gateway. |
|
|
129
|
+
# | 403 | OUTDATED_APP_TOKEN | Application token version is outdated. Please
|
|
130
|
+
# create a new one. |
|
|
131
|
+
# | 403 | TEST_CARD_CANNOT_BE_BANNED | Test cards cannot be banned. |
|
|
132
|
+
# | 403 | INSTALLMENTS_NOT_ENABLED | Installment payments are not enabled. |
|
|
133
|
+
# | 409 | IDEMPOTENCY_KEY_CONFLICT | The specified idempotency key has been
|
|
134
|
+
# used previously for a different request. |
|
|
135
|
+
# | 409 | NON_UNIQUE_ACTIVE_TOKEN | An active transaction token already
|
|
136
|
+
# exists. |
|
|
137
|
+
# | 409 | WEBHOOK_URL_EXISTS | The specified Webhook URL is already
|
|
138
|
+
# registered. |
|
|
139
|
+
# | 500 | COULD_NOT_REFRESH_AUTH | Failed to refresh the login token. |
|
|
140
|
+
# | 500 | DB_ERROR | Internal database error. |
|
|
141
|
+
# | 500 | FILE_UPLOAD_ERROR | File upload failed. |
|
|
142
|
+
# | 500 | IMPROPER_AUTH | Authorization state is improper. |
|
|
143
|
+
# | 500 | TIMEOUT | A timeout occurred during internal processing. |
|
|
144
|
+
# | 500 | UNABLE_TO_GET_IDEMPOTENT_RESULT | Cache found for idempotency key,
|
|
145
|
+
# but failed to retrieve the previous processing result. |
|
|
146
|
+
# | 500 | UNKNOWN_ERROR | An unexpected error occurred. |
|
|
147
|
+
# | 503 | SERVICE_UNAVAILABLE_TRY_AGAIN | Service is temporarily
|
|
148
|
+
# unavailable. Please try again later. |
|
|
149
|
+
# | 504 | NO_GATEWAY_AVAILABLE_TO_PROCESS_THE_REQUEST | This request is not
|
|
150
|
+
# supported by the connected gateway system. |
|
|
151
|
+
# @return [String]
|
|
152
|
+
attr_accessor :code
|
|
153
|
+
|
|
154
|
+
# List of detailed API errors.
|
|
155
|
+
# @return [Array[ApiErrorDetail]]
|
|
156
|
+
attr_accessor :errors
|
|
157
|
+
|
|
158
|
+
# The constructor.
|
|
159
|
+
# @param [String] reason The reason for raising an exception.
|
|
160
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
161
|
+
def initialize(reason, response)
|
|
162
|
+
super(reason, response)
|
|
163
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
164
|
+
unbox(hash)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Populates this object by extracting properties from a hash.
|
|
168
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
169
|
+
# response body.
|
|
170
|
+
def unbox(hash)
|
|
171
|
+
return nil unless hash
|
|
172
|
+
|
|
173
|
+
@code = hash.key?('code') ? hash['code'] : nil
|
|
174
|
+
# Parameter is an array, so we need to iterate through it
|
|
175
|
+
@errors = nil
|
|
176
|
+
unless hash['errors'].nil?
|
|
177
|
+
@errors = []
|
|
178
|
+
hash['errors'].each do |structure|
|
|
179
|
+
@errors << (ApiErrorDetail.from_hash(structure) if structure)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
@errors = SKIP unless hash.key?('errors')
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Provides a human-readable string representation of the object.
|
|
187
|
+
def to_s
|
|
188
|
+
class_name = self.class.name.split('::').last
|
|
189
|
+
"<#{class_name} status: #{@status}, code: #{@code}, errors: #{@errors}>"
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
193
|
+
def inspect
|
|
194
|
+
class_name = self.class.name.split('::').last
|
|
195
|
+
"<#{class_name} status: #{@status.inspect}, code: #{@code.inspect}, errors:"\
|
|
196
|
+
" #{@errors.inspect}>"
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|