mastercard_psp_payment 1.0.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.
- checksums.yaml +7 -0
- data/LICENSE.txt +24 -0
- data/README.md +53 -0
- data/lib/mastercard_psp_payment/api/psp_payment_data_api.rb +36 -0
- data/lib/mastercard_psp_payment/models/address.rb +255 -0
- data/lib/mastercard_psp_payment/models/authentication_options.rb +255 -0
- data/lib/mastercard_psp_payment/models/card.rb +245 -0
- data/lib/mastercard_psp_payment/models/cryptogram.rb +209 -0
- data/lib/mastercard_psp_payment/models/payment_data.rb +203 -0
- data/lib/mastercard_psp_payment/models/tokenization.rb +212 -0
- data/lib/mastercard_psp_payment/tracker/sdk_api_tracker.rb +57 -0
- data/lib/mastercard_psp_payment/version.rb +3 -0
- data/lib/mastercard_psp_payment.rb +30 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 82a7ceb0830b93a631af697f53a0b62c8366ac9d
|
4
|
+
data.tar.gz: 13b97bd9370ec0d1ee2407469873c3f7cdef8812
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67e7da3fe5e72ad0f1a51482a9a4ff15d63ccedc3f550a75969adfdc322f34a567aa8740450f3e9d066bf44343bfb86f7cb7dd88529b107094b1d1b09d516169
|
7
|
+
data.tar.gz: d30874fbc593b13ea98e8aebe67d4ce42e84c432ea9cfc88ec93f7843762db241d36e25c448ced4ca0f508e8cfb97149075c5ed467e583bf2456e9cf950041a2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2017, 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,53 @@
|
|
1
|
+
# MastercardPspPayment
|
2
|
+
Masterpass™ is Mastercard’s integrated digital wallet and checkout solution.
|
3
|
+
Masterpass enables consumers to store and manage their payment, shipping, and loyalty program information in their Masterpass Wallet, and to quickly and seamlessly access this information to make secure payments wherever they see the "Buy with MasterPass" button on a merchant website or mobile application.
|
4
|
+
|
5
|
+
From a cardholder's perspective, Masterpass significantly speeds up the checkout process, removing the need to re-enter payment, shipping or loyalty program details during checkout.
|
6
|
+
The Masterpass solution is simple, secure and easy for merchants to integrate into their existing website or application.
|
7
|
+
|
8
|
+
For more information, refer [Masterpass PSP Integration](https://developer.mastercard.com/documentation/masterpass-integration-psp).
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'mastercard_psp_payment'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install mastercard_psp_payment
|
25
|
+
|
26
|
+
|
27
|
+
## Copyright
|
28
|
+
Copyright (c) 2017, Mastercard International Incorporated. See LICENSE for details.
|
29
|
+
|
30
|
+
## LICENSE
|
31
|
+
Copyright (c) 2017, Mastercard International Incorporated. All rights reserved.
|
32
|
+
|
33
|
+
Redistribution and use in source and binary forms, with or without modification, are
|
34
|
+
permitted provided that the following conditions are met:
|
35
|
+
|
36
|
+
Redistributions of source code must retain the above copyright notice, this list of
|
37
|
+
conditions and the following disclaimer.
|
38
|
+
Redistributions in binary form must reproduce the above copyright notice, this list of
|
39
|
+
conditions and the following disclaimer in the documentation and/or other materials
|
40
|
+
provided with the distribution.
|
41
|
+
Neither the name of the Mastercard International Incorporated nor the names of its
|
42
|
+
contributors may be used to endorse or promote products derived from this software
|
43
|
+
without specific prior written permission.
|
44
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
45
|
+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
46
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
47
|
+
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
48
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
49
|
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
50
|
+
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
51
|
+
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
52
|
+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
53
|
+
SUCH DAMAGE.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'mastercard_core_sdk'
|
3
|
+
require_relative '../../mastercard_psp_payment/models/payment_data'
|
4
|
+
|
5
|
+
|
6
|
+
module MastercardPspPayment
|
7
|
+
module Api
|
8
|
+
|
9
|
+
class PSPPaymentDataApi
|
10
|
+
include MastercardCoreSdk::Core, MastercardCoreSdk::Client, MastercardCoreSdk::Exceptions
|
11
|
+
include MastercardPspPayment::Tracker
|
12
|
+
|
13
|
+
|
14
|
+
# PSP PaymentData Service :
|
15
|
+
# This service is used by PSP to retrieve the consumer's payment, shipping address, and personal information.
|
16
|
+
# @param transaction_id This is a transaction identifier.
|
17
|
+
# @param api_config Optional ApiConfig object specifying configuration : consumer key, private key, host URL.
|
18
|
+
# @return [PaymentData]
|
19
|
+
def self.show(transaction_id, api_config = nil)
|
20
|
+
path = "/masterpass/psp-paymentdata/{transactionId}"
|
21
|
+
service_request = ServiceRequest.new
|
22
|
+
service_request.path_params["transactionId"] = transaction_id
|
23
|
+
service_request.content_type = "application/json"
|
24
|
+
api_client = ApiClient.new(api_config)
|
25
|
+
api_client.api_tracker = SdkApiTracker.new
|
26
|
+
api_client.error_handler = ErrorHandler.new
|
27
|
+
return api_client.call(path, service_request, "GET",PaymentData)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
|
@@ -0,0 +1,255 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'roxml'
|
3
|
+
|
4
|
+
|
5
|
+
module MastercardPspPayment
|
6
|
+
# This class contains methods to get the consumer's address details.
|
7
|
+
class Address
|
8
|
+
include ROXML
|
9
|
+
|
10
|
+
xml_name "Address"
|
11
|
+
|
12
|
+
# @!attribute city
|
13
|
+
# @return [String] the cardholder's city.
|
14
|
+
xml_accessor :city, :from =>"city"
|
15
|
+
|
16
|
+
# @!attribute country
|
17
|
+
# @return [String] the cardholder's country as defined by ISO 3166-1 alpha-2 digit country codes; for example, US is the United States, AU is Australia, CA is Canada, GB is the United Kingdom, and so on.
|
18
|
+
xml_accessor :country, :from =>"country"
|
19
|
+
|
20
|
+
# @!attribute subdivision
|
21
|
+
# @return [String] the cardholder's country's subdivision as defined by ISO 3166-1 alpha-2 digit code; for example, US-VA is Virginia, US-OH is Ohio, and so on.
|
22
|
+
xml_accessor :subdivision, :from =>"subdivision"
|
23
|
+
|
24
|
+
# @!attribute line1
|
25
|
+
# @return [String] the address in line 1 is used for the street number and the street name.
|
26
|
+
xml_accessor :line1, :from =>"line1"
|
27
|
+
|
28
|
+
# @!attribute line2
|
29
|
+
# @return [String] the address in line 2 is used for the apartment number, suite number, and so on.
|
30
|
+
xml_accessor :line2, :from =>"line2"
|
31
|
+
|
32
|
+
# @!attribute line3
|
33
|
+
# @return [String] the address in line 3 is used to enter the remaining address information if it does not fit in lines 1 and 2.
|
34
|
+
xml_accessor :line3, :from =>"line3"
|
35
|
+
|
36
|
+
# @!attribute line4
|
37
|
+
# @return [String] the address in line 4 is used to enter the remaining address information if it does not fit in lines 1, 2 and 3.
|
38
|
+
xml_accessor :line4, :from =>"line4"
|
39
|
+
|
40
|
+
# @!attribute line5
|
41
|
+
# @return [String] the address in line 5 is used to enter the remaining address information if it does not fit in lines 1,2,3 and 4.
|
42
|
+
xml_accessor :line5, :from =>"line5"
|
43
|
+
|
44
|
+
# @!attribute postal_code
|
45
|
+
# @return [String] the postal code or zip code appended to the mailing address for the purpose of sorting mail.
|
46
|
+
xml_accessor :postal_code, :from =>"postalCode"
|
47
|
+
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:city => :city ,
|
53
|
+
:country => :country ,
|
54
|
+
:subdivision => :subdivision ,
|
55
|
+
:line1 => :line1 ,
|
56
|
+
:line2 => :line2 ,
|
57
|
+
:line3 => :line3 ,
|
58
|
+
:line4 => :line4 ,
|
59
|
+
:line5 => :line5 ,
|
60
|
+
:postal_code => :postalCode
|
61
|
+
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize(attributes = {})
|
66
|
+
return unless attributes.is_a?(Hash)
|
67
|
+
|
68
|
+
# convert string to symbol for hash key
|
69
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
70
|
+
|
71
|
+
|
72
|
+
if attributes.has_key?(:city)
|
73
|
+
self.city = attributes[:city]
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:country)
|
77
|
+
self.country = attributes[:country]
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:subdivision)
|
81
|
+
self.subdivision = attributes[:subdivision]
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:line1)
|
85
|
+
self.line1 = attributes[:line1]
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:line2)
|
89
|
+
self.line2 = attributes[:line2]
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:line3)
|
93
|
+
self.line3 = attributes[:line3]
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:line4)
|
97
|
+
self.line4 = attributes[:line4]
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.has_key?(:line5)
|
101
|
+
self.line5 = attributes[:line5]
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:postal_code)
|
105
|
+
self.postal_code = attributes[:postal_code]
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
# Check equality by comparing each attribute.
|
114
|
+
def ==(o)
|
115
|
+
return true if self.equal?(o)
|
116
|
+
self.class == o.class &&
|
117
|
+
city == o.city &&
|
118
|
+
country == o.country &&
|
119
|
+
subdivision == o.subdivision &&
|
120
|
+
line1 == o.line1 &&
|
121
|
+
line2 == o.line2 &&
|
122
|
+
line3 == o.line3 &&
|
123
|
+
line4 == o.line4 &&
|
124
|
+
line5 == o.line5 &&
|
125
|
+
postal_code == o.postal_code
|
126
|
+
end
|
127
|
+
|
128
|
+
# @see the `==` method
|
129
|
+
def eql?(o)
|
130
|
+
self == o
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculate hash code according to all attributes.
|
134
|
+
def hash
|
135
|
+
[city, country, subdivision, line1, line2, line3, line4, line5, postal_code].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# build the object from hash
|
139
|
+
def build_from_hash(attributes)
|
140
|
+
return nil unless attributes.is_a?(Hash)
|
141
|
+
self.class.datatype_map.each_pair do |key, type|
|
142
|
+
if type =~ /^Array<(.*)>/i
|
143
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
144
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
145
|
+
else
|
146
|
+
#TODO show warning in debug mode
|
147
|
+
end
|
148
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
149
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
150
|
+
else
|
151
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
self
|
156
|
+
end
|
157
|
+
|
158
|
+
def _deserialize(type, value)
|
159
|
+
case type.to_sym
|
160
|
+
when :DateTime
|
161
|
+
DateTime.parse(value)
|
162
|
+
when :Date
|
163
|
+
Date.parse(value)
|
164
|
+
when :String
|
165
|
+
value.to_s
|
166
|
+
when :Integer
|
167
|
+
value.to_i
|
168
|
+
when :Float
|
169
|
+
value.to_f
|
170
|
+
when :BOOLEAN
|
171
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
|
+
true
|
173
|
+
else
|
174
|
+
false
|
175
|
+
end
|
176
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
177
|
+
inner_type = Regexp.last_match[:inner_type]
|
178
|
+
value.map { |v| _deserialize(inner_type, v) }
|
179
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
180
|
+
k_type = Regexp.last_match[:k_type]
|
181
|
+
v_type = Regexp.last_match[:v_type]
|
182
|
+
{}.tap do |hash|
|
183
|
+
value.each do |k, v|
|
184
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
else # model
|
188
|
+
_model = MastercardPspPayment.const_get(type).new
|
189
|
+
_model.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def to_s
|
194
|
+
to_hash.to_s
|
195
|
+
end
|
196
|
+
|
197
|
+
# to_body is an alias to to_body (backward compatibility))
|
198
|
+
def to_body
|
199
|
+
to_hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# return the object in the form of hash
|
203
|
+
def to_hash(include_root = false)
|
204
|
+
attributes_hash = {}
|
205
|
+
hash = {}
|
206
|
+
self.class.attribute_map.each_pair do |attr, param|
|
207
|
+
value = self.send(attr)
|
208
|
+
next if value.nil?
|
209
|
+
hash[param] = _to_hash(value)
|
210
|
+
end
|
211
|
+
attributes_hash = include_root ? { "Address" => hash } : hash
|
212
|
+
return attributes_hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Method to output non-array value in the form of hash
|
216
|
+
# For object, use to_hash. Otherwise, just return the value
|
217
|
+
def _to_hash(value)
|
218
|
+
if value.is_a?(Array)
|
219
|
+
value.compact.map{ |v| _to_hash(v) }
|
220
|
+
elsif value.is_a?(Hash)
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
223
|
+
end
|
224
|
+
elsif value.respond_to? :to_hash
|
225
|
+
value.to_hash
|
226
|
+
else
|
227
|
+
value
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
|
232
|
+
private
|
233
|
+
def after_parse
|
234
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
235
|
+
end
|
236
|
+
|
237
|
+
# Attribute datatype mapping.
|
238
|
+
def self.datatype_map
|
239
|
+
{
|
240
|
+
:city => 'String',
|
241
|
+
:country => 'String',
|
242
|
+
:subdivision => 'String',
|
243
|
+
:line1 => 'String',
|
244
|
+
:line2 => 'String',
|
245
|
+
:line3 => 'String',
|
246
|
+
:line4 => 'String',
|
247
|
+
:line5 => 'String',
|
248
|
+
:postal_code => 'String'
|
249
|
+
|
250
|
+
}
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
|
255
|
+
end
|
@@ -0,0 +1,255 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'roxml'
|
3
|
+
|
4
|
+
|
5
|
+
module MastercardPspPayment
|
6
|
+
# This class contains methods to set different authentication options required during DSRP.
|
7
|
+
class AuthenticationOptions
|
8
|
+
include ROXML
|
9
|
+
|
10
|
+
xml_name "AuthenticationOptions"
|
11
|
+
|
12
|
+
# @!attribute authenticate_method
|
13
|
+
# @return [String] the method used to authenticate the cardholder at checkout. Valid values are MERCHANT ONLY, 3DS and No Authentication.
|
14
|
+
xml_accessor :authenticate_method, :from =>"authenticateMethod"
|
15
|
+
|
16
|
+
# @!attribute card_enrollment_method
|
17
|
+
# @return [String] the method by which the card was added to the wallet. Valid values are: Manual Direct Provisioned 3DS Manual NFC Tap.
|
18
|
+
xml_accessor :card_enrollment_method, :from =>"cardEnrollmentMethod"
|
19
|
+
|
20
|
+
# @!attribute c_avv
|
21
|
+
# @return [String] the (CAVV) Cardholder Authentication Verification Value generated by card issuer upon successful authentication of the cardholder. This must be passed in the authorization message.
|
22
|
+
xml_accessor :c_avv, :from =>"cAvv"
|
23
|
+
|
24
|
+
# @!attribute eci_flag
|
25
|
+
# @return [String] the Electronic commerce indicator (ECI) flag. Possible values are as follows: Mastercard: 00:No Authentication 01:Attempts (Card Issuer Liability) 02:Authenticated by ACS (Card Issuer Liability) 03:Maestro (MARP) 05:Risk Based Authentication (Issuer, not in use) 06:Risk Based Authentication (Merchant, not in use) Visa: 05:Authenticated (Card Issuer Liability) 06:Attempts (Card Issuer Liability) 07:No 3DS Authentication (Merchant Liability)
|
26
|
+
xml_accessor :eci_flag, :from =>"eciFlag"
|
27
|
+
|
28
|
+
# @!attribute master_card_assigned_id
|
29
|
+
# @return [String] the value assigned by Mastercard and represents programs associated directly with Maestro cards. This field should be supplied in the authorization request by the merchant.
|
30
|
+
xml_accessor :master_card_assigned_id, :from =>"masterCardAssignedID"
|
31
|
+
|
32
|
+
# @!attribute pa_res_status
|
33
|
+
# @return [String] the message formatted, digitally signed, and sent from the ACS (issuer) to the MPI providing the results of the issuer's Mastercard SecureCode/Verified by Visa cardholder authentication. Possible values are: Y-The card was successfully authenticated via 3-D Secure A-signifies that either (a) the transaction was successfully authenticated via a 3-D Secure attempts transaction or (b)the cardholder was prompted to activate 3-D Secure during shopping but declined (Visa). U-Authentication results were unavailable.
|
34
|
+
xml_accessor :pa_res_status, :from =>"paResStatus"
|
35
|
+
|
36
|
+
# @!attribute sc_enrollment_status
|
37
|
+
# @return [String] the Mastercard SecureCode Enrollment Status. Indicates if the issuer of the card supports payer authentication for this card. Possible values are as follows: Y-The card is eligible for 3-D Secure authentication. N-The card is not eligible for 3-D Secure authentication. U-Lookup of the card's 3-D Secure eligibility status was either unavailable, or the card is inapplicable (for example, prepaid cards).
|
38
|
+
xml_accessor :sc_enrollment_status, :from =>"scEnrollmentStatus"
|
39
|
+
|
40
|
+
# @!attribute signature_verification
|
41
|
+
# @return [String] the signature verification. Possible values are as follows: Y-Indicates that the signature of the PaRes has been validated successfully and the message contents can be trusted. N-Indicates that for a variety of reasons (tampering, certificate expiration, and so on) the PaRes could not be validated, and the result should not be trusted.
|
42
|
+
xml_accessor :signature_verification, :from =>"signatureVerification"
|
43
|
+
|
44
|
+
# @!attribute xid
|
45
|
+
# @return [String] the transaction identifier resulting from authentication processing.
|
46
|
+
xml_accessor :xid, :from =>"xid"
|
47
|
+
|
48
|
+
|
49
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
50
|
+
def self.attribute_map
|
51
|
+
{
|
52
|
+
:authenticate_method => :authenticateMethod ,
|
53
|
+
:card_enrollment_method => :cardEnrollmentMethod ,
|
54
|
+
:c_avv => :cAvv ,
|
55
|
+
:eci_flag => :eciFlag ,
|
56
|
+
:master_card_assigned_id => :masterCardAssignedID ,
|
57
|
+
:pa_res_status => :paResStatus ,
|
58
|
+
:sc_enrollment_status => :scEnrollmentStatus ,
|
59
|
+
:signature_verification => :signatureVerification ,
|
60
|
+
:xid => :xid
|
61
|
+
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize(attributes = {})
|
66
|
+
return unless attributes.is_a?(Hash)
|
67
|
+
|
68
|
+
# convert string to symbol for hash key
|
69
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
70
|
+
|
71
|
+
|
72
|
+
if attributes.has_key?(:authenticate_method)
|
73
|
+
self.authenticate_method = attributes[:authenticate_method]
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:card_enrollment_method)
|
77
|
+
self.card_enrollment_method = attributes[:card_enrollment_method]
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:c_avv)
|
81
|
+
self.c_avv = attributes[:c_avv]
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:eci_flag)
|
85
|
+
self.eci_flag = attributes[:eci_flag]
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:master_card_assigned_id)
|
89
|
+
self.master_card_assigned_id = attributes[:master_card_assigned_id]
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:pa_res_status)
|
93
|
+
self.pa_res_status = attributes[:pa_res_status]
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:sc_enrollment_status)
|
97
|
+
self.sc_enrollment_status = attributes[:sc_enrollment_status]
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.has_key?(:signature_verification)
|
101
|
+
self.signature_verification = attributes[:signature_verification]
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:xid)
|
105
|
+
self.xid = attributes[:xid]
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
# Check equality by comparing each attribute.
|
114
|
+
def ==(o)
|
115
|
+
return true if self.equal?(o)
|
116
|
+
self.class == o.class &&
|
117
|
+
authenticate_method == o.authenticate_method &&
|
118
|
+
card_enrollment_method == o.card_enrollment_method &&
|
119
|
+
c_avv == o.c_avv &&
|
120
|
+
eci_flag == o.eci_flag &&
|
121
|
+
master_card_assigned_id == o.master_card_assigned_id &&
|
122
|
+
pa_res_status == o.pa_res_status &&
|
123
|
+
sc_enrollment_status == o.sc_enrollment_status &&
|
124
|
+
signature_verification == o.signature_verification &&
|
125
|
+
xid == o.xid
|
126
|
+
end
|
127
|
+
|
128
|
+
# @see the `==` method
|
129
|
+
def eql?(o)
|
130
|
+
self == o
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculate hash code according to all attributes.
|
134
|
+
def hash
|
135
|
+
[authenticate_method, card_enrollment_method, c_avv, eci_flag, master_card_assigned_id, pa_res_status, sc_enrollment_status, signature_verification, xid].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# build the object from hash
|
139
|
+
def build_from_hash(attributes)
|
140
|
+
return nil unless attributes.is_a?(Hash)
|
141
|
+
self.class.datatype_map.each_pair do |key, type|
|
142
|
+
if type =~ /^Array<(.*)>/i
|
143
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
144
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
145
|
+
else
|
146
|
+
#TODO show warning in debug mode
|
147
|
+
end
|
148
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
149
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
150
|
+
else
|
151
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
self
|
156
|
+
end
|
157
|
+
|
158
|
+
def _deserialize(type, value)
|
159
|
+
case type.to_sym
|
160
|
+
when :DateTime
|
161
|
+
DateTime.parse(value)
|
162
|
+
when :Date
|
163
|
+
Date.parse(value)
|
164
|
+
when :String
|
165
|
+
value.to_s
|
166
|
+
when :Integer
|
167
|
+
value.to_i
|
168
|
+
when :Float
|
169
|
+
value.to_f
|
170
|
+
when :BOOLEAN
|
171
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
172
|
+
true
|
173
|
+
else
|
174
|
+
false
|
175
|
+
end
|
176
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
177
|
+
inner_type = Regexp.last_match[:inner_type]
|
178
|
+
value.map { |v| _deserialize(inner_type, v) }
|
179
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
180
|
+
k_type = Regexp.last_match[:k_type]
|
181
|
+
v_type = Regexp.last_match[:v_type]
|
182
|
+
{}.tap do |hash|
|
183
|
+
value.each do |k, v|
|
184
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
else # model
|
188
|
+
_model = MastercardPspPayment.const_get(type).new
|
189
|
+
_model.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def to_s
|
194
|
+
to_hash.to_s
|
195
|
+
end
|
196
|
+
|
197
|
+
# to_body is an alias to to_body (backward compatibility))
|
198
|
+
def to_body
|
199
|
+
to_hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# return the object in the form of hash
|
203
|
+
def to_hash(include_root = false)
|
204
|
+
attributes_hash = {}
|
205
|
+
hash = {}
|
206
|
+
self.class.attribute_map.each_pair do |attr, param|
|
207
|
+
value = self.send(attr)
|
208
|
+
next if value.nil?
|
209
|
+
hash[param] = _to_hash(value)
|
210
|
+
end
|
211
|
+
attributes_hash = include_root ? { "AuthenticationOptions" => hash } : hash
|
212
|
+
return attributes_hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Method to output non-array value in the form of hash
|
216
|
+
# For object, use to_hash. Otherwise, just return the value
|
217
|
+
def _to_hash(value)
|
218
|
+
if value.is_a?(Array)
|
219
|
+
value.compact.map{ |v| _to_hash(v) }
|
220
|
+
elsif value.is_a?(Hash)
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
223
|
+
end
|
224
|
+
elsif value.respond_to? :to_hash
|
225
|
+
value.to_hash
|
226
|
+
else
|
227
|
+
value
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
|
232
|
+
private
|
233
|
+
def after_parse
|
234
|
+
self.send(:remove_instance_variable, :@roxml_references) if defined? self.roxml_references
|
235
|
+
end
|
236
|
+
|
237
|
+
# Attribute datatype mapping.
|
238
|
+
def self.datatype_map
|
239
|
+
{
|
240
|
+
:authenticate_method => 'String',
|
241
|
+
:card_enrollment_method => 'String',
|
242
|
+
:c_avv => 'String',
|
243
|
+
:eci_flag => 'String',
|
244
|
+
:master_card_assigned_id => 'String',
|
245
|
+
:pa_res_status => 'String',
|
246
|
+
:sc_enrollment_status => 'String',
|
247
|
+
:signature_verification => 'String',
|
248
|
+
:xid => 'String'
|
249
|
+
|
250
|
+
}
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
|
255
|
+
end
|