Open anilgorgec opened 6 days ago
Could you please share your (Go) spec here?
I've had exactly this problem and solved it by creating a custom Hex field and a custom BCD prefix:
35: custom.NewTrack2(&field.Spec{
Length: 37,
Description: "Track 2 Data",
Enc: encoding.Binary,
Pref: custom.BCD.LL,
}),
I could'nt manage to use moov/iso8583 built in types (perhaps it is possible to do so). I can share you this implementation here if you want and moderators allow.
Could you please share your (Go) spec here?
The spec is as follows.
var Spec87 = &iso8583.MessageSpec{
Name: "ISO",
Fields: map[int]field.Field{
0: field.NewString(&field.Spec{
Length: 4,
Description: "Message Type Indicator",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
1: field.NewBitmap(&field.Spec{
Length: 8,
Description: "Bitmap",
Enc: encoding.BytesToASCIIHex,
Pref: prefix.Hex.Fixed,
}),
3: field.NewNumeric(&field.Spec{
Length: 6,
Description: "Processing Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
4: field.NewString(&field.Spec{
Length: 12,
Description: "Transaction Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
Pad: padding.Left('0'),
}),
11: field.NewString(&field.Spec{
Length: 6,
Description: "Systems Trace Audit Number (STAN)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
12: field.NewString(&field.Spec{
Length: 6,
Description: "Local Transaction Time",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
13: field.NewString(&field.Spec{
Length: 4,
Description: "Local Transaction Date",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
22: field.NewString(&field.Spec{
Length: 3,
Description: "Point of Sale (POS) Entry Mode",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
24: field.NewString(&field.Spec{
Length: 3,
Description: "Function Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
25: field.NewString(&field.Spec{
Length: 2,
Description: "Point of Service Condition Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
35: field.NewTrack2(&field.Spec{
Length: 37,
Description: "Track 2 Data",
Enc: encoding.ASCIIHexToBytes,
Pref: prefix.ASCII.LL,
}),
41: field.NewString(&field.Spec{
Length: 8,
Description: "Card Acceptor Terminal Identification",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
},
}
I've had exactly this problem and solved it by creating a custom Hex field and a custom BCD prefix:
35: custom.NewTrack2(&field.Spec{ Length: 37, Description: "Track 2 Data", Enc: encoding.Binary, Pref: custom.BCD.LL, }),
I could'nt manage to use moov/iso8583 built in types (perhaps it is possible to do so). I can share you this implementation here if you want and moderators allow.
if they allows, I wanna see it. It will give idea at least.
Hello,
I have a question regarding odd numbers. for example the Track 2 Data field has a length of 37 characters, which is an odd number. Since ISO 8583 messages are often processed in hexadecimal or BCD format, they need to be byte-aligned.
I tried to parse the iso message in the example below.but I could not get the output as expected output.
Can you help me with this issue?
ISO Message:
020030200580208000000000000000000015001079890071002100375111111211111111d11110000000000000000f5445535430303031
output
expected output