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
459 stars 151 forks source link

Unable to parse valid NACHA files containing POP and ARC SEC Codes when SCC is set to 200 #1072

Closed vishwasbabu closed 2 years ago

vishwasbabu commented 2 years ago

ACH Version: v1.18.6

What were you trying to do? Trying to parse valid NACHA files we received from a correspondent bank. The NACHA files themselves were very similar to the MOOV examples for https://github.com/moov-io/ach/blob/master/test/ach-arc-read/arc-debit.ach and https://github.com/moov-io/ach/blob/master/test/ach-pop-read/pop-debit.ach with one change, the Service Class Code being set to 200

What did you expect to see? The files being parsed successfully

What did you see? A validation error stating

{
    "ID": "b9c09fab3229f13f8cdadd7d0fea1c50bb71de4d",
    "error": "line:4 record:Batches *ach.BatchError batch #1 (POP) ServiceClassCode header SCC is not valid for this batch's type: 220"
}

How can we reproduce the problem? Replace the SCC on https://github.com/moov-io/ach/blob/master/test/ach-pop-read/pop-debit.ach with 200 and try parsing the file

vishwasbabu commented 2 years ago

While it is true that Ideally the batches for POP and ARC should have had Service Class Code set to 225 / Debits Only, It does look like there are ACH Originators who set the Service Class Code for a batch to Mixed Debits and Credits (200) and send out only Debits. Maybe we should modify the strict validation the Moov library does at https://github.com/moov-io/ach/blob/master/batchPOP.go#L65 to allow the same?

nazeer1100126 commented 2 years ago

I have sent MR.

adamdecaf commented 2 years ago

I've released v1.19.2 with this fix. Thanks again!

https://github.com/moov-io/ach/releases/tag/v1.19.2