class AuthorizeNet::ECheck

Models an eCheck.

Constants

PAYMENT_METHOD_CODE

Attributes

account_holder_name[RW]
account_number[RW]
account_type[RW]
bank_name[RW]
check_number[RW]
echeck_type[RW]
routing_number[RW]

Public Class Methods

new(routing_number, account_number, bank_name, account_holder_name, options = {}) click to toggle source

Constructs a new eCheck object.

routing_number

The bank routing number as a string.

account_number

The bank account number as a string.

bank_name

The legal name of the bank. This should match the name associated with the routing_number.

account_holder_name

The full name on the bank account represented by account_number.

options

A hash of options. Accepts echeck_type (the type of check, can usually be ignored), check_number (the number on the check, only needed for some check types), and account_type (the type of bank account the check draws from). All values should be passed as strings.

# File lib/authorize_net/payment_methods/echeck.rb, line 46
def initialize(routing_number, account_number, bank_name, account_holder_name, options = {})
  @routing_number = routing_number
  @account_number = account_number
  @bank_name = bank_name
  @account_holder_name = account_holder_name
  options = @@option_defaults.merge(options)
  @echeck_type = options[:echeck_type]
  @check_number = options[:check_number]
  @account_type = options[:account_type]
end

Public Instance Methods

to_hash() click to toggle source
# File lib/authorize_net/payment_methods/echeck.rb, line 57
def to_hash
  hash = {
    :method => PAYMENT_METHOD_CODE,
    :bank_aba_code => @routing_number,
    :bank_acct_num => @account_number,
    :bank_acct_type => @account_type,
    :bank_name => @bank_name,
    :bank_acct_name => @account_holder_name,
    :echeck_type => @echeck_type
  }
  hash[:bank_check_number] = @check_number unless @check_number.nil?
  hash
end