From 3c3b14c73980367783ffed047b01f48314669060 Mon Sep 17 00:00:00 2001 From: Brooke E Kline Jr Date: Fri, 26 Oct 2018 15:32:49 -0400 Subject: [PATCH] Support acknowledgment entries - ACK & ATX #327 ACk and AXT testing adjustments --- batch.go | 12 ++---------- batchACK_test.go | 7 +++---- batchATX_test.go | 48 ++++++++++++++++++++++++------------------------ entryDetail.go | 35 ++++++++--------------------------- 4 files changed, 37 insertions(+), 65 deletions(-) diff --git a/batch.go b/batch.go index 8c22936e8..717f8acfd 100644 --- a/batch.go +++ b/batch.go @@ -29,26 +29,18 @@ func NewBatch(bh *BatchHeader) (Batcher, error) { switch bh.StandardEntryClassCode { case "ACK": return NewBatchACK(bh), nil - case "ATX": - return NewBatchATX(bh), nil case "ARC": return NewBatchARC(bh), nil + case "ATX": + return NewBatchATX(bh), nil case "BOC": return NewBatchBOC(bh), nil - /* case "CCD", "ACK": - return NewBatchCCD(bh), nil - ToDo: Should we do it this way and slash up batchCCD? - */ case "CCD": return NewBatchCCD(bh), nil case "CIE": return NewBatchCIE(bh), nil case "COR": return NewBatchCOR(bh), nil - /* case "CTX", ATX: - return NewBatchCTX(bh), nil - ToDo: Should we do it this way and slash up batchCTX - */ case "CTX": return NewBatchCTX(bh), nil case "IAT": diff --git a/batchACK_test.go b/batchACK_test.go index a23ec65a1..e5a8c318c 100644 --- a/batchACK_test.go +++ b/batchACK_test.go @@ -15,9 +15,9 @@ func mockBatchACKHeader() *BatchHeader { bh.ServiceClassCode = 220 bh.StandardEntryClassCode = "ACK" bh.CompanyName = "Your Company, inc" - bh.CompanyIdentification = "121042882" + bh.CompanyIdentification = "231380104" bh.CompanyEntryDescription = "Vndr Pay" - bh.ODFIIdentification = "231380104" + bh.ODFIIdentification = "23138010" return bh } @@ -28,8 +28,7 @@ func mockACKEntryDetail() *EntryDetail { entry.SetRDFI("121042882") entry.DFIAccountNumber = "744-5678-99" entry.Amount = 0 - // ToDo: In EntryDetail Change To Proper Name - entry.IdentificationNumber = "121042880000001" + entry.SetOriginalTraceNumber(121042880000001) entry.SetReceivingCompany("Best Co. #23") entry.SetTraceNumber(mockBatchACKHeader().ODFIIdentification, 1) entry.DiscretionaryData = "S" diff --git a/batchATX_test.go b/batchATX_test.go index 4d93700bb..3b820256d 100644 --- a/batchATX_test.go +++ b/batchATX_test.go @@ -15,9 +15,9 @@ func mockBatchATXHeader() *BatchHeader { bh.ServiceClassCode = 220 bh.StandardEntryClassCode = "ATX" bh.CompanyName = "Payee Name" - bh.CompanyIdentification = "121042882" + bh.CompanyIdentification = "231380104" bh.CompanyEntryDescription = "ACH ATX" - bh.ODFIIdentification = "12104288" + bh.ODFIIdentification = "23138010" return bh } @@ -25,10 +25,10 @@ func mockBatchATXHeader() *BatchHeader { func mockATXEntryDetail() *EntryDetail { entry := NewEntryDetail() entry.TransactionCode = 24 - entry.SetRDFI("231380104") + entry.SetRDFI("121042882") entry.DFIAccountNumber = "744-5678-99" entry.Amount = 0 - entry.IdentificationNumber = "45689033" + entry.SetOriginalTraceNumber(121042880000001) entry.SetCATXAddendaRecords(1) entry.SetCATXReceivingCompany("Receiver Company") entry.SetTraceNumber(mockBatchATXHeader().ODFIIdentification, 1) @@ -300,16 +300,16 @@ func testBatchATXAddenda10000(t testing.TB) { bh.ServiceClassCode = 220 bh.StandardEntryClassCode = "ATX" bh.CompanyName = "Payee Name" - bh.CompanyIdentification = "121042882" + bh.CompanyIdentification = "231380104" bh.CompanyEntryDescription = "ACH ATX" - bh.ODFIIdentification = "12104288" + bh.ODFIIdentification = "23138010" entry := NewEntryDetail() entry.TransactionCode = 24 - entry.SetRDFI("231380104") + entry.SetRDFI("121042882") entry.DFIAccountNumber = "744-5678-99" entry.Amount = 0 - entry.IdentificationNumber = "45689033" + entry.SetOriginalTraceNumber(121042880000001) entry.SetCATXAddendaRecords(9999) entry.SetCATXReceivingCompany("Receiver Company") entry.SetTraceNumber(mockBatchATXHeader().ODFIIdentification, 1) @@ -353,16 +353,16 @@ func testBatchATXAddendaRecords(t testing.TB) { bh.ServiceClassCode = 220 bh.StandardEntryClassCode = "ATX" bh.CompanyName = "Payee Name" - bh.CompanyIdentification = "121042882" + bh.CompanyIdentification = "231380104" bh.CompanyEntryDescription = "ACH ATX" - bh.ODFIIdentification = "12104288" + bh.ODFIIdentification = "23138010" entry := NewEntryDetail() entry.TransactionCode = 24 - entry.SetRDFI("231380104") + entry.SetRDFI("121042882") entry.DFIAccountNumber = "744-5678-99" entry.Amount = 0 - entry.IdentificationNumber = "45689033" + entry.SetOriginalTraceNumber(121042880000001) entry.SetCATXAddendaRecords(500) entry.SetCATXReceivingCompany("Receiver Company") entry.SetTraceNumber(mockBatchATXHeader().ODFIIdentification, 1) @@ -451,16 +451,16 @@ func testBatchATXZeroAddendaRecords(t testing.TB) { bh.ServiceClassCode = 220 bh.StandardEntryClassCode = "ATX" bh.CompanyName = "Payee Name" - bh.CompanyIdentification = "121042882" + bh.CompanyIdentification = "231380104" bh.CompanyEntryDescription = "ACH ATX" - bh.ODFIIdentification = "12104288" + bh.ODFIIdentification = "23138010" entry := NewEntryDetail() entry.TransactionCode = 24 - entry.SetRDFI("231380104") + entry.SetRDFI("121042882") entry.DFIAccountNumber = "744-5678-99" entry.Amount = 0 - entry.IdentificationNumber = "45689033" + entry.SetOriginalTraceNumber(121042880000001) entry.SetCATXAddendaRecords(1) entry.SetCATXReceivingCompany("Receiver Company") entry.SetTraceNumber(mockBatchATXHeader().ODFIIdentification, 1) @@ -500,17 +500,17 @@ func testBatchATXTransactionCode(t testing.TB) { bh.ServiceClassCode = 220 bh.StandardEntryClassCode = "ATX" bh.CompanyName = "Payee Name" - bh.CompanyIdentification = "121042882" + bh.CompanyIdentification = "231380104" bh.CompanyEntryDescription = "ACH ATX" - bh.ODFIIdentification = "12104288" + bh.ODFIIdentification = "23138010" bh.OriginatorStatusCode = 2 entry := NewEntryDetail() entry.TransactionCode = 23 - entry.SetRDFI("231380104") + entry.SetRDFI("121042882") entry.DFIAccountNumber = "744-5678-99" entry.Amount = 0 - entry.IdentificationNumber = "45689033" + entry.SetOriginalTraceNumber(121042880000001) entry.SetCATXAddendaRecords(1) entry.SetCATXReceivingCompany("Receiver Company") entry.SetTraceNumber(mockBatchATXHeader().ODFIIdentification, 1) @@ -551,17 +551,17 @@ func TestBatchATXAmount(t *testing.T) { bh.ServiceClassCode = 220 bh.StandardEntryClassCode = "ATX" bh.CompanyName = "Payee Name" - bh.CompanyIdentification = "121042882" + bh.CompanyIdentification = "231380104" bh.CompanyEntryDescription = "ACH ATX" - bh.ODFIIdentification = "12104288" + bh.ODFIIdentification = "23138010" bh.OriginatorStatusCode = 2 entry := NewEntryDetail() entry.TransactionCode = 23 - entry.SetRDFI("231380104") + entry.SetRDFI("121042882") entry.DFIAccountNumber = "744-5678-99" entry.Amount = 25000 - entry.IdentificationNumber = "45689033" + entry.SetOriginalTraceNumber(121042880000001) entry.SetCATXAddendaRecords(1) entry.SetCATXReceivingCompany("Receiver Company") entry.SetTraceNumber(mockBatchATXHeader().ODFIIdentification, 1) diff --git a/entryDetail.go b/entryDetail.go index 954cd893d..3b10ab1eb 100644 --- a/entryDetail.go +++ b/entryDetail.go @@ -400,35 +400,16 @@ func (ed *EntryDetail) SetReceivingCompany(s string) { ed.IndividualName = s } -// ToDo: Deprecate -// SetCTXAddendaRecords setter for CTX AddendaRecords characters 1-4 of underlying IndividualName -func (ed *EntryDetail) SetCTXAddendaRecords(i int) { - ed.IndividualName = ed.numericField(i, 4) -} - -// ToDo: Deprecate -// SetCTXReceivingCompany setter for CTX ReceivingCompany characters 5-20 underlying IndividualName -// Position 21-22 of underlying Individual Name are reserved blank space for ATX " " -func (ed *EntryDetail) SetCTXReceivingCompany(s string) { - ed.IndividualName = ed.IndividualName + ed.alphaField(s, 16) + " " -} - -// ToDo: Deprecate -// CTXAddendaRecordsField is used in CTX files, characters 1-4 of underlying IndividualName field -func (ed *EntryDetail) CTXAddendaRecordsField() string { - return ed.parseStringField(ed.IndividualName[0:4]) -} - -// ToDo: Deprecate -// CTXReceivingCompanyField is used in CTX files, characters 5-20 of underlying IndividualName field -func (ed *EntryDetail) CTXReceivingCompanyField() string { - return ed.parseStringField(ed.IndividualName[4:20]) +// OriginalTraceNumberField is used in ACK and ATX files but returns the underlying IdentificationNumber field +func (ed *EntryDetail) OriginalTraceNumberField() string { + return ed.IdentificationNumberField() } -// ToDo: Deprecate -// CTXReservedField is used in CTX files, characters 21-22 of underlying IndividualName field -func (ed *EntryDetail) CTXReservedField() string { - return ed.IndividualName[20:22] +// SetOriginalTraceNumber setter for ACK and ATX OriginalTraceNumber which is underlying IdentificationNumber +func (ed *EntryDetail) SetOriginalTraceNumber(i int) { + s := strconv.Itoa(i) + //ed.IdentificationNumber = ed.numericField(i, 15) + ed.IdentificationNumber = s } // SetCATXAddendaRecords setter for CTX and ATX AddendaRecords characters 1-4 of underlying IndividualName