class ActiveMerchant::Billing::AVSResult

Implements the Address Verification System www.cybersource.com/developers/other_resources/quick_references/avs_results/. en.wikipedia.org/wiki/Address_Verification_System www.emsecommerce.net/avs_cvv2_response_codes.htm www.cardfellow.com/blog/address-verification-service-avs/

Constants

MESSAGES
POSTAL_MATCH_CODE

Map vendor’s AVS result code to a postal match code

STREET_MATCH_CODE

Map vendor’s AVS result code to a street match code

Attributes

code[R]
message[R]
postal_match[R]
street_match[R]

Public Class Methods

messages() click to toggle source
# File lib/active_merchant/billing/avs_result.rb, line 64
def self.messages
  MESSAGES
end
new(attrs) click to toggle source
# File lib/active_merchant/billing/avs_result.rb, line 68
def initialize(attrs)
  attrs ||= {}

  @code = attrs[:code].upcase unless attrs[:code].blank?
  @message = self.class.messages[code]

  if attrs[:street_match].blank?
    @street_match = STREET_MATCH_CODE[code]
  else
    @street_match = attrs[:street_match].upcase
  end

  if attrs[:postal_match].blank?
    @postal_match = POSTAL_MATCH_CODE[code]
  else
    @postal_match = attrs[:postal_match].upcase
  end
end

Public Instance Methods

to_hash() click to toggle source
# File lib/active_merchant/billing/avs_result.rb, line 87
def to_hash
  { 'code' => code,
    'message' => message,
    'street_match' => street_match,
    'postal_match' => postal_match }
end