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
452 stars 150 forks source link

Cannot create a return entry for Prenotes #1332

Closed sunnygill-stash closed 3 months ago

sunnygill-stash commented 9 months ago

ACH Version

v1.31.1

What were you trying to do?

We were attempting to generate a return entry for a prenote for that we received. We received a validation error out of moov because the amount was $0. It appears as though moov is only allowing entries with prenote transaction codes (23, 28, 33, 38, 43, 48, 53) to have $0 amounts. When a prenote is returned it is required to have a transaction code for returns or NOCs (21, 26, 31, 36, 41, 46, 51).

What did you expect to see?

We expected moov to accept entries that have return transaction codes to have $0 amounts. this batch type requires that the amount is non-zero

What did you see?

We received an error that prevented file generation.

How can we reproduce the problem?

Create an entry with a return transaction code and a $0 amount.

adamdecaf commented 9 months ago

Can you reproduce this on the latest release? It sounds very familiar to https://github.com/moov-io/ach/issues/1215

sunnygill-stash commented 9 months ago

I am able to reproduce the error with the latest version. It seems like the existing code will work if the Company Entry Description is PRENOTE. I spoke with our banking personnel and was told that will not always be the case.

If you change the test linked below so that the Company Entry Description is not PRENOTE then it will fail

https://github.com/moov-io/ach/blob/82130e8159396c1684d8ad9b94b7065d0aad2f80/test/issues/issue1215_test.go#L34

adamdecaf commented 9 months ago

Yea, I can reproduce the issue and it puts us in a bit of a tough spot. Returns are supposed to "Return only the exact dollar amount of the original entry." That means typical transactional returns are invalid when their amount is zero. All returns have the same TransactionCodes so we lose all information that the entry is a prenote.

I don't think it's safe to allow every return to have zero'd amounts because that's wrong. Do you know of a better solution?

adamdecaf commented 9 months ago

Setting AllowInvalidAmounts lets this specific case pass validation. See https://github.com/moov-io/ach/pull/1333

sunnygill-stash commented 9 months ago

Yea, I can reproduce the issue and it puts us in a bit of a tough spot. Returns are supposed to "Return only the exact dollar amount of the original entry." That means typical transactional returns are invalid when their amount is zero. All returns have the same TransactionCodes so we lose all information that the entry is a prenote.

I don't think it's safe to allow every return to have zero'd amounts because that's wrong. Do you know of a better solution?

I don't believe that there is anyway to identify a transaction as a prenote when it is a return entry. I don't know how you can do this without allowing all returns to have $0 amounts. I am trying to talk our banking personnel to let us set the CompanyEntryDescription to "PRENOTE" so we can avoid this issue.

adamdecaf commented 8 months ago

Did you hear back about being able to use PRENOTE?

adamdecaf commented 6 months ago

Any update @sunnygill-stash ?

bulhi commented 4 months ago

We just ran into the same problem recently. Exactly as the OP says, there's no way how to tell a prenote return from a regular return, so I think the ValidAmountForCodes method should just ignore returns.

Screenshot 2024-05-03 at 3 24 52 PM
bulhi commented 4 months ago

The specification also doesn't mention the need to set the company entry description to PRENOTE anywhere, as far as I can see. We can do that as a workaround, but I think the batch is valid even without that.

adamdecaf commented 4 months ago

Okay we can ignore returns when AllowInvalidAmounts is set.

adamdecaf commented 3 months ago

What SEC code are you using for prenotes? I think allow zero amount returns is SEC code specific.

bulhi commented 3 months ago

It just happened with a PPD but as far as I understand it a prenote can have any SEC code, it's just the transaction code that's different. From the NACHA spec:

Generally speaking, the format of a prenotification entry is the same as a live dollar entry. However, the dollar amount of a prenotification entry is zero and a unique transaction code is use to indicate a prenotification entry.

... Prenotification entries may be intermingled within a batch of credit and/or debit live dollar entries. The Transaction Codes for prenotification entries are:

23 Prenotification for DDA credit. 28 Prenotification for DDA debit. 33 Prenotification for Savings credit. 38 Prenotification for Savings debit. 43 Prenotification for General Ledger credit. 48 Prenotification for General Ledger debit. 53 Prenotification for Loan Account credit.

adamdecaf commented 3 months ago

I've created https://github.com/moov-io/ach/pull/1421 - could you look over it and double check I'm not missing anything?

bulhi commented 3 months ago

I think it's looking good, thanks!

adamdecaf commented 3 months ago

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