Repository: moov-io/ach
Pull request #167 (2018-04-13 16:48:31)

Remove param 
Remove FileParam


Patch:
diff --git a/README.md b/README.md
index 9685d91d..58d1d2cb 100644
--- a/README.md
+++ b/README.md
@@ -67,12 +67,15 @@ if len(achFile.ReturnEntries) > 0 {
 The following is based on [simple file creation](https://github.com/moov-io/ach/tree/master/example/simple-file-creation)
  
  ```go
-file := ach.NewFile(ach.FileParam{
-	ImmediateDestination:     "0210000890",
-	ImmediateOrigin:          "123456789",
-	ImmediateDestinationName: "Your Bank",
-	ImmediateOriginName:      "Your Company",
-	ReferenceCode:            "#00000A1"})
+	fh := ach.NewFileHeader()
+	fh.ImmediateDestination = 9876543210 // A blank space followed by your ODFI's transit/routing number
+	fh.ImmediateOrigin = 1234567890      // Organization or Company FED ID usually 1 and FEIN/SSN. Assigned by your ODFI
+	fh.FileCreationDate = time.Now()     // Todays Date
+	fh.ImmediateDestinationName = "Federal Reserve Bank"
+	fh.ImmediateOriginName = "My Bank Name")
+
+	file := ach.NewFile()
+	file.SetHeader(fh)
 ```
 
 Explicitly create a PPD batch file. 
@@ -117,14 +120,15 @@ mockBatch, _ := ach.NewBatch(mockBatchPPDHeader())
 To create an entry
 
  ```go
-entry := ach.NewEntryDetail(ach.EntryParam{
-	ReceivingDFI:      "102001017",
-	RDFIAccount:       "5343121",
-	Amount:            "17500",
-	TransactionCode:   "27",
-	IDNumber:          "ABC##jvkdjfuiwn",
-	IndividualName:    "Bob Smith",
-	DiscretionaryData: "B1"})
+entry := ach.NewEntryDetail()
+entry.TransactionCode = 22
+entry.SetRDFI(9101298)
+entry.DFIAccountNumber = "123456789"
+entry.Amount = 100000000
+entry.IndividualName = "Wade Arnold"
+entry.SetTraceNumber(bh.ODFIIdentification, 1)
+entry.IdentificationNumber = "ABC##jvkdjfuiwn"
+entry.Category = ach.CategoryForward
 ```
 
 To add one or more optional addenda records for an entry
@@ -175,14 +179,16 @@ batch2, _ := ach.NewBatch(mockBatchWEBHeader())
 Add an entry and define if it is a single or reoccurring payment. The following is a reoccurring payment for $7.99
 
 ```go
-entry2 := ach.NewEntryDetail(ach.EntryParam{
-	ReceivingDFI:      "102001017",
-	RDFIAccount:       "5343121",
-	Amount:            "799",
-	TransactionCode:   "22",
-	IDNumber:          "#123456",
-	IndividualName:    "Wade Arnold",
-	PaymentType: 		"R"})
+entry2 := ach.NewEntryDetail()
+entry2.TransactionCode = 22
+entry2.SetRDFI(102001017)
+entry2.DFIAccountNumber = "5343121"
+entry2.Amount = 799
+entry2.IndividualName = "Wade Arnold"
+entry2.SetTraceNumber(bh.ODFIIdentification, 1)
+entry2.IdentificationNumber = "#123456"
+entry.DiscretionaryData = "R"
+entry2.Category = ach.CategoryForward
 
 addenda2 := ach.NewAddenda(ach.AddendaParam{
 	PaymentRelatedInfo: "Monthly Membership Subscription"})
diff --git a/batch.go b/batch.go
index dae70d3a..80c8d3aa 100644
--- a/batch.go
+++ b/batch.go
@@ -124,7 +124,7 @@ func (batch *batch) build() error {
 		}
 		// Add a sequenced TraceNumber if one is not already set. Have to keep original trance number Return and NOC entries
 		if currentTraceNumberODFI != batch.header.ODFIIdentification {
-			batch.entries[i].setTraceNumber(batch.header.ODFIIdentification, seq)
+			batch.entries[i].SetTraceNumber(batch.header.ODFIIdentification, seq)
 		}
 		seq++
 		addendaSeq := 1
diff --git a/batchHeader.go b/batchHeader.go
index a96b0622..65d0580e 100644
--- a/batchHeader.go
+++ b/batchHeader.go
@@ -41,7 +41,13 @@ type BatchHeader struct {
 	// alpha or numeric character) of the entity in the company name field
 	CompanyIdentification string
 
-	// StandardEntryClassCode PPD’ for consumer transactions, ‘CCD’ or ‘CTX’ for corporate
+	// StandardEntryClassCode
+	// Identifies the payment type (product) found within an ACH batch-using a 3-character code.
+	// The SEC Code pertains to all items within batch.
+	// Determines format of the detail records.
+	// Determines addenda records (required or optional PLUS one or up to 9,999 records).
+	// Determines rules to follow (return time frames).
+	// Some SEC codes require specific data in predetermined fields within the ACH record
 	StandardEntryClassCode string
 
 	// CompanyEntryDescription A description of the entries contained in the batch
@@ -268,4 +274,4 @@ func (bh *BatchHeader) BatchNumberField() string {
 
 func (bh *BatchHeader) settlementDateField() string {
 	return bh.alphaField(bh.settlementDate, 3)
-}
\ No newline at end of file
+}
diff --git a/entryDetail.go b/entryDetail.go
index edff73b4..97e2188d 100644
--- a/entryDetail.go
+++ b/entryDetail.go
@@ -90,45 +90,12 @@ const (
 	CategoryNOC     = "NOC"
 )
 
-// EntryParam is the minimal fields required to make a ach entry
-type EntryParam struct {
-	ReceivingDFI      string `json:"receiving_dfi"`
-	RDFIAccount       string `json:"rdfi_account"`
-	Amount            string `json:"amount"`
-	IDNumber          string `json:"id_number,omitempty"`
-	IndividualName    string `json:"individual_name,omitempty"`
-	ReceivingCompany  string `json:"receiving_company,omitempty"`
-	DiscretionaryData string `json:"discretionary_data,omitempty"`
-	PaymentType       string `json:"payment_type,omitempty"`
-	TransactionCode   string `json:"transaction_code"`
-}
-
-// NewEntryDetail returns a new EntryDetail with default values for none exported fields
-func NewEntryDetail(params ...EntryParam) *EntryDetail {
+// NewEntryDetail returns a new EntryDetail with default values for non exported fields
+func NewEntryDetail() *EntryDetail {
 	entry := &EntryDetail{
 		recordType: "6",
 		Category:   CategoryForward,
 	}
-	if len(params) > 0 {
-		entry.SetRDFI(entry.parseNumField(params[0].ReceivingDFI))
-		entry.DFIAccountNumber = params[0].RDFIAccount
-		entry.Amount = entry.parseNumField(params[0].Amount)
-		entry.IdentificationNumber = params[0].IDNumber
-		if params[0].IndividualName != "" {
-			entry.IndividualName = params[0].IndividualName
-		} else {
-			entry.IndividualName = params[0].ReceivingCompany
-		}
-		if params[0].PaymentType != "" {
-			entry.SetPaymentType(params[0].PaymentType)
-		} else {
-			entry.DiscretionaryData = params[0].DiscretionaryData
-		}
-		entry.TransactionCode = entry.parseNumField(params[0].TransactionCode)
-
-		entry.setTraceNumber(entry.RDFIIdentification, 1)
-		return entry
-	}
 	return entry
 }
 
@@ -264,9 +231,9 @@ func (ed *EntryDetail) SetRDFI(rdfi int) *EntryDetail {
 	return ed
 }
 
-// setTraceNumber takes first 8 digits of RDFI and concatenates a sequence number onto the TraceNumber
-func (ed *EntryDetail) setTraceNumber(RDFIIdentification int, seq int) {
-	trace := ed.numericField(RDFIIdentification, 8) + ed.numericField(seq, 7)
+// SetTraceNumber takes first 8 digits of ODFI and concatenates a sequence number onto the TraceNumber
+func (ed *EntryDetail) SetTraceNumber(ODFIIdentification int, seq int) {
+	trace := ed.numericField(ODFIIdentification, 8) + ed.numericField(seq, 7)
 	ed.TraceNumber = ed.parseNumField(trace)
 }
 
@@ -317,7 +284,7 @@ func (ed *EntryDetail) PaymentTypeField() string {
 	return ed.DiscretionaryData
 }
 
-// SetPaymentType as R (Reoccuring) all other values will result in S (single)
+// SetPaymentType as R (Reccuring) all other values will result in S (single)
 func (ed *EntryDetail) SetPaymentType(t string) {
 	t = strings.ToUpper(strings.TrimSpace(t))
 	if t == "R" {
diff --git a/example/ach-ppd-write/main.go b/example/ach-ppd-write/main.go
index 42d964ca..5c0a838c 100644
--- a/example/ach-ppd-write/main.go
+++ b/example/ach-ppd-write/main.go
@@ -35,11 +35,12 @@ func main() {
 	// Identifies the receivers account information
 	// can be multiple entry's per batch
 	entry := ach.NewEntryDetail()
-	// Identifies the entry as a debit and credit entry AND to what type of account (Savings, DDA, Loan
-	entry.TransactionCode = 22                     // Code 22: Credit (deposit) to checking account
-	entry.SetRDFI(9101298)                         // Receivers bank transit routing number
-	entry.DFIAccountNumber = "12345678"            // Receivers bank account number
-	entry.Amount = 100000000                       // Amount of transaction with no decimal. One dollar and eleven cents = 111
+	// Identifies the entry as a debit and credit entry AND to what type of account (Savings, DDA, Loan, GL)
+	entry.TransactionCode = 22          // Code 22: Credit (deposit) to checking account
+	entry.SetRDFI(9101298)              // Receivers bank transit routing number
+	entry.DFIAccountNumber = "12345678" // Receivers bank account number
+	entry.Amount = 100000000            // Amount of transaction with no decimal. One dollar and eleven cents = 111
+	entry.SetTraceNumber(bh.ODFIIdentification, 1)
 	entry.IndividualName = "Receiver Account Name" // Identifies the receiver of the transaction
 
 	// build the batch
diff --git a/example/simple-file-creation/main.go b/example/simple-file-creation/main.go
index 4b57ea9f..2417c851 100644
--- a/example/simple-file-creation/main.go
+++ b/example/simple-file-creation/main.go
@@ -11,12 +11,14 @@ import (
 
 func main() {
 	// To create a file
-	file := ach.NewFile(ach.FileParam{
-		ImmediateDestination:     "0210000890",
-		ImmediateOrigin:          "123456789",
-		ImmediateDestinationName: "Your Bank",
-		ImmediateOriginName:      "Your Company",
-		ReferenceCode:            "#00000A1"})
+	fh := ach.NewFileHeader()
+	fh.ImmediateDestination = 9876543210
+	fh.ImmediateOrigin = 1234567890
+	fh.FileCreationDate = time.Now()
+	fh.ImmediateDestinationName = "Federal Reserve Bank"
+	fh.ImmediateOriginName = "My Bank Name"
+	file := ach.NewFile()
+	file.SetHeader(fh)
 
 	// To create a batch.
 	// Errors only if payment type is not supported.
@@ -32,14 +34,15 @@ func main() {
 	batch, _ := ach.NewBatch(bh)
 
 	// To create an entry
-	entry := ach.NewEntryDetail(ach.EntryParam{
-		ReceivingDFI:      "102001017",
-		RDFIAccount:       "5343121",
-		Amount:            "17500",
-		TransactionCode:   "27",
-		IDNumber:          "#456789",
-		IndividualName:    "Bob Smith",
-		DiscretionaryData: "B1"})
+	entry := ach.NewEntryDetail()
+	entry.TransactionCode = 22
+	entry.SetRDFI(9101298)
+	entry.DFIAccountNumber = "123456789"
+	entry.Amount = 100000000
+	entry.IndividualName = "Wade Arnold"
+	entry.SetTraceNumber(bh.ODFIIdentification, 1)
+	entry.IdentificationNumber = "ABC##jvkdjfuiwn"
+	entry.Category = ach.CategoryForward
 
 	// To add one or more optional addenda records for an entry
 	addenda, _ := ach.NewAddenda(ach.AddendaParam{
@@ -73,17 +76,19 @@ func main() {
 
 	batch2, _ := ach.NewBatch(bh2)
 
-	// Add an entry and define if it is a single or reoccuring payment
-	// The following is a reoccuring payment for $7.99
+	// Add an entry and define if it is a single or reccuring payment
+	// The following is a reccuring payment for $7.99
 
-	entry2 := ach.NewEntryDetail(ach.EntryParam{
-		ReceivingDFI:    "102001017",
-		RDFIAccount:     "5343121",
-		Amount:          "799",
-		TransactionCode: "22",
-		IDNumber:        "#123456",
-		IndividualName:  "Wade Arnold",
-		PaymentType:     "R"})
+	entry2 := ach.NewEntryDetail()
+	entry2.TransactionCode = 22
+	entry2.SetRDFI(102001017)
+	entry2.DFIAccountNumber = "5343121"
+	entry2.Amount = 799
+	entry2.IndividualName = "Wade Arnold"
+	entry2.SetTraceNumber(bh2.ODFIIdentification, 2)
+	entry2.IdentificationNumber = "#123456"
+	entry2.DiscretionaryData = "R"
+	entry2.Category = ach.CategoryForward
 
 	addenda2, _ := ach.NewAddenda(ach.AddendaParam{
 		PaymentRelatedInfo: "Monthly Membership Subscription"})
@@ -112,5 +117,3 @@ func main() {
 	}
 	w.Flush()
 }
-
-
diff --git a/file.go b/file.go
index 186403ae..7d944aa8 100644
--- a/file.go
+++ b/file.go
@@ -74,28 +74,8 @@ type File struct {
 	converters
 }
 
-// FileParam is the minimal fields required to make a ach file header
-type FileParam struct {
-	// ImmediateDestination is the originating banks ABA routing number. Frequently your banks ABA routing number.
-	ImmediateDestination string `json:"immediate_destination"`
-	// ImmediateOrigin
-	ImmediateOrigin string `json:"immediate_origin"`
-	// ImmediateDestinationName is the originating banks name.
-	ImmediateDestinationName string `json:"immediate_destination_name"`
-	ImmediateOriginName      string `json:"immediate_origin_name"`
-	ReferenceCode            string `json:"reference_code,omitempty"`
-}
-
 // NewFile constructs a file template.
-func NewFile(params ...FileParam) *File {
-	if len(params) > 0 {
-		fh := NewFileHeader(params[0])
-		return &File{
-			Header:  fh,
-			Control: NewFileControl(),
-		}
-
-	}
+func NewFile() *File {
 	return &File{
 		Header:  NewFileHeader(),
 		Control: NewFileControl(),
diff --git a/fileHeader.go b/fileHeader.go
index d5575f62..49d0f4d4 100644
--- a/fileHeader.go
+++ b/fileHeader.go
@@ -92,7 +92,7 @@ type FileHeader struct {
 }
 
 // NewFileHeader returns a new FileHeader with default values for none exported fields
-func NewFileHeader(params ...FileParam) FileHeader {
+func NewFileHeader() FileHeader {
 	fh := FileHeader{
 		recordType:     "1",
 		priorityCode:   "01",
@@ -101,15 +101,6 @@ func NewFileHeader(params ...FileParam) FileHeader {
 		blockingFactor: "10",
 		formatCode:     "1",
 	}
-	if len(params) > 0 {
-		fh.ImmediateDestination = fh.parseNumField(params[0].ImmediateDestination)
-		fh.ImmediateOrigin = fh.parseNumField(params[0].ImmediateOrigin)
-		fh.ImmediateDestinationName = params[0].ImmediateDestinationName
-		fh.ImmediateOriginName = params[0].ImmediateOriginName
-		fh.ReferenceCode = params[0].ReferenceCode
-		fh.FileCreationDate = time.Now()
-		return fh
-	}
 	return fh
 }
 


Test patch:
diff --git a/batchCCD_test.go b/batchCCD_test.go
index e71bb5f2..07ee5138 100644
--- a/batchCCD_test.go
+++ b/batchCCD_test.go
@@ -23,7 +23,7 @@ func mockCCDEntryDetail() *EntryDetail {
 	entry.Amount = 5000000
 	entry.IdentificationNumber = "location #23"
 	entry.SetReceivingCompany("Best Co. #23")
-	entry.setTraceNumber(6200001, 123)
+	entry.SetTraceNumber(mockBatchCCDHeader().ODFIIdentification, 1)
 	entry.DiscretionaryData = "S"
 	return entry
 }
diff --git a/batchCOR_test.go b/batchCOR_test.go
index bfd35b49..6754f5d8 100644
--- a/batchCOR_test.go
+++ b/batchCOR_test.go
@@ -25,7 +25,7 @@ func mockCOREntryDetail() *EntryDetail {
 	entry.Amount = 0
 	entry.IdentificationNumber = "location #23"
 	entry.SetReceivingCompany("Best Co. #23")
-	entry.setTraceNumber(6200001, 0)
+	entry.SetTraceNumber(mockBatchCORHeader().ODFIIdentification, 1)
 	entry.DiscretionaryData = "S"
 	return entry
 }
diff --git a/batchPPD_test.go b/batchPPD_test.go
index 510d923d..c3ec5c1b 100644
--- a/batchPPD_test.go
+++ b/batchPPD_test.go
@@ -9,7 +9,6 @@ import (
 	"time"
 )
 
-
 func mockBatchPPDHeader() *BatchHeader {
 	bh := NewBatchHeader()
 	bh.ServiceClassCode = 220
@@ -29,8 +28,33 @@ func mockPPDEntryDetail() *EntryDetail {
 	entry.DFIAccountNumber = "123456789"
 	entry.Amount = 100000000
 	entry.IndividualName = "Wade Arnold"
-	entry.setTraceNumber(mockBatchPPDHeader().ODFIIdentification, 1)
-	//entry.setTraceNumber(6200001, 1)
+	entry.SetTraceNumber(mockBatchPPDHeader().ODFIIdentification, 1)
+	entry.Category = CategoryForward
+	return entry
+}
+
+func mockBatchPPDHeader2() *BatchHeader {
+	bh := NewBatchHeader()
+	bh.ServiceClassCode = 200
+	bh.CompanyName = "MY BEST COMP."
+	bh.CompanyDiscretionaryData = "INCLUDES OVERTIME"
+	bh.CompanyIdentification = "1419871234"
+	bh.StandardEntryClassCode = "PPD"
+	bh.CompanyEntryDescription = "PAYROLL"
+	bh.EffectiveEntryDate = time.Now()
+	bh.ODFIIdentification = 109991234
+	return bh
+}
+
+func mockPPDEntry2() *EntryDetail {
+	entry := NewEntryDetail()
+	entry.TransactionCode = 22                  // ACH Credit
+	entry.SetRDFI(81086674)                     // scottrade bank routing number
+	entry.DFIAccountNumber = "62292250"         // scottrade account number
+	entry.Amount = 1000000                      // 1k dollars
+	entry.IdentificationNumber = "658-888-2468" // Unique ID for payment
+	entry.IndividualName = "Wade Arnold"
+	entry.SetTraceNumber(mockBatchPPDHeader2().ODFIIdentification, 1)
 	entry.Category = CategoryForward
 	return entry
 }
@@ -128,26 +152,8 @@ func TestBatchODFIIDMismatch(t *testing.T) {
 }
 
 func TestBatchBuild(t *testing.T) {
-	header := NewBatchHeader()
-	header.ServiceClassCode = 200
-	header.CompanyName = "MY BEST COMP."
-	header.CompanyDiscretionaryData = "INCLUDES OVERTIME"
-	header.CompanyIdentification = "1419871234"
-	header.StandardEntryClassCode = "PPD"
-	header.CompanyEntryDescription = "PAYROLL"
-	header.EffectiveEntryDate = time.Now()
-	header.ODFIIdentification = 109991234
-
-	mockBatch := NewBatchPPD(mockBatchPPDHeader())
-
-	entry := NewEntryDetail()
-	entry.TransactionCode = 22                  // ACH Credit
-	entry.SetRDFI(81086674)                // scottrade bank routing number
-	entry.DFIAccountNumber = "62292250"         // scottrade account number
-	entry.Amount = 1000000                      // 1k dollars
-	entry.IdentificationNumber = "658-888-2468" // Unique ID for payment
-	entry.IndividualName = "Wade Arnold"
-	entry.setTraceNumber(header.ODFIIdentification, 1)
+	mockBatch := NewBatchPPD(mockBatchPPDHeader2())
+	entry := mockPPDEntry2()
 	a1, _ := NewAddenda()
 	entry.AddAddenda(a1)
 	mockBatch.AddEntry(entry)
diff --git a/batchTEL_test.go b/batchTEL_test.go
index b3a24584..fd6a9b5b 100644
--- a/batchTEL_test.go
+++ b/batchTEL_test.go
@@ -23,7 +23,7 @@ func mockTELEntryDetail() *EntryDetail {
 	entry.Amount = 5000000
 	entry.IdentificationNumber = "Phone 333-2222"
 	entry.IndividualName = "Wade Arnold"
-	entry.setTraceNumber(6200001, 123)
+	entry.SetTraceNumber(mockBatchTELHeader().ODFIIdentification, 123)
 	entry.SetPaymentType("S")
 	return entry
 }
diff --git a/batchWEB_test.go b/batchWEB_test.go
index d80ceb0a..a5f53fe3 100644
--- a/batchWEB_test.go
+++ b/batchWEB_test.go
@@ -20,7 +20,7 @@ func mockWEBEntryDetail() *EntryDetail {
 	entry.DFIAccountNumber = "123456789"
 	entry.Amount = 100000000
 	entry.IndividualName = "Wade Arnold"
-	entry.setTraceNumber(6200001, 1)
+	entry.SetTraceNumber(mockBatchWEBHeader().ODFIIdentification, 1)
 	entry.SetPaymentType("S")
 	return entry
 }
diff --git a/batch_test.go b/batch_test.go
index 4c137245..0b7dbfdc 100644
--- a/batch_test.go
+++ b/batch_test.go
@@ -137,7 +137,7 @@ func TestBatchDNEMismatch(t *testing.T) {
 
 func TestBatchTraceNumberNotODFI(t *testing.T) {
 	mockBatch := mockBatch()
-	mockBatch.GetEntries()[0].setTraceNumber(12345678, 1)
+	mockBatch.GetEntries()[0].SetTraceNumber(12345678, 1)
 	if err := mockBatch.verify(); err != nil {
 		if e, ok := err.(*BatchError); ok {
 			if e.FieldName != "ODFIIdentificationField" {
@@ -245,7 +245,6 @@ func TestBatchAddendaTraceNumber(t *testing.T) {
 	}
 }
 
-
 func TestNewBatchDefault(t *testing.T) {
 	_, err := NewBatch(mockBatchInvalidSECHeader())
 
@@ -258,8 +257,6 @@ func TestNewBatchDefault(t *testing.T) {
 	}
 }
 
-
-
 func TestBatchCategory(t *testing.T) {
 	mockBatch := mockBatch()
 	// Add a Addenda Return to the mock batch
diff --git a/entryDetail_internal_test.go b/entryDetail_internal_test.go
index 600a21ad..72f94a46 100644
--- a/entryDetail_internal_test.go
+++ b/entryDetail_internal_test.go
@@ -16,7 +16,21 @@ func mockEntryDetail() *EntryDetail {
 	entry.DFIAccountNumber = "123456789"
 	entry.Amount = 100000000
 	entry.IndividualName = "Wade Arnold"
-	entry.setTraceNumber(6200001, 1)
+	entry.SetTraceNumber(mockBatchHeader().ODFIIdentification, 1)
+	entry.IdentificationNumber = "ABC##jvkdjfuiwn"
+	entry.Category = CategoryForward
+	return entry
+}
+
+func mockEntryDemandDebit() *EntryDetail {
+	entry := NewEntryDetail()
+	entry.TransactionCode = 27
+	entry.SetRDFI(102001017)
+	entry.DFIAccountNumber = "5343121"
+	entry.Amount = 17500
+	entry.IndividualName = "Robert Smith"
+	entry.SetTraceNumber(mockBatchHeader().ODFIIdentification, 1)
+	entry.IdentificationNumber = "ABC##jvkdjfuiwn"
 	entry.Category = CategoryForward
 	return entry
 }
diff --git a/recordParams_test.go b/recordParams_test.go
index aa21c8c2..adea6d07 100644
--- a/recordParams_test.go
+++ b/recordParams_test.go
@@ -1,28 +1,22 @@
 package ach
 
 import (
-	"testing"
 	"bytes"
+	"testing"
 )
 
 func TestFileParam(t *testing.T) {
-	f := NewFile(
-		FileParam{
-			ImmediateDestination:     "0210000890",
-			ImmediateOrigin:          "123456789",
-			ImmediateDestinationName: "Your Bank",
-			ImmediateOriginName:      "Your Company",
-			ReferenceCode:            "#00000A1"})
+	f := NewFile()
+	f.SetHeader(mockFileHeader())
 	if err := f.Header.Validate(); err != nil {
 		t.Errorf("%T: %s", err, err)
 	}
 
-	if f.Header.ImmediateOriginName != "Your Company" {
+	if f.Header.ImmediateOriginName != "My Bank Name" {
 		t.Errorf("FileParam value was not copied to file.Header")
 	}
 }
 
-
 func TestBatchParam(t *testing.T) {
 	companyName := "ACME Corporation"
 	batch, _ := NewBatch(mockBatchPPDHeader())
@@ -36,44 +30,34 @@ func TestBatchParam(t *testing.T) {
 	}
 }
 
-func TestEntryParam(t *testing.T) {
-	entry := NewEntryDetail(EntryParam{
-		ReceivingDFI:      "102001017",
-		RDFIAccount:       "5343121",
-		Amount:            "17500",
-		TransactionCode:   "27",
-		IDNumber:          "ABC##jvkdjfuiwn",
-		IndividualName:    "Bob Smith",
-		DiscretionaryData: "B1"})
+func TestEntryDetail(t *testing.T) {
+	entry := mockEntryDetail()
+	//override mockEntryDetail
+	entry.TransactionCode = 27
 
 	if err := entry.Validate(); err != nil {
 		t.Errorf("%T: %s", err, err)
 	}
 }
 
-func TestEntryParamPaymentType(t *testing.T) {
-	entry := NewEntryDetail(EntryParam{
-		ReceivingDFI:    "102001017",
-		RDFIAccount:     "5343121",
-		Amount:          "17500",
-		TransactionCode: "27",
-		IDNumber:        "ABC##jvkdjfuiwn",
-		IndividualName:  "Bob Smith",
-		PaymentType:     "R"})
+func TestEntryDetailPaymentType(t *testing.T) {
+
+	entry := mockEntryDetail()
+	//override mockEntryDetail
+	entry.TransactionCode = 27
+	entry.DiscretionaryData = "R"
 
 	if err := entry.Validate(); err != nil {
 		t.Errorf("%T: %s", err, err)
 	}
 }
 
-func TestEntryParamReceivingCompany(t *testing.T) {
-	entry := NewEntryDetail(EntryParam{
-		ReceivingDFI:     "102001017",
-		RDFIAccount:      "5343121",
-		Amount:           "17500",
-		TransactionCode:  "27",
-		IDNumber:         "location #23",
-		ReceivingCompany: "Best Co. #23"})
+func TestEntryDetailReceivingCompany(t *testing.T) {
+	entry := mockEntryDetail()
+	//override mockEntryDetail
+	entry.TransactionCode = 27
+	entry.IdentificationNumber = "location #23"
+	entry.IndividualName = "Best Co. #23"
 
 	if err := entry.Validate(); err != nil {
 		t.Errorf("%T: %s", err, err)
@@ -91,25 +75,14 @@ func TestAddendaParam(t *testing.T) {
 
 func TestBuildFileParam(t *testing.T) {
 	// To create a file
-	file := NewFile(FileParam{
-		ImmediateDestination:     "0210000890",
-		ImmediateOrigin:          "123456789",
-		ImmediateDestinationName: "Your Bank",
-		ImmediateOriginName:      "Your Company",
-		ReferenceCode:            "#00000A1"})
+	file := NewFile()
+	file.SetHeader(mockFileHeader())
 
 	// To create a batch. Errors only if payment type is not supported.
 	batch, _ := NewBatch(mockBatchHeader())
 
 	// To create an entry
-	entry := NewEntryDetail(EntryParam{
-		ReceivingDFI:      "102001017",
-		RDFIAccount:       "5343121",
-		Amount:            "17500",
-		TransactionCode:   "27",
-		IDNumber:          "ABC##jvkdjfuiwn",
-		IndividualName:    "Robert Smith",
-		DiscretionaryData: "B1"})
+	entry := mockEntryDemandDebit()
 
 	// To add one or more optional addenda records for an entry
 
@@ -135,17 +108,10 @@ func TestBuildFileParam(t *testing.T) {
 
 	batch, _ = NewBatch(mockBatchWEBHeader())
 
-	// Add an entry and define if it is a single or reoccuring payment
+	// Add an entry and define if it is a single or reccuring payment
 	// The following is a reoccuring payment for $7.99
 
-	entry = NewEntryDetail(EntryParam{
-		ReceivingDFI:    "102001017",
-		RDFIAccount:     "5343121",
-		Amount:          "799",
-		TransactionCode: "22",
-		IDNumber:        "#123456",
-		IndividualName:  "Wade Arnold",
-		PaymentType:     "R"})
+	entry = mockWEBEntryDetail()
 
 	addenda, _ = NewAddenda(AddendaParam{
 		PaymentRelatedInfo: "Monthly Membership Subscription"})