Skip to content

CorrectedData parsing returns empty struct when one of multiple expected fields is missing #1714

@junav

Description

@junav

ACH Version

v1.53.4

What were you trying to do?

While parsing Addenda98 corrected data, I noticed an issue with how CorrectedData is constructed when a correction code expects multiple fields, but only one of them is present in the addenda record.

In addenda98.go (around line 297), if any of the expected fields for a given correction code are missing, the parsing logic returns an empty CorrectedData struct, even when one of the fields is actually present and valid.

This causes partial-but-valid corrected data to be dropped entirely. This behavior prevents consumers from accessing partially corrected data, and makes it difficult to distinguish between:
• no corrected data
• partially corrected data

What did you expect to see?

For correction codes that expect two corrected fields, such as C03 – Incorrect Routing Number and incorrect account number.
CorrectedData{
RoutingNumber: "12345678",
AccountNumber: "",
}

What did you see?

CorrectedData{}

How can we reproduce the problem?

Test a C03 NOC record with only the corrected routing number populated (second corrected field missing); CorrectedData is parsed as empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions