Sha256: f234c16e898aa330884d755191129877a14df58bcddffb3fa53c2d01f6e1e19d

Contents?: true

Size: 1.38 KB

Versions: 25

Compression:

Stored size: 1.38 KB

Contents

module Braintree
  class UsBankAccount
    include BaseModule

    attr_reader :account_holder_name
    attr_reader :account_type
    attr_reader :ach_mandate
    attr_reader :bank_name
    attr_reader :default
    attr_reader :image_url
    attr_reader :last_4
    attr_reader :routing_number
    attr_reader :token
    attr_reader :verifications
    attr_reader :verified

    def initialize(gateway, attributes) # :nodoc:
      @gateway = gateway
      set_instance_variables_from_hash(attributes)
      @ach_mandate = AchMandate.new(attributes[:ach_mandate]) if attributes[:ach_mandate]

      if attributes[:verifications]
        @verifications = attributes[:verifications].map do |v|
          UsBankAccountVerification._new(v)
        end
      end
    end

    def default?
      @default
    end

    class << self
      protected :new
    end

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

    def self.find(*args)
      Configuration.gateway.us_bank_account.find(*args)
    end

    def self.sale(token, transaction_attributes)
      Configuration.gateway.transaction.sale(transaction_attributes.merge(
          :payment_method_token => token,
          :options => { :submit_for_settlement => true }
        )
      )
    end

    def self.sale!(token, transaction_attributes)
      return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
braintree-3.3.0 lib/braintree/us_bank_account.rb
braintree-3.2.0 lib/braintree/us_bank_account.rb
braintree-3.1.0 lib/braintree/us_bank_account.rb
braintree-3.0.1 lib/braintree/us_bank_account.rb
braintree-2.104.1 lib/braintree/us_bank_account.rb
braintree-2.104.0 lib/braintree/us_bank_account.rb
braintree-2.103.0 lib/braintree/us_bank_account.rb
braintree-2.102.0 lib/braintree/us_bank_account.rb
braintree-2.101.0 lib/braintree/us_bank_account.rb
braintree-2.100.0 lib/braintree/us_bank_account.rb
braintree-2.99.0 lib/braintree/us_bank_account.rb
braintree-2.98.0 lib/braintree/us_bank_account.rb
braintree-2.97.0 lib/braintree/us_bank_account.rb
braintree-2.96.0 lib/braintree/us_bank_account.rb
braintree-2.95.0 lib/braintree/us_bank_account.rb
braintree-2.94.0 lib/braintree/us_bank_account.rb
braintree-2.93.0 lib/braintree/us_bank_account.rb
braintree-2.92.0 lib/braintree/us_bank_account.rb
braintree-2.91.0 lib/braintree/us_bank_account.rb
braintree-2.90.0 lib/braintree/us_bank_account.rb