Sha256: 9a1923a3d8c61038b06e5c7f0f931fcf6fa01e30252155d55aadc51ba7601f64

Contents?: true

Size: 1.6 KB

Versions: 22

Compression:

Stored size: 1.6 KB

Contents

module Braintree
  # See http://www.braintreepayments.com/docs/ruby/general/card_verification
  class CreditCardVerification
    include BaseModule

    module Status
      FAILED = 'failed'
      GATEWAY_REJECTED = 'gateway_rejected'
      PROCESSOR_DECLINED = 'processor_declined'
      VERIFIED = '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

    def initialize(attributes) # :nodoc:
      set_instance_variables_from_hash(attributes)
    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

22 entries across 22 versions & 1 rubygems

Version Path
braintree-2.36.0 lib/braintree/credit_card_verification.rb
braintree-2.35.0 lib/braintree/credit_card_verification.rb
braintree-2.34.1 lib/braintree/credit_card_verification.rb
braintree-2.34.0 lib/braintree/credit_card_verification.rb
braintree-2.33.1 lib/braintree/credit_card_verification.rb
braintree-2.33.0 lib/braintree/credit_card_verification.rb
braintree-2.32.1 lib/braintree/credit_card_verification.rb
braintree-2.31.0 lib/braintree/credit_card_verification.rb
braintree-2.30.2 lib/braintree/credit_card_verification.rb
braintree-2.30.0 lib/braintree/credit_card_verification.rb
braintree-2.29.0 lib/braintree/credit_card_verification.rb
braintree-2.28.0 lib/braintree/credit_card_verification.rb
braintree-2.27.1 lib/braintree/credit_card_verification.rb
braintree-2.27.0 lib/braintree/credit_card_verification.rb
braintree-2.26.0 lib/braintree/credit_card_verification.rb
braintree-2.25.0 lib/braintree/credit_card_verification.rb
braintree-2.24.0 lib/braintree/credit_card_verification.rb
braintree-2.23.0 lib/braintree/credit_card_verification.rb
braintree-2.22.0 lib/braintree/credit_card_verification.rb
braintree-2.21.0 lib/braintree/credit_card_verification.rb