mastercard_merchant_onboarding 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,247 @@
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 branding details.
8
+ class CheckoutBrand
9
+ include ROXML
10
+
11
+ xml_name "CheckoutBrand"
12
+
13
+ # @!attribute checkout_id
14
+ # @return [String] If the checkout brand exists for update action, then the checkout id is mandatory. For example, a4c411by7lob4i81xb6r41i820mw3n151.
15
+ xml_accessor :checkout_id, :from =>"CheckoutId"
16
+
17
+ # @!attribute checkout_identifier
18
+ # @return [String] Used by the merchant upload response.
19
+ xml_accessor :checkout_identifier, :from =>"CheckoutIdentifier"
20
+
21
+ # @!attribute name
22
+ # @return [String] Name displayed on Masterpass site during checkout when no logo is provided. For example, XYZ Pizza.
23
+ xml_accessor :name, :from =>"Name"
24
+
25
+ # @!attribute display_name
26
+ # @return [String] the display name. For example, XYZ Pizza.
27
+ xml_accessor :display_name, :from =>"DisplayName"
28
+
29
+ # @!attribute production_url
30
+ # @return [String] the production checkout URL. For example, https://xyzpizza.com
31
+ xml_accessor :production_url, :from =>"ProductionUrl"
32
+
33
+ # @!attribute sandbox_url
34
+ # @return [String] the sandbox checkout URL. For example, https://test.xyzpizza.com
35
+ xml_accessor :sandbox_url, :from =>"SandboxUrl"
36
+
37
+ # @!attribute logo_url
38
+ # @return [String] Merchant logo displayed on Masterpass site during checkout. If not specified, the Name is displayed. For example, http://xyzpizza.com/logo.jpg
39
+ xml_accessor :logo_url, :from =>"LogoUrl"
40
+
41
+ # @!attribute extension_point
42
+ # @return [ExtensionPoint] the extension point for future enhancement.
43
+ xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
44
+
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :checkout_id => :CheckoutId ,
50
+ :checkout_identifier => :CheckoutIdentifier ,
51
+ :name => :Name ,
52
+ :display_name => :DisplayName ,
53
+ :production_url => :ProductionUrl ,
54
+ :sandbox_url => :SandboxUrl ,
55
+ :logo_url => :LogoUrl ,
56
+ :extension_point => :ExtensionPoint
57
+
58
+ }
59
+ end
60
+
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
66
+
67
+
68
+ if attributes.has_key?(:checkout_id)
69
+ self.checkout_id = attributes[:checkout_id]
70
+ end
71
+
72
+ if attributes.has_key?(:checkout_identifier)
73
+ self.checkout_identifier = attributes[:checkout_identifier]
74
+ end
75
+
76
+ if attributes.has_key?(:name)
77
+ self.name = attributes[:name]
78
+ end
79
+
80
+ if attributes.has_key?(:display_name)
81
+ self.display_name = attributes[:display_name]
82
+ end
83
+
84
+ if attributes.has_key?(:production_url)
85
+ self.production_url = attributes[:production_url]
86
+ end
87
+
88
+ if attributes.has_key?(:sandbox_url)
89
+ self.sandbox_url = attributes[:sandbox_url]
90
+ end
91
+
92
+ if attributes.has_key?(:logo_url)
93
+ self.logo_url = attributes[:logo_url]
94
+ end
95
+
96
+ if attributes.has_key?(:extension_point)
97
+ self.extension_point = attributes[:extension_point]
98
+ end
99
+
100
+ end
101
+
102
+
103
+
104
+
105
+ # Check equality by comparing each attribute.
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ checkout_id == o.checkout_id &&
110
+ checkout_identifier == o.checkout_identifier &&
111
+ name == o.name &&
112
+ display_name == o.display_name &&
113
+ production_url == o.production_url &&
114
+ sandbox_url == o.sandbox_url &&
115
+ logo_url == o.logo_url &&
116
+ extension_point == o.extension_point
117
+ end
118
+
119
+ # @see the `==` method
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculate hash code according to all attributes.
125
+ def hash
126
+ [checkout_id, checkout_identifier, name, display_name, production_url, sandbox_url, logo_url, extension_point].hash
127
+ end
128
+
129
+ # build the object from hash
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.datatype_map.each_pair do |key, type|
133
+ if type =~ /^Array<(.*)>/i
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
136
+ else
137
+ #TODO show warning in debug mode
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ else
142
+ # data not found in attributes(hash), not an issue as the data can be optional
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :DateTime
152
+ DateTime.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :Object
156
+ value
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :BOOLEAN
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ _model = MastercardMerchantOnboarding.const_get(type).new
182
+ _model.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_body (backward compatibility))
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # return the object in the form of hash
196
+ def to_hash(include_root = false)
197
+ attributes_hash = {}
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ next if value.nil?
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ attributes_hash = include_root ? { "CheckoutBrand" => hash } : hash
205
+ return attributes_hash
206
+ end
207
+
208
+ # Method to output non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map{ |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+
224
+
225
+ private
226
+ def after_parse
227
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
228
+ end
229
+
230
+ # Attribute datatype mapping.
231
+ def self.datatype_map
232
+ {
233
+ :checkout_id => 'String',
234
+ :checkout_identifier => 'String',
235
+ :name => 'String',
236
+ :display_name => 'String',
237
+ :production_url => 'String',
238
+ :sandbox_url => 'String',
239
+ :logo_url => 'String',
240
+ :extension_point => 'ExtensionPoint'
241
+
242
+ }
243
+ end
244
+ end
245
+
246
+
247
+ end
@@ -0,0 +1,169 @@
1
+ require 'date'
2
+ require 'roxml'
3
+
4
+
5
+ module MastercardMerchantOnboarding
6
+ # This class contains merchant's email details.
7
+ class Emails
8
+ include ROXML
9
+
10
+ xml_name "Emails"
11
+
12
+ # @!attribute email_address
13
+ # @return [Array<String>] the merchant's email address. For example, email@xyzpizza.com.
14
+ xml_accessor :email_address, :from =>"EmailAddress", :as =>[]
15
+
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :email_address => :EmailAddress
21
+
22
+ }
23
+ end
24
+
25
+ def initialize(attributes = {})
26
+ return unless attributes.is_a?(Hash)
27
+
28
+ # convert string to symbol for hash key
29
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
30
+
31
+
32
+ if attributes.has_key?(:email_address)
33
+ self.email_address = attributes[:email_address]
34
+ end
35
+
36
+ end
37
+
38
+
39
+
40
+
41
+ # Check equality by comparing each attribute.
42
+ def ==(o)
43
+ return true if self.equal?(o)
44
+ self.class == o.class &&
45
+ email_address == o.email_address
46
+ end
47
+
48
+ # @see the `==` method
49
+ def eql?(o)
50
+ self == o
51
+ end
52
+
53
+ # Calculate hash code according to all attributes.
54
+ def hash
55
+ [email_address].hash
56
+ end
57
+
58
+ # build the object from hash
59
+ def build_from_hash(attributes)
60
+ return nil unless attributes.is_a?(Hash)
61
+ self.class.datatype_map.each_pair do |key, type|
62
+ if type =~ /^Array<(.*)>/i
63
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
64
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
65
+ else
66
+ #TODO show warning in debug mode
67
+ end
68
+ elsif !attributes[self.class.attribute_map[key]].nil?
69
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
70
+ else
71
+ # data not found in attributes(hash), not an issue as the data can be optional
72
+ end
73
+ end
74
+
75
+ self
76
+ end
77
+
78
+ def _deserialize(type, value)
79
+ case type.to_sym
80
+ when :DateTime
81
+ DateTime.parse(value)
82
+ when :Date
83
+ Date.parse(value)
84
+ when :Object
85
+ value
86
+ when :String
87
+ value.to_s
88
+ when :Integer
89
+ value.to_i
90
+ when :Float
91
+ value.to_f
92
+ when :BOOLEAN
93
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
94
+ true
95
+ else
96
+ false
97
+ end
98
+ when /\AArray<(?<inner_type>.+)>\z/
99
+ inner_type = Regexp.last_match[:inner_type]
100
+ value.map { |v| _deserialize(inner_type, v) }
101
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
102
+ k_type = Regexp.last_match[:k_type]
103
+ v_type = Regexp.last_match[:v_type]
104
+ {}.tap do |hash|
105
+ value.each do |k, v|
106
+ hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
107
+ end
108
+ end
109
+ else # model
110
+ _model = MastercardMerchantOnboarding.const_get(type).new
111
+ _model.build_from_hash(value)
112
+ end
113
+ end
114
+
115
+ def to_s
116
+ to_hash.to_s
117
+ end
118
+
119
+ # to_body is an alias to to_body (backward compatibility))
120
+ def to_body
121
+ to_hash
122
+ end
123
+
124
+ # return the object in the form of hash
125
+ def to_hash(include_root = false)
126
+ attributes_hash = {}
127
+ hash = {}
128
+ self.class.attribute_map.each_pair do |attr, param|
129
+ value = self.send(attr)
130
+ next if value.nil?
131
+ hash[param] = _to_hash(value)
132
+ end
133
+ attributes_hash = include_root ? { "Emails" => hash } : hash
134
+ return attributes_hash
135
+ end
136
+
137
+ # Method to output non-array value in the form of hash
138
+ # For object, use to_hash. Otherwise, just return the value
139
+ def _to_hash(value)
140
+ if value.is_a?(Array)
141
+ value.compact.map{ |v| _to_hash(v) }
142
+ elsif value.is_a?(Hash)
143
+ {}.tap do |hash|
144
+ value.each { |k, v| hash[k] = _to_hash(v) }
145
+ end
146
+ elsif value.respond_to? :to_hash
147
+ value.to_hash
148
+ else
149
+ value
150
+ end
151
+ end
152
+
153
+
154
+ private
155
+ def after_parse
156
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
157
+ end
158
+
159
+ # Attribute datatype mapping.
160
+ def self.datatype_map
161
+ {
162
+ :email_address => 'Array<String>'
163
+
164
+ }
165
+ end
166
+ end
167
+
168
+
169
+ end
@@ -0,0 +1,167 @@
1
+ require 'date'
2
+ require 'roxml'
3
+
4
+
5
+ module MastercardMerchantOnboarding
6
+ # This class contains methods require to set additional details.
7
+ class ExtensionPoint
8
+ include ROXML
9
+
10
+ xml_name "ExtensionPoint"
11
+
12
+ xml_accessor :any, :from =>"any"
13
+
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :any => :any
19
+
20
+ }
21
+ end
22
+
23
+ def initialize(attributes = {})
24
+ return unless attributes.is_a?(Hash)
25
+
26
+ # convert string to symbol for hash key
27
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
28
+
29
+
30
+ if attributes.has_key?(:any)
31
+ self.any = attributes[:any]
32
+ end
33
+
34
+ end
35
+
36
+
37
+
38
+
39
+ # Check equality by comparing each attribute.
40
+ def ==(o)
41
+ return true if self.equal?(o)
42
+ self.class == o.class &&
43
+ any == o.any
44
+ end
45
+
46
+ # @see the `==` method
47
+ def eql?(o)
48
+ self == o
49
+ end
50
+
51
+ # Calculate hash code according to all attributes.
52
+ def hash
53
+ [any].hash
54
+ end
55
+
56
+ # build the object from hash
57
+ def build_from_hash(attributes)
58
+ return nil unless attributes.is_a?(Hash)
59
+ self.class.datatype_map.each_pair do |key, type|
60
+ if type =~ /^Array<(.*)>/i
61
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
62
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
63
+ else
64
+ #TODO show warning in debug mode
65
+ end
66
+ elsif !attributes[self.class.attribute_map[key]].nil?
67
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
68
+ else
69
+ # data not found in attributes(hash), not an issue as the data can be optional
70
+ end
71
+ end
72
+
73
+ self
74
+ end
75
+
76
+ def _deserialize(type, value)
77
+ case type.to_sym
78
+ when :DateTime
79
+ DateTime.parse(value)
80
+ when :Date
81
+ Date.parse(value)
82
+ when :Object
83
+ value
84
+ when :String
85
+ value.to_s
86
+ when :Integer
87
+ value.to_i
88
+ when :Float
89
+ value.to_f
90
+ when :BOOLEAN
91
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
92
+ true
93
+ else
94
+ false
95
+ end
96
+ when /\AArray<(?<inner_type>.+)>\z/
97
+ inner_type = Regexp.last_match[:inner_type]
98
+ value.map { |v| _deserialize(inner_type, v) }
99
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
100
+ k_type = Regexp.last_match[:k_type]
101
+ v_type = Regexp.last_match[:v_type]
102
+ {}.tap do |hash|
103
+ value.each do |k, v|
104
+ hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
105
+ end
106
+ end
107
+ else # model
108
+ _model = MastercardMerchantOnboarding.const_get(type).new
109
+ _model.build_from_hash(value)
110
+ end
111
+ end
112
+
113
+ def to_s
114
+ to_hash.to_s
115
+ end
116
+
117
+ # to_body is an alias to to_body (backward compatibility))
118
+ def to_body
119
+ to_hash
120
+ end
121
+
122
+ # return the object in the form of hash
123
+ def to_hash(include_root = false)
124
+ attributes_hash = {}
125
+ hash = {}
126
+ self.class.attribute_map.each_pair do |attr, param|
127
+ value = self.send(attr)
128
+ next if value.nil?
129
+ hash[param] = _to_hash(value)
130
+ end
131
+ attributes_hash = include_root ? { "ExtensionPoint" => hash } : hash
132
+ return attributes_hash
133
+ end
134
+
135
+ # Method to output non-array value in the form of hash
136
+ # For object, use to_hash. Otherwise, just return the value
137
+ def _to_hash(value)
138
+ if value.is_a?(Array)
139
+ value.compact.map{ |v| _to_hash(v) }
140
+ elsif value.is_a?(Hash)
141
+ {}.tap do |hash|
142
+ value.each { |k, v| hash[k] = _to_hash(v) }
143
+ end
144
+ elsif value.respond_to? :to_hash
145
+ value.to_hash
146
+ else
147
+ value
148
+ end
149
+ end
150
+
151
+
152
+ private
153
+ def after_parse
154
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
155
+ end
156
+
157
+ # Attribute datatype mapping.
158
+ def self.datatype_map
159
+ {
160
+ :any => 'Object'
161
+
162
+ }
163
+ end
164
+ end
165
+
166
+
167
+ end