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,309 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'roxml'
|
3
|
+
require_relative '../../mastercard_merchant_onboarding/models/auth_option'
|
4
|
+
require_relative '../../mastercard_merchant_onboarding/models/checkout_brand'
|
5
|
+
require_relative '../../mastercard_merchant_onboarding/models/extension_point'
|
6
|
+
require_relative '../../mastercard_merchant_onboarding/models/merchant_acquirer'
|
7
|
+
require_relative '../../mastercard_merchant_onboarding/models/profile'
|
8
|
+
require_relative '../../mastercard_merchant_onboarding/models/reward_program'
|
9
|
+
|
10
|
+
|
11
|
+
module MastercardMerchantOnboarding
|
12
|
+
# This class contains various merchant details.
|
13
|
+
class Merchant
|
14
|
+
include ROXML
|
15
|
+
|
16
|
+
xml_name "Merchant"
|
17
|
+
|
18
|
+
# @!attribute sp_merchant_id
|
19
|
+
# @return [String] the Service Provider Issued merchant ID. This should be unique per Service Provider. For example, 123456789
|
20
|
+
xml_accessor :sp_merchant_id, :from =>"SPMerchantId"
|
21
|
+
|
22
|
+
# @!attribute action
|
23
|
+
# @return [String] the merchant action. Valid values are C(Create), U(Update) and D(Delete).
|
24
|
+
xml_accessor :action, :from =>"Action"
|
25
|
+
|
26
|
+
# @!attribute profile
|
27
|
+
# @return [Profile] the merchant Profile. Mandatory for Create(Action=C) and Update(Action=U).
|
28
|
+
xml_accessor :profile, :from =>"Profile",:as => Profile
|
29
|
+
|
30
|
+
# @!attribute reward_program
|
31
|
+
# @return [RewardProgram] the reward program information.
|
32
|
+
xml_accessor :reward_program, :from =>"RewardProgram",:as => RewardProgram
|
33
|
+
|
34
|
+
xml_accessor :checkout_brand, :from =>"CheckoutBrand", :as =>[CheckoutBrand]
|
35
|
+
|
36
|
+
# @!attribute auth_option
|
37
|
+
# @return [Array<AuthOption>] the authentication options.
|
38
|
+
xml_accessor :auth_option, :from =>"AuthOption", :as =>[AuthOption]
|
39
|
+
|
40
|
+
# @!attribute merchant_acquirer
|
41
|
+
# @return [Array<MerchantAcquirer>] the merchant acquirer.
|
42
|
+
xml_accessor :merchant_acquirer, :from =>"MerchantAcquirer", :as =>[MerchantAcquirer]
|
43
|
+
|
44
|
+
# @!attribute checkout_level
|
45
|
+
# @return [String] the checkout level.
|
46
|
+
xml_accessor :checkout_level, :from =>"CheckoutLevel"
|
47
|
+
|
48
|
+
# @!attribute extension_point
|
49
|
+
# @return [ExtensionPoint] the extension point for future enhancement.
|
50
|
+
xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
|
51
|
+
|
52
|
+
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
54
|
+
def self.attribute_map
|
55
|
+
{
|
56
|
+
:sp_merchant_id => :SPMerchantId ,
|
57
|
+
:action => :Action ,
|
58
|
+
:profile => :Profile ,
|
59
|
+
:reward_program => :RewardProgram ,
|
60
|
+
:checkout_brand => :CheckoutBrand ,
|
61
|
+
:auth_option => :AuthOption ,
|
62
|
+
:merchant_acquirer => :MerchantAcquirer ,
|
63
|
+
:checkout_level => :CheckoutLevel ,
|
64
|
+
:extension_point => :ExtensionPoint
|
65
|
+
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def initialize(attributes = {})
|
70
|
+
return unless attributes.is_a?(Hash)
|
71
|
+
|
72
|
+
# convert string to symbol for hash key
|
73
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
74
|
+
|
75
|
+
|
76
|
+
if attributes.has_key?(:sp_merchant_id)
|
77
|
+
self.sp_merchant_id = attributes[:sp_merchant_id]
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:action)
|
81
|
+
self.action = attributes[:action]
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:profile)
|
85
|
+
self.profile = attributes[:profile]
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:reward_program)
|
89
|
+
self.reward_program = attributes[:reward_program]
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:checkout_brand)
|
93
|
+
self.checkout_brand = attributes[:checkout_brand]
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:auth_option)
|
97
|
+
self.auth_option = attributes[:auth_option]
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.has_key?(:merchant_acquirer)
|
101
|
+
self.merchant_acquirer = attributes[:merchant_acquirer]
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:checkout_level)
|
105
|
+
self.checkout_level = attributes[:checkout_level]
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.has_key?(:extension_point)
|
109
|
+
self.extension_point = attributes[:extension_point]
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
# Overriding setter method checkout_brand
|
116
|
+
# @param value
|
117
|
+
def checkout_brand=(value)
|
118
|
+
if (value.is_a?(Array))
|
119
|
+
@checkout_brand = value
|
120
|
+
else
|
121
|
+
@checkout_brand = [] if !@checkout_brand
|
122
|
+
@checkout_brand.push value
|
123
|
+
end
|
124
|
+
end
|
125
|
+
# Overriding setter method auth_option
|
126
|
+
# @param value
|
127
|
+
def auth_option=(value)
|
128
|
+
if (value.is_a?(Array))
|
129
|
+
@auth_option = value
|
130
|
+
else
|
131
|
+
@auth_option = [] if !@auth_option
|
132
|
+
@auth_option.push value
|
133
|
+
end
|
134
|
+
end
|
135
|
+
# Overriding setter method merchant_acquirer
|
136
|
+
# @param value
|
137
|
+
def merchant_acquirer=(value)
|
138
|
+
if (value.is_a?(Array))
|
139
|
+
@merchant_acquirer = value
|
140
|
+
else
|
141
|
+
@merchant_acquirer = [] if !@merchant_acquirer
|
142
|
+
@merchant_acquirer.push value
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
# Custom attribute writer method checking allowed values (enum).
|
148
|
+
def action=(action)
|
149
|
+
allowed_values = ["C", "U", "D"]
|
150
|
+
if action && !allowed_values.include?(action)
|
151
|
+
fail "invalid value for 'action', must be one of #{allowed_values}"
|
152
|
+
end
|
153
|
+
@action = action
|
154
|
+
end
|
155
|
+
|
156
|
+
# Custom attribute writer method checking allowed values (enum).
|
157
|
+
def checkout_level=(checkout_level)
|
158
|
+
allowed_values = ["STANDARD", "EXPRESS"]
|
159
|
+
if checkout_level && !allowed_values.include?(checkout_level)
|
160
|
+
fail "invalid value for 'checkout_level', must be one of #{allowed_values}"
|
161
|
+
end
|
162
|
+
@checkout_level = checkout_level
|
163
|
+
end
|
164
|
+
|
165
|
+
# Check equality by comparing each attribute.
|
166
|
+
def ==(o)
|
167
|
+
return true if self.equal?(o)
|
168
|
+
self.class == o.class &&
|
169
|
+
sp_merchant_id == o.sp_merchant_id &&
|
170
|
+
action == o.action &&
|
171
|
+
profile == o.profile &&
|
172
|
+
reward_program == o.reward_program &&
|
173
|
+
checkout_brand == o.checkout_brand &&
|
174
|
+
auth_option == o.auth_option &&
|
175
|
+
merchant_acquirer == o.merchant_acquirer &&
|
176
|
+
checkout_level == o.checkout_level &&
|
177
|
+
extension_point == o.extension_point
|
178
|
+
end
|
179
|
+
|
180
|
+
# @see the `==` method
|
181
|
+
def eql?(o)
|
182
|
+
self == o
|
183
|
+
end
|
184
|
+
|
185
|
+
# Calculate hash code according to all attributes.
|
186
|
+
def hash
|
187
|
+
[sp_merchant_id, action, profile, reward_program, checkout_brand, auth_option, merchant_acquirer, checkout_level, extension_point].hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# build the object from hash
|
191
|
+
def build_from_hash(attributes)
|
192
|
+
return nil unless attributes.is_a?(Hash)
|
193
|
+
self.class.datatype_map.each_pair do |key, type|
|
194
|
+
if type =~ /^Array<(.*)>/i
|
195
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
196
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
197
|
+
else
|
198
|
+
#TODO show warning in debug mode
|
199
|
+
end
|
200
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
201
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
202
|
+
else
|
203
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
self
|
208
|
+
end
|
209
|
+
|
210
|
+
def _deserialize(type, value)
|
211
|
+
case type.to_sym
|
212
|
+
when :DateTime
|
213
|
+
DateTime.parse(value)
|
214
|
+
when :Date
|
215
|
+
Date.parse(value)
|
216
|
+
when :Object
|
217
|
+
value
|
218
|
+
when :String
|
219
|
+
value.to_s
|
220
|
+
when :Integer
|
221
|
+
value.to_i
|
222
|
+
when :Float
|
223
|
+
value.to_f
|
224
|
+
when :BOOLEAN
|
225
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
226
|
+
true
|
227
|
+
else
|
228
|
+
false
|
229
|
+
end
|
230
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
231
|
+
inner_type = Regexp.last_match[:inner_type]
|
232
|
+
value.map { |v| _deserialize(inner_type, v) }
|
233
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
234
|
+
k_type = Regexp.last_match[:k_type]
|
235
|
+
v_type = Regexp.last_match[:v_type]
|
236
|
+
{}.tap do |hash|
|
237
|
+
value.each do |k, v|
|
238
|
+
hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
else # model
|
242
|
+
_model = MastercardMerchantOnboarding.const_get(type).new
|
243
|
+
_model.build_from_hash(value)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def to_s
|
248
|
+
to_hash.to_s
|
249
|
+
end
|
250
|
+
|
251
|
+
# to_body is an alias to to_body (backward compatibility))
|
252
|
+
def to_body
|
253
|
+
to_hash
|
254
|
+
end
|
255
|
+
|
256
|
+
# return the object in the form of hash
|
257
|
+
def to_hash(include_root = false)
|
258
|
+
attributes_hash = {}
|
259
|
+
hash = {}
|
260
|
+
self.class.attribute_map.each_pair do |attr, param|
|
261
|
+
value = self.send(attr)
|
262
|
+
next if value.nil?
|
263
|
+
hash[param] = _to_hash(value)
|
264
|
+
end
|
265
|
+
attributes_hash = include_root ? { "Merchant" => hash } : hash
|
266
|
+
return attributes_hash
|
267
|
+
end
|
268
|
+
|
269
|
+
# Method to output non-array value in the form of hash
|
270
|
+
# For object, use to_hash. Otherwise, just return the value
|
271
|
+
def _to_hash(value)
|
272
|
+
if value.is_a?(Array)
|
273
|
+
value.compact.map{ |v| _to_hash(v) }
|
274
|
+
elsif value.is_a?(Hash)
|
275
|
+
{}.tap do |hash|
|
276
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
277
|
+
end
|
278
|
+
elsif value.respond_to? :to_hash
|
279
|
+
value.to_hash
|
280
|
+
else
|
281
|
+
value
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
|
286
|
+
private
|
287
|
+
def after_parse
|
288
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
289
|
+
end
|
290
|
+
|
291
|
+
# Attribute datatype mapping.
|
292
|
+
def self.datatype_map
|
293
|
+
{
|
294
|
+
:sp_merchant_id => 'String',
|
295
|
+
:action => 'String',
|
296
|
+
:profile => 'Profile',
|
297
|
+
:reward_program => 'RewardProgram',
|
298
|
+
:checkout_brand => 'Array<CheckoutBrand>',
|
299
|
+
:auth_option => 'Array<AuthOption>',
|
300
|
+
:merchant_acquirer => 'Array<MerchantAcquirer>',
|
301
|
+
:checkout_level => 'String',
|
302
|
+
:extension_point => 'ExtensionPoint'
|
303
|
+
|
304
|
+
}
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
|
309
|
+
end
|
@@ -0,0 +1,258 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'roxml'
|
3
|
+
require_relative '../../mastercard_merchant_onboarding/models/acquirer'
|
4
|
+
require_relative '../../mastercard_merchant_onboarding/models/extension_point'
|
5
|
+
require_relative '../../mastercard_merchant_onboarding/models/merchant_acquirer_brand'
|
6
|
+
|
7
|
+
|
8
|
+
module MastercardMerchantOnboarding
|
9
|
+
# This class contains the merchant's acquirer details.
|
10
|
+
class MerchantAcquirer
|
11
|
+
include ROXML
|
12
|
+
|
13
|
+
xml_name "MerchantAcquirer"
|
14
|
+
|
15
|
+
# @!attribute action
|
16
|
+
# @return [String] the Create, Update, Delete action. Used to create (C), update (U) or delete (D) Visa Password.
|
17
|
+
xml_accessor :action, :from =>"Action"
|
18
|
+
|
19
|
+
# @!attribute acquirer
|
20
|
+
# @return [Acquirer] the merchant's acquirer details.
|
21
|
+
xml_accessor :acquirer, :from =>"Acquirer",:as => Acquirer
|
22
|
+
|
23
|
+
# @!attribute merchant_acquirer_brand
|
24
|
+
# @return [MerchantAcquirerBrand] the merchant acquirer brand.
|
25
|
+
xml_accessor :merchant_acquirer_brand, :from =>"MerchantAcquirerBrand",:as => MerchantAcquirerBrand
|
26
|
+
|
27
|
+
# @!attribute extension_point
|
28
|
+
# @return [ExtensionPoint] the extension point for future enhancement.
|
29
|
+
xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
|
30
|
+
|
31
|
+
# @!attribute id
|
32
|
+
# @return [String] the acquirer id. Used while merchant upload response.
|
33
|
+
xml_accessor :id, :from =>"ID"
|
34
|
+
|
35
|
+
# @!attribute name
|
36
|
+
# @return [String] the merchant's acquirer name. Used while merchant upload response.
|
37
|
+
xml_accessor :name, :from =>"Name"
|
38
|
+
|
39
|
+
# @!attribute assigned_merchant_id
|
40
|
+
# @return [String] the assigned merchant id. Used while merchant upload response.
|
41
|
+
xml_accessor :assigned_merchant_id, :from =>"AssignedMerchantID"
|
42
|
+
|
43
|
+
# @!attribute ds_status
|
44
|
+
# @return [String] the assigned merchant id. Used while merchant upload response.
|
45
|
+
xml_accessor :ds_status, :from =>"DSStatus"
|
46
|
+
|
47
|
+
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
49
|
+
def self.attribute_map
|
50
|
+
{
|
51
|
+
:action => :Action ,
|
52
|
+
:acquirer => :Acquirer ,
|
53
|
+
:merchant_acquirer_brand => :MerchantAcquirerBrand ,
|
54
|
+
:extension_point => :ExtensionPoint ,
|
55
|
+
:id => :ID ,
|
56
|
+
:name => :Name ,
|
57
|
+
:assigned_merchant_id => :AssignedMerchantID ,
|
58
|
+
:ds_status => :DSStatus
|
59
|
+
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def initialize(attributes = {})
|
64
|
+
return unless attributes.is_a?(Hash)
|
65
|
+
|
66
|
+
# convert string to symbol for hash key
|
67
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
68
|
+
|
69
|
+
|
70
|
+
if attributes.has_key?(:action)
|
71
|
+
self.action = attributes[:action]
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:acquirer)
|
75
|
+
self.acquirer = attributes[:acquirer]
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:merchant_acquirer_brand)
|
79
|
+
self.merchant_acquirer_brand = attributes[:merchant_acquirer_brand]
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:extension_point)
|
83
|
+
self.extension_point = attributes[:extension_point]
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:id)
|
87
|
+
self.id = attributes[:id]
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:name)
|
91
|
+
self.name = attributes[:name]
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:assigned_merchant_id)
|
95
|
+
self.assigned_merchant_id = attributes[:assigned_merchant_id]
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:ds_status)
|
99
|
+
self.ds_status = attributes[:ds_status]
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
# Custom attribute writer method checking allowed values (enum).
|
108
|
+
def action=(action)
|
109
|
+
allowed_values = ["C", "U", "D"]
|
110
|
+
if action && !allowed_values.include?(action)
|
111
|
+
fail "invalid value for 'action', must be one of #{allowed_values}"
|
112
|
+
end
|
113
|
+
@action = action
|
114
|
+
end
|
115
|
+
|
116
|
+
# Check equality by comparing each attribute.
|
117
|
+
def ==(o)
|
118
|
+
return true if self.equal?(o)
|
119
|
+
self.class == o.class &&
|
120
|
+
action == o.action &&
|
121
|
+
acquirer == o.acquirer &&
|
122
|
+
merchant_acquirer_brand == o.merchant_acquirer_brand &&
|
123
|
+
extension_point == o.extension_point &&
|
124
|
+
id == o.id &&
|
125
|
+
name == o.name &&
|
126
|
+
assigned_merchant_id == o.assigned_merchant_id &&
|
127
|
+
ds_status == o.ds_status
|
128
|
+
end
|
129
|
+
|
130
|
+
# @see the `==` method
|
131
|
+
def eql?(o)
|
132
|
+
self == o
|
133
|
+
end
|
134
|
+
|
135
|
+
# Calculate hash code according to all attributes.
|
136
|
+
def hash
|
137
|
+
[action, acquirer, merchant_acquirer_brand, extension_point, id, name, assigned_merchant_id, ds_status].hash
|
138
|
+
end
|
139
|
+
|
140
|
+
# build the object from hash
|
141
|
+
def build_from_hash(attributes)
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
143
|
+
self.class.datatype_map.each_pair do |key, type|
|
144
|
+
if type =~ /^Array<(.*)>/i
|
145
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
146
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
147
|
+
else
|
148
|
+
#TODO show warning in debug mode
|
149
|
+
end
|
150
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
151
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
152
|
+
else
|
153
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
self
|
158
|
+
end
|
159
|
+
|
160
|
+
def _deserialize(type, value)
|
161
|
+
case type.to_sym
|
162
|
+
when :DateTime
|
163
|
+
DateTime.parse(value)
|
164
|
+
when :Date
|
165
|
+
Date.parse(value)
|
166
|
+
when :Object
|
167
|
+
value
|
168
|
+
when :String
|
169
|
+
value.to_s
|
170
|
+
when :Integer
|
171
|
+
value.to_i
|
172
|
+
when :Float
|
173
|
+
value.to_f
|
174
|
+
when :BOOLEAN
|
175
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
176
|
+
true
|
177
|
+
else
|
178
|
+
false
|
179
|
+
end
|
180
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
181
|
+
inner_type = Regexp.last_match[:inner_type]
|
182
|
+
value.map { |v| _deserialize(inner_type, v) }
|
183
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
184
|
+
k_type = Regexp.last_match[:k_type]
|
185
|
+
v_type = Regexp.last_match[:v_type]
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each do |k, v|
|
188
|
+
hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
else # model
|
192
|
+
_model = MastercardMerchantOnboarding.const_get(type).new
|
193
|
+
_model.build_from_hash(value)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def to_s
|
198
|
+
to_hash.to_s
|
199
|
+
end
|
200
|
+
|
201
|
+
# to_body is an alias to to_body (backward compatibility))
|
202
|
+
def to_body
|
203
|
+
to_hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# return the object in the form of hash
|
207
|
+
def to_hash(include_root = false)
|
208
|
+
attributes_hash = {}
|
209
|
+
hash = {}
|
210
|
+
self.class.attribute_map.each_pair do |attr, param|
|
211
|
+
value = self.send(attr)
|
212
|
+
next if value.nil?
|
213
|
+
hash[param] = _to_hash(value)
|
214
|
+
end
|
215
|
+
attributes_hash = include_root ? { "MerchantAcquirer" => hash } : hash
|
216
|
+
return attributes_hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Method to output non-array value in the form of hash
|
220
|
+
# For object, use to_hash. Otherwise, just return the value
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map{ |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
|
236
|
+
private
|
237
|
+
def after_parse
|
238
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
239
|
+
end
|
240
|
+
|
241
|
+
# Attribute datatype mapping.
|
242
|
+
def self.datatype_map
|
243
|
+
{
|
244
|
+
:action => 'String',
|
245
|
+
:acquirer => 'Acquirer',
|
246
|
+
:merchant_acquirer_brand => 'MerchantAcquirerBrand',
|
247
|
+
:extension_point => 'ExtensionPoint',
|
248
|
+
:id => 'String',
|
249
|
+
:name => 'String',
|
250
|
+
:assigned_merchant_id => 'String',
|
251
|
+
:ds_status => 'String'
|
252
|
+
|
253
|
+
}
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
end
|