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 merchant's address details.
8
+ class Address
9
+ include ROXML
10
+
11
+ xml_name "Address"
12
+
13
+ # @!attribute city
14
+ # @return [String] the merchant's city. For example, New York.
15
+ xml_accessor :city, :from =>"City"
16
+
17
+ # @!attribute country
18
+ # @return [String] the merchant's country. Standard 2-letter ISO 3166 country codes. For example, US.
19
+ xml_accessor :country, :from =>"Country"
20
+
21
+ # @!attribute country_subdivision
22
+ # @return [String] the merchant’s country subdivision. Defined by ISO 3166-1 alpha-2 digit code. For example, US-VA is Virginia, US-OH is Ohio.
23
+ xml_accessor :country_subdivision, :from =>"CountrySubdivision"
24
+
25
+ # @!attribute line1
26
+ # @return [String] the merchant’s address line 1. For example, 1 Main Street.
27
+ xml_accessor :line1, :from =>"Line1"
28
+
29
+ # @!attribute line2
30
+ # @return [String] the merchant’s address line 2.
31
+ xml_accessor :line2, :from =>"Line2"
32
+
33
+ # @!attribute line3
34
+ # @return [String] the merchant’s address line 3.
35
+ xml_accessor :line3, :from =>"Line3"
36
+
37
+ # @!attribute postal_code
38
+ # @return [String] the merchant’s postal code. For example, 10001.
39
+ xml_accessor :postal_code, :from =>"PostalCode"
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
+ :city => :City ,
50
+ :country => :Country ,
51
+ :country_subdivision => :CountrySubdivision ,
52
+ :line1 => :Line1 ,
53
+ :line2 => :Line2 ,
54
+ :line3 => :Line3 ,
55
+ :postal_code => :PostalCode ,
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?(:city)
69
+ self.city = attributes[:city]
70
+ end
71
+
72
+ if attributes.has_key?(:country)
73
+ self.country = attributes[:country]
74
+ end
75
+
76
+ if attributes.has_key?(:country_subdivision)
77
+ self.country_subdivision = attributes[:country_subdivision]
78
+ end
79
+
80
+ if attributes.has_key?(:line1)
81
+ self.line1 = attributes[:line1]
82
+ end
83
+
84
+ if attributes.has_key?(:line2)
85
+ self.line2 = attributes[:line2]
86
+ end
87
+
88
+ if attributes.has_key?(:line3)
89
+ self.line3 = attributes[:line3]
90
+ end
91
+
92
+ if attributes.has_key?(:postal_code)
93
+ self.postal_code = attributes[:postal_code]
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
+ city == o.city &&
110
+ country == o.country &&
111
+ country_subdivision == o.country_subdivision &&
112
+ line1 == o.line1 &&
113
+ line2 == o.line2 &&
114
+ line3 == o.line3 &&
115
+ postal_code == o.postal_code &&
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
+ [city, country, country_subdivision, line1, line2, line3, postal_code, 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 ? { "Address" => 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
+ :city => 'String',
234
+ :country => 'String',
235
+ :country_subdivision => 'String',
236
+ :line1 => 'String',
237
+ :line2 => 'String',
238
+ :line3 => 'String',
239
+ :postal_code => 'String',
240
+ :extension_point => 'ExtensionPoint'
241
+
242
+ }
243
+ end
244
+ end
245
+
246
+
247
+ end
@@ -0,0 +1,210 @@
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 authentication options.
8
+ class AuthOption
9
+ include ROXML
10
+
11
+ xml_name "AuthOption"
12
+
13
+ # @!attribute card_brand
14
+ # @return [String] Card brands enrolled for advanced authentication. For example, for Mastercard, use MASTER.
15
+ xml_accessor :card_brand, :from =>"CardBrand"
16
+
17
+ # @!attribute type
18
+ # @return [String] Authentication type.
19
+ xml_accessor :type, :from =>"Type"
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
+ :type => :Type ,
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?(:type)
48
+ self.type = attributes[:type]
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
+ # Custom attribute writer method checking allowed values (enum).
61
+ def card_brand=(card_brand)
62
+ allowed_values = ["MASTER_CARD", "VISA", "AMERICAN_EXPRESS", "DISCOVER", "JCB", "MAESTRO", "DINERS"]
63
+ if card_brand && !allowed_values.include?(card_brand)
64
+ fail "invalid value for 'card_brand', must be one of #{allowed_values}"
65
+ end
66
+ @card_brand = card_brand
67
+ end
68
+
69
+ # Custom attribute writer method checking allowed values (enum).
70
+ def type=(type)
71
+ allowed_values = ["BASIC", "ALL_TRANSACTIONS", "VERIFIED"]
72
+ if type && !allowed_values.include?(type)
73
+ fail "invalid value for 'type', must be one of #{allowed_values}"
74
+ end
75
+ @type = type
76
+ end
77
+
78
+ # Check equality by comparing each attribute.
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ card_brand == o.card_brand &&
83
+ type == o.type &&
84
+ extension_point == o.extension_point
85
+ end
86
+
87
+ # @see the `==` method
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculate hash code according to all attributes.
93
+ def hash
94
+ [card_brand, type, extension_point].hash
95
+ end
96
+
97
+ # build the object from hash
98
+ def build_from_hash(attributes)
99
+ return nil unless attributes.is_a?(Hash)
100
+ self.class.datatype_map.each_pair do |key, type|
101
+ if type =~ /^Array<(.*)>/i
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
+ else
105
+ #TODO show warning in debug mode
106
+ end
107
+ elsif !attributes[self.class.attribute_map[key]].nil?
108
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
+ else
110
+ # data not found in attributes(hash), not an issue as the data can be optional
111
+ end
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :Object
124
+ value
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :BOOLEAN
132
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when /\AArray<(?<inner_type>.+)>\z/
138
+ inner_type = Regexp.last_match[:inner_type]
139
+ value.map { |v| _deserialize(inner_type, v) }
140
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
141
+ k_type = Regexp.last_match[:k_type]
142
+ v_type = Regexp.last_match[:v_type]
143
+ {}.tap do |hash|
144
+ value.each do |k, v|
145
+ hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
146
+ end
147
+ end
148
+ else # model
149
+ _model = MastercardMerchantOnboarding.const_get(type).new
150
+ _model.build_from_hash(value)
151
+ end
152
+ end
153
+
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_body (backward compatibility))
159
+ def to_body
160
+ to_hash
161
+ end
162
+
163
+ # return the object in the form of hash
164
+ def to_hash(include_root = false)
165
+ attributes_hash = {}
166
+ hash = {}
167
+ self.class.attribute_map.each_pair do |attr, param|
168
+ value = self.send(attr)
169
+ next if value.nil?
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ attributes_hash = include_root ? { "AuthOption" => hash } : hash
173
+ return attributes_hash
174
+ end
175
+
176
+ # Method to output non-array value in the form of hash
177
+ # For object, use to_hash. Otherwise, just return the value
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map{ |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+
192
+
193
+ private
194
+ def after_parse
195
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
196
+ end
197
+
198
+ # Attribute datatype mapping.
199
+ def self.datatype_map
200
+ {
201
+ :card_brand => 'String',
202
+ :type => 'String',
203
+ :extension_point => 'ExtensionPoint'
204
+
205
+ }
206
+ end
207
+ end
208
+
209
+
210
+ end