Sha256: 774b0f508283fdad370198eb7ff581e84ca093bf3d2bcfc5421bba17b5eab48c

Contents?: true

Size: 679 Bytes

Versions: 2

Compression:

Stored size: 679 Bytes

Contents

module ACH
  class Entry < Record
    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 => 6,
      :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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ach_builder-0.0.2 lib/ach/entry.rb
ach_builder-0.0.1.1 lib/ach/entry.rb