Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Repository files navigation

#ACH

Build Status

ach is a Ruby helper for builder ACH files. In particular, it helps with field order and alignment, and adds padding lines to end of file.

This library has only been used in one production application and for very limited purposes. Please test thoroughly before using in a production environment.

See ACH::Builder for a similar Perl library

##Example

You should consult a copy of the ACH Rules for details on individual fields. You can probably obtain a copy from your bank.

require'ach'# Create ACH fileach=ACH::ACHFile.newtrace_number=0# File Headerfh=ach.headerfh.immediate_destination='000000000'fh.immediate_destination_name='BANK NAME'fh.immediate_origin='000000000'fh.immediate_origin_name='BANK NAME'# Batchbatch=ACH::Batch.newbh=batch.headerbh.company_name='Company Name'bh.company_identification='123456789'# Use 10 characters if you're not using an EINbh.standard_entry_class_code='PPD'bh.company_entry_description='DESCRIPTION'bh.company_descriptive_date=Date.todaybh.effective_entry_date=ACH::NextFederalReserveEffectiveDate.new(Date.today).resultbh.originating_dfi_identification='00000000'ach.batches << batch# Detail Entryed=ACH::EntryDetail.newed.transaction_code=ACH::CHECKING_CREDITed.routing_number='000000000'ed.account_number='00000000000'ed.amount=100# In centsed.individual_id_number='Employee Name'ed.individual_name='Employee Name'ed.originating_dfi_identification='00000000'batch.entries << ed# ... Additional detail entries, possibly including *offsetting entry*, if needed.# Insert trace numbersbatch.entries.each.with_index(1){ |entry,index| entry.trace_number=index}File.write('ach.txt',ach.to_s)pach.report
# Parse an ACH fileach=ACH::ACHFile.new(File.read('examples/ach/fixtures/return_noc.txt'))ach.batches.first.entries.first.addenda.first.payment_data=>"C05992222220280489 1211403932 1211"

Note: When adding an amount to your ach file, it needs to be in cents. So you'll want to multiply any dollar amounts by 100

##Copyright

Copyright (c) 2008-2009 Jared E Morgan, released under the MIT license

About

Helper for building ACH files in Ruby

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages