Sha256: d3b03be0a7f57aa0fdd7c09ce902edd97bdf1da72f62bf37a3731280828b297b

Contents?: true

Size: 1.68 KB

Versions: 11

Compression:

Stored size: 1.68 KB

Contents

module Braintree
  class CreditCardVerification
    include BaseModule

    module Status
      Failed = 'failed'
      GatewayRejected = 'gateway_rejected'
      ProcessorDeclined = 'processor_declined'
      Verified = 'verified'

      All = [Failed, GatewayRejected, ProcessorDeclined, Verified]
    end

    attr_reader :avs_error_response_code, :avs_postal_code_response_code, :avs_street_address_response_code,
      :cvv_response_code, :merchant_account_id, :processor_response_code, :processor_response_text, :status,
      :id, :gateway_rejection_reason, :credit_card, :billing, :created_at, :risk_data

    def initialize(attributes) # :nodoc:
      set_instance_variables_from_hash(attributes)
      @risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
    end

    def inspect # :nodoc:
      attr_order = [
        :status, :processor_response_code, :processor_response_text,
        :cvv_response_code, :avs_error_response_code,
        :avs_postal_code_response_code, :avs_street_address_response_code,
        :merchant_account_id, :gateway_rejection_reason, :id, :credit_card, :billing, :created_at
      ]
      formatted_attrs = attr_order.map do |attr|
        "#{attr}: #{send(attr).inspect}"
      end
      "#<#{self.class} #{formatted_attrs.join(", ")}>"
    end

    class << self
      protected :new
    end

    def self._new(*args) # :nodoc:
      self.new *args
    end

    def self.find(id)
      Configuration.gateway.verification.find(id)
    end

    def self.search(&block)
      Configuration.gateway.verification.search(&block)
    end

    def ==(other)
      return false unless other.is_a?(CreditCardVerification)
      id == other.id
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
braintree-2.56.0 lib/braintree/credit_card_verification.rb
braintree-2.55.0 lib/braintree/credit_card_verification.rb
braintree-2.54.0 lib/braintree/credit_card_verification.rb
braintree-2.50.0 lib/braintree/credit_card_verification.rb
braintree-2.49.0 lib/braintree/credit_card_verification.rb
braintree-2.48.1 lib/braintree/credit_card_verification.rb
braintree-2.48.0 lib/braintree/credit_card_verification.rb
braintree-2.47.0 lib/braintree/credit_card_verification.rb
braintree-2.46.0 lib/braintree/credit_card_verification.rb
braintree-2.45.0 lib/braintree/credit_card_verification.rb
braintree-2.44.0 lib/braintree/credit_card_verification.rb