ParseAddenda02
Add scaled down veriosn of ParseAddenda02
@@ -306,3 +306,57 @@ func BenchmarkAddenda02String(b *testing.B) {
testAddenda02String(b)
}
}
+
+func testParseAddenda02(t testing.TB) {
+ addendaPOS := NewAddenda02()
+ var line = "702REFONEAREFTERM021000490612123456Target Store 0049 PHILADELPHIA PA091012980000088"
+ addendaPOS.Parse(line)
+
+ if addendaPOS.recordType != "7" {
+ t.Errorf("RecordType Expected '7' got: %v", addendaPOS.recordType)
+ }
+ if addendaPOS.TypeCode() != "02" {
+ t.Errorf("TypeCode Expected 02 got: %v", addendaPOS.TypeCode())
+ }
+ if addendaPOS.ReferenceInformationOne != "REFONEA" {
+ t.Errorf("ReferenceInformationOne Expected 'REFONEA' got: %v", addendaPOS.ReferenceInformationOneField())
+ }
+ if addendaPOS.ReferenceInformationTwo != "REF" {
+ t.Errorf("ReferenceInformationTwo Expected 'REF' got: %v", addendaPOS.ReferenceInformationTwoField())
+ }
+ if addendaPOS.TerminalIdentificationCode != "TERM02" {
+ t.Errorf("TerminalIdentificationCode Expected 'TERM02' got: %v", addendaPOS.TerminalIdentificationCodeField())
+ }
+ if addendaPOS.TransactionSerialNumber != "100049" {
+ t.Errorf("TransactionSerialNumber Expected '100049' got: %v", addendaPOS.TransactionSerialNumberField())
+ }
+ if addendaPOS.TransactionDate != "0612" {
+ t.Errorf("TransactionDate Expected '0612' got: %v", addendaPOS.TransactionDateField())
+ }
+ if addendaPOS.AuthorizationCodeOrExpireDate != "123456" {
+ t.Errorf("AuthorizationCodeOrExpireDate Expected '123456' got: %v", addendaPOS.AuthorizationCodeOrExpireDateField())
+ }
+ if addendaPOS.TerminalLocation != "Target Store 0049" {
+ t.Errorf("TerminalLocation Expected 'Target Store 0049' got: %v", addendaPOS.TerminalLocationField())
+ }
+ if addendaPOS.TerminalCity != "PHILADELPHIA" {
+ t.Errorf("TerminalCity Expected '123456' got: %v", addendaPOS.TerminalCityField())
+ }
+ if addendaPOS.TerminalState != "PA" {
+ t.Errorf("TerminalState Expected '123456' got: %v", addendaPOS.TerminalStateField())
+ }
+ if addendaPOS.TraceNumber != 91012980000088 {
+ t.Errorf("TraceNumber Expected '91012980000088' got: %v", addendaPOS.TraceNumberField())
+ }
+}
+
+func TestParseAddenda02(t *testing.T) {
+ testParseAddenda02(t)
+}
+
+func BenchmarkParseAddenda02(b *testing.B) {
+ b.ReportAllocs()
+ for i := 0; i < b.N; i++ {
+ testParseAddenda02(b)
+ }
+}
\ No newline at end of file
