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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8ebdb9bf7743d2836548774d0a41cdaf815462f5
4
+ data.tar.gz: 361e3becb40211e883dc35a345d76dadd3509176
5
+ SHA512:
6
+ metadata.gz: 7bcfba174394afd64ee12aeddd4364f50fc98807e6aee2ec3255b3ef38004816952907b5f65f41c89ce353dd821fa3e9e88bed4cd3b46fea6db805e5d6edf19a
7
+ data.tar.gz: 08da190d3f450ca7538b6ff75f772a6d34b20456f2c97136b525da01b63acc75e66497aa83acf79cdf36e0d8af48c170f12021a569f892bddbd4849f0bc749ca
data/LICENSE.txt ADDED
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2018, MasterCard International Incorporated
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are
5
+ permitted provided that the following conditions are met:
6
+
7
+ Redistributions of source code must retain the above copyright notice, this list of
8
+ conditions and the following disclaimer.
9
+ Redistributions in binary form must reproduce the above copyright notice, this list of
10
+ conditions and the following disclaimer in the documentation and/or other materials
11
+ provided with the distribution.
12
+ Neither the name of the MasterCard International Incorporated nor the names of its
13
+ contributors may be used to endorse or promote products derived from this software
14
+ without specific prior written permission.
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
16
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
18
+ SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
20
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
+ SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # MastercardMerchantOnboarding
2
+ Masterpass™ is Mastercard’s integrated digital wallet and checkout solution.
3
+ MastercardMerchantOnboarding allows to onboard a single merchant to Masterpass™ in real time.
4
+ It can be used to complete the following tasks:
5
+
6
+ • Add an individual merchant to Masterpass.
7
+
8
+ • Update an individual, existing Masterpass merchant record.
9
+
10
+ • Delete an individual merchant record from Masterpass.
11
+
12
+ Masterpass then provides a real-time response to the API.
13
+
14
+ ## Installation
15
+
16
+ Add this line to your application's Gemfile:
17
+
18
+ ```ruby
19
+ gem 'mastercard_merchant_onboarding'
20
+ ```
21
+
22
+ And then execute:
23
+
24
+ $ bundle
25
+
26
+ Or install it yourself as:
27
+
28
+ $ gem install mastercard_merchant_onboarding
29
+
30
+ ## Copyright
31
+ Copyright (c) 2018, Mastercard International Incorporated. See LICENSE for details.
32
+
33
+ ## LICENSE
34
+ Copyright (c) 2018, Mastercard International Incorporated. All rights reserved.
35
+
36
+ Redistribution and use in source and binary forms, with or without modification, are
37
+ permitted provided that the following conditions are met:
38
+
39
+ Redistributions of source code must retain the above copyright notice, this list of
40
+ conditions and the following disclaimer.
41
+ Redistributions in binary form must reproduce the above copyright notice, this list of
42
+ conditions and the following disclaimer in the documentation and/or other materials
43
+ provided with the distribution.
44
+ Neither the name of the Mastercard International Incorporated nor the names of its
45
+ contributors may be used to endorse or promote products derived from this software
46
+ without specific prior written permission.
47
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
48
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
49
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
50
+ SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
51
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
52
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
53
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
54
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
55
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56
+ SUCH DAMAGE.
@@ -0,0 +1,58 @@
1
+ # Common files
2
+ require_relative 'mastercard_merchant_onboarding/version'
3
+ require_relative 'mastercard_merchant_onboarding/tracker/sdk_api_tracker'
4
+
5
+ # Models
6
+
7
+ require_relative 'mastercard_merchant_onboarding/models/merchant_upload'
8
+
9
+ require_relative 'mastercard_merchant_onboarding/models/merchant'
10
+
11
+ require_relative 'mastercard_merchant_onboarding/models/profile'
12
+
13
+ require_relative 'mastercard_merchant_onboarding/models/address'
14
+
15
+ require_relative 'mastercard_merchant_onboarding/models/phone'
16
+
17
+ require_relative 'mastercard_merchant_onboarding/models/emails'
18
+
19
+ require_relative 'mastercard_merchant_onboarding/models/acquirer'
20
+
21
+ require_relative 'mastercard_merchant_onboarding/models/reward_program'
22
+
23
+ require_relative 'mastercard_merchant_onboarding/models/checkout_brand'
24
+
25
+ require_relative 'mastercard_merchant_onboarding/models/auth_option'
26
+
27
+ require_relative 'mastercard_merchant_onboarding/models/merchant_acquirer'
28
+
29
+ require_relative 'mastercard_merchant_onboarding/models/merchant_acquirer_brand'
30
+
31
+ require_relative 'mastercard_merchant_onboarding/models/extension_point'
32
+
33
+ require_relative 'mastercard_merchant_onboarding/models/merchant_download'
34
+
35
+ require_relative 'mastercard_merchant_onboarding/models/summary'
36
+
37
+ require_relative 'mastercard_merchant_onboarding/models/project_key_type'
38
+
39
+ require_relative 'mastercard_merchant_onboarding/models/merchant_response_record'
40
+
41
+ require_relative 'mastercard_merchant_onboarding/models/validate_file_response'
42
+
43
+ require_relative 'mastercard_merchant_onboarding/models/validated_merchant'
44
+
45
+
46
+ # APIs
47
+
48
+
49
+ require_relative 'mastercard_merchant_onboarding/api/single_merchant_validate_api'
50
+
51
+ require_relative 'mastercard_merchant_onboarding/api/single_merchant_upload_api'
52
+
53
+
54
+
55
+
56
+ module MastercardMerchantOnboarding
57
+
58
+ end
@@ -0,0 +1,42 @@
1
+ require 'uri'
2
+ require 'mastercard_core_sdk'
3
+ require_relative '../../mastercard_merchant_onboarding/models/merchant_upload'
4
+ require_relative '../../mastercard_merchant_onboarding/models/merchant_download'
5
+
6
+
7
+ module MastercardMerchantOnboarding
8
+ module Api
9
+
10
+ class SingleMerchantUploadApi
11
+ include MastercardCoreSdk::Core, MastercardCoreSdk::Client, MastercardCoreSdk::Exceptions
12
+ include MastercardMerchantOnboarding::Tracker
13
+
14
+
15
+ # Single Merchant Upload Service
16
+ # This service is used by service providers to onboard merchant information one at a time to Masterpass through the project. Returns a MerchantDownload payload that will contain records of merchants that have, or have not, enabled 3-D Secure.
17
+ # @param project_id Identifier of project created in the Merchant Portal.
18
+ # @param merchant_upload Merchant upload request.
19
+ # @param api_config Optional ApiConfig object specifying configuration : consumer key, private key, host URL.
20
+ # @return [MerchantDownload]
21
+ def self.create(project_id, merchant_upload, api_config = nil)
22
+ path = "/masterpasspsp/v6/checkoutproject/{projectId}/file"
23
+ service_request = ServiceRequest.new
24
+ service_request.path_params["projectId"] = project_id
25
+
26
+
27
+ service_request.body = merchant_upload
28
+
29
+ service_request.content_type = "application/xml"
30
+ api_client = ApiClient.new(api_config)
31
+ api_client.api_tracker = SdkApiTracker.new
32
+ api_client.error_handler = ErrorHandler.new
33
+ return api_client.call(path, service_request, "POST",MerchantDownload)
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+ end
40
+
41
+
42
+
@@ -0,0 +1,42 @@
1
+ require 'uri'
2
+ require 'mastercard_core_sdk'
3
+ require_relative '../../mastercard_merchant_onboarding/models/merchant_upload'
4
+ require_relative '../../mastercard_merchant_onboarding/models/validate_file_response'
5
+
6
+
7
+ module MastercardMerchantOnboarding
8
+ module Api
9
+
10
+ class SingleMerchantValidateApi
11
+ include MastercardCoreSdk::Core, MastercardCoreSdk::Client, MastercardCoreSdk::Exceptions
12
+ include MastercardMerchantOnboarding::Tracker
13
+
14
+
15
+ # Single Merchant Validate Service.
16
+ # This service is used by service providers to validate merchant upload prior to actual onboarding submission. This process mimics the validation XML process via the user interface used within the merchant portal. Returns a ValidateFileResponse payload that will contain 3DS and/or non-3DS merchant status records.
17
+ # @param project_id Identifier of project created in the Merchant Portal.
18
+ # @param merchant_upload Merchant upload request.
19
+ # @param api_config Optional ApiConfig object specifying configuration : consumer key, private key, host URL.
20
+ # @return [ValidateFileResponse]
21
+ def self.create(project_id, merchant_upload, api_config = nil)
22
+ path = "/masterpasspsp/v6/checkoutproject/{projectId}/file/validation"
23
+ service_request = ServiceRequest.new
24
+ service_request.path_params["projectId"] = project_id
25
+
26
+
27
+ service_request.body = merchant_upload
28
+
29
+ service_request.content_type = "application/xml"
30
+ api_client = ApiClient.new(api_config)
31
+ api_client.api_tracker = SdkApiTracker.new
32
+ api_client.error_handler = ErrorHandler.new
33
+ return api_client.call(path, service_request, "POST",ValidateFileResponse)
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+ end
40
+
41
+
42
+
@@ -0,0 +1,225 @@
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 acquirer details.
8
+ class Acquirer
9
+ include ROXML
10
+
11
+ xml_name "Acquirer"
12
+
13
+ # @!attribute action
14
+ # @return [String] the merchant acquirer action. Valid values are C(Create), U(Update), and D (Delete).
15
+ xml_accessor :action, :from =>"Action"
16
+
17
+ # @!attribute id
18
+ # @return [String] the merchant's acquirer id. For example, 453214.
19
+ xml_accessor :id, :from =>"Id"
20
+
21
+ # @!attribute name
22
+ # @return [String] the merchant's acquirer name. For example, Test Acquirer. 3DS merchants must reduce their character limit to 250 to meet Cardinal Commerce’s API specifications.
23
+ xml_accessor :name, :from =>"Name"
24
+
25
+ # @!attribute assigned_merchant_id
26
+ # @return [String] the acquirer assigned merchant id. For example, 435t6543.
27
+ xml_accessor :assigned_merchant_id, :from =>"AssignedMerchantId"
28
+
29
+ # @!attribute password
30
+ # @return [String] the acquirer password for 3DS setup. For example, Visa. 3DS merchants must reduce their character limit to 8 to meet Cardinal Commerce’s API specifications.
31
+ xml_accessor :password, :from =>"Password"
32
+
33
+ # @!attribute extension_point
34
+ # @return [ExtensionPoint] the extension point for future enhancement.
35
+ xml_accessor :extension_point, :from =>"ExtensionPoint",:as => ExtensionPoint
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :action => :Action ,
42
+ :id => :Id ,
43
+ :name => :Name ,
44
+ :assigned_merchant_id => :AssignedMerchantId ,
45
+ :password => :Password ,
46
+ :extension_point => :ExtensionPoint
47
+
48
+ }
49
+ end
50
+
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
56
+
57
+
58
+ if attributes.has_key?(:action)
59
+ self.action = attributes[:action]
60
+ end
61
+
62
+ if attributes.has_key?(:id)
63
+ self.id = attributes[:id]
64
+ end
65
+
66
+ if attributes.has_key?(:name)
67
+ self.name = attributes[:name]
68
+ end
69
+
70
+ if attributes.has_key?(:assigned_merchant_id)
71
+ self.assigned_merchant_id = attributes[:assigned_merchant_id]
72
+ end
73
+
74
+ if attributes.has_key?(:password)
75
+ self.password = attributes[:password]
76
+ end
77
+
78
+ if attributes.has_key?(:extension_point)
79
+ self.extension_point = attributes[:extension_point]
80
+ end
81
+
82
+ end
83
+
84
+
85
+
86
+
87
+ # Check equality by comparing each attribute.
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ action == o.action &&
92
+ id == o.id &&
93
+ name == o.name &&
94
+ assigned_merchant_id == o.assigned_merchant_id &&
95
+ password == o.password &&
96
+ extension_point == o.extension_point
97
+ end
98
+
99
+ # @see the `==` method
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculate hash code according to all attributes.
105
+ def hash
106
+ [action, id, name, assigned_merchant_id, password, extension_point].hash
107
+ end
108
+
109
+ # build the object from hash
110
+ def build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.datatype_map.each_pair do |key, type|
113
+ if type =~ /^Array<(.*)>/i
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
+ else
117
+ #TODO show warning in debug mode
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ else
122
+ # data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :Object
136
+ value
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :BOOLEAN
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when /\AArray<(?<inner_type>.+)>\z/
150
+ inner_type = Regexp.last_match[:inner_type]
151
+ value.map { |v| _deserialize(inner_type, v) }
152
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
153
+ k_type = Regexp.last_match[:k_type]
154
+ v_type = Regexp.last_match[:v_type]
155
+ {}.tap do |hash|
156
+ value.each do |k, v|
157
+ hash[_deserialize(k_type, k).to_sym] = _deserialize(v_type, v)
158
+ end
159
+ end
160
+ else # model
161
+ _model = MastercardMerchantOnboarding.const_get(type).new
162
+ _model.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ def to_s
167
+ to_hash.to_s
168
+ end
169
+
170
+ # to_body is an alias to to_body (backward compatibility))
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # return the object in the form of hash
176
+ def to_hash(include_root = false)
177
+ attributes_hash = {}
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ next if value.nil?
182
+ hash[param] = _to_hash(value)
183
+ end
184
+ attributes_hash = include_root ? { "Acquirer" => hash } : hash
185
+ return attributes_hash
186
+ end
187
+
188
+ # Method to output non-array value in the form of hash
189
+ # For object, use to_hash. Otherwise, just return the value
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map{ |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+
204
+
205
+ private
206
+ def after_parse
207
+ self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
208
+ end
209
+
210
+ # Attribute datatype mapping.
211
+ def self.datatype_map
212
+ {
213
+ :action => 'String',
214
+ :id => 'String',
215
+ :name => 'String',
216
+ :assigned_merchant_id => 'String',
217
+ :password => 'String',
218
+ :extension_point => 'ExtensionPoint'
219
+
220
+ }
221
+ end
222
+ end
223
+
224
+
225
+ end