-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
130 lines (115 loc) · 3.23 KB
/
index.html
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ISO 8583 Test</title>
<script type="text/javascript" src="iso8583.js"></script>
<script type="text/javascript">
var message;
function addRow(label, value)
{
return '<tr><td>'+label+'</td><td>'+value+'</td></tr>';
}
function parseMessage()
{
message = document.getElementById('input').value;
var iso = new ISO8583(message, 1);
var data = iso.parseDataElement();
var propertiesHTML = '<h3>Message Poperties</h3><table border="1"><thead><tr><td>Label</td><td>Value</td><tr></thead>';
propertiesHTML += '<tbody>';
propertiesHTML += addRow('MTI', iso.mti);
propertiesHTML += addRow('ISO Version ID', iso.versionID);
propertiesHTML += addRow('ISO Version', iso.version);
propertiesHTML += addRow('Message Class ID', iso.messageClassID);
propertiesHTML += addRow('Message Class', iso.messageClass);
propertiesHTML += addRow('Message Function ID', iso.messageFunctionID);
propertiesHTML += addRow('Message Function', iso.messageFunction);
propertiesHTML += addRow('Message Origin ID', iso.messageOriginID);
propertiesHTML += addRow('Message Origin', iso.messageOrigin);
propertiesHTML += addRow('Bitmap', iso.bitmap);
propertiesHTML += addRow('Message Length', iso.messageLength);
propertiesHTML += addRow('Data Element Offset', iso.dataElementOffset);
propertiesHTML += addRow('Data Element Length', iso.dataElementLength);
propertiesHTML += '</tbody>';
propertiesHTML += '</table>';
document.getElementById('properties').innerHTML = propertiesHTML;
var firstdata = data[0];
var field = [];
var i, i;
for(i in firstdata)
{
field.push(i);
}
var dataHTML = '<h3>Data Elements</h3><table border="1"><thead><tr>';
for(i in firstdata)
{
dataHTML += '<td>'+i+'</td>';
}
dataHTML += '</tr></thead><tbody>'
for(i in data)
{
dataHTML += '<tr>';
for(j in data[i])
{
dataHTML += '<td>'+data[i][j]+'</td>';
}
dataHTML += '</tr>';
}
dataHTML += '</tbody></table>'
document.getElementById('data').innerHTML = dataHTML;
}
window.onload = function()
{
document.getElementById('calc').addEventListener('click', function(e){
parseMessage();
e.preventDefault();
});
}
</script>
<style type="text/css">
body{
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
}
table{
border-collapse:collapse;
}
td{
padding:4px 5px;
}
thead td{
font-weight:bold;
}
#message, #properties, #data{
padding:5px 0;
}
#input{
width:100%;
height:80px;
box-sizing:border-box;
padding:5px 5px;
border:1px solid #DDDDDD;
}
#calc{
padding:6px 14px;
border:1px solid #777777;
background-color:#EEEEEE;
}
</style>
</head>
<body>
<div class="form">
<h1>ISO 8583 Parser</h1>
<form action="" method="get" enctype="multipart/form-data">
<div>
<textarea id="input" placeholder="Type ISO 8583 message here...">0200B23A800128A1801800000000140000006500000000000020500428132710000578132710042804280428034561745917000123400001100000230579A1B2C3D4E5 SOLABTEST TEST-3 DF MX010abcdefghij4847B456PRO013 1234P0399904ABCD</textarea>
</div>
<div>
<input type="button" id="calc" value="Parse Message">
</div>
</form>
</div>
<div id="properties"></div>
<div id="data"></div>
</body>
</html>