Sha256: 8ce71c71353a9396a0a0feddc071d2bfcdd9511743b400a783fa2ae1cf33dd89

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

module Braintree
  class UsBankAccount
    include BaseModule

    attr_reader :routing_number, :last_4, :account_type, :account_holder_name, :token, :image_url, :bank_name, :ach_mandate, :default

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

    def default?
      @default
    end

    class << self
      protected :new
    end

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

    def self.find(token)
      Configuration.gateway.us_bank_account.find(token)
    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

10 entries across 10 versions & 1 rubygems

Version Path
braintree-2.80.1 lib/braintree/us_bank_account.rb
braintree-2.80.0 lib/braintree/us_bank_account.rb
braintree-2.79.0 lib/braintree/us_bank_account.rb
braintree-2.78.0 lib/braintree/us_bank_account.rb
braintree-2.77.0 lib/braintree/us_bank_account.rb
braintree-2.76.0 lib/braintree/us_bank_account.rb
braintree-2.75.0 lib/braintree/us_bank_account.rb
braintree-2.74.0 lib/braintree/us_bank_account.rb
braintree-2.73.0 lib/braintree/us_bank_account.rb
braintree-2.72.0 lib/braintree/us_bank_account.rb