-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
batch: tabulate on build/create calls #388
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -401,6 +401,14 @@ func TestFile__readFromJson(t *testing.T) { | |
t.Fatal(err) | ||
} | ||
|
||
// Ensure the file is valid | ||
if err := file.Create(); err != nil { | ||
t.Error(err) | ||
} | ||
if err := file.Validate(); err != nil { | ||
t.Error(err) | ||
} | ||
|
||
if file.ID != "adam-01" { | ||
t.Errorf("file.ID: %s", file.ID) | ||
} | ||
|
@@ -422,15 +430,15 @@ func TestFile__readFromJson(t *testing.T) { | |
} | ||
batch := file.Batches[0] | ||
batchControl := batch.GetControl() | ||
if batchControl.EntryAddendaCount != 2 { | ||
if batchControl.EntryAddendaCount != 1 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bkmoovio Shouldn't this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi Adam, EntryAddendaCount in the Company/Batch Control Record and File Control Record can be confusing as it is not the AddendaCount for an Entry. It is (for reference page OR108) the tally for each Entry Detail Record processed and each Addenda Record processed, within either the batch or file, as appropriate. For a BatchPPD with one EntryDetail , and no Addenda05, EntryAddendaCount should be 1, If the one EntryDetail has an Addenda05, EntryAddendaCount would be 2. Hopefully that helps . (Clear as Mud) For the second question: Prior to removing addendumer change, the code set entryCount as follows: for i, entry := range batch.Entries { going forward I had added +1 to entryCount for each entry (EntryDetail) + each Addenda property if the property was defined. Addenda02, len(Addenda05), Addenda98, Addenda99. it looks like you created a function for that which is great. I should have. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, okay. Those names are confusing but it makes sense. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well that's a good idea. |
||
t.Errorf("EntryAddendaCount: %d", batchControl.EntryAddendaCount) | ||
} | ||
|
||
// Control | ||
if file.Control.BatchCount != 1 { | ||
t.Errorf("BatchCount: %d", file.Control.BatchCount) | ||
} | ||
if file.Control.EntryAddendaCount != 2 { | ||
if file.Control.EntryAddendaCount != 1 { | ||
t.Errorf("File Control EntryAddendaCount: %d", file.Control.EntryAddendaCount) | ||
} | ||
if file.Control.TotalDebitEntryDollarAmountInFile != 0 || file.Control.TotalCreditEntryDollarAmountInFile != 100000 { | ||
|
@@ -448,3 +456,29 @@ func TestFile__readFromJson(t *testing.T) { | |
t.Error(err) | ||
} | ||
} | ||
|
||
// TestFile__jsonFileNoControlBlobs will read an ach.File from its JSON form, but the JSON has no | ||
// batchControl or fileControl sub-objects. | ||
func TestFile__jsonFileNoControlBlobs(t *testing.T) { | ||
path := filepath.Join("test", "testdata", "ppd-no-control-blobs-valid.json") | ||
bs, err := ioutil.ReadFile(path) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
file, err := FileFromJSON(bs) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if err := file.Create(); err != nil { | ||
t.Fatal(err) | ||
} | ||
if err := file.Validate(); err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if file.ID != "adam-01" { | ||
t.Errorf("file.ID: %s", file.ID) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"id": "adam-01", | ||
"fileHeader": { | ||
"id": "adam-01", | ||
"immediateDestination": "231380104", | ||
"immediateOrigin": "121042882", | ||
"fileCreationDate": "2018-10-08T00:00:00Z", | ||
"fileCreationTime": "0000-01-01T00:00:00Z", | ||
"fileIDModifier": "A", | ||
"immediateDestinationName": "Citadel", | ||
"immediateOriginName": "Wells Fargo" | ||
}, | ||
"batches": [ | ||
{ | ||
"batchHeader": { | ||
"id": "adam-01", | ||
"serviceClassCode": 200, | ||
"companyName": "Wells Fargo", | ||
"companyIdentification": "121042882", | ||
"standardEntryClassCode": "PPD", | ||
"companyEntryDescription": "Trans. Des", | ||
"effectiveEntryDate": "2018-10-09T00:00:00Z", | ||
"ODFIIdentification": "12104288", | ||
"batchNumber": 1 | ||
}, | ||
"entryDetails": [ | ||
{ | ||
"id": "adam-01", | ||
"transactionCode": 22, | ||
"RDFIIdentification": "23138010", | ||
"checkDigit": "4", | ||
"DFIAccountNumber": "81967038518 ", | ||
"amount": 100000, | ||
"identificationNumber": "#83738AB# ", | ||
"individualName": "Steven Tander ", | ||
"discretionaryData": " ", | ||
"addendaRecordIndicator": 1, | ||
"traceNumber": "121042880000001", | ||
"category": "Forward", | ||
"addenda05": [ | ||
{ | ||
"entryDetailSequenceNumber": 1, | ||
"sequenceNumber": 1, | ||
"paymentRelatedInformation": "Bonus for working on #OSS!", | ||
"typeCode": "", | ||
"id": "gvluehibyuuqdoajiqfn" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
], | ||
"IATBatches": null, | ||
"NotificationOfChange": null, | ||
"ReturnEntries": null | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
batches