class Yapstone::CreditCardAuthResponse

The CreditCardAuthResponse provides details about verification for different parts of the credit card. authResult tells you whether the payment is authorized with the credit card. The Card Verification Value (CVV) is the code on the back of a credit card. cvvResult tells whether the CVV code was valid. The Address Verification Service (AVS) tells you whether the customer's provided address matches what is on the credit card.

Attributes

auth_result[RW]
auth_verification_code[RW]
avs_result[RW]
cvv_result[RW]
processor[RW]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 51
def self.attribute_map
  {
    :'auth_result' => :'authResult',
    :'cvv_result' => :'cvvResult',
    :'avs_result' => :'avsResult',
    :'auth_verification_code' => :'authVerificationCode',
    :'processor' => :'processor'
  }
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 160
def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 74
def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Yapstone::CreditCardAuthResponse` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Yapstone::CreditCardAuthResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'auth_result')
    self.auth_result = attributes[:'auth_result']
  end

  if attributes.key?(:'cvv_result')
    self.cvv_result = attributes[:'cvv_result']
  end

  if attributes.key?(:'avs_result')
    self.avs_result = attributes[:'avs_result']
  end

  if attributes.key?(:'auth_verification_code')
    self.auth_verification_code = attributes[:'auth_verification_code']
  end

  if attributes.key?(:'processor')
    self.processor = attributes[:'processor']
  end
end
openapi_types() click to toggle source

Attribute type mapping.

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 62
def self.openapi_types
  {
    :'auth_result' => :'Result',
    :'cvv_result' => :'Result',
    :'avs_result' => :'Result',
    :'auth_verification_code' => :'String',
    :'processor' => :'String'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 135
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      auth_result == o.auth_result &&
      cvv_result == o.cvv_result &&
      avs_result == o.avs_result &&
      auth_verification_code == o.auth_verification_code &&
      processor == o.processor
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 188
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 :Object
    # generic object (usually a Hash), return directly
    value
  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
    Yapstone.const_get(type).build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 253
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) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 167
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 147
def eql?(o)
  self == o
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Integer] Hash code

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 153
def hash
  [auth_result, cvv_result, avs_result, auth_verification_code, processor].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 110
def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end
processor=(processor) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] processor Object to be assigned

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 125
def processor=(processor)
  validator = EnumAttributeValidator.new('String', ["FD", "WP", "VN", "FIRST_DATA", "WORLD_PAY", "VANTIV_SSL"])
  unless validator.valid?(processor)
    fail ArgumentError, "invalid value for \"processor\", must be one of #{validator.allowable_values}."
  end
  @processor = processor
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 233
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 239
def to_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
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 227
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/yapstone-payments/models/credit_card_auth_response.rb, line 117
def valid?
  processor_validator = EnumAttributeValidator.new('String', ["FD", "WP", "VN", "FIRST_DATA", "WORLD_PAY", "VANTIV_SSL"])
  return false unless processor_validator.valid?(@processor)
  true
end