mastercard_merchant_onboarding 1.1.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.
Files changed (28) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +24 -0
  3. data/README.md +56 -0
  4. data/lib/mastercard_merchant_onboarding.rb +58 -0
  5. data/lib/mastercard_merchant_onboarding/api/single_merchant_upload_api.rb +42 -0
  6. data/lib/mastercard_merchant_onboarding/api/single_merchant_validate_api.rb +42 -0
  7. data/lib/mastercard_merchant_onboarding/models/acquirer.rb +225 -0
  8. data/lib/mastercard_merchant_onboarding/models/address.rb +247 -0
  9. data/lib/mastercard_merchant_onboarding/models/auth_option.rb +210 -0
  10. data/lib/mastercard_merchant_onboarding/models/checkout_brand.rb +247 -0
  11. data/lib/mastercard_merchant_onboarding/models/emails.rb +169 -0
  12. data/lib/mastercard_merchant_onboarding/models/extension_point.rb +167 -0
  13. data/lib/mastercard_merchant_onboarding/models/merchant.rb +309 -0
  14. data/lib/mastercard_merchant_onboarding/models/merchant_acquirer.rb +258 -0
  15. data/lib/mastercard_merchant_onboarding/models/merchant_acquirer_brand.rb +211 -0
  16. data/lib/mastercard_merchant_onboarding/models/merchant_download.rb +215 -0
  17. data/lib/mastercard_merchant_onboarding/models/merchant_response_record.rb +236 -0
  18. data/lib/mastercard_merchant_onboarding/models/merchant_upload.rb +182 -0
  19. data/lib/mastercard_merchant_onboarding/models/phone.rb +192 -0
  20. data/lib/mastercard_merchant_onboarding/models/profile.rb +273 -0
  21. data/lib/mastercard_merchant_onboarding/models/project_key_type.rb +180 -0
  22. data/lib/mastercard_merchant_onboarding/models/reward_program.rb +203 -0
  23. data/lib/mastercard_merchant_onboarding/models/summary.rb +259 -0
  24. data/lib/mastercard_merchant_onboarding/models/validate_file_response.rb +191 -0
  25. data/lib/mastercard_merchant_onboarding/models/validated_merchant.rb +202 -0
  26. data/lib/mastercard_merchant_onboarding/tracker/sdk_api_tracker.rb +57 -0
  27. data/lib/mastercard_merchant_onboarding/version.rb +3 -0
  28. metadata +186 -0
@@ -0,0 +1,182 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_merchant_onboarding/models/extension_point'
4
+ require_relative '../../mastercard_merchant_onboarding/models/merchant'
5
+
6
+
7
+ module MastercardMerchantOnboarding
8
+ # This class contains various methods for to set different merchant upload parameters required for Single-Merchant Upload Service.
9
+ class MerchantUpload
10
+ include ROXML
11
+
12
+ xml_name "MerchantUpload"
13
+
14
+ # @!attribute merchant
15
+ # @return [Merchant] the merchant details
16
+ xml_accessor :merchant, :from =>"Merchant",:as => Merchant
17
+
18
+ # @!attribute extension_point
19
+ # @return [ExtensionPoint] the extension point for future enhancement.
20
+ xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :merchant => :Merchant ,
27
+ :extension_point => :ExtensionPoint
28
+
29
+ }
30
+ end
31
+
32
+ def initialize(attributes = {})
33
+ return unless attributes.is_a?(Hash)
34
+
35
+ # convert string to symbol for hash key
36
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
37
+
38
+
39
+ if attributes.has_key?(:merchant)
40
+ self.merchant = attributes[:merchant]
41
+ end
42
+
43
+ if attributes.has_key?(:extension_point)
44
+ self.extension_point = attributes[:extension_point]
45
+ end
46
+
47
+ end
48
+
49
+
50
+
51
+
52
+ # Check equality by comparing each attribute.
53
+ def ==(o)
54
+ return true if self.equal?(o)
55
+ self.class == o.class &&
56
+ merchant == o.merchant &&
57
+ extension_point == o.extension_point
58
+ end
59
+
60
+ # @see the `==` method
61
+ def eql?(o)
62
+ self == o
63
+ end
64
+
65
+ # Calculate hash code according to all attributes.
66
+ def hash
67
+ [merchant, extension_point].hash
68
+ end
69
+
70
+ # build the object from hash
71
+ def build_from_hash(attributes)
72
+ return nil unless attributes.is_a?(Hash)
73
+ self.class.datatype_map.each_pair do |key, type|
74
+ if type =~ /^Array<(.*)>/i
75
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
76
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
77
+ else
78
+ #TODO show warning in debug mode
79
+ end
80
+ elsif !attributes[self.class.attribute_map[key]].nil?
81
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
82
+ else
83
+ # data not found in attributes(hash), not an issue as the data can be optional
84
+ end
85
+ end
86
+
87
+ self
88
+ end
89
+
90
+ def _deserialize(type, value)
91
+ case type.to_sym
92
+ when :DateTime
93
+ DateTime.parse(value)
94
+ when :Date
95
+ Date.parse(value)
96
+ when :Object
97
+ value
98
+ when :String
99
+ value.to_s
100
+ when :Integer
101
+ value.to_i
102
+ when :Float
103
+ value.to_f
104
+ when :BOOLEAN
105
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
106
+ true
107
+ else
108
+ false
109
+ end
110
+ when /\AArray<(?<inner_type>.+)>\z/
111
+ inner_type = Regexp.last_match[:inner_type]
112
+ value.map { |v| _deserialize(inner_type, v) }
113
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
114
+ k_type = Regexp.last_match[:k_type]
115
+ v_type = Regexp.last_match[:v_type]
116
+ {}.tap do |hash|
117
+ value.each do |k, v|
118
+ hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
119
+ end
120
+ end
121
+ else # model
122
+ _model = MastercardMerchantOnboarding.const_get(type).new
123
+ _model.build_from_hash(value)
124
+ end
125
+ end
126
+
127
+ def to_s
128
+ to_hash.to_s
129
+ end
130
+
131
+ # to_body is an alias to to_body (backward compatibility))
132
+ def to_body
133
+ to_hash
134
+ end
135
+
136
+ # return the object in the form of hash
137
+ def to_hash(include_root = false)
138
+ attributes_hash = {}
139
+ hash = {}
140
+ self.class.attribute_map.each_pair do |attr, param|
141
+ value = self.send(attr)
142
+ next if value.nil?
143
+ hash[param] = _to_hash(value)
144
+ end
145
+ attributes_hash = include_root ? { "MerchantUpload" => hash } : hash
146
+ return attributes_hash
147
+ end
148
+
149
+ # Method to output non-array value in the form of hash
150
+ # For object, use to_hash. Otherwise, just return the value
151
+ def _to_hash(value)
152
+ if value.is_a?(Array)
153
+ value.compact.map{ |v| _to_hash(v) }
154
+ elsif value.is_a?(Hash)
155
+ {}.tap do |hash|
156
+ value.each { |k, v| hash[k] = _to_hash(v) }
157
+ end
158
+ elsif value.respond_to? :to_hash
159
+ value.to_hash
160
+ else
161
+ value
162
+ end
163
+ end
164
+
165
+
166
+ private
167
+ def after_parse
168
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
169
+ end
170
+
171
+ # Attribute datatype mapping.
172
+ def self.datatype_map
173
+ {
174
+ :merchant => 'Merchant',
175
+ :extension_point => 'ExtensionPoint'
176
+
177
+ }
178
+ end
179
+ end
180
+
181
+
182
+ end
@@ -0,0 +1,192 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_merchant_onboarding/models/extension_point'
4
+
5
+
6
+ module MastercardMerchantOnboarding
7
+ # This class contains merchant's phone details.
8
+ class Phone
9
+ include ROXML
10
+
11
+ xml_name "Phone"
12
+
13
+ # @!attribute country_code
14
+ # @return [String] the merchant's phone country code. For example, 75.
15
+ xml_accessor :country_code, :from =>"CountryCode"
16
+
17
+ # @!attribute number
18
+ # @return [String] the merchant's phone number. For example, 9785453432.
19
+ xml_accessor :number, :from =>"Number"
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
+ :country_code => :CountryCode ,
30
+ :number => :Number ,
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?(:country_code)
44
+ self.country_code = attributes[:country_code]
45
+ end
46
+
47
+ if attributes.has_key?(:number)
48
+ self.number = attributes[:number]
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
+
59
+
60
+ # Check equality by comparing each attribute.
61
+ def ==(o)
62
+ return true if self.equal?(o)
63
+ self.class == o.class &&
64
+ country_code == o.country_code &&
65
+ number == o.number &&
66
+ extension_point == o.extension_point
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
+ [country_code, number, extension_point].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 ? { "Phone" => 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
+ :country_code => 'String',
184
+ :number => 'String',
185
+ :extension_point => 'ExtensionPoint'
186
+
187
+ }
188
+ end
189
+ end
190
+
191
+
192
+ end
@@ -0,0 +1,273 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_merchant_onboarding/models/acquirer'
4
+ require_relative '../../mastercard_merchant_onboarding/models/address'
5
+ require_relative '../../mastercard_merchant_onboarding/models/emails'
6
+ require_relative '../../mastercard_merchant_onboarding/models/extension_point'
7
+ require_relative '../../mastercard_merchant_onboarding/models/phone'
8
+
9
+
10
+ module MastercardMerchantOnboarding
11
+ # This class contains various merchant profile details.
12
+ class Profile
13
+ include ROXML
14
+
15
+ xml_name "Profile"
16
+
17
+ # @!attribute name
18
+ # @return [String] the merchant name. For example, XYZ Pizza
19
+ xml_accessor :name, :from =>"Name"
20
+
21
+ # @!attribute doing_bus_as
22
+ # @return [String] the alias - Doing Business As. For example, XYZ Pizza Inc.
23
+ xml_accessor :doing_bus_as, :from =>"DoingBusAs"
24
+
25
+ # @!attribute fed_tax_id
26
+ # @return [String] the merchant’s Federal Tax ID. For example, 999990001.
27
+ xml_accessor :fed_tax_id, :from =>"FedTaxId"
28
+
29
+ # @!attribute url
30
+ # @return [String] the merchant’s website URL. For example, www.xyzpizza.com.
31
+ xml_accessor :url, :from =>"Url"
32
+
33
+ # @!attribute business_category
34
+ # @return [String] the merchant’s business type. For example, Restaurant.
35
+ xml_accessor :business_category, :from =>"BusinessCategory"
36
+
37
+ # @!attribute address
38
+ # @return [Address] the merchant's address.
39
+ xml_accessor :address, :from =>"Address",:as => Address
40
+
41
+ # @!attribute phone
42
+ # @return [Phone] the merchant's phone.
43
+ xml_accessor :phone, :from =>"Phone",:as => Phone
44
+
45
+ # @!attribute emails
46
+ # @return [Emails] the merchant's email addresses.
47
+ xml_accessor :emails, :from =>"Emails",:as => Emails
48
+
49
+ # @!attribute acquirer
50
+ # @return [Acquirer] the merchant's acquirer.
51
+ xml_accessor :acquirer, :from =>"Acquirer",:as => Acquirer
52
+
53
+ # @!attribute extension_point
54
+ # @return [ExtensionPoint] the extension point for future enhancement.
55
+ xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
56
+
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :name => :Name ,
62
+ :doing_bus_as => :DoingBusAs ,
63
+ :fed_tax_id => :FedTaxId ,
64
+ :url => :Url ,
65
+ :business_category => :BusinessCategory ,
66
+ :address => :Address ,
67
+ :phone => :Phone ,
68
+ :emails => :Emails ,
69
+ :acquirer => :Acquirer ,
70
+ :extension_point => :ExtensionPoint
71
+
72
+ }
73
+ end
74
+
75
+ def initialize(attributes = {})
76
+ return unless attributes.is_a?(Hash)
77
+
78
+ # convert string to symbol for hash key
79
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
80
+
81
+
82
+ if attributes.has_key?(:name)
83
+ self.name = attributes[:name]
84
+ end
85
+
86
+ if attributes.has_key?(:doing_bus_as)
87
+ self.doing_bus_as = attributes[:doing_bus_as]
88
+ end
89
+
90
+ if attributes.has_key?(:fed_tax_id)
91
+ self.fed_tax_id = attributes[:fed_tax_id]
92
+ end
93
+
94
+ if attributes.has_key?(:url)
95
+ self.url = attributes[:url]
96
+ end
97
+
98
+ if attributes.has_key?(:business_category)
99
+ self.business_category = attributes[:business_category]
100
+ end
101
+
102
+ if attributes.has_key?(:address)
103
+ self.address = attributes[:address]
104
+ end
105
+
106
+ if attributes.has_key?(:phone)
107
+ self.phone = attributes[:phone]
108
+ end
109
+
110
+ if attributes.has_key?(:emails)
111
+ self.emails = attributes[:emails]
112
+ end
113
+
114
+ if attributes.has_key?(:acquirer)
115
+ self.acquirer = attributes[:acquirer]
116
+ end
117
+
118
+ if attributes.has_key?(:extension_point)
119
+ self.extension_point = attributes[:extension_point]
120
+ end
121
+
122
+ end
123
+
124
+
125
+
126
+
127
+ # Check equality by comparing each attribute.
128
+ def ==(o)
129
+ return true if self.equal?(o)
130
+ self.class == o.class &&
131
+ name == o.name &&
132
+ doing_bus_as == o.doing_bus_as &&
133
+ fed_tax_id == o.fed_tax_id &&
134
+ url == o.url &&
135
+ business_category == o.business_category &&
136
+ address == o.address &&
137
+ phone == o.phone &&
138
+ emails == o.emails &&
139
+ acquirer == o.acquirer &&
140
+ extension_point == o.extension_point
141
+ end
142
+
143
+ # @see the `==` method
144
+ def eql?(o)
145
+ self == o
146
+ end
147
+
148
+ # Calculate hash code according to all attributes.
149
+ def hash
150
+ [name, doing_bus_as, fed_tax_id, url, business_category, address, phone, emails, acquirer, extension_point].hash
151
+ end
152
+
153
+ # build the object from hash
154
+ def build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ self.class.datatype_map.each_pair do |key, type|
157
+ if type =~ /^Array<(.*)>/i
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
160
+ else
161
+ #TODO show warning in debug mode
162
+ end
163
+ elsif !attributes[self.class.attribute_map[key]].nil?
164
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
165
+ else
166
+ # data not found in attributes(hash), not an issue as the data can be optional
167
+ end
168
+ end
169
+
170
+ self
171
+ end
172
+
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :DateTime
176
+ DateTime.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :Object
180
+ value
181
+ when :String
182
+ value.to_s
183
+ when :Integer
184
+ value.to_i
185
+ when :Float
186
+ value.to_f
187
+ when :BOOLEAN
188
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
189
+ true
190
+ else
191
+ false
192
+ end
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ _model = MastercardMerchantOnboarding.const_get(type).new
206
+ _model.build_from_hash(value)
207
+ end
208
+ end
209
+
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_body (backward compatibility))
215
+ def to_body
216
+ to_hash
217
+ end
218
+
219
+ # return the object in the form of hash
220
+ def to_hash(include_root = false)
221
+ attributes_hash = {}
222
+ hash = {}
223
+ self.class.attribute_map.each_pair do |attr, param|
224
+ value = self.send(attr)
225
+ next if value.nil?
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ attributes_hash = include_root ? { "Profile" => hash } : hash
229
+ return attributes_hash
230
+ end
231
+
232
+ # Method to output non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map{ |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+
249
+ private
250
+ def after_parse
251
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
252
+ end
253
+
254
+ # Attribute datatype mapping.
255
+ def self.datatype_map
256
+ {
257
+ :name => 'String',
258
+ :doing_bus_as => 'String',
259
+ :fed_tax_id => 'String',
260
+ :url => 'String',
261
+ :business_category => 'String',
262
+ :address => 'Address',
263
+ :phone => 'Phone',
264
+ :emails => 'Emails',
265
+ :acquirer => 'Acquirer',
266
+ :extension_point => 'ExtensionPoint'
267
+
268
+ }
269
+ end
270
+ end
271
+
272
+
273
+ end