* ACH-formatted transactions are supposed to be 80 character rows, but ACH emitters play loose and fast with that. 81 (CR/LF) and 82 (CR+LF) character entries are common enough in the wild that financial communities regularly complain about them. ACH transactions are supposed to be concatenative, so it wouldn't surprise me to learn that most real-world ACH handling code needs to handle 80, 81, and 82-character records in the same stream.
* The envelope and hierarchy of ACH is extremely simple. The internal state machine isn't: there are plenty of overlapping entry classes[1], obscure return codes, common misuse of said codes, and rider entries (like addenda information). The records for international settlements are shockingly complex; no ODFIs or RDFIs seem to follow the rules about not clawing back money after various contest periods expire.
[1]: When do I use CIE entries versus PPD? Do I use WEB for a recurring utility payment that was initiated online?
- the formats (there are more than one for interbank communications) are never properly followed by any bank, and many add their own undocumented proprietary extensions to them
- they are usually processed in batches, and the entirety of bank systems are built assuming that everything is processed in batches at specific times of day
- entries in batches may and will arrive out-of-order. For example, a request to cancel a transaction may and at one point will arrive before the request to authorize a transaction.
- a lot of other systems are built into the entire transaction process and assuming everything is processed in batches: fraud detection, dunning chains [1], account cancellations, reminders, fees etc. etc.
- There are systems where bank holidays are built into the system. If bank holiday is on a Friday, and you request/send payment, it will not be processed by the bank on the other side until Monday evening and the transaction will not be completed until Tuesday morning.
And that's just scraping the top of the iceberg. You can't just magically replace this. But you can try to build on top/work around that.
Source: worked at Klarna [2]
This is on purpose by some banks. They will sort the incoming queue and process withdraws before deposits to increase the number of NSF fees they collect.