Class: SolidusBraintree::AVSResult

Inherits:
ActiveMerchant::Billing::AVSResult
  • Object
show all
Defined in:
app/models/solidus_braintree/avs_result.rb

Constant Summary collapse

AVS_MAPPING =

Mapping took from ActiveMerchant::Billing::BraintreeBlueGateway

{
  'M' => {
    'M' => 'M',
    'N' => 'A',
    'U' => 'B',
    'I' => 'B',
    'A' => 'B'
  },
  'N' => {
    'M' => 'Z',
    'N' => 'C',
    'U' => 'C',
    'I' => 'C',
    'A' => 'C'
  },
  'U' => {
    'M' => 'P',
    'N' => 'N',
    'U' => 'I',
    'I' => 'I',
    'A' => 'I'
  },
  'I' => {
    'M' => 'P',
    'N' => 'C',
    'U' => 'I',
    'I' => 'I',
    'A' => 'I'
  },
  'A' => {
    'M' => 'P',
    'N' => 'C',
    'U' => 'I',
    'I' => 'I',
    'A' => 'I'
  },
  'B' => {
    'B' => 'B'
  },
  nil => { nil => nil }
}.freeze

Class Method Summary collapse

Class Method Details

.build(transaction) ⇒ Object



53
54
55
56
57
58
59
# File 'app/models/solidus_braintree/avs_result.rb', line 53

def build(transaction)
  new(
    code: avs_code_from(transaction),
    street_match: transaction.avs_street_address_response_code,
    postal_match: transaction.avs_postal_code_response_code
  )
end