batch: only check DNE specifics if the SEC code is DNE
This came up when a PPD prenote was created, but this check was too
broad and returned an error incorrectly.
@@ -230,8 +230,10 @@ func BenchmarkBatchIsEntryHash(b *testing.B) {
}
func testBatchDNEMismatch(t testing.TB) {
+ bh := mockBatchHeader()
+ bh.StandardEntryClassCode = DNE
mockBatch := mockBatch()
- mockBatch.SetHeader(mockBatchHeader())
+ mockBatch.SetHeader(bh)
ed := mockBatch.GetEntries()[0]
ed.AddAddenda05(mockAddenda05())
ed.AddAddenda05(mockAddenda05())
@@ -256,6 +258,19 @@ func BenchmarkBatchDNEMismatch(b *testing.B) {
}
}
+func TestBatch__DNEOriginatorCheck(t *testing.T) {
+ bh := mockBatchHeader()
+ bh.OriginatorStatusCode = 1
+ bh.StandardEntryClassCode = PPD
+
+ batch := mockBatch()
+ batch.SetHeader(bh)
+
+ if err := batch.isOriginatorDNE(); err != nil {
+ t.Errorf("%T: %s", err, err)
+ }
+}
+
func testBatchTraceNumberNotODFI(t testing.TB) {
mockBatch := mockBatch()
mockBatch.GetEntries()[0].SetTraceNumber("12345678", 1)
