Class: MastercardMerchantCheckout::AuthenticationOptions

Inherits:
Object
  • Object
show all
Includes:
ROXML
Defined in:
lib/mastercard_merchant_checkout/models/authentication_options.rb

Overview

The authentication information required during DSRP.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AuthenticationOptions

Returns a new instance of AuthenticationOptions.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 65

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}

  
  if attributes.has_key?(:authenticate_method)
    self.authenticate_method = attributes[:authenticate_method]
  end
  
  if attributes.has_key?(:card_enrollment_method)
    self.card_enrollment_method = attributes[:card_enrollment_method]
  end
  
  if attributes.has_key?(:c_avv)
    self.c_avv = attributes[:c_avv]
  end
  
  if attributes.has_key?(:eci_flag)
    self.eci_flag = attributes[:eci_flag]
  end
  
  if attributes.has_key?(:master_card_assigned_id)
    self.master_card_assigned_id = attributes[:master_card_assigned_id]
  end
  
  if attributes.has_key?(:pa_res_status)
    self.pa_res_status = attributes[:pa_res_status]
  end
  
  if attributes.has_key?(:sc_enrollment_status)
    self.sc_enrollment_status = attributes[:sc_enrollment_status]
  end
  
  if attributes.has_key?(:signature_verification)
    self.signature_verification = attributes[:signature_verification]
  end
  
  if attributes.has_key?(:xid)
    self.xid = attributes[:xid]
  end
  
end

Instance Attribute Details

#authenticate_methodString

Returns the method used to authenticate the cardholder at checkout. Valid values are MERCHANT ONLY, 3DS and No Authentication.

Returns:

  • (String)

    the method used to authenticate the cardholder at checkout. Valid values are MERCHANT ONLY, 3DS and No Authentication.



14
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 14

xml_accessor :authenticate_method, :from =>"authenticateMethod"

#c_avvString

Returns the (CAVV) Cardholder Authentication Verification Value generated by the card issuer upon successful authentication of the cardholder. This must be passed in the authorization message.

Returns:

  • (String)

    the (CAVV) Cardholder Authentication Verification Value generated by the card issuer upon successful authentication of the cardholder. This must be passed in the authorization message.



22
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 22

xml_accessor :c_avv, :from =>"cAvv"

#card_enrollment_methodString

Returns the method by which the card was added to the wallet. Valid values are: Manual Direct Provisioned 3DS Manual, and NFC Tap.

Returns:

  • (String)

    the method by which the card was added to the wallet. Valid values are: Manual Direct Provisioned 3DS Manual, and NFC Tap.



18
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 18

xml_accessor :card_enrollment_method, :from =>"cardEnrollmentMethod"

#eci_flagString

Returns 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).

Returns:

  • (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
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 26

xml_accessor :eci_flag, :from =>"eciFlag"

#master_card_assigned_idString

Returns 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.

Returns:

  • (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
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 30

xml_accessor :master_card_assigned_id, :from =>"masterCardAssignedID"

#pa_res_statusString

Returns 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.

Returns:

  • (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
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 34

xml_accessor :pa_res_status, :from =>"paResStatus"

#sc_enrollment_statusString

Returns 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).

Returns:

  • (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
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 38

xml_accessor :sc_enrollment_status, :from =>"scEnrollmentStatus"

#signature_verificationString

Returns 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.

Returns:

  • (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
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 42

xml_accessor :signature_verification, :from =>"signatureVerification"

#xidString

Returns the transaction identifier resulting from authentication processing.

Returns:

  • (String)

    the transaction identifier resulting from authentication processing.



46
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 46

xml_accessor :xid, :from =>"xid"

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 50

def self.attribute_map
  {
    :authenticate_method => :authenticateMethod ,
    :card_enrollment_method => :cardEnrollmentMethod ,
    :c_avv => :cAvv ,
    :eci_flag => :eciFlag ,
    :master_card_assigned_id => :masterCardAssignedID ,
    :pa_res_status => :paResStatus ,
    :sc_enrollment_status => :scEnrollmentStatus ,
    :signature_verification => :signatureVerification ,
    :xid => :xid 
    
  }
end

Instance Method Details

#==(o) ⇒ Object

Check equality by comparing each attribute.



114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 114

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      authenticate_method == o.authenticate_method &&
      card_enrollment_method == o.card_enrollment_method &&
      c_avv == o.c_avv &&
      eci_flag == o.eci_flag &&
      master_card_assigned_id == o.master_card_assigned_id &&
      pa_res_status == o.pa_res_status &&
      sc_enrollment_status == o.sc_enrollment_status &&
      signature_verification == o.signature_verification &&
      xid == o.xid
end

#_deserialize(type, value) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 158

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    _model = MastercardMerchantCheckout.const_get(type).new
    _model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Object

Method to output non-array value in the form of hash For object, use to_hash. Otherwise, just return the value



217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 217

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

build the object from hash



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 139

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.datatype_map.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      else
        #TODO show warning in debug mode
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    else
      # data not found in attributes(hash), not an issue as the data can be optional
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)

See Also:

  • `==` method


129
130
131
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 129

def eql?(o)
  self == o
end

#hashObject

Calculate hash code according to all attributes.



134
135
136
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 134

def hash
  [authenticate_method, card_enrollment_method, c_avv, eci_flag, master_card_assigned_id, pa_res_status, sc_enrollment_status, signature_verification, xid].hash
end

#to_bodyObject

to_body is an alias to to_body (backward compatibility))



198
199
200
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 198

def to_body
  to_hash
end

#to_hash(include_root = false) ⇒ Object

return the object in the form of hash



203
204
205
206
207
208
209
210
211
212
213
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 203

def to_hash(include_root = false)
  attributes_hash = {} 
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  attributes_hash = include_root ? { "AuthenticationOptions" => hash } : hash  
  return attributes_hash
end

#to_sObject



193
194
195
# File 'lib/mastercard_merchant_checkout/models/authentication_options.rb', line 193

def to_s
  to_hash.to_s
end