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,211 @@
|
|
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 merchant's acquirer brand details.
|
8
|
+
class MerchantAcquirerBrand
|
9
|
+
include ROXML
|
10
|
+
|
11
|
+
xml_name "MerchantAcquirerBrand"
|
12
|
+
|
13
|
+
# @!attribute card_brand
|
14
|
+
# @return [String] the merchant's acquirer card brand. For example, for Mastercard, use MASTER.
|
15
|
+
xml_accessor :card_brand, :from =>"CardBrand"
|
16
|
+
|
17
|
+
# @!attribute currency
|
18
|
+
# @return [Array<String>] the currency code. ISO 4217 standard 3-letter currency code. If this field is left blank, then all currency codes will be enabled.
|
19
|
+
xml_accessor :currency, :from =>"Currency", :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
|
+
:card_brand => :CardBrand ,
|
30
|
+
:currency => :Currency ,
|
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?(:card_brand)
|
44
|
+
self.card_brand = attributes[:card_brand]
|
45
|
+
end
|
46
|
+
|
47
|
+
if attributes.has_key?(:currency)
|
48
|
+
self.currency = attributes[:currency]
|
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 currency
|
59
|
+
# @param value
|
60
|
+
def currency=(value)
|
61
|
+
if (value.is_a?(Array))
|
62
|
+
@currency = value
|
63
|
+
else
|
64
|
+
@currency = [] if !@currency
|
65
|
+
@currency.push value
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
# Custom attribute writer method checking allowed values (enum).
|
71
|
+
def card_brand=(card_brand)
|
72
|
+
allowed_values = ["MASTER_CARD", "VISA", "AMERICAN_EXPRESS", "DISCOVER", "JCB", "MAESTRO", "DINERS"]
|
73
|
+
if card_brand && !allowed_values.include?(card_brand)
|
74
|
+
fail "invalid value for 'card_brand', must be one of #{allowed_values}"
|
75
|
+
end
|
76
|
+
@card_brand = card_brand
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check equality by comparing each attribute.
|
80
|
+
def ==(o)
|
81
|
+
return true if self.equal?(o)
|
82
|
+
self.class == o.class &&
|
83
|
+
card_brand == o.card_brand &&
|
84
|
+
currency == o.currency &&
|
85
|
+
extension_point == o.extension_point
|
86
|
+
end
|
87
|
+
|
88
|
+
# @see the `==` method
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculate hash code according to all attributes.
|
94
|
+
def hash
|
95
|
+
[card_brand, currency, extension_point].hash
|
96
|
+
end
|
97
|
+
|
98
|
+
# build the object from hash
|
99
|
+
def build_from_hash(attributes)
|
100
|
+
return nil unless attributes.is_a?(Hash)
|
101
|
+
self.class.datatype_map.each_pair do |key, type|
|
102
|
+
if type =~ /^Array<(.*)>/i
|
103
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
104
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
105
|
+
else
|
106
|
+
#TODO show warning in debug mode
|
107
|
+
end
|
108
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
109
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
110
|
+
else
|
111
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
self
|
116
|
+
end
|
117
|
+
|
118
|
+
def _deserialize(type, value)
|
119
|
+
case type.to_sym
|
120
|
+
when :DateTime
|
121
|
+
DateTime.parse(value)
|
122
|
+
when :Date
|
123
|
+
Date.parse(value)
|
124
|
+
when :Object
|
125
|
+
value
|
126
|
+
when :String
|
127
|
+
value.to_s
|
128
|
+
when :Integer
|
129
|
+
value.to_i
|
130
|
+
when :Float
|
131
|
+
value.to_f
|
132
|
+
when :BOOLEAN
|
133
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
134
|
+
true
|
135
|
+
else
|
136
|
+
false
|
137
|
+
end
|
138
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
139
|
+
inner_type = Regexp.last_match[:inner_type]
|
140
|
+
value.map { |v| _deserialize(inner_type, v) }
|
141
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
142
|
+
k_type = Regexp.last_match[:k_type]
|
143
|
+
v_type = Regexp.last_match[:v_type]
|
144
|
+
{}.tap do |hash|
|
145
|
+
value.each do |k, v|
|
146
|
+
hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
else # model
|
150
|
+
_model = MastercardMerchantOnboarding.const_get(type).new
|
151
|
+
_model.build_from_hash(value)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def to_s
|
156
|
+
to_hash.to_s
|
157
|
+
end
|
158
|
+
|
159
|
+
# to_body is an alias to to_body (backward compatibility))
|
160
|
+
def to_body
|
161
|
+
to_hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# return the object in the form of hash
|
165
|
+
def to_hash(include_root = false)
|
166
|
+
attributes_hash = {}
|
167
|
+
hash = {}
|
168
|
+
self.class.attribute_map.each_pair do |attr, param|
|
169
|
+
value = self.send(attr)
|
170
|
+
next if value.nil?
|
171
|
+
hash[param] = _to_hash(value)
|
172
|
+
end
|
173
|
+
attributes_hash = include_root ? { "MerchantAcquirerBrand" => hash } : hash
|
174
|
+
return attributes_hash
|
175
|
+
end
|
176
|
+
|
177
|
+
# Method to output non-array value in the form of hash
|
178
|
+
# For object, use to_hash. Otherwise, just return the value
|
179
|
+
def _to_hash(value)
|
180
|
+
if value.is_a?(Array)
|
181
|
+
value.compact.map{ |v| _to_hash(v) }
|
182
|
+
elsif value.is_a?(Hash)
|
183
|
+
{}.tap do |hash|
|
184
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
185
|
+
end
|
186
|
+
elsif value.respond_to? :to_hash
|
187
|
+
value.to_hash
|
188
|
+
else
|
189
|
+
value
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
|
194
|
+
private
|
195
|
+
def after_parse
|
196
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
197
|
+
end
|
198
|
+
|
199
|
+
# Attribute datatype mapping.
|
200
|
+
def self.datatype_map
|
201
|
+
{
|
202
|
+
:card_brand => 'String',
|
203
|
+
:currency => 'Array<String>',
|
204
|
+
:extension_point => 'ExtensionPoint'
|
205
|
+
|
206
|
+
}
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'roxml'
|
3
|
+
require_relative '../../mastercard_merchant_onboarding/models/extension_point'
|
4
|
+
require_relative '../../mastercard_merchant_onboarding/models/merchant_response_record'
|
5
|
+
require_relative '../../mastercard_merchant_onboarding/models/summary'
|
6
|
+
|
7
|
+
|
8
|
+
module MastercardMerchantOnboarding
|
9
|
+
# This class contains the merchant upload response details.
|
10
|
+
class MerchantDownload
|
11
|
+
include ROXML
|
12
|
+
|
13
|
+
xml_name "MerchantDownload"
|
14
|
+
|
15
|
+
# @!attribute summary
|
16
|
+
# @return [Summary] the summary of the upload request.
|
17
|
+
xml_accessor :summary, :from =>"Summary",:as => Summary
|
18
|
+
|
19
|
+
# @!attribute merchant_response_record
|
20
|
+
# @return [Array<MerchantResponseRecord>] the list of merchants uploaded/edited.
|
21
|
+
xml_accessor :merchant_response_record, :from =>"MerchantResponseRecord", :as =>[MerchantResponseRecord]
|
22
|
+
|
23
|
+
# @!attribute extension_point
|
24
|
+
# @return [ExtensionPoint] the extension point for future enhancement.
|
25
|
+
xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
|
26
|
+
|
27
|
+
# @!attribute version
|
28
|
+
# @return [String] the version information.
|
29
|
+
xml_accessor :version, :from =>"@Version"
|
30
|
+
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:summary => :Summary ,
|
36
|
+
:merchant_response_record => :MerchantResponseRecord ,
|
37
|
+
:extension_point => :ExtensionPoint ,
|
38
|
+
:version => :Version
|
39
|
+
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def initialize(attributes = {})
|
44
|
+
return unless attributes.is_a?(Hash)
|
45
|
+
|
46
|
+
# convert string to symbol for hash key
|
47
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
48
|
+
|
49
|
+
|
50
|
+
if attributes.has_key?(:summary)
|
51
|
+
self.summary = attributes[:summary]
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes.has_key?(:merchant_response_record)
|
55
|
+
self.merchant_response_record = attributes[:merchant_response_record]
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.has_key?(:extension_point)
|
59
|
+
self.extension_point = attributes[:extension_point]
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:version)
|
63
|
+
self.version = attributes[:version]
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# Overriding setter method merchant_response_record
|
70
|
+
# @param value
|
71
|
+
def merchant_response_record=(value)
|
72
|
+
if (value.is_a?(Array))
|
73
|
+
@merchant_response_record = value
|
74
|
+
else
|
75
|
+
@merchant_response_record = [] if !@merchant_response_record
|
76
|
+
@merchant_response_record.push value
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
# Check equality by comparing each attribute.
|
82
|
+
def ==(o)
|
83
|
+
return true if self.equal?(o)
|
84
|
+
self.class == o.class &&
|
85
|
+
summary == o.summary &&
|
86
|
+
merchant_response_record == o.merchant_response_record &&
|
87
|
+
extension_point == o.extension_point &&
|
88
|
+
version == o.version
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
def eql?(o)
|
93
|
+
self == o
|
94
|
+
end
|
95
|
+
|
96
|
+
# Calculate hash code according to all attributes.
|
97
|
+
def hash
|
98
|
+
[summary, merchant_response_record, extension_point, version].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# build the object from hash
|
102
|
+
def build_from_hash(attributes)
|
103
|
+
return nil unless attributes.is_a?(Hash)
|
104
|
+
self.class.datatype_map.each_pair do |key, type|
|
105
|
+
if type =~ /^Array<(.*)>/i
|
106
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
107
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
108
|
+
else
|
109
|
+
#TODO show warning in debug mode
|
110
|
+
end
|
111
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
112
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
113
|
+
else
|
114
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
self
|
119
|
+
end
|
120
|
+
|
121
|
+
def _deserialize(type, value)
|
122
|
+
case type.to_sym
|
123
|
+
when :DateTime
|
124
|
+
DateTime.parse(value)
|
125
|
+
when :Date
|
126
|
+
Date.parse(value)
|
127
|
+
when :Object
|
128
|
+
value
|
129
|
+
when :String
|
130
|
+
value.to_s
|
131
|
+
when :Integer
|
132
|
+
value.to_i
|
133
|
+
when :Float
|
134
|
+
value.to_f
|
135
|
+
when :BOOLEAN
|
136
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
137
|
+
true
|
138
|
+
else
|
139
|
+
false
|
140
|
+
end
|
141
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
142
|
+
inner_type = Regexp.last_match[:inner_type]
|
143
|
+
value.map { |v| _deserialize(inner_type, v) }
|
144
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
145
|
+
k_type = Regexp.last_match[:k_type]
|
146
|
+
v_type = Regexp.last_match[:v_type]
|
147
|
+
{}.tap do |hash|
|
148
|
+
value.each do |k, v|
|
149
|
+
hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
else # model
|
153
|
+
_model = MastercardMerchantOnboarding.const_get(type).new
|
154
|
+
_model.build_from_hash(value)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def to_s
|
159
|
+
to_hash.to_s
|
160
|
+
end
|
161
|
+
|
162
|
+
# to_body is an alias to to_body (backward compatibility))
|
163
|
+
def to_body
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# return the object in the form of hash
|
168
|
+
def to_hash(include_root = false)
|
169
|
+
attributes_hash = {}
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
attributes_hash = include_root ? { "MerchantDownload" => hash } : hash
|
177
|
+
return attributes_hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Method to output non-array value in the form of hash
|
181
|
+
# For object, use to_hash. Otherwise, just return the value
|
182
|
+
def _to_hash(value)
|
183
|
+
if value.is_a?(Array)
|
184
|
+
value.compact.map{ |v| _to_hash(v) }
|
185
|
+
elsif value.is_a?(Hash)
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
188
|
+
end
|
189
|
+
elsif value.respond_to? :to_hash
|
190
|
+
value.to_hash
|
191
|
+
else
|
192
|
+
value
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
|
197
|
+
private
|
198
|
+
def after_parse
|
199
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
200
|
+
end
|
201
|
+
|
202
|
+
# Attribute datatype mapping.
|
203
|
+
def self.datatype_map
|
204
|
+
{
|
205
|
+
:summary => 'Summary',
|
206
|
+
:merchant_response_record => 'Array<MerchantResponseRecord>',
|
207
|
+
:extension_point => 'ExtensionPoint',
|
208
|
+
:version => 'String'
|
209
|
+
|
210
|
+
}
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
|
215
|
+
end
|
@@ -0,0 +1,236 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'roxml'
|
3
|
+
require_relative '../../mastercard_merchant_onboarding/models/checkout_brand'
|
4
|
+
require_relative '../../mastercard_merchant_onboarding/models/extension_point'
|
5
|
+
require_relative '../../mastercard_merchant_onboarding/models/merchant_acquirer'
|
6
|
+
|
7
|
+
|
8
|
+
module MastercardMerchantOnboarding
|
9
|
+
# This class contains the merchant response record.
|
10
|
+
class MerchantResponseRecord
|
11
|
+
include ROXML
|
12
|
+
|
13
|
+
xml_name "MerchantResponseRecord"
|
14
|
+
|
15
|
+
# @!attribute sp_merchant_id
|
16
|
+
# @return [String] the merchant identifier for a specific service provider. For example, 12345.
|
17
|
+
xml_accessor :sp_merchant_id, :from =>"SPMerchantId"
|
18
|
+
|
19
|
+
# @!attribute error_text
|
20
|
+
# @return [String] the error description for failure. For example, Invalid rewards logo URL.
|
21
|
+
xml_accessor :error_text, :from =>"ErrorText"
|
22
|
+
|
23
|
+
# @!attribute checkout_brand
|
24
|
+
# @return [Array<CheckoutBrand>] the checkout branding. Choice (ErrorText or CheckoutBrand).
|
25
|
+
xml_accessor :checkout_brand, :from =>"CheckoutBrand", :as =>[CheckoutBrand]
|
26
|
+
|
27
|
+
# @!attribute merchant_acquirer
|
28
|
+
# @return [Array<MerchantAcquirer>] the merchant acquirer information.
|
29
|
+
xml_accessor :merchant_acquirer, :from =>"MerchantAcquirer", :as =>[MerchantAcquirer]
|
30
|
+
|
31
|
+
# @!attribute extension_point
|
32
|
+
# @return [ExtensionPoint] the extension point for future enhancement.
|
33
|
+
xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
|
34
|
+
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:sp_merchant_id => :SPMerchantId ,
|
40
|
+
:error_text => :ErrorText ,
|
41
|
+
:checkout_brand => :CheckoutBrand ,
|
42
|
+
:merchant_acquirer => :MerchantAcquirer ,
|
43
|
+
:extension_point => :ExtensionPoint
|
44
|
+
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
53
|
+
|
54
|
+
|
55
|
+
if attributes.has_key?(:sp_merchant_id)
|
56
|
+
self.sp_merchant_id = attributes[:sp_merchant_id]
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:error_text)
|
60
|
+
self.error_text = attributes[:error_text]
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes.has_key?(:checkout_brand)
|
64
|
+
self.checkout_brand = attributes[:checkout_brand]
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.has_key?(:merchant_acquirer)
|
68
|
+
self.merchant_acquirer = attributes[:merchant_acquirer]
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes.has_key?(:extension_point)
|
72
|
+
self.extension_point = attributes[:extension_point]
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
# Overriding setter method checkout_brand
|
79
|
+
# @param value
|
80
|
+
def checkout_brand=(value)
|
81
|
+
if (value.is_a?(Array))
|
82
|
+
@checkout_brand = value
|
83
|
+
else
|
84
|
+
@checkout_brand = [] if !@checkout_brand
|
85
|
+
@checkout_brand.push value
|
86
|
+
end
|
87
|
+
end
|
88
|
+
# Overriding setter method merchant_acquirer
|
89
|
+
# @param value
|
90
|
+
def merchant_acquirer=(value)
|
91
|
+
if (value.is_a?(Array))
|
92
|
+
@merchant_acquirer = value
|
93
|
+
else
|
94
|
+
@merchant_acquirer = [] if !@merchant_acquirer
|
95
|
+
@merchant_acquirer.push value
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
# Check equality by comparing each attribute.
|
101
|
+
def ==(o)
|
102
|
+
return true if self.equal?(o)
|
103
|
+
self.class == o.class &&
|
104
|
+
sp_merchant_id == o.sp_merchant_id &&
|
105
|
+
error_text == o.error_text &&
|
106
|
+
checkout_brand == o.checkout_brand &&
|
107
|
+
merchant_acquirer == o.merchant_acquirer &&
|
108
|
+
extension_point == o.extension_point
|
109
|
+
end
|
110
|
+
|
111
|
+
# @see the `==` method
|
112
|
+
def eql?(o)
|
113
|
+
self == o
|
114
|
+
end
|
115
|
+
|
116
|
+
# Calculate hash code according to all attributes.
|
117
|
+
def hash
|
118
|
+
[sp_merchant_id, error_text, checkout_brand, merchant_acquirer, extension_point].hash
|
119
|
+
end
|
120
|
+
|
121
|
+
# build the object from hash
|
122
|
+
def build_from_hash(attributes)
|
123
|
+
return nil unless attributes.is_a?(Hash)
|
124
|
+
self.class.datatype_map.each_pair do |key, type|
|
125
|
+
if type =~ /^Array<(.*)>/i
|
126
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
127
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
128
|
+
else
|
129
|
+
#TODO show warning in debug mode
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
else
|
134
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
self
|
139
|
+
end
|
140
|
+
|
141
|
+
def _deserialize(type, value)
|
142
|
+
case type.to_sym
|
143
|
+
when :DateTime
|
144
|
+
DateTime.parse(value)
|
145
|
+
when :Date
|
146
|
+
Date.parse(value)
|
147
|
+
when :Object
|
148
|
+
value
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :BOOLEAN
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
_model = MastercardMerchantOnboarding.const_get(type).new
|
174
|
+
_model.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def to_s
|
179
|
+
to_hash.to_s
|
180
|
+
end
|
181
|
+
|
182
|
+
# to_body is an alias to to_body (backward compatibility))
|
183
|
+
def to_body
|
184
|
+
to_hash
|
185
|
+
end
|
186
|
+
|
187
|
+
# return the object in the form of hash
|
188
|
+
def to_hash(include_root = false)
|
189
|
+
attributes_hash = {}
|
190
|
+
hash = {}
|
191
|
+
self.class.attribute_map.each_pair do |attr, param|
|
192
|
+
value = self.send(attr)
|
193
|
+
next if value.nil?
|
194
|
+
hash[param] = _to_hash(value)
|
195
|
+
end
|
196
|
+
attributes_hash = include_root ? { "MerchantResponseRecord" => hash } : hash
|
197
|
+
return attributes_hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Method to output non-array value in the form of hash
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
202
|
+
def _to_hash(value)
|
203
|
+
if value.is_a?(Array)
|
204
|
+
value.compact.map{ |v| _to_hash(v) }
|
205
|
+
elsif value.is_a?(Hash)
|
206
|
+
{}.tap do |hash|
|
207
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
208
|
+
end
|
209
|
+
elsif value.respond_to? :to_hash
|
210
|
+
value.to_hash
|
211
|
+
else
|
212
|
+
value
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
|
217
|
+
private
|
218
|
+
def after_parse
|
219
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
220
|
+
end
|
221
|
+
|
222
|
+
# Attribute datatype mapping.
|
223
|
+
def self.datatype_map
|
224
|
+
{
|
225
|
+
:sp_merchant_id => 'String',
|
226
|
+
:error_text => 'String',
|
227
|
+
:checkout_brand => 'Array<CheckoutBrand>',
|
228
|
+
:merchant_acquirer => 'Array<MerchantAcquirer>',
|
229
|
+
:extension_point => 'ExtensionPoint'
|
230
|
+
|
231
|
+
}
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
|
236
|
+
end
|