Sha256: 5c4ca4ef60f3a1c77274a90d5bf20346d6314633b4a67e96f8cff560a9b29707

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

module ACH
  module Record
    # 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
    class Entry < Base
      CREDIT_TRANSACTION_CODE_ENDING_DIGITS = ('0'..'4').to_a.freeze
      
      fields :record_type,
        :transaction_code,
        :routing_number,
        :bank_account,
        :amount,
        :customer_acct,
        :customer_name,
        :transaction_type,
        :addenda,
        :bank_15
      
      defaults :record_type => BATCH_ENTRY_RECORD_TYPE,
        :transaction_code   => 27,
        :transaction_type   => 'S',
        :customer_acct      => '',
        :addenda            => 0,
        :bank_15            => ''
      
      def debit?
        !credit?
      end
      
      def credit?
        CREDIT_TRANSACTION_CODE_ENDING_DIGITS.include? transaction_code.to_s[1..1]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ach_builder-0.2.1 lib/ach/record/entry.rb