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,180 @@
1
+ require 'date'
2
+ require 'roxml'
3
+
4
+
5
+ module MastercardMerchantOnboarding
6
+ # This class contains the project key type.
7
+ class ProjectKeyType
8
+ include ROXML
9
+
10
+ xml_name "ProjectKeyType"
11
+
12
+ # @!attribute sandbox_key
13
+ # @return [String] the developer’s sandbox API key. For example, 245d5a537a457c2f2b55644b704142694449644b56673d9d
14
+ xml_accessor :sandbox_key, :from =>"SandboxKey"
15
+
16
+ # @!attribute production_key
17
+ # @return [String] the developer’s production API key. For example, 245d5a537a457c2f2b55644b704142694449644b56673d9d
18
+ xml_accessor :production_key, :from =>"ProductionKey"
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :sandbox_key => :SandboxKey ,
25
+ :production_key => :ProductionKey
26
+
27
+ }
28
+ end
29
+
30
+ def initialize(attributes = {})
31
+ return unless attributes.is_a?(Hash)
32
+
33
+ # convert string to symbol for hash key
34
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
35
+
36
+
37
+ if attributes.has_key?(:sandbox_key)
38
+ self.sandbox_key = attributes[:sandbox_key]
39
+ end
40
+
41
+ if attributes.has_key?(:production_key)
42
+ self.production_key = attributes[:production_key]
43
+ end
44
+
45
+ end
46
+
47
+
48
+
49
+
50
+ # Check equality by comparing each attribute.
51
+ def ==(o)
52
+ return true if self.equal?(o)
53
+ self.class == o.class &&
54
+ sandbox_key == o.sandbox_key &&
55
+ production_key == o.production_key
56
+ end
57
+
58
+ # @see the `==` method
59
+ def eql?(o)
60
+ self == o
61
+ end
62
+
63
+ # Calculate hash code according to all attributes.
64
+ def hash
65
+ [sandbox_key, production_key].hash
66
+ end
67
+
68
+ # build the object from hash
69
+ def build_from_hash(attributes)
70
+ return nil unless attributes.is_a?(Hash)
71
+ self.class.datatype_map.each_pair do |key, type|
72
+ if type =~ /^Array<(.*)>/i
73
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
74
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
75
+ else
76
+ #TODO show warning in debug mode
77
+ end
78
+ elsif !attributes[self.class.attribute_map[key]].nil?
79
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
80
+ else
81
+ # data not found in attributes(hash), not an issue as the data can be optional
82
+ end
83
+ end
84
+
85
+ self
86
+ end
87
+
88
+ def _deserialize(type, value)
89
+ case type.to_sym
90
+ when :DateTime
91
+ DateTime.parse(value)
92
+ when :Date
93
+ Date.parse(value)
94
+ when :Object
95
+ value
96
+ when :String
97
+ value.to_s
98
+ when :Integer
99
+ value.to_i
100
+ when :Float
101
+ value.to_f
102
+ when :BOOLEAN
103
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
104
+ true
105
+ else
106
+ false
107
+ end
108
+ when /\AArray<(?<inner_type>.+)>\z/
109
+ inner_type = Regexp.last_match[:inner_type]
110
+ value.map { |v| _deserialize(inner_type, v) }
111
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
112
+ k_type = Regexp.last_match[:k_type]
113
+ v_type = Regexp.last_match[:v_type]
114
+ {}.tap do |hash|
115
+ value.each do |k, v|
116
+ hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
117
+ end
118
+ end
119
+ else # model
120
+ _model = MastercardMerchantOnboarding.const_get(type).new
121
+ _model.build_from_hash(value)
122
+ end
123
+ end
124
+
125
+ def to_s
126
+ to_hash.to_s
127
+ end
128
+
129
+ # to_body is an alias to to_body (backward compatibility))
130
+ def to_body
131
+ to_hash
132
+ end
133
+
134
+ # return the object in the form of hash
135
+ def to_hash(include_root = false)
136
+ attributes_hash = {}
137
+ hash = {}
138
+ self.class.attribute_map.each_pair do |attr, param|
139
+ value = self.send(attr)
140
+ next if value.nil?
141
+ hash[param] = _to_hash(value)
142
+ end
143
+ attributes_hash = include_root ? { "ProjectKeyType" => hash } : hash
144
+ return attributes_hash
145
+ end
146
+
147
+ # Method to output non-array value in the form of hash
148
+ # For object, use to_hash. Otherwise, just return the value
149
+ def _to_hash(value)
150
+ if value.is_a?(Array)
151
+ value.compact.map{ |v| _to_hash(v) }
152
+ elsif value.is_a?(Hash)
153
+ {}.tap do |hash|
154
+ value.each { |k, v| hash[k] = _to_hash(v) }
155
+ end
156
+ elsif value.respond_to? :to_hash
157
+ value.to_hash
158
+ else
159
+ value
160
+ end
161
+ end
162
+
163
+
164
+ private
165
+ def after_parse
166
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
167
+ end
168
+
169
+ # Attribute datatype mapping.
170
+ def self.datatype_map
171
+ {
172
+ :sandbox_key => 'String',
173
+ :production_key => 'String'
174
+
175
+ }
176
+ end
177
+ end
178
+
179
+
180
+ end
@@ -0,0 +1,203 @@
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 reward program details.
8
+ class RewardProgram
9
+ include ROXML
10
+
11
+ xml_name "RewardProgram"
12
+
13
+ # @!attribute name
14
+ # @return [String] the reward program name.
15
+ xml_accessor :name, :from =>"Name"
16
+
17
+ # @!attribute id
18
+ # @return [String] the reward id.
19
+ xml_accessor :id, :from =>"Id"
20
+
21
+ # @!attribute logo_url
22
+ # @return [String] the logo url.
23
+ xml_accessor :logo_url, :from =>"LogoUrl"
24
+
25
+ # @!attribute extension_point
26
+ # @return [ExtensionPoint] the extension point for future enhancement.
27
+ xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
28
+
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :name => :Name ,
34
+ :id => :Id ,
35
+ :logo_url => :LogoUrl ,
36
+ :extension_point => :ExtensionPoint
37
+
38
+ }
39
+ end
40
+
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
46
+
47
+
48
+ if attributes.has_key?(:name)
49
+ self.name = attributes[:name]
50
+ end
51
+
52
+ if attributes.has_key?(:id)
53
+ self.id = attributes[:id]
54
+ end
55
+
56
+ if attributes.has_key?(:logo_url)
57
+ self.logo_url = attributes[:logo_url]
58
+ end
59
+
60
+ if attributes.has_key?(:extension_point)
61
+ self.extension_point = attributes[:extension_point]
62
+ end
63
+
64
+ end
65
+
66
+
67
+
68
+
69
+ # Check equality by comparing each attribute.
70
+ def ==(o)
71
+ return true if self.equal?(o)
72
+ self.class == o.class &&
73
+ name == o.name &&
74
+ id == o.id &&
75
+ logo_url == o.logo_url &&
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
+ [name, id, logo_url, 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 ? { "RewardProgram" => 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
+ :name => 'String',
194
+ :id => 'String',
195
+ :logo_url => 'String',
196
+ :extension_point => 'ExtensionPoint'
197
+
198
+ }
199
+ end
200
+ end
201
+
202
+
203
+ end
@@ -0,0 +1,259 @@
1
+ require 'date'
2
+ require 'roxml'
3
+ require_relative '../../mastercard_merchant_onboarding/models/extension_point'
4
+ require_relative '../../mastercard_merchant_onboarding/models/project_key_type'
5
+
6
+
7
+ module MastercardMerchantOnboarding
8
+ # This class contains the merchant upload summary.
9
+ class Summary
10
+ include ROXML
11
+
12
+ xml_name "Summary"
13
+
14
+ # @!attribute batch_id
15
+ # @return [Integer] the system assigned batch Id. For example, 277800
16
+ xml_accessor :batch_id, :from =>"BatchId"
17
+
18
+ # @!attribute description
19
+ # @return [String] the description provided during file upload. For example, Merchant file upload.
20
+ xml_accessor :description, :from =>"Description"
21
+
22
+ # @!attribute upload_timestamp
23
+ # @return [String] the upload time stamp. For example, 2013-05-18T11:45:19.444-05:00
24
+ xml_accessor :upload_timestamp, :from =>"UploadTimestamp"
25
+
26
+ # @!attribute upload_file_name
27
+ # @return [String] the upload file name. For example, merchant.xml
28
+ xml_accessor :upload_file_name, :from =>"UploadFileName"
29
+
30
+ # @!attribute success_count
31
+ # @return [Integer] the number of successfully uploaded merchant brandings.
32
+ xml_accessor :success_count, :from =>"SuccessCount"
33
+
34
+ # @!attribute failure_count
35
+ # @return [Integer] the number of unsuccessfully uploaded merchant brandings.
36
+ xml_accessor :failure_count, :from =>"FailureCount"
37
+
38
+ # @!attribute error_text
39
+ # @return [String] the description of errors resulting upload failures. For example, Invalid Format.
40
+ xml_accessor :error_text, :from =>"ErrorText"
41
+
42
+ # @!attribute project_keys
43
+ # @return [ProjectKeyType] the developer environment keys.
44
+ xml_accessor :project_keys, :from =>"ProjectKeys",:as => ProjectKeyType
45
+
46
+ # @!attribute extension_point
47
+ # @return [ExtensionPoint] the extension point for future enhancement.
48
+ xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
49
+
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :batch_id => :BatchId ,
55
+ :description => :Description ,
56
+ :upload_timestamp => :UploadTimestamp ,
57
+ :upload_file_name => :UploadFileName ,
58
+ :success_count => :SuccessCount ,
59
+ :failure_count => :FailureCount ,
60
+ :error_text => :ErrorText ,
61
+ :project_keys => :ProjectKeys ,
62
+ :extension_point => :ExtensionPoint
63
+
64
+ }
65
+ end
66
+
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
72
+
73
+
74
+ if attributes.has_key?(:batch_id)
75
+ self.batch_id = attributes[:batch_id]
76
+ end
77
+
78
+ if attributes.has_key?(:description)
79
+ self.description = attributes[:description]
80
+ end
81
+
82
+ if attributes.has_key?(:upload_timestamp)
83
+ self.upload_timestamp = attributes[:upload_timestamp]
84
+ end
85
+
86
+ if attributes.has_key?(:upload_file_name)
87
+ self.upload_file_name = attributes[:upload_file_name]
88
+ end
89
+
90
+ if attributes.has_key?(:success_count)
91
+ self.success_count = attributes[:success_count]
92
+ end
93
+
94
+ if attributes.has_key?(:failure_count)
95
+ self.failure_count = attributes[:failure_count]
96
+ end
97
+
98
+ if attributes.has_key?(:error_text)
99
+ self.error_text = attributes[:error_text]
100
+ end
101
+
102
+ if attributes.has_key?(:project_keys)
103
+ self.project_keys = attributes[:project_keys]
104
+ end
105
+
106
+ if attributes.has_key?(:extension_point)
107
+ self.extension_point = attributes[:extension_point]
108
+ end
109
+
110
+ end
111
+
112
+
113
+
114
+
115
+ # Check equality by comparing each attribute.
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ batch_id == o.batch_id &&
120
+ description == o.description &&
121
+ upload_timestamp == o.upload_timestamp &&
122
+ upload_file_name == o.upload_file_name &&
123
+ success_count == o.success_count &&
124
+ failure_count == o.failure_count &&
125
+ error_text == o.error_text &&
126
+ project_keys == o.project_keys &&
127
+ extension_point == o.extension_point
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
+ [batch_id, description, upload_timestamp, upload_file_name, success_count, failure_count, error_text, project_keys, extension_point].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 ? { "Summary" => 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
+ :batch_id => 'Integer',
245
+ :description => 'String',
246
+ :upload_timestamp => 'String',
247
+ :upload_file_name => 'String',
248
+ :success_count => 'Integer',
249
+ :failure_count => 'Integer',
250
+ :error_text => 'String',
251
+ :project_keys => 'ProjectKeyType',
252
+ :extension_point => 'ExtensionPoint'
253
+
254
+ }
255
+ end
256
+ end
257
+
258
+
259
+ end