moov-io / ach

ACH implements a reader, writer, and validator for Automated Clearing House (ACH) files. The HTTP server is available in a Docker image and the Go package is available.
https://moov-io.github.io/ach/
Apache License 2.0
455 stars 154 forks source link

File Creation - Merge Files #529

Closed wadearnold closed 5 years ago

wadearnold commented 5 years ago

A utility function should exist that takes an array of ACH.Files and merges them into one or many files. If the merged file exceeds the NACHA record limit limitation of 10k entries and the additional file should be created.

adamdecaf commented 5 years ago
// MergeFiles is a helper function for consolidating an array of ACH Files into as few files
// as possible. This is useful for optimizing cost and network efficiency.
//
// Per NACHA rules files must remain under 10,000 lines (when rendered in their ASCII encoding)
//
// File Batches can only be merged if they are unique and routed to and from the same ABA routing numbers.
func MergeFiles(files []*File) ([]*File, error) { ... }

@wadearnold and/or @bkmoovio would you have other comments to add here?

I'm going to use some of paygate's mergeTransfer logic and line count wrapper for this.

bkmoovio commented 5 years ago

I think it’s good. Wade can probably chime in on if any specific additional requirements are needed. It’s great if you can leverage what you did in paygate.