bk-apimatic-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 +203 -0
- data/bin/console +15 -0
- data/lib/boku_direct_payments_api/api_helper.rb +10 -0
- data/lib/boku_direct_payments_api/client.rb +99 -0
- data/lib/boku_direct_payments_api/configuration.rb +168 -0
- data/lib/boku_direct_payments_api/controllers/account_resources_controller.rb +45 -0
- data/lib/boku_direct_payments_api/controllers/base_controller.rb +60 -0
- data/lib/boku_direct_payments_api/controllers/charge_controller.rb +247 -0
- data/lib/boku_direct_payments_api/controllers/config_resources_controller.rb +50 -0
- data/lib/boku_direct_payments_api/controllers/consumer_registration_controller.rb +428 -0
- data/lib/boku_direct_payments_api/controllers/forex_controller.rb +38 -0
- data/lib/boku_direct_payments_api/controllers/fund_check_controller.rb +39 -0
- data/lib/boku_direct_payments_api/controllers/refund_controller.rb +80 -0
- data/lib/boku_direct_payments_api/controllers/seller_of_record_controller.rb +69 -0
- data/lib/boku_direct_payments_api/exceptions/api_exception.rb +21 -0
- data/lib/boku_direct_payments_api/http/http_call_back.rb +10 -0
- data/lib/boku_direct_payments_api/http/http_method_enum.rb +10 -0
- data/lib/boku_direct_payments_api/http/http_request.rb +10 -0
- data/lib/boku_direct_payments_api/http/http_response.rb +10 -0
- data/lib/boku_direct_payments_api/http/proxy_settings.rb +22 -0
- data/lib/boku_direct_payments_api/models/account_profile.rb +122 -0
- data/lib/boku_direct_payments_api/models/account_profile_attribute.rb +90 -0
- data/lib/boku_direct_payments_api/models/account_profile_request.rb +131 -0
- data/lib/boku_direct_payments_api/models/account_profile_response.rb +104 -0
- data/lib/boku_direct_payments_api/models/account_profile_response_record.rb +142 -0
- data/lib/boku_direct_payments_api/models/account_profile_result_status_enum.rb +47 -0
- data/lib/boku_direct_payments_api/models/account_profile_selector.rb +132 -0
- data/lib/boku_direct_payments_api/models/base_model.rb +110 -0
- data/lib/boku_direct_payments_api/models/begin_single_charge_request.rb +360 -0
- data/lib/boku_direct_payments_api/models/begin_single_charge_request_hosted.rb +110 -0
- data/lib/boku_direct_payments_api/models/begin_single_charge_request_qr_info.rb +74 -0
- data/lib/boku_direct_payments_api/models/begin_single_charge_response.rb +254 -0
- data/lib/boku_direct_payments_api/models/begin_single_charge_response_hosted.rb +90 -0
- data/lib/boku_direct_payments_api/models/begin_single_charge_response_qr_info.rb +85 -0
- data/lib/boku_direct_payments_api/models/business_details.rb +209 -0
- data/lib/boku_direct_payments_api/models/cancel_optin_request.rb +123 -0
- data/lib/boku_direct_payments_api/models/cancel_optin_response.rb +143 -0
- data/lib/boku_direct_payments_api/models/carrier_gw.rb +82 -0
- data/lib/boku_direct_payments_api/models/charge.rb +288 -0
- data/lib/boku_direct_payments_api/models/charge_msisdn_request.rb +233 -0
- data/lib/boku_direct_payments_api/models/charge_plus_optin_request.rb +390 -0
- data/lib/boku_direct_payments_api/models/charge_plus_optin_request_hosted.rb +96 -0
- data/lib/boku_direct_payments_api/models/charge_plus_optin_response.rb +278 -0
- data/lib/boku_direct_payments_api/models/charge_plus_optin_response_hosted.rb +75 -0
- data/lib/boku_direct_payments_api/models/charge_request.rb +332 -0
- data/lib/boku_direct_payments_api/models/charge_response.rb +253 -0
- data/lib/boku_direct_payments_api/models/charge_status_enum.rb +43 -0
- data/lib/boku_direct_payments_api/models/check_eligibility_request.rb +117 -0
- data/lib/boku_direct_payments_api/models/check_eligibility_response.rb +116 -0
- data/lib/boku_direct_payments_api/models/client_call.rb +91 -0
- data/lib/boku_direct_payments_api/models/confirm_optin_request.rb +141 -0
- data/lib/boku_direct_payments_api/models/confirm_optin_response.rb +211 -0
- data/lib/boku_direct_payments_api/models/confirm_verify_device_request.rb +161 -0
- data/lib/boku_direct_payments_api/models/confirm_verify_device_response.rb +137 -0
- data/lib/boku_direct_payments_api/models/eligibility_status_enum.rb +40 -0
- data/lib/boku_direct_payments_api/models/forex_request.rb +97 -0
- data/lib/boku_direct_payments_api/models/forex_response.rb +127 -0
- data/lib/boku_direct_payments_api/models/fund_check_request.rb +132 -0
- data/lib/boku_direct_payments_api/models/fund_check_response.rb +89 -0
- data/lib/boku_direct_payments_api/models/invalid_request_field.rb +93 -0
- data/lib/boku_direct_payments_api/models/mandate_constraint.rb +92 -0
- data/lib/boku_direct_payments_api/models/mandate_period_enum.rb +48 -0
- data/lib/boku_direct_payments_api/models/mcc_mnc_mapping.rb +85 -0
- data/lib/boku_direct_payments_api/models/method_enum.rb +36 -0
- data/lib/boku_direct_payments_api/models/msisdn_network_request.rb +97 -0
- data/lib/boku_direct_payments_api/models/msisdn_network_response.rb +116 -0
- data/lib/boku_direct_payments_api/models/network_info.rb +84 -0
- data/lib/boku_direct_payments_api/models/network_info_network.rb +168 -0
- data/lib/boku_direct_payments_api/models/optin_accept_networks.rb +87 -0
- data/lib/boku_direct_payments_api/models/optin_info.rb +99 -0
- data/lib/boku_direct_payments_api/models/optin_info_optin_network.rb +104 -0
- data/lib/boku_direct_payments_api/models/optin_info_optin_types.rb +128 -0
- data/lib/boku_direct_payments_api/models/optin_network.rb +115 -0
- data/lib/boku_direct_payments_api/models/optin_purpose_enum.rb +62 -0
- data/lib/boku_direct_payments_api/models/optin_request.rb +338 -0
- data/lib/boku_direct_payments_api/models/optin_request_hosted.rb +110 -0
- data/lib/boku_direct_payments_api/models/optin_request_qr_info.rb +75 -0
- data/lib/boku_direct_payments_api/models/optin_response.rb +220 -0
- data/lib/boku_direct_payments_api/models/optin_response_hosted.rb +87 -0
- data/lib/boku_direct_payments_api/models/optin_response_qr_info.rb +85 -0
- data/lib/boku_direct_payments_api/models/optin_state.rb +164 -0
- data/lib/boku_direct_payments_api/models/optin_status_enum.rb +51 -0
- data/lib/boku_direct_payments_api/models/optin_terms.rb +214 -0
- data/lib/boku_direct_payments_api/models/optin_type_enum.rb +45 -0
- data/lib/boku_direct_payments_api/models/payment_method_status_enum.rb +44 -0
- data/lib/boku_direct_payments_api/models/period.rb +89 -0
- data/lib/boku_direct_payments_api/models/period_unit_enum.rb +46 -0
- data/lib/boku_direct_payments_api/models/query_charge_request.rb +149 -0
- data/lib/boku_direct_payments_api/models/query_charge_response.rb +101 -0
- data/lib/boku_direct_payments_api/models/query_optin_request.rb +104 -0
- data/lib/boku_direct_payments_api/models/query_optin_response.rb +129 -0
- data/lib/boku_direct_payments_api/models/query_refund_request.rb +122 -0
- data/lib/boku_direct_payments_api/models/query_refund_response.rb +101 -0
- data/lib/boku_direct_payments_api/models/refund.rb +249 -0
- data/lib/boku_direct_payments_api/models/refund_charge_notification.rb +88 -0
- data/lib/boku_direct_payments_api/models/refund_charge_request.rb +231 -0
- data/lib/boku_direct_payments_api/models/refund_charge_response.rb +203 -0
- data/lib/boku_direct_payments_api/models/refund_status_enum.rb +43 -0
- data/lib/boku_direct_payments_api/models/refund_type_enum.rb +36 -0
- data/lib/boku_direct_payments_api/models/register_payment_method_request.rb +152 -0
- data/lib/boku_direct_payments_api/models/register_payment_method_response.rb +172 -0
- data/lib/boku_direct_payments_api/models/register_seller_of_record_request.rb +118 -0
- data/lib/boku_direct_payments_api/models/register_seller_of_record_response.rb +156 -0
- data/lib/boku_direct_payments_api/models/resend_otp_request.rb +167 -0
- data/lib/boku_direct_payments_api/models/resend_otp_response.rb +118 -0
- data/lib/boku_direct_payments_api/models/result.rb +154 -0
- data/lib/boku_direct_payments_api/models/result_status_enum.rb +36 -0
- data/lib/boku_direct_payments_api/models/reversal.rb +89 -0
- data/lib/boku_direct_payments_api/models/reverse_charge_request.rb +104 -0
- data/lib/boku_direct_payments_api/models/reverse_charge_response.rb +157 -0
- data/lib/boku_direct_payments_api/models/seller_of_record.rb +76 -0
- data/lib/boku_direct_payments_api/models/seller_of_record_status_enum.rb +44 -0
- data/lib/boku_direct_payments_api/models/send_sms.rb +89 -0
- data/lib/boku_direct_payments_api/models/settlement.rb +126 -0
- data/lib/boku_direct_payments_api/models/silent_mo.rb +78 -0
- data/lib/boku_direct_payments_api/models/status_enum.rb +40 -0
- data/lib/boku_direct_payments_api/models/subscription.rb +105 -0
- data/lib/boku_direct_payments_api/models/timeout.rb +75 -0
- data/lib/boku_direct_payments_api/models/type_enum.rb +36 -0
- data/lib/boku_direct_payments_api/models/validate_optin_request.rb +179 -0
- data/lib/boku_direct_payments_api/models/validate_optin_response.rb +195 -0
- data/lib/boku_direct_payments_api/models/verify_device_request.rb +135 -0
- data/lib/boku_direct_payments_api/models/verify_device_response.rb +137 -0
- data/lib/boku_direct_payments_api/utilities/date_time_helper.rb +11 -0
- data/lib/boku_direct_payments_api/utilities/file_wrapper.rb +28 -0
- data/lib/boku_direct_payments_api/utilities/xml_utilities.rb +12 -0
- data/lib/boku_direct_payments_api.rb +166 -0
- data/test/controllers/controller_test_base.rb +23 -0
- data/test/controllers/test_account_resources_controller.rb +44 -0
- data/test/controllers/test_charge_controller.rb +159 -0
- data/test/controllers/test_config_resources_controller.rb +47 -0
- data/test/controllers/test_consumer_registration_controller.rb +262 -0
- data/test/controllers/test_forex_controller.rb +40 -0
- data/test/controllers/test_fund_check_controller.rb +41 -0
- data/test/controllers/test_refund_controller.rb +76 -0
- data/test/controllers/test_seller_of_record_controller.rb +72 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +255 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# boku_direct_payments_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module BokuDirectPaymentsApi
|
|
7
|
+
# The status of the operation
|
|
8
|
+
class AccountProfileResultStatusEnum
|
|
9
|
+
ACCOUNT_PROFILE_RESULT_STATUS_ENUM = [
|
|
10
|
+
# The account profile was retrieved successfully
|
|
11
|
+
OK = 'ok'.freeze,
|
|
12
|
+
|
|
13
|
+
# The record identified corresponds to an account whose identity has not
|
|
14
|
+
# yet been confirmed, or has not yet agreed to have profile information
|
|
15
|
+
# queried.
|
|
16
|
+
NOTFOUND = 'not-found'.freeze,
|
|
17
|
+
|
|
18
|
+
# The account profile was retrieved successfully
|
|
19
|
+
NOTAUTHORIZED = 'not-authorized'.freeze,
|
|
20
|
+
|
|
21
|
+
# An unspecified error occurred while fetching profile information for
|
|
22
|
+
# this record
|
|
23
|
+
ERROR = 'error'.freeze
|
|
24
|
+
].freeze
|
|
25
|
+
|
|
26
|
+
def self.validate(value)
|
|
27
|
+
return false if value.nil?
|
|
28
|
+
|
|
29
|
+
ACCOUNT_PROFILE_RESULT_STATUS_ENUM.include?(value)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.from_value(value, default_value = OK)
|
|
33
|
+
return default_value if value.nil?
|
|
34
|
+
|
|
35
|
+
str = value.to_s.strip
|
|
36
|
+
|
|
37
|
+
case str.downcase
|
|
38
|
+
when 'ok' then OK
|
|
39
|
+
when 'notfound' then NOTFOUND
|
|
40
|
+
when 'notauthorized' then NOTAUTHORIZED
|
|
41
|
+
when 'error' then ERROR
|
|
42
|
+
else
|
|
43
|
+
default_value
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# boku_direct_payments_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module BokuDirectPaymentsApi
|
|
7
|
+
# Account Profile Selector - General elements
|
|
8
|
+
class AccountProfileSelector < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Issuer's charge token.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :acr
|
|
15
|
+
|
|
16
|
+
# Merchant-assigned unique opt-in ID.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :merchant_optin_id
|
|
19
|
+
|
|
20
|
+
# Consumer's mobile phone number normalized into international MSISDN
|
|
21
|
+
# format: country code + mobile phone number
|
|
22
|
+
# @return [String]
|
|
23
|
+
attr_accessor :msisdn
|
|
24
|
+
|
|
25
|
+
# Carrier payment method's Network ID.
|
|
26
|
+
# @return [String]
|
|
27
|
+
attr_accessor :network_id
|
|
28
|
+
|
|
29
|
+
# Boku-assigned unique opt-in ID.
|
|
30
|
+
# @return [String]
|
|
31
|
+
attr_accessor :optin_id
|
|
32
|
+
|
|
33
|
+
# A mapping from model property names to API property names.
|
|
34
|
+
def self.names
|
|
35
|
+
@_hash = {} if @_hash.nil?
|
|
36
|
+
@_hash['acr'] = 'acr'
|
|
37
|
+
@_hash['merchant_optin_id'] = 'merchant-optin-id'
|
|
38
|
+
@_hash['msisdn'] = 'msisdn'
|
|
39
|
+
@_hash['network_id'] = 'network-id'
|
|
40
|
+
@_hash['optin_id'] = 'optin-id'
|
|
41
|
+
@_hash
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# An array for optional fields
|
|
45
|
+
def self.optionals
|
|
46
|
+
%w[
|
|
47
|
+
acr
|
|
48
|
+
merchant_optin_id
|
|
49
|
+
msisdn
|
|
50
|
+
network_id
|
|
51
|
+
optin_id
|
|
52
|
+
]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# An array for nullable fields
|
|
56
|
+
def self.nullables
|
|
57
|
+
[]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def initialize(acr = SKIP, merchant_optin_id = SKIP, msisdn = SKIP,
|
|
61
|
+
network_id = SKIP, optin_id = SKIP)
|
|
62
|
+
@acr = acr unless acr == SKIP
|
|
63
|
+
@merchant_optin_id = merchant_optin_id unless merchant_optin_id == SKIP
|
|
64
|
+
@msisdn = msisdn unless msisdn == SKIP
|
|
65
|
+
@network_id = network_id unless network_id == SKIP
|
|
66
|
+
@optin_id = optin_id unless optin_id == SKIP
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Creates an instance of the object from a hash.
|
|
70
|
+
def self.from_hash(hash)
|
|
71
|
+
return nil unless hash
|
|
72
|
+
|
|
73
|
+
# Extract variables from the hash.
|
|
74
|
+
acr = hash.key?('acr') ? hash['acr'] : SKIP
|
|
75
|
+
merchant_optin_id =
|
|
76
|
+
hash.key?('merchant-optin-id') ? hash['merchant-optin-id'] : SKIP
|
|
77
|
+
msisdn = hash.key?('msisdn') ? hash['msisdn'] : SKIP
|
|
78
|
+
network_id = hash.key?('network-id') ? hash['network-id'] : SKIP
|
|
79
|
+
optin_id = hash.key?('optin-id') ? hash['optin-id'] : SKIP
|
|
80
|
+
|
|
81
|
+
# Create object from extracted values.
|
|
82
|
+
AccountProfileSelector.new(acr,
|
|
83
|
+
merchant_optin_id,
|
|
84
|
+
msisdn,
|
|
85
|
+
network_id,
|
|
86
|
+
optin_id)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def self.from_element(root)
|
|
90
|
+
acr = XmlUtilities.from_attribute(root, 'acr', String)
|
|
91
|
+
merchant_optin_id = XmlUtilities.from_element(root, 'merchant-optin-id',
|
|
92
|
+
String)
|
|
93
|
+
msisdn = XmlUtilities.from_attribute(root, 'msisdn', String)
|
|
94
|
+
network_id = XmlUtilities.from_attribute(root, 'network-id', String)
|
|
95
|
+
optin_id = XmlUtilities.from_attribute(root, 'optin-id', String)
|
|
96
|
+
|
|
97
|
+
new(acr,
|
|
98
|
+
merchant_optin_id,
|
|
99
|
+
msisdn,
|
|
100
|
+
network_id,
|
|
101
|
+
optin_id)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def to_xml_element(doc, root_name)
|
|
105
|
+
root = doc.create_element(root_name)
|
|
106
|
+
|
|
107
|
+
XmlUtilities.add_as_attribute(root, 'acr', acr)
|
|
108
|
+
XmlUtilities.add_as_subelement(doc, root, 'merchant-optin-id',
|
|
109
|
+
merchant_optin_id)
|
|
110
|
+
XmlUtilities.add_as_attribute(root, 'msisdn', msisdn)
|
|
111
|
+
XmlUtilities.add_as_attribute(root, 'network-id', network_id)
|
|
112
|
+
XmlUtilities.add_as_attribute(root, 'optin-id', optin_id)
|
|
113
|
+
|
|
114
|
+
root
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Provides a human-readable string representation of the object.
|
|
118
|
+
def to_s
|
|
119
|
+
class_name = self.class.name.split('::').last
|
|
120
|
+
"<#{class_name} acr: #{@acr}, merchant_optin_id: #{@merchant_optin_id}, msisdn: #{@msisdn},"\
|
|
121
|
+
" network_id: #{@network_id}, optin_id: #{@optin_id}>"
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
125
|
+
def inspect
|
|
126
|
+
class_name = self.class.name.split('::').last
|
|
127
|
+
"<#{class_name} acr: #{@acr.inspect}, merchant_optin_id: #{@merchant_optin_id.inspect},"\
|
|
128
|
+
" msisdn: #{@msisdn.inspect}, network_id: #{@network_id.inspect}, optin_id:"\
|
|
129
|
+
" #{@optin_id.inspect}>"
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# boku_direct_payments_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module BokuDirectPaymentsApi
|
|
7
|
+
# Base model.
|
|
8
|
+
# rubocop:disable all
|
|
9
|
+
class BaseModel < CoreLibrary::BaseModel
|
|
10
|
+
# Returns a Hash representation of the current object.
|
|
11
|
+
def to_hash
|
|
12
|
+
# validating the model being serialized
|
|
13
|
+
self.class.validate(self) if self.class.respond_to?(:validate)
|
|
14
|
+
|
|
15
|
+
hash = {}
|
|
16
|
+
instance_variables.each do |name|
|
|
17
|
+
value = instance_variable_get(name)
|
|
18
|
+
name = name[1..]
|
|
19
|
+
if name == 'additional_properties'
|
|
20
|
+
additional_properties = process_additional_properties(value, self.class.names)
|
|
21
|
+
hash.merge!(additional_properties)
|
|
22
|
+
else
|
|
23
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
|
24
|
+
optional_fields = self.class.optionals
|
|
25
|
+
nullable_fields = self.class.nullables
|
|
26
|
+
if value.nil?
|
|
27
|
+
next unless nullable_fields.include?(name)
|
|
28
|
+
|
|
29
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
|
30
|
+
raise ArgumentError,
|
|
31
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
hash[key] = nil
|
|
36
|
+
unless value.nil?
|
|
37
|
+
if respond_to?("to_custom_#{name}")
|
|
38
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
|
39
|
+
params = [hash, key]
|
|
40
|
+
hash[key] = send("to_custom_#{name}", *params)
|
|
41
|
+
else
|
|
42
|
+
hash[key] = send("to_custom_#{name}")
|
|
43
|
+
end
|
|
44
|
+
elsif respond_to?("to_union_type_#{name}")
|
|
45
|
+
hash[key] = send("to_union_type_#{name}")
|
|
46
|
+
elsif value.instance_of? Array
|
|
47
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
48
|
+
elsif value.instance_of? Hash
|
|
49
|
+
hash[key] = {}
|
|
50
|
+
value.each do |k, v|
|
|
51
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
|
52
|
+
end
|
|
53
|
+
else
|
|
54
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
hash
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Processes additional properties, ensuring no conflicts with existing properties.
|
|
63
|
+
def process_additional_properties(additional_properties, existing_prop_names)
|
|
64
|
+
hash = {}
|
|
65
|
+
additional_properties.each do |name, value|
|
|
66
|
+
check_for_conflict(name, existing_prop_names)
|
|
67
|
+
|
|
68
|
+
hash[name] = if value.is_a?(Array)
|
|
69
|
+
process_array(value)
|
|
70
|
+
elsif value.is_a?(Hash)
|
|
71
|
+
process_hash(value)
|
|
72
|
+
else
|
|
73
|
+
process_basic_value(value)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
hash
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Checks if an additional property conflicts with a model's existing property.
|
|
80
|
+
def check_for_conflict(name, existing_prop_names)
|
|
81
|
+
return unless existing_prop_names.key?(name)
|
|
82
|
+
|
|
83
|
+
raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Processes an array of values, recursively calling `to_hash` on BaseModel objects.
|
|
87
|
+
def process_array(value)
|
|
88
|
+
value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
|
|
92
|
+
def process_hash(value)
|
|
93
|
+
value.transform_values do |v|
|
|
94
|
+
v.is_a?(BaseModel) ? v.to_hash : v
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Processes a basic value (non-array, non-hash).
|
|
99
|
+
def process_basic_value(value)
|
|
100
|
+
value.is_a?(BaseModel) ? value.to_hash : value
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Returns a JSON representation of the curent object.
|
|
104
|
+
def to_json(options = {})
|
|
105
|
+
hash = to_hash
|
|
106
|
+
hash.to_json(options)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
# rubocop:enable all
|
|
110
|
+
end
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
# boku_direct_payments_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module BokuDirectPaymentsApi
|
|
7
|
+
# 'begin-single-charge' Request - General Parameters
|
|
8
|
+
class BeginSingleChargeRequest < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Type of charge.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_reader :charge_type
|
|
15
|
+
|
|
16
|
+
# ISO 3166-1 alpha-2 country code.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :country
|
|
19
|
+
|
|
20
|
+
# ISO 4217 three-letter currency code.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :currency
|
|
23
|
+
|
|
24
|
+
# ISO 4217 three-letter currency code.
|
|
25
|
+
# @return [BeginSingleChargeRequestHosted]
|
|
26
|
+
attr_accessor :hosted
|
|
27
|
+
|
|
28
|
+
# Unique identifier for the consumer, assigned by the merchant.
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :merchant_consumer_id
|
|
31
|
+
|
|
32
|
+
# Boku-assigned merchant ID.
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :merchant_id
|
|
35
|
+
|
|
36
|
+
# A description of the purchased item.
|
|
37
|
+
# @return [String]
|
|
38
|
+
attr_accessor :merchant_item_description
|
|
39
|
+
|
|
40
|
+
# Merchant-assigned unique request ID.
|
|
41
|
+
# Multiple requests received with the same merchant-request-id will be
|
|
42
|
+
# handled idempotently within the idempotency window.
|
|
43
|
+
# @return [String]
|
|
44
|
+
attr_accessor :merchant_request_id
|
|
45
|
+
|
|
46
|
+
# Merchant-assigned transaction ID.
|
|
47
|
+
# _***Boku recommends merchants send this ID for future reference.**_
|
|
48
|
+
# @return [String]
|
|
49
|
+
attr_accessor :merchant_transaction_id
|
|
50
|
+
|
|
51
|
+
# The payment method selected by the consumer.
|
|
52
|
+
# Each wallet provider will be its own payment method. A list of available
|
|
53
|
+
# values will be provided on demand.
|
|
54
|
+
# @return [String]
|
|
55
|
+
attr_accessor :payment_method
|
|
56
|
+
|
|
57
|
+
# Total amount to charge, including tax.
|
|
58
|
+
# @return [Float]
|
|
59
|
+
attr_accessor :total_amount
|
|
60
|
+
|
|
61
|
+
# The IP address of the consumer. Helps improve fraud detection by
|
|
62
|
+
# supporting internal risk checks and partner decisions. Supports IPv4 and
|
|
63
|
+
# IPv6 formats.
|
|
64
|
+
# @return [String]
|
|
65
|
+
attr_accessor :consumer_ip_address
|
|
66
|
+
|
|
67
|
+
# The IP address of the consumer. Helps improve fraud detection by
|
|
68
|
+
# supporting internal risk checks and partner decisions. Supports IPv4 and
|
|
69
|
+
# IPv6 formats.
|
|
70
|
+
# @return [Hash[String, String]]
|
|
71
|
+
attr_accessor :consumer_transaction_data
|
|
72
|
+
|
|
73
|
+
# Merchant-supplied metadata. This metadata is returned in the
|
|
74
|
+
# 'begin-single-charge' response and can be available in merchant reports.
|
|
75
|
+
# @return [String]
|
|
76
|
+
attr_accessor :merchant_data
|
|
77
|
+
|
|
78
|
+
# Supplies the URL for Boku to send a notification once the charge is
|
|
79
|
+
# complete.
|
|
80
|
+
# @return [String]
|
|
81
|
+
attr_accessor :notification_url
|
|
82
|
+
|
|
83
|
+
# Optin and Charge Request API can be made for specific Seller of Record
|
|
84
|
+
# previously registered with Boku.
|
|
85
|
+
# @return [SellerOfRecord]
|
|
86
|
+
attr_accessor :seller_of_record
|
|
87
|
+
|
|
88
|
+
# **DISCLAIMER: This API or element is use-case specific and not needed for
|
|
89
|
+
# generic usage of our payment product. Please disregard unless otherwise
|
|
90
|
+
# directed to include in your integration.**
|
|
91
|
+
# Element containing settlement information about the original charge.
|
|
92
|
+
# @return [Settlement]
|
|
93
|
+
attr_accessor :settlement
|
|
94
|
+
|
|
95
|
+
# ISO 3166-1 alpha-2 country code where this operation is occurring (e.g.,
|
|
96
|
+
# which storefront).
|
|
97
|
+
# @return [String]
|
|
98
|
+
attr_accessor :source_country
|
|
99
|
+
|
|
100
|
+
# Specifies how long to block waiting for a response
|
|
101
|
+
# @return [Timeout]
|
|
102
|
+
attr_accessor :timeout
|
|
103
|
+
|
|
104
|
+
# A mapping from model property names to API property names.
|
|
105
|
+
def self.names
|
|
106
|
+
@_hash = {} if @_hash.nil?
|
|
107
|
+
@_hash['charge_type'] = 'charge-type'
|
|
108
|
+
@_hash['country'] = 'country'
|
|
109
|
+
@_hash['currency'] = 'currency'
|
|
110
|
+
@_hash['hosted'] = 'hosted'
|
|
111
|
+
@_hash['merchant_consumer_id'] = 'merchant-consumer-id'
|
|
112
|
+
@_hash['merchant_id'] = 'merchant-id'
|
|
113
|
+
@_hash['merchant_item_description'] = 'merchant-item-description'
|
|
114
|
+
@_hash['merchant_request_id'] = 'merchant-request-id'
|
|
115
|
+
@_hash['merchant_transaction_id'] = 'merchant-transaction-id'
|
|
116
|
+
@_hash['payment_method'] = 'payment-method'
|
|
117
|
+
@_hash['total_amount'] = 'total-amount'
|
|
118
|
+
@_hash['consumer_ip_address'] = 'consumer-ip-address'
|
|
119
|
+
@_hash['consumer_transaction_data'] = 'consumer-transaction-data'
|
|
120
|
+
@_hash['merchant_data'] = 'merchant-data'
|
|
121
|
+
@_hash['notification_url'] = 'notification-url'
|
|
122
|
+
@_hash['seller_of_record'] = 'seller-of-record'
|
|
123
|
+
@_hash['settlement'] = 'settlement'
|
|
124
|
+
@_hash['source_country'] = 'source-country'
|
|
125
|
+
@_hash['timeout'] = 'timeout'
|
|
126
|
+
@_hash
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# An array for optional fields
|
|
130
|
+
def self.optionals
|
|
131
|
+
%w[
|
|
132
|
+
consumer_ip_address
|
|
133
|
+
consumer_transaction_data
|
|
134
|
+
merchant_data
|
|
135
|
+
notification_url
|
|
136
|
+
seller_of_record
|
|
137
|
+
settlement
|
|
138
|
+
source_country
|
|
139
|
+
timeout
|
|
140
|
+
]
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# An array for nullable fields
|
|
144
|
+
def self.nullables
|
|
145
|
+
[]
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def initialize(country = nil, currency = nil, hosted = nil,
|
|
149
|
+
merchant_consumer_id = nil, merchant_id = nil,
|
|
150
|
+
merchant_item_description = nil, merchant_request_id = nil,
|
|
151
|
+
merchant_transaction_id = nil, payment_method = nil,
|
|
152
|
+
total_amount = nil, consumer_ip_address = SKIP,
|
|
153
|
+
consumer_transaction_data = SKIP, merchant_data = SKIP,
|
|
154
|
+
notification_url = SKIP, seller_of_record = SKIP,
|
|
155
|
+
settlement = SKIP, source_country = SKIP, timeout = SKIP)
|
|
156
|
+
@charge_type = 'hosted'
|
|
157
|
+
@country = country
|
|
158
|
+
@currency = currency
|
|
159
|
+
@hosted = hosted
|
|
160
|
+
@merchant_consumer_id = merchant_consumer_id
|
|
161
|
+
@merchant_id = merchant_id
|
|
162
|
+
@merchant_item_description = merchant_item_description
|
|
163
|
+
@merchant_request_id = merchant_request_id
|
|
164
|
+
@merchant_transaction_id = merchant_transaction_id
|
|
165
|
+
@payment_method = payment_method
|
|
166
|
+
@total_amount = total_amount
|
|
167
|
+
@consumer_ip_address = consumer_ip_address unless consumer_ip_address == SKIP
|
|
168
|
+
unless consumer_transaction_data == SKIP
|
|
169
|
+
@consumer_transaction_data =
|
|
170
|
+
consumer_transaction_data
|
|
171
|
+
end
|
|
172
|
+
@merchant_data = merchant_data unless merchant_data == SKIP
|
|
173
|
+
@notification_url = notification_url unless notification_url == SKIP
|
|
174
|
+
@seller_of_record = seller_of_record unless seller_of_record == SKIP
|
|
175
|
+
@settlement = settlement unless settlement == SKIP
|
|
176
|
+
@source_country = source_country unless source_country == SKIP
|
|
177
|
+
@timeout = timeout unless timeout == SKIP
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Creates an instance of the object from a hash.
|
|
181
|
+
def self.from_hash(hash)
|
|
182
|
+
return nil unless hash
|
|
183
|
+
|
|
184
|
+
# Extract variables from the hash.
|
|
185
|
+
country = hash.key?('country') ? hash['country'] : nil
|
|
186
|
+
currency = hash.key?('currency') ? hash['currency'] : nil
|
|
187
|
+
hosted = BeginSingleChargeRequestHosted.from_hash(hash['hosted']) if hash['hosted']
|
|
188
|
+
merchant_consumer_id =
|
|
189
|
+
hash.key?('merchant-consumer-id') ? hash['merchant-consumer-id'] : nil
|
|
190
|
+
merchant_id = hash.key?('merchant-id') ? hash['merchant-id'] : nil
|
|
191
|
+
merchant_item_description =
|
|
192
|
+
hash.key?('merchant-item-description') ? hash['merchant-item-description'] : nil
|
|
193
|
+
merchant_request_id =
|
|
194
|
+
hash.key?('merchant-request-id') ? hash['merchant-request-id'] : nil
|
|
195
|
+
merchant_transaction_id =
|
|
196
|
+
hash.key?('merchant-transaction-id') ? hash['merchant-transaction-id'] : nil
|
|
197
|
+
payment_method =
|
|
198
|
+
hash.key?('payment-method') ? hash['payment-method'] : nil
|
|
199
|
+
total_amount = hash.key?('total-amount') ? hash['total-amount'] : nil
|
|
200
|
+
consumer_ip_address =
|
|
201
|
+
hash.key?('consumer-ip-address') ? hash['consumer-ip-address'] : SKIP
|
|
202
|
+
consumer_transaction_data =
|
|
203
|
+
hash.key?('consumer-transaction-data') ? hash['consumer-transaction-data'] : SKIP
|
|
204
|
+
merchant_data = hash.key?('merchant-data') ? hash['merchant-data'] : SKIP
|
|
205
|
+
notification_url =
|
|
206
|
+
hash.key?('notification-url') ? hash['notification-url'] : SKIP
|
|
207
|
+
seller_of_record = SellerOfRecord.from_hash(hash['seller-of-record']) if
|
|
208
|
+
hash['seller-of-record']
|
|
209
|
+
settlement = Settlement.from_hash(hash['settlement']) if hash['settlement']
|
|
210
|
+
source_country =
|
|
211
|
+
hash.key?('source-country') ? hash['source-country'] : SKIP
|
|
212
|
+
timeout = Timeout.from_hash(hash['timeout']) if hash['timeout']
|
|
213
|
+
|
|
214
|
+
# Create object from extracted values.
|
|
215
|
+
BeginSingleChargeRequest.new(country,
|
|
216
|
+
currency,
|
|
217
|
+
hosted,
|
|
218
|
+
merchant_consumer_id,
|
|
219
|
+
merchant_id,
|
|
220
|
+
merchant_item_description,
|
|
221
|
+
merchant_request_id,
|
|
222
|
+
merchant_transaction_id,
|
|
223
|
+
payment_method,
|
|
224
|
+
total_amount,
|
|
225
|
+
consumer_ip_address,
|
|
226
|
+
consumer_transaction_data,
|
|
227
|
+
merchant_data,
|
|
228
|
+
notification_url,
|
|
229
|
+
seller_of_record,
|
|
230
|
+
settlement,
|
|
231
|
+
source_country,
|
|
232
|
+
timeout)
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def self.from_element(root)
|
|
236
|
+
charge_type = XmlUtilities.from_element(root, 'charge-type', String)
|
|
237
|
+
country = XmlUtilities.from_element(root, 'country', String)
|
|
238
|
+
currency = XmlUtilities.from_element(root, 'currency', String)
|
|
239
|
+
hosted = XmlUtilities.from_element(root, 'hosted',
|
|
240
|
+
BeginSingleChargeRequestHosted)
|
|
241
|
+
merchant_consumer_id = XmlUtilities.from_element(root,
|
|
242
|
+
'merchant-consumer-id',
|
|
243
|
+
String)
|
|
244
|
+
merchant_id = XmlUtilities.from_element(root, 'merchant-id', String)
|
|
245
|
+
merchant_item_description = XmlUtilities.from_element(
|
|
246
|
+
root, 'merchant-item-description', String
|
|
247
|
+
)
|
|
248
|
+
merchant_request_id = XmlUtilities.from_element(root,
|
|
249
|
+
'merchant-request-id',
|
|
250
|
+
String)
|
|
251
|
+
merchant_transaction_id = XmlUtilities.from_element(
|
|
252
|
+
root, 'merchant-transaction-id', String
|
|
253
|
+
)
|
|
254
|
+
payment_method = XmlUtilities.from_element(root, 'payment-method', String)
|
|
255
|
+
total_amount = XmlUtilities.from_element(root, 'total-amount', Float)
|
|
256
|
+
consumer_ip_address = XmlUtilities.from_element(root,
|
|
257
|
+
'consumer-ip-address',
|
|
258
|
+
String)
|
|
259
|
+
consumer_transaction_data = XmlUtilities.from_element_to_hash(
|
|
260
|
+
root, 'consumer-transaction-data', Hash
|
|
261
|
+
)
|
|
262
|
+
merchant_data = XmlUtilities.from_element(root, 'merchant-data', String)
|
|
263
|
+
notification_url = XmlUtilities.from_element(root, 'notification-url',
|
|
264
|
+
String)
|
|
265
|
+
seller_of_record = XmlUtilities.from_element(root, 'seller-of-record',
|
|
266
|
+
SellerOfRecord)
|
|
267
|
+
settlement = XmlUtilities.from_element(root, 'Settlement', Settlement)
|
|
268
|
+
source_country = XmlUtilities.from_element(root, 'source-country', String)
|
|
269
|
+
timeout = XmlUtilities.from_element(root, 'timeout', Timeout)
|
|
270
|
+
|
|
271
|
+
new(charge_type,
|
|
272
|
+
country,
|
|
273
|
+
currency,
|
|
274
|
+
hosted,
|
|
275
|
+
merchant_consumer_id,
|
|
276
|
+
merchant_id,
|
|
277
|
+
merchant_item_description,
|
|
278
|
+
merchant_request_id,
|
|
279
|
+
merchant_transaction_id,
|
|
280
|
+
payment_method,
|
|
281
|
+
total_amount,
|
|
282
|
+
consumer_ip_address,
|
|
283
|
+
consumer_transaction_data,
|
|
284
|
+
merchant_data,
|
|
285
|
+
notification_url,
|
|
286
|
+
seller_of_record,
|
|
287
|
+
settlement,
|
|
288
|
+
source_country,
|
|
289
|
+
timeout)
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
def to_xml_element(doc, root_name)
|
|
293
|
+
root = doc.create_element(root_name)
|
|
294
|
+
|
|
295
|
+
XmlUtilities.add_as_subelement(doc, root, 'charge-type', charge_type)
|
|
296
|
+
XmlUtilities.add_as_subelement(doc, root, 'country', country)
|
|
297
|
+
XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
|
|
298
|
+
XmlUtilities.add_as_subelement(doc, root, 'hosted', hosted)
|
|
299
|
+
XmlUtilities.add_as_subelement(doc, root, 'merchant-consumer-id',
|
|
300
|
+
merchant_consumer_id)
|
|
301
|
+
XmlUtilities.add_as_subelement(doc, root, 'merchant-id', merchant_id)
|
|
302
|
+
XmlUtilities.add_as_subelement(doc, root, 'merchant-item-description',
|
|
303
|
+
merchant_item_description)
|
|
304
|
+
XmlUtilities.add_as_subelement(doc, root, 'merchant-request-id',
|
|
305
|
+
merchant_request_id)
|
|
306
|
+
XmlUtilities.add_as_subelement(doc, root, 'merchant-transaction-id',
|
|
307
|
+
merchant_transaction_id)
|
|
308
|
+
XmlUtilities.add_as_subelement(doc, root, 'payment-method',
|
|
309
|
+
payment_method)
|
|
310
|
+
XmlUtilities.add_as_subelement(doc, root, 'total-amount', total_amount)
|
|
311
|
+
XmlUtilities.add_as_subelement(doc, root, 'consumer-ip-address',
|
|
312
|
+
consumer_ip_address)
|
|
313
|
+
XmlUtilities.add_hash_as_subelement(doc, root,
|
|
314
|
+
'consumer-transaction-data',
|
|
315
|
+
consumer_transaction_data)
|
|
316
|
+
XmlUtilities.add_as_subelement(doc, root, 'merchant-data', merchant_data)
|
|
317
|
+
XmlUtilities.add_as_subelement(doc, root, 'notification-url',
|
|
318
|
+
notification_url)
|
|
319
|
+
XmlUtilities.add_as_subelement(doc, root, 'seller-of-record',
|
|
320
|
+
seller_of_record)
|
|
321
|
+
XmlUtilities.add_as_subelement(doc, root, 'Settlement', settlement)
|
|
322
|
+
XmlUtilities.add_as_subelement(doc, root, 'source-country',
|
|
323
|
+
source_country)
|
|
324
|
+
XmlUtilities.add_as_subelement(doc, root, 'timeout', timeout)
|
|
325
|
+
|
|
326
|
+
root
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# Provides a human-readable string representation of the object.
|
|
330
|
+
def to_s
|
|
331
|
+
class_name = self.class.name.split('::').last
|
|
332
|
+
"<#{class_name} charge_type: #{@charge_type}, country: #{@country}, currency: #{@currency},"\
|
|
333
|
+
" hosted: #{@hosted}, merchant_consumer_id: #{@merchant_consumer_id}, merchant_id:"\
|
|
334
|
+
" #{@merchant_id}, merchant_item_description: #{@merchant_item_description},"\
|
|
335
|
+
" merchant_request_id: #{@merchant_request_id}, merchant_transaction_id:"\
|
|
336
|
+
" #{@merchant_transaction_id}, payment_method: #{@payment_method}, total_amount:"\
|
|
337
|
+
" #{@total_amount}, consumer_ip_address: #{@consumer_ip_address}, consumer_transaction_data:"\
|
|
338
|
+
" #{@consumer_transaction_data}, merchant_data: #{@merchant_data}, notification_url:"\
|
|
339
|
+
" #{@notification_url}, seller_of_record: #{@seller_of_record}, settlement: #{@settlement},"\
|
|
340
|
+
" source_country: #{@source_country}, timeout: #{@timeout}>"
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
344
|
+
def inspect
|
|
345
|
+
class_name = self.class.name.split('::').last
|
|
346
|
+
"<#{class_name} charge_type: #{@charge_type.inspect}, country: #{@country.inspect},"\
|
|
347
|
+
" currency: #{@currency.inspect}, hosted: #{@hosted.inspect}, merchant_consumer_id:"\
|
|
348
|
+
" #{@merchant_consumer_id.inspect}, merchant_id: #{@merchant_id.inspect},"\
|
|
349
|
+
" merchant_item_description: #{@merchant_item_description.inspect}, merchant_request_id:"\
|
|
350
|
+
" #{@merchant_request_id.inspect}, merchant_transaction_id:"\
|
|
351
|
+
" #{@merchant_transaction_id.inspect}, payment_method: #{@payment_method.inspect},"\
|
|
352
|
+
" total_amount: #{@total_amount.inspect}, consumer_ip_address:"\
|
|
353
|
+
" #{@consumer_ip_address.inspect}, consumer_transaction_data:"\
|
|
354
|
+
" #{@consumer_transaction_data.inspect}, merchant_data: #{@merchant_data.inspect},"\
|
|
355
|
+
" notification_url: #{@notification_url.inspect}, seller_of_record:"\
|
|
356
|
+
" #{@seller_of_record.inspect}, settlement: #{@settlement.inspect}, source_country:"\
|
|
357
|
+
" #{@source_country.inspect}, timeout: #{@timeout.inspect}>"
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
end
|