rs-ach
ACH (Automated Clearing House) file parser for Rust following the NACHA (National Automated Clearing House Association) specifications.
Features
- Parse ACH file headers and batch records
- Support for PPD, CCD, and other standard entry class codes
- Entry detail records with addenda support
- Type-safe parsing with comprehensive error handling
- Zero-copy parsing for maximum performance
- Complete NACHA format validation
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Example
use AchFile;
ACH File Format
An ACH file consists of the following record types:
File Header (Record Type 1)
Contains file-level information including:
- Immediate destination and origin (routing numbers)
- File creation date and time
- File identification
Batch Header (Record Type 5)
Contains batch-level information including:
- Service class code (200=mixed, 220=credits only, 225=debits only)
- Company name and identification
- Standard entry class code (PPD, CCD, WEB, etc.)
- Effective entry date
Entry Detail (Record Type 6)
Contains individual transaction information including:
- Transaction code (22=checking credit, 27=checking debit, 32=savings credit, 37=savings debit)
- Receiving DFI identification (routing number)
- Account number
- Amount (in cents)
- Individual name
Addenda (Record Type 7)
Optional additional information for an entry detail record.
Batch Control (Record Type 8)
Contains batch totals and counts:
- Entry/addenda count
- Entry hash
- Total debit and credit amounts
File Control (Record Type 9)
Contains file-level totals and counts:
- Batch count
- Block count
- Total debit and credit amounts
Error Handling
The parser provides detailed error information through the AchError enum:
use ;
match parse
Testing
Run the test suite:
The test suite includes:
- Basic ACH file parsing
- Credits-only batches (service class 220)
- Debits-only batches (service class 225)
- Entries with addenda records
- Error handling for invalid formats
License
MIT