Sha256: 1ce4b085acf8f4083f93ef4532c2a7cb70c37d007578a9f4ecf3f8dfc8a919dc

Contents?: true

Size: 1.36 KB

Versions: 10

Compression:

Stored size: 1.36 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)
      @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)
      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

10 entries across 10 versions & 1 rubygems

Version Path
braintree-4.25.0 lib/braintree/us_bank_account.rb
braintree-4.24.0 lib/braintree/us_bank_account.rb
braintree-4.23.0 lib/braintree/us_bank_account.rb
braintree-4.22.0 lib/braintree/us_bank_account.rb
braintree-4.21.0 lib/braintree/us_bank_account.rb
braintree-4.20.0 lib/braintree/us_bank_account.rb
braintree-4.19.0 lib/braintree/us_bank_account.rb
braintree-4.18.0 lib/braintree/us_bank_account.rb
braintree-4.17.0 lib/braintree/us_bank_account.rb
braintree-4.16.0 lib/braintree/us_bank_account.rb