-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1203 from adamdecaf/issue1202
fix: accumulate batches without BatchControl records
- Loading branch information
Showing
5 changed files
with
75 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package issues | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/moov-io/ach" | ||
"github.com/moov-io/ach/cmd/achcli/describe" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestIssue1202(t *testing.T) { | ||
file, err := ach.ReadFile(filepath.Join("..", "..", "test", "testdata", "return-no-batch-controls.ach")) | ||
require.ErrorContains(t, err, ach.ErrFileHeader.Error()) | ||
|
||
if testing.Verbose() { | ||
describe.File(os.Stdout, file, nil) | ||
} | ||
|
||
require.Len(t, file.Batches, 2) | ||
require.Len(t, file.NotificationOfChange, 1) | ||
require.Len(t, file.ReturnEntries, 1) | ||
|
||
b1Entries := file.Batches[0].GetEntries() | ||
require.Len(t, b1Entries, 1) | ||
require.Nil(t, b1Entries[0].Addenda98) | ||
require.NotNil(t, b1Entries[0].Addenda99) | ||
|
||
b2Entries := file.Batches[1].GetEntries() | ||
require.Len(t, b2Entries, 1) | ||
require.NotNil(t, b2Entries[0].Addenda98) | ||
require.Nil(t, b2Entries[0].Addenda99) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
5200CoinLion 123456789 WEBTRANSFER 000101 1091000010000001 | ||
626091400606123456789 0000012354MjMxNDAwMjAtOGQPaul Jones S 1091000017611242 | ||
799R01091400600000001 09100001 091000017611242 | ||
5220Your Company, in 121042882 CORVendor Pay 000000 1121042880000001 | ||
621231380104744-5678-99 0000000000location #23 Best Co. #23 S 1121042880000001 | ||
798C01121042880000001 121042881918171614 091012980000088 |