-
Notifications
You must be signed in to change notification settings - Fork 163
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
Add const values for batch header.service class code #394
Changes from 9 commits
917f4c1
eea516d
9c49ac2
7a7c724
c9c3936
34d2089
b1839b6
00cab4a
f49c92b
58625de
4f279b3
04887ba
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 |
---|---|---|
|
@@ -18,9 +18,7 @@ type ADVBatchControl struct { | |
ID string `json:"id"` | ||
// RecordType defines the type of record in the block. | ||
recordType string | ||
// ServiceClassCode ACH Mixed Debits and Credits ‘200’ | ||
// ACH Credits Only ‘220’ | ||
// ACH Debits Only ‘225' | ||
// Constant AutomatedAccountingAdvices: 280 | ||
// Same as 'ServiceClassCode' in BatchHeaderRecord | ||
ServiceClassCode int `json:"serviceClassCode"` | ||
// EntryAddendaCount is a tally of each Entry Detail Record and each Addenda | ||
|
@@ -60,7 +58,8 @@ func (bc *ADVBatchControl) Parse(record string) { | |
|
||
// 1-1 Always "8" | ||
bc.recordType = "8" | ||
// 2-4 This is the same as the "Service code" field in previous Batch Header Record | ||
// 2-4 This is the same as the "Service code" field in previous Batch Header Record - | ||
// AutomatedAccountingAdvices: 280 | ||
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. Does this comment need to be here? Not sure what it tells me. 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. Ok I'll remove. No problem! |
||
bc.ServiceClassCode = bc.parseNumField(record[1:4]) | ||
// 5-10 Total number of Entry Detail Record in the batch | ||
bc.EntryAddendaCount = bc.parseNumField(record[4:10]) | ||
|
@@ -83,7 +82,7 @@ func (bc *ADVBatchControl) Parse(record string) { | |
func NewADVBatchControl() *ADVBatchControl { | ||
return &ADVBatchControl{ | ||
recordType: "8", | ||
ServiceClassCode: 280, | ||
ServiceClassCode: AutomatedAccountingAdvices, | ||
EntryHash: 1, | ||
BatchNumber: 1, | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import ( | |
|
||
func mockADVBatchControl() *ADVBatchControl { | ||
bc := NewADVBatchControl() | ||
bc.ServiceClassCode = 220 | ||
bc.ServiceClassCode = CreditsOnly | ||
bc.ACHOperatorData = "T-BANK" | ||
bc.ODFIIdentification = "12104288" | ||
return bc | ||
|
@@ -23,7 +23,7 @@ func testMockADVBatchControl(t testing.TB) { | |
if err := bc.Validate(); err != nil { | ||
t.Error("mockADVBatchControl does not validate and will break other tests") | ||
} | ||
if bc.ServiceClassCode != 220 { | ||
if bc.ServiceClassCode != CreditsOnly { | ||
t.Error("ServiceClassCode depedendent default value has changed") | ||
} | ||
if bc.ACHOperatorData != "T-BANK" { | ||
|
@@ -49,12 +49,12 @@ func BenchmarkMockADVBatchControl(b *testing.B) { | |
|
||
// TestParseADVBatchControl parses a known Batch ControlRecord string. | ||
func testParseADVBatchControl(t testing.TB) { | ||
var line = "822500000100053200010000000000000001050000000000000000000000T-BANK 076401250000001" | ||
var line = "828000000100053200010000000000000001050000000000000000000000T-BANK 076401250000001" | ||
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. Nice! Good catch! |
||
r := NewReader(strings.NewReader(line)) | ||
r.line = line | ||
bh := BatchHeader{BatchNumber: 1, | ||
StandardEntryClassCode: "ADV", | ||
ServiceClassCode: 280, | ||
ServiceClassCode: AutomatedAccountingAdvices, | ||
CompanyIdentification: "origid", | ||
ODFIIdentification: "12104288"} | ||
r.addCurrentBatch(NewBatchADV(&bh)) | ||
|
@@ -68,8 +68,8 @@ func testParseADVBatchControl(t testing.TB) { | |
if record.recordType != "8" { | ||
t.Errorf("RecordType Expected '8' got: %v", record.recordType) | ||
} | ||
if record.ServiceClassCode != 225 { | ||
t.Errorf("ServiceClassCode Expected '225' got: %v", record.ServiceClassCode) | ||
if record.ServiceClassCode != AutomatedAccountingAdvices { | ||
t.Errorf("ServiceClassCode Expected '280' got: %v", record.ServiceClassCode) | ||
} | ||
if record.EntryAddendaCountField() != "000001" { | ||
t.Errorf("EntryAddendaCount Expected '000001' got: %v", record.EntryAddendaCountField()) | ||
|
@@ -114,7 +114,7 @@ func testADVBCString(t testing.TB) { | |
r.line = line | ||
bh := BatchHeader{BatchNumber: 1, | ||
StandardEntryClassCode: "ADV", | ||
ServiceClassCode: 280, | ||
ServiceClassCode: AutomatedAccountingAdvices, | ||
CompanyIdentification: "origid", | ||
ODFIIdentification: "12104288"} | ||
r.addCurrentBatch(NewBatchADV(&bh)) | ||
|
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.
Should this be commented out?
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.
I'll remove!
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.
since this in adv control, I'll have it be this