Sha256: 2fb91d0616526a9624000cfee6bb433ef023f8f15b18fbce7392f8379fd5ac29

Contents?: true

Size: 1.86 KB

Versions: 21

Compression:

Stored size: 1.86 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 self.create(attributes)
      Util.verify_keys(CreditCardVerificationGateway._create_signature, attributes)
      Configuration.gateway.verification.create(attributes)
    end

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

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
braintree-2.73.0 lib/braintree/credit_card_verification.rb
braintree-2.72.0 lib/braintree/credit_card_verification.rb
braintree-2.71.0 lib/braintree/credit_card_verification.rb
braintree-2.70.0 lib/braintree/credit_card_verification.rb
braintree-2.69.1 lib/braintree/credit_card_verification.rb
braintree-2.69.0 lib/braintree/credit_card_verification.rb
braintree-2.68.2 lib/braintree/credit_card_verification.rb
braintree-2.68.1 lib/braintree/credit_card_verification.rb
braintree-2.68.0 lib/braintree/credit_card_verification.rb
braintree-2.67.0 lib/braintree/credit_card_verification.rb
braintree-2.66.0 lib/braintree/credit_card_verification.rb
braintree-2.65.0 lib/braintree/credit_card_verification.rb
braintree-2.64.0 lib/braintree/credit_card_verification.rb
braintree-2.63.0 lib/braintree/credit_card_verification.rb
braintree-2.62.0 lib/braintree/credit_card_verification.rb
braintree-2.61.1 lib/braintree/credit_card_verification.rb
braintree-2.61.0 lib/braintree/credit_card_verification.rb
braintree-2.60.0 lib/braintree/credit_card_verification.rb
braintree-2.59.0 lib/braintree/credit_card_verification.rb
braintree-2.58.0 lib/braintree/credit_card_verification.rb