Skip to content

Commit

Permalink
merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
rowland66 committed Oct 4, 2023
2 parents 3bbd482 + bcbeed0 commit 4e5becd
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v0.24.2 (Released 2023-10-04)

IMPROVEMENTS
- add IAT Batches to populateHashes

BUILD
- remove zookeeper

## v0.24.1 (Released 2023-09-11)

IMPROVEMENTS
Expand Down
7 changes: 7 additions & 0 deletions internal/incoming/odfi/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ func populateHashes(file *ach.File) {
entries[j].ID = hash([]byte(entries[j].String()))
}
}

for i := range file.IATBatches {
entries := file.IATBatches[i].GetEntries()
for j := range entries {
entries[j].ID = hash([]byte(entries[j].String()))
}
}
}

func hash(data []byte) string {
Expand Down
11 changes: 11 additions & 0 deletions internal/incoming/odfi/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ func TestProcessor_populateHashes(t *testing.T) {
require.Equal(t, "389723d3a8293a802169b5db27f288d32e96b9c6", entries[0].ID)
}

func TestProcessor_populateIatHashes(t *testing.T) {
file, err := ach.ReadFile(filepath.Join("testdata", "iat-credit.ach"))
require.NoError(t, err)

populateHashes(file)
require.Equal(t, "", file.IATBatches[0].ID)

entries := file.IATBatches[0].GetEntries()
require.Equal(t, "f26f52d2603771f52c983bf6062ba503fd126087", entries[0].ID)
}

func TestProcessor_MultiReturnCorrection(t *testing.T) {
cfg := service.ODFIFiles{
Processors: service.ODFIProcessors{
Expand Down
20 changes: 20 additions & 0 deletions internal/incoming/odfi/testdata/iat-credit.ach
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
101 121042882 2313801041812180000A094101Bank My Bank Name
5225 FF3 US123456789 IATTRADEPAYMTCADUSD181219 1231380100000001
6221210428820007 0000100000123456789 1231380100000001
710ANN000000000000100000928383-23938 BEK Enterprises 0000001
711BEK Solutions 15 West Place Street 0000001
712JacobsTown*PA\ US*19305\ 0000001
713Wells Fargo 01231380104 US 0000001
714Citadel Bank 01121042882 CA 0000001
7159874654932139872121 Front Street 0000001
716LetterTown*AB\ CA*80014\ 0000001
717This is an international payment 00010000001
718Bank of France 01456456456987987 FR 00010000001
82250000100012104288000000000000000000100000 231380100000001
9000001000002000000100012104288000000000000000000100000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999

0 comments on commit 4e5becd

Please sign in to comment.