Skip to content

Commit

Permalink
Merge pull request #336 from moov-io/Support-NOC-for-IAT-Entries-#328
Browse files Browse the repository at this point in the history
Support noc for iat entries #328
  • Loading branch information
bkmoovio authored Nov 1, 2018
2 parents bcb2751 + fb681e7 commit 3aeb5fc
Show file tree
Hide file tree
Showing 14 changed files with 407 additions and 168 deletions.
5 changes: 0 additions & 5 deletions addenda10.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ func (addenda10 *Addenda10) reservedField() string {
return addenda10.alphaField(addenda10.reserved, 6)
}

// TypeCode Defines the specific explanation and format for the addenda10 information left padded
func (addenda10 *Addenda10) typeCode() string {
return addenda10.TypeCode
}

// EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string
func (addenda10 *Addenda10) EntryDetailSequenceNumberField() string {
return addenda10.numericField(addenda10.EntryDetailSequenceNumber, 7)
Expand Down
5 changes: 0 additions & 5 deletions addenda11.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ func (addenda11 *Addenda11) reservedField() string {
return addenda11.alphaField(addenda11.reserved, 14)
}

// TypeCode Defines the specific explanation and format for the addenda11 information left padded
func (addenda11 *Addenda11) typeCode() string {
return addenda11.TypeCode
}

// EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string
func (addenda11 *Addenda11) EntryDetailSequenceNumberField() string {
return addenda11.numericField(addenda11.EntryDetailSequenceNumber, 7)
Expand Down
5 changes: 0 additions & 5 deletions addenda12.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,6 @@ func (addenda12 *Addenda12) reservedField() string {
return addenda12.alphaField(addenda12.reserved, 14)
}

// TypeCode Defines the specific explanation and format for the addenda12 information left padded
func (addenda12 *Addenda12) typeCode() string {
return addenda12.TypeCode
}

// EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string
func (addenda12 *Addenda12) EntryDetailSequenceNumberField() string {
return addenda12.numericField(addenda12.EntryDetailSequenceNumber, 7)
Expand Down
5 changes: 0 additions & 5 deletions addenda13.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,6 @@ func (addenda13 *Addenda13) reservedField() string {
return addenda13.alphaField(addenda13.reserved, 10)
}

// TypeCode Defines the specific explanation and format for the addenda13 information left padded
func (addenda13 *Addenda13) typeCode() string {
return addenda13.TypeCode
}

// EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string
func (addenda13 *Addenda13) EntryDetailSequenceNumberField() string {
return addenda13.numericField(addenda13.EntryDetailSequenceNumber, 7)
Expand Down
5 changes: 0 additions & 5 deletions addenda14.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@ func (addenda14 *Addenda14) reservedField() string {
return addenda14.alphaField(addenda14.reserved, 10)
}

// TypeCode Defines the specific explanation and format for the addenda14 information left padded
func (addenda14 *Addenda14) typeCode() string {
return addenda14.TypeCode
}

// EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string
func (addenda14 *Addenda14) EntryDetailSequenceNumberField() string {
return addenda14.numericField(addenda14.EntryDetailSequenceNumber, 7)
Expand Down
5 changes: 0 additions & 5 deletions addenda15.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ func (addenda15 *Addenda15) reservedField() string {
return addenda15.alphaField(addenda15.reserved, 34)
}

// TypeCode Defines the specific explanation and format for the addenda15 information left padded
func (addenda15 *Addenda15) typeCode() string {
return addenda15.TypeCode
}

// EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string
func (addenda15 *Addenda15) EntryDetailSequenceNumberField() string {
return addenda15.numericField(addenda15.EntryDetailSequenceNumber, 7)
Expand Down
5 changes: 0 additions & 5 deletions addenda16.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ func (addenda16 *Addenda16) reservedField() string {
return addenda16.alphaField(addenda16.reserved, 14)
}

// TypeCode Defines the specific explanation and format for the addenda16 information left padded
func (addenda16 *Addenda16) typeCode() string {
return addenda16.TypeCode
}

// EntryDetailSequenceNumberField returns a zero padded EntryDetailSequenceNumber string
func (addenda16 *Addenda16) EntryDetailSequenceNumberField() string {
return addenda16.numericField(addenda16.EntryDetailSequenceNumber, 7)
Expand Down
16 changes: 14 additions & 2 deletions addenda17_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func testAddenda17Parse(t testing.TB) {
if Addenda17.recordType != "7" {
t.Errorf("expected %v got %v", "7", Addenda17.recordType)
}
if Addenda17.TypeCode != "17" {
if Addenda17.typeCode() != "17" {
t.Errorf("expected %v got %v", "17", Addenda17.TypeCode)
}
if Addenda17.PaymentRelatedInformation != "This is an international payment" {
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestValidateAddenda17RecordType(t *testing.T) {
}
}

func TestAddenda17TypeCodeFieldInclusion(t *testing.T) {
func TestAddenda17FieldInclusionTypeCode(t *testing.T) {
addenda17 := mockAddenda17()
addenda17.TypeCode = ""
if err := addenda17.Validate(); err != nil {
Expand All @@ -134,6 +134,18 @@ func TestAddenda17FieldInclusion(t *testing.T) {
}
}

func TestAddenda17FieldInclusionSequenceNumber(t *testing.T) {
addenda17 := mockAddenda17()
addenda17.SequenceNumber = 0
if err := addenda17.Validate(); err != nil {
if e, ok := err.(*FieldError); ok {
if e.FieldName != "SequenceNumber" {
t.Errorf("%T: %s", err, err)
}
}
}
}

func TestAddenda17FieldInclusionRecordType(t *testing.T) {
addenda17 := mockAddenda17()
addenda17.recordType = ""
Expand Down
67 changes: 63 additions & 4 deletions addenda18_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package ach

import (
"strings"
"testing"
)

Expand Down Expand Up @@ -108,7 +107,7 @@ func testAddenda18Parse(t testing.TB) {
if Addenda18.recordType != "7" {
t.Errorf("expected %v got %v", "7", Addenda18.recordType)
}
if Addenda18.TypeCode != "18" {
if Addenda18.typeCode() != "18" {
t.Errorf("expected %v got %v", "18", Addenda18.TypeCode)
}
if Addenda18.ForeignCorrespondentBankName != "Bank of Germany" {
Expand Down Expand Up @@ -180,7 +179,7 @@ func TestValidateAddenda18RecordType(t *testing.T) {
}
}

func TestAddenda18TypeCodeFieldInclusion(t *testing.T) {
func TestAddenda18FieldInclusionTypeCode(t *testing.T) {
addenda18 := mockAddenda18()
addenda18.TypeCode = ""
if err := addenda18.Validate(); err != nil {
Expand All @@ -204,12 +203,72 @@ func TestAddenda18FieldInclusion(t *testing.T) {
}
}

func TestAddenda18FieldInclusionSequenceNumber(t *testing.T) {
addenda18 := mockAddenda18()
addenda18.SequenceNumber = 0
if err := addenda18.Validate(); err != nil {
if e, ok := err.(*FieldError); ok {
if e.FieldName != "SequenceNumber" {
t.Errorf("%T: %s", err, err)
}
}
}
}

func TestAddenda18FieldInclusionRecordType(t *testing.T) {
addenda18 := mockAddenda18()
addenda18.recordType = ""
if err := addenda18.Validate(); err != nil {
if e, ok := err.(*FieldError); ok {
if !strings.Contains(e.Msg, msgFieldInclusion) {
if e.FieldName != "recordType" {
t.Errorf("%T: %s", err, err)
}
}
}
}

func TestAddenda18FieldInclusionFCBankName(t *testing.T) {
addenda18 := mockAddenda18()
addenda18.ForeignCorrespondentBankName = ""
if err := addenda18.Validate(); err != nil {
if e, ok := err.(*FieldError); ok {
if e.FieldName != "ForeignCorrespondentBankName" {
t.Errorf("%T: %s", err, err)
}
}
}
}

func TestAddenda18FieldInclusionFCBankIDNumberQualifier(t *testing.T) {
addenda18 := mockAddenda18()
addenda18.ForeignCorrespondentBankIDNumberQualifier = ""
if err := addenda18.Validate(); err != nil {
if e, ok := err.(*FieldError); ok {
if e.FieldName != "ForeignCorrespondentBankIDNumberQualifier" {
t.Errorf("%T: %s", err, err)
}
}
}
}

func TestAddenda18FieldInclusionFCBankIDNumber(t *testing.T) {
addenda18 := mockAddenda18()
addenda18.ForeignCorrespondentBankIDNumber = ""
if err := addenda18.Validate(); err != nil {
if e, ok := err.(*FieldError); ok {
if e.FieldName != "ForeignCorrespondentBankIDNumber" {
t.Errorf("%T: %s", err, err)
}
}
}
}

func TestAddenda18FieldInclusionFCBankBranchCountryCode(t *testing.T) {
addenda18 := mockAddenda18()
addenda18.ForeignCorrespondentBankBranchCountryCode = ""
if err := addenda18.Validate(); err != nil {
if e, ok := err.(*FieldError); ok {
if e.FieldName != "ForeignCorrespondentBankBranchCountryCode" {
t.Errorf("%T: %s", err, err)
}
}
Expand Down
Loading

0 comments on commit 3aeb5fc

Please sign in to comment.