mastercard_merchant_onboarding 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +24 -0
- data/README.md +56 -0
- data/lib/mastercard_merchant_onboarding.rb +58 -0
- data/lib/mastercard_merchant_onboarding/api/single_merchant_upload_api.rb +42 -0
- data/lib/mastercard_merchant_onboarding/api/single_merchant_validate_api.rb +42 -0
- data/lib/mastercard_merchant_onboarding/models/acquirer.rb +225 -0
- data/lib/mastercard_merchant_onboarding/models/address.rb +247 -0
- data/lib/mastercard_merchant_onboarding/models/auth_option.rb +210 -0
- data/lib/mastercard_merchant_onboarding/models/checkout_brand.rb +247 -0
- data/lib/mastercard_merchant_onboarding/models/emails.rb +169 -0
- data/lib/mastercard_merchant_onboarding/models/extension_point.rb +167 -0
- data/lib/mastercard_merchant_onboarding/models/merchant.rb +309 -0
- data/lib/mastercard_merchant_onboarding/models/merchant_acquirer.rb +258 -0
- data/lib/mastercard_merchant_onboarding/models/merchant_acquirer_brand.rb +211 -0
- data/lib/mastercard_merchant_onboarding/models/merchant_download.rb +215 -0
- data/lib/mastercard_merchant_onboarding/models/merchant_response_record.rb +236 -0
- data/lib/mastercard_merchant_onboarding/models/merchant_upload.rb +182 -0
- data/lib/mastercard_merchant_onboarding/models/phone.rb +192 -0
- data/lib/mastercard_merchant_onboarding/models/profile.rb +273 -0
- data/lib/mastercard_merchant_onboarding/models/project_key_type.rb +180 -0
- data/lib/mastercard_merchant_onboarding/models/reward_program.rb +203 -0
- data/lib/mastercard_merchant_onboarding/models/summary.rb +259 -0
- data/lib/mastercard_merchant_onboarding/models/validate_file_response.rb +191 -0
- data/lib/mastercard_merchant_onboarding/models/validated_merchant.rb +202 -0
- data/lib/mastercard_merchant_onboarding/tracker/sdk_api_tracker.rb +57 -0
- data/lib/mastercard_merchant_onboarding/version.rb +3 -0
- metadata +186 -0
@@ -0,0 +1,191 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'roxml'
|
3
|
+
require_relative '../../mastercard_merchant_onboarding/models/validated_merchant'
|
4
|
+
|
5
|
+
|
6
|
+
module MastercardMerchantOnboarding
|
7
|
+
# This class contains the 3DS and/or non-3DS merchant status records.
|
8
|
+
class ValidateFileResponse
|
9
|
+
include ROXML
|
10
|
+
|
11
|
+
xml_name "ValidateFileResponse"
|
12
|
+
|
13
|
+
# @!attribute validated_merchant
|
14
|
+
# @return [Array<ValidatedMerchant>] the validation details of a merchant.
|
15
|
+
xml_accessor :validated_merchant, :from =>"ValidatedMerchant", :as =>[ValidatedMerchant]
|
16
|
+
|
17
|
+
# @!attribute error_text
|
18
|
+
# @return [String] the description of validation error.
|
19
|
+
xml_accessor :error_text, :from =>"ErrorText"
|
20
|
+
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:validated_merchant => :ValidatedMerchant ,
|
26
|
+
:error_text => :ErrorText
|
27
|
+
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize(attributes = {})
|
32
|
+
return unless attributes.is_a?(Hash)
|
33
|
+
|
34
|
+
# convert string to symbol for hash key
|
35
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
36
|
+
|
37
|
+
|
38
|
+
if attributes.has_key?(:validated_merchant)
|
39
|
+
self.validated_merchant = attributes[:validated_merchant]
|
40
|
+
end
|
41
|
+
|
42
|
+
if attributes.has_key?(:error_text)
|
43
|
+
self.error_text = attributes[:error_text]
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
# Overriding setter method validated_merchant
|
50
|
+
# @param value
|
51
|
+
def validated_merchant=(value)
|
52
|
+
if (value.is_a?(Array))
|
53
|
+
@validated_merchant = value
|
54
|
+
else
|
55
|
+
@validated_merchant = [] if !@validated_merchant
|
56
|
+
@validated_merchant.push value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
# Check equality by comparing each attribute.
|
62
|
+
def ==(o)
|
63
|
+
return true if self.equal?(o)
|
64
|
+
self.class == o.class &&
|
65
|
+
validated_merchant == o.validated_merchant &&
|
66
|
+
error_text == o.error_text
|
67
|
+
end
|
68
|
+
|
69
|
+
# @see the `==` method
|
70
|
+
def eql?(o)
|
71
|
+
self == o
|
72
|
+
end
|
73
|
+
|
74
|
+
# Calculate hash code according to all attributes.
|
75
|
+
def hash
|
76
|
+
[validated_merchant, error_text].hash
|
77
|
+
end
|
78
|
+
|
79
|
+
# build the object from hash
|
80
|
+
def build_from_hash(attributes)
|
81
|
+
return nil unless attributes.is_a?(Hash)
|
82
|
+
self.class.datatype_map.each_pair do |key, type|
|
83
|
+
if type =~ /^Array<(.*)>/i
|
84
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
85
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
86
|
+
else
|
87
|
+
#TODO show warning in debug mode
|
88
|
+
end
|
89
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
90
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
91
|
+
else
|
92
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
def _deserialize(type, value)
|
100
|
+
case type.to_sym
|
101
|
+
when :DateTime
|
102
|
+
DateTime.parse(value)
|
103
|
+
when :Date
|
104
|
+
Date.parse(value)
|
105
|
+
when :Object
|
106
|
+
value
|
107
|
+
when :String
|
108
|
+
value.to_s
|
109
|
+
when :Integer
|
110
|
+
value.to_i
|
111
|
+
when :Float
|
112
|
+
value.to_f
|
113
|
+
when :BOOLEAN
|
114
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
115
|
+
true
|
116
|
+
else
|
117
|
+
false
|
118
|
+
end
|
119
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
120
|
+
inner_type = Regexp.last_match[:inner_type]
|
121
|
+
value.map { |v| _deserialize(inner_type, v) }
|
122
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
123
|
+
k_type = Regexp.last_match[:k_type]
|
124
|
+
v_type = Regexp.last_match[:v_type]
|
125
|
+
{}.tap do |hash|
|
126
|
+
value.each do |k, v|
|
127
|
+
hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
else # model
|
131
|
+
_model = MastercardMerchantOnboarding.const_get(type).new
|
132
|
+
_model.build_from_hash(value)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def to_s
|
137
|
+
to_hash.to_s
|
138
|
+
end
|
139
|
+
|
140
|
+
# to_body is an alias to to_body (backward compatibility))
|
141
|
+
def to_body
|
142
|
+
to_hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# return the object in the form of hash
|
146
|
+
def to_hash(include_root = false)
|
147
|
+
attributes_hash = {}
|
148
|
+
hash = {}
|
149
|
+
self.class.attribute_map.each_pair do |attr, param|
|
150
|
+
value = self.send(attr)
|
151
|
+
next if value.nil?
|
152
|
+
hash[param] = _to_hash(value)
|
153
|
+
end
|
154
|
+
attributes_hash = include_root ? { "ValidateFileResponse" => hash } : hash
|
155
|
+
return attributes_hash
|
156
|
+
end
|
157
|
+
|
158
|
+
# Method to output non-array value in the form of hash
|
159
|
+
# For object, use to_hash. Otherwise, just return the value
|
160
|
+
def _to_hash(value)
|
161
|
+
if value.is_a?(Array)
|
162
|
+
value.compact.map{ |v| _to_hash(v) }
|
163
|
+
elsif value.is_a?(Hash)
|
164
|
+
{}.tap do |hash|
|
165
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
166
|
+
end
|
167
|
+
elsif value.respond_to? :to_hash
|
168
|
+
value.to_hash
|
169
|
+
else
|
170
|
+
value
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
private
|
176
|
+
def after_parse
|
177
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
178
|
+
end
|
179
|
+
|
180
|
+
# Attribute datatype mapping.
|
181
|
+
def self.datatype_map
|
182
|
+
{
|
183
|
+
:validated_merchant => 'Array<ValidatedMerchant>',
|
184
|
+
:error_text => 'String'
|
185
|
+
|
186
|
+
}
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
|
191
|
+
end
|
@@ -0,0 +1,202 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'roxml'
|
3
|
+
require_relative '../../mastercard_merchant_onboarding/models/extension_point'
|
4
|
+
|
5
|
+
|
6
|
+
module MastercardMerchantOnboarding
|
7
|
+
# This class contains the validated merchant details.
|
8
|
+
class ValidatedMerchant
|
9
|
+
include ROXML
|
10
|
+
|
11
|
+
xml_name "ValidatedMerchant"
|
12
|
+
|
13
|
+
# @!attribute merchant_id
|
14
|
+
# @return [String] the identifier of the merchant defined by the Service Provider.
|
15
|
+
xml_accessor :merchant_id, :from =>"MerchantId"
|
16
|
+
|
17
|
+
# @!attribute error_text
|
18
|
+
# @return [Array<String>] the description of validation error.
|
19
|
+
xml_accessor :error_text, :from =>"ErrorText", :as =>[]
|
20
|
+
|
21
|
+
# @!attribute extension_point
|
22
|
+
# @return [ExtensionPoint] the extension point for future enhancement.
|
23
|
+
xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
|
24
|
+
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:merchant_id => :MerchantId ,
|
30
|
+
:error_text => :ErrorText ,
|
31
|
+
:extension_point => :ExtensionPoint
|
32
|
+
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def initialize(attributes = {})
|
37
|
+
return unless attributes.is_a?(Hash)
|
38
|
+
|
39
|
+
# convert string to symbol for hash key
|
40
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
41
|
+
|
42
|
+
|
43
|
+
if attributes.has_key?(:merchant_id)
|
44
|
+
self.merchant_id = attributes[:merchant_id]
|
45
|
+
end
|
46
|
+
|
47
|
+
if attributes.has_key?(:error_text)
|
48
|
+
self.error_text = attributes[:error_text]
|
49
|
+
end
|
50
|
+
|
51
|
+
if attributes.has_key?(:extension_point)
|
52
|
+
self.extension_point = attributes[:extension_point]
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
# Overriding setter method error_text
|
59
|
+
# @param value
|
60
|
+
def error_text=(value)
|
61
|
+
if (value.is_a?(Array))
|
62
|
+
@error_text = value
|
63
|
+
else
|
64
|
+
@error_text = [] if !@error_text
|
65
|
+
@error_text.push value
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
# Check equality by comparing each attribute.
|
71
|
+
def ==(o)
|
72
|
+
return true if self.equal?(o)
|
73
|
+
self.class == o.class &&
|
74
|
+
merchant_id == o.merchant_id &&
|
75
|
+
error_text == o.error_text &&
|
76
|
+
extension_point == o.extension_point
|
77
|
+
end
|
78
|
+
|
79
|
+
# @see the `==` method
|
80
|
+
def eql?(o)
|
81
|
+
self == o
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculate hash code according to all attributes.
|
85
|
+
def hash
|
86
|
+
[merchant_id, error_text, extension_point].hash
|
87
|
+
end
|
88
|
+
|
89
|
+
# build the object from hash
|
90
|
+
def build_from_hash(attributes)
|
91
|
+
return nil unless attributes.is_a?(Hash)
|
92
|
+
self.class.datatype_map.each_pair do |key, type|
|
93
|
+
if type =~ /^Array<(.*)>/i
|
94
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
95
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
96
|
+
else
|
97
|
+
#TODO show warning in debug mode
|
98
|
+
end
|
99
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
101
|
+
else
|
102
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
109
|
+
def _deserialize(type, value)
|
110
|
+
case type.to_sym
|
111
|
+
when :DateTime
|
112
|
+
DateTime.parse(value)
|
113
|
+
when :Date
|
114
|
+
Date.parse(value)
|
115
|
+
when :Object
|
116
|
+
value
|
117
|
+
when :String
|
118
|
+
value.to_s
|
119
|
+
when :Integer
|
120
|
+
value.to_i
|
121
|
+
when :Float
|
122
|
+
value.to_f
|
123
|
+
when :BOOLEAN
|
124
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
125
|
+
true
|
126
|
+
else
|
127
|
+
false
|
128
|
+
end
|
129
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
130
|
+
inner_type = Regexp.last_match[:inner_type]
|
131
|
+
value.map { |v| _deserialize(inner_type, v) }
|
132
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
133
|
+
k_type = Regexp.last_match[:k_type]
|
134
|
+
v_type = Regexp.last_match[:v_type]
|
135
|
+
{}.tap do |hash|
|
136
|
+
value.each do |k, v|
|
137
|
+
hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
else # model
|
141
|
+
_model = MastercardMerchantOnboarding.const_get(type).new
|
142
|
+
_model.build_from_hash(value)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def to_s
|
147
|
+
to_hash.to_s
|
148
|
+
end
|
149
|
+
|
150
|
+
# to_body is an alias to to_body (backward compatibility))
|
151
|
+
def to_body
|
152
|
+
to_hash
|
153
|
+
end
|
154
|
+
|
155
|
+
# return the object in the form of hash
|
156
|
+
def to_hash(include_root = false)
|
157
|
+
attributes_hash = {}
|
158
|
+
hash = {}
|
159
|
+
self.class.attribute_map.each_pair do |attr, param|
|
160
|
+
value = self.send(attr)
|
161
|
+
next if value.nil?
|
162
|
+
hash[param] = _to_hash(value)
|
163
|
+
end
|
164
|
+
attributes_hash = include_root ? { "ValidatedMerchant" => hash } : hash
|
165
|
+
return attributes_hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Method to output non-array value in the form of hash
|
169
|
+
# For object, use to_hash. Otherwise, just return the value
|
170
|
+
def _to_hash(value)
|
171
|
+
if value.is_a?(Array)
|
172
|
+
value.compact.map{ |v| _to_hash(v) }
|
173
|
+
elsif value.is_a?(Hash)
|
174
|
+
{}.tap do |hash|
|
175
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
176
|
+
end
|
177
|
+
elsif value.respond_to? :to_hash
|
178
|
+
value.to_hash
|
179
|
+
else
|
180
|
+
value
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
private
|
186
|
+
def after_parse
|
187
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
188
|
+
end
|
189
|
+
|
190
|
+
# Attribute datatype mapping.
|
191
|
+
def self.datatype_map
|
192
|
+
{
|
193
|
+
:merchant_id => 'String',
|
194
|
+
:error_text => 'Array<String>',
|
195
|
+
:extension_point => 'ExtensionPoint'
|
196
|
+
|
197
|
+
}
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'mastercard_core_sdk'
|
2
|
+
|
3
|
+
module MastercardMerchantOnboarding
|
4
|
+
module Tracker
|
5
|
+
# Provides tracking api information and user-agent information.
|
6
|
+
class SdkApiTracker
|
7
|
+
include MastercardCoreSdk, MastercardCoreSdk::Core, MastercardCoreSdk::Tracker::ApiTracker
|
8
|
+
|
9
|
+
# Defines the programming language.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :language
|
13
|
+
|
14
|
+
# Defines the programming language version.
|
15
|
+
#
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :language_version
|
18
|
+
|
19
|
+
# Defines the client sdk gem version.
|
20
|
+
#
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :client_sdk_version
|
23
|
+
|
24
|
+
# Defines the plugin version if any defined in MasterCardApiConfiguration as additional_properties.
|
25
|
+
#
|
26
|
+
# @return [String]
|
27
|
+
attr_reader :plugin_version
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@language = "Ruby"
|
31
|
+
@language_version = RUBY_VERSION
|
32
|
+
@client_sdk_version = MastercardMerchantOnboarding::VERSION
|
33
|
+
|
34
|
+
additional_track_info = MasterCardApiConfiguration.additional_properties
|
35
|
+
if (additional_track_info && additional_track_info.size > 0 && additional_track_info.key?(PLUGIN_VERSION))
|
36
|
+
@plugin_version = additional_track_info[PLUGIN_VERSION]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Overriding ApiTracker#tracking_info method.
|
41
|
+
#
|
42
|
+
# @return [String]
|
43
|
+
def tracking_info
|
44
|
+
api_tracker_string = CLIENT_SDK_VERSION + client_sdk_version + SEPERATOR + LANG_NAME + language + SEPERATOR + LANG_VERSION + language_version
|
45
|
+
api_tracker_string += SEPERATOR + PLUGIN_VERSION + EQUAL + plugin_version unless plugin_version.nil?
|
46
|
+
return api_tracker_string
|
47
|
+
end
|
48
|
+
|
49
|
+
# Overriding ApiTracker#user_agent_info method.
|
50
|
+
#
|
51
|
+
# @return [String]
|
52
|
+
def user_agent_info
|
53
|
+
return USER_AGENT
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|