Class: ACH::Record::Entry

Inherits:
Base
  • Object
show all
Defined in:
lib/ach/record/entry.rb

Overview

A subclass of ACH::Record::Base, an Entry appears in an ACH::Batch component. It is the main record for representing a particular transaction.

Fields

  • record_type

  • transaction_code

  • routing_number

  • bank_account

  • amount

  • customer_acct

  • customer_name

  • transaction_type

  • addenda

  • bank_15

Constant Summary collapse

CREDIT_TRANSACTION_CODE_ENDING_DIGITS =

List of digits that Credit transaction code should start from.

('0'..'4').to_a.freeze

Constants included from Constants

Constants::BATCH_ADDENDA_RECORD_TYPE, Constants::BATCH_CONTROL_RECORD_TYPE, Constants::BATCH_ENTRY_RECORD_TYPE, Constants::BATCH_HEADER_RECORD_TYPE, Constants::BLOCKING_FACTOR, Constants::FILE_CONTROL_RECORD_TYPE, Constants::FILE_HEADER_RECORD_TYPE, Constants::FORMAT_CODE, Constants::RECORD_SIZE, Constants::ROWS_DELIMITER

Instance Method Summary collapse

Methods inherited from Base

#[]=, defaults, fields, #fields, from_s, #initialize, #to_s!

Methods included from Validations

#errors, #valid?

Constructor Details

This class inherits a constructor from ACH::Record::Base

Instance Method Details

#credit?Boolean

Return true if the second digit of a value of the transaction_code field is one of CREDIT_TRANSACTION_CODE_ENDING_DIGITS.

Returns:

  • (Boolean)


52
53
54
# File 'lib/ach/record/entry.rb', line 52

def credit?
  CREDIT_TRANSACTION_CODE_ENDING_DIGITS.include? transaction_code.to_s[1..1]
end

#debit?Boolean

Return true if self is not a credit record.

Returns:

  • (Boolean)


44
45
46
# File 'lib/ach/record/entry.rb', line 44

def debit?
  !credit?
end