Class: AuthorizeNet::ECheck

Inherits:
Object
  • Object
show all
Defined in:
lib/authorize_net/payment_methods/echeck.rb

Overview

Models an eCheck.

Defined Under Namespace

Modules: AccountType, CheckType

Constant Summary collapse

PAYMENT_METHOD_CODE =
AuthorizeNet::PaymentMethodType::ECHECK
@@option_defaults =

The option defaults for the constructor.

{
  :echeck_type => CheckType::INTERNET_INITIATED,
  :check_number => nil,
  :account_type => AccountType::CHECKING
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(routing_number, account_number, bank_name, account_holder_name, options = {}) ⇒ ECheck

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.



46
47
48
49
50
51
52
53
54
55
# File 'lib/authorize_net/payment_methods/echeck.rb', line 46

def initialize(routing_number, , bank_name, , options = {})
  @routing_number = routing_number
  @account_number = 
  @bank_name = bank_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

Instance Attribute Details

#account_holder_nameObject

Returns the value of attribute account_holder_name.



36
37
38
# File 'lib/authorize_net/payment_methods/echeck.rb', line 36

def 
  @account_holder_name
end

#account_numberObject

Returns the value of attribute account_number.



36
37
38
# File 'lib/authorize_net/payment_methods/echeck.rb', line 36

def 
  @account_number
end

#account_typeObject

Returns the value of attribute account_type.



36
37
38
# File 'lib/authorize_net/payment_methods/echeck.rb', line 36

def 
  @account_type
end

#bank_nameObject

Returns the value of attribute bank_name.



36
37
38
# File 'lib/authorize_net/payment_methods/echeck.rb', line 36

def bank_name
  @bank_name
end

#check_numberObject

Returns the value of attribute check_number.



36
37
38
# File 'lib/authorize_net/payment_methods/echeck.rb', line 36

def check_number
  @check_number
end

#echeck_typeObject

Returns the value of attribute echeck_type.



36
37
38
# File 'lib/authorize_net/payment_methods/echeck.rb', line 36

def echeck_type
  @echeck_type
end

#routing_numberObject

Returns the value of attribute routing_number.



36
37
38
# File 'lib/authorize_net/payment_methods/echeck.rb', line 36

def routing_number
  @routing_number
end

Instance Method Details

#to_hashObject



57
58
59
60
61
62
63
64
65
66
67
68
69
# 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