forked from moov-io/iso8583
-
Notifications
You must be signed in to change notification settings - Fork 1
/
spec87ascii.go
416 lines (414 loc) · 11.6 KB
/
spec87ascii.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
package specs
import (
"github.com/moov-io/iso8583"
"github.com/moov-io/iso8583/encoding"
"github.com/moov-io/iso8583/field"
"github.com/moov-io/iso8583/padding"
"github.com/moov-io/iso8583/prefix"
)
// we keep it for compatibility reasons
var Spec87ASCII *iso8583.MessageSpec = &iso8583.MessageSpec{
Name: "ISO 8583 v1987 ASCII",
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: 16,
Description: "Bitmap",
Enc: encoding.BytesToASCIIHex,
Pref: prefix.Hex.Fixed,
}),
2: field.NewString(&field.Spec{
Length: 19,
Description: "Primary Account Number",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LL,
}),
3: field.NewNumeric(&field.Spec{
Length: 6,
Description: "Processing Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
Pad: padding.Left('0'),
}),
4: field.NewString(&field.Spec{
Length: 12,
Description: "Transaction Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
Pad: padding.Left('0'),
}),
5: field.NewString(&field.Spec{
Length: 12,
Description: "Settlement Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
Pad: padding.Left('0'),
}),
6: field.NewString(&field.Spec{
Length: 12,
Description: "Billing Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
Pad: padding.Left('0'),
}),
7: field.NewString(&field.Spec{
Length: 10,
Description: "Transmission Date & Time",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
8: field.NewString(&field.Spec{
Length: 8,
Description: "Billing Fee Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
9: field.NewString(&field.Spec{
Length: 8,
Description: "Settlement Conversion Rate",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
10: field.NewString(&field.Spec{
Length: 8,
Description: "Cardholder Billing Conversion Rate",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
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,
}),
14: field.NewString(&field.Spec{
Length: 4,
Description: "Expiration Date",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
15: field.NewString(&field.Spec{
Length: 4,
Description: "Settlement Date",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
16: field.NewString(&field.Spec{
Length: 4,
Description: "Currency Conversion Date",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
17: field.NewString(&field.Spec{
Length: 4,
Description: "Capture Date",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
18: field.NewString(&field.Spec{
Length: 4,
Description: "Merchant Type",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
19: field.NewString(&field.Spec{
Length: 3,
Description: "Acquiring Institution Country Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
20: field.NewString(&field.Spec{
Length: 3,
Description: "PAN Extended Country Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
21: field.NewString(&field.Spec{
Length: 3,
Description: "Forwarding Institution Country Code",
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,
}),
23: field.NewString(&field.Spec{
Length: 3,
Description: "Card Sequence Number (CSN)",
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,
}),
26: field.NewString(&field.Spec{
Length: 2,
Description: "Point of Service PIN Capture Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
27: field.NewString(&field.Spec{
Length: 1,
Description: "Authorizing Identification Response Length",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
28: field.NewString(&field.Spec{
Length: 9,
Description: "Transaction Fee Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
29: field.NewString(&field.Spec{
Length: 9,
Description: "Settlement Fee Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
30: field.NewString(&field.Spec{
Length: 9,
Description: "Transaction Processing Fee Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
31: field.NewString(&field.Spec{
Length: 9,
Description: "Settlement Processing Fee Amount",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
32: field.NewString(&field.Spec{
Length: 11,
Description: "Acquiring Institution Identification Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LL,
}),
33: field.NewString(&field.Spec{
Length: 11,
Description: "Forwarding Institution Identification Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LL,
}),
34: field.NewString(&field.Spec{
Length: 28,
Description: "Extended Primary Account Number",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LL,
}),
35: field.NewString(&field.Spec{
Length: 37,
Description: "Track 2 Data",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LL,
}),
36: field.NewString(&field.Spec{
Length: 104,
Description: "Track 3 Data",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
37: field.NewString(&field.Spec{
Length: 12,
Description: "Retrieval Reference Number",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
38: field.NewString(&field.Spec{
Length: 6,
Description: "Authorization Identification Response",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
39: field.NewString(&field.Spec{
Length: 2,
Description: "Response Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
40: field.NewString(&field.Spec{
Length: 3,
Description: "Service Restriction Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
41: field.NewString(&field.Spec{
Length: 8,
Description: "Card Acceptor Terminal Identification",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
42: field.NewString(&field.Spec{
Length: 15,
Description: "Card Acceptor Identification Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
43: field.NewString(&field.Spec{
Length: 40,
Description: "Card Acceptor Name/Location",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
44: field.NewString(&field.Spec{
Length: 99,
Description: "Additional Data",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LL,
}),
45: field.NewString(&field.Spec{
Length: 76,
Description: "Track 1 Data",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LL,
}),
46: field.NewString(&field.Spec{
Length: 999,
Description: "Additional data (ISO)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
47: field.NewString(&field.Spec{
Length: 999,
Description: "Additional data (National)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
48: field.NewString(&field.Spec{
Length: 999,
Description: "Additional data (Private)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
49: field.NewString(&field.Spec{
Length: 3,
Description: "Transaction Currency Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
50: field.NewString(&field.Spec{
Length: 3,
Description: "Settlement Currency Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
51: field.NewString(&field.Spec{
Length: 3,
Description: "Cardholder Billing Currency Code",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
52: field.NewString(&field.Spec{
Length: 8,
Description: "PIN Data",
Enc: encoding.BytesToASCIIHex,
Pref: prefix.Hex.Fixed,
}),
53: field.NewString(&field.Spec{
Length: 16,
Description: "Security Related Control Information",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
54: field.NewString(&field.Spec{
Length: 120,
Description: "Additional Amounts",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
55: field.NewString(&field.Spec{
Length: 999,
Description: "ICC Data – EMV Having Multiple Tags",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
56: field.NewString(&field.Spec{
Length: 999,
Description: "Reserved (ISO)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
57: field.NewString(&field.Spec{
Length: 999,
Description: "Reserved (National)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
58: field.NewString(&field.Spec{
Length: 999,
Description: "Reserved (National)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
59: field.NewString(&field.Spec{
Length: 999,
Description: "Reserved (National)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
60: field.NewString(&field.Spec{
Length: 999,
Description: "Reserved (National)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
61: field.NewString(&field.Spec{
Length: 999,
Description: "Reserved (Private)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
62: field.NewString(&field.Spec{
Length: 999,
Description: "Reserved (Private)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
63: field.NewString(&field.Spec{
Length: 999,
Description: "Reserved (Private)",
Enc: encoding.ASCII,
Pref: prefix.ASCII.LLL,
}),
64: field.NewString(&field.Spec{
Length: 8,
Description: "Message Authentication Code (MAC)",
Enc: encoding.BytesToASCIIHex,
Pref: prefix.Hex.Fixed,
}),
90: field.NewString(&field.Spec{
Length: 42,
Description: "Original Data Elements",
Enc: encoding.ASCII,
Pref: prefix.ASCII.Fixed,
}),
},
}