-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtrackingRequest.js
More file actions
executable file
·28 lines (26 loc) · 892 Bytes
/
trackingRequest.js
File metadata and controls
executable file
·28 lines (26 loc) · 892 Bytes
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
#!/usr/bin/env node
import fs from 'node:fs';
import format from 'xml-formatter';
import auth from './auth.js';
import {getIsoDateTime, getMessageReference, trackingRequest} from './index.js';
const req = {
trackingRequest: {
TrackingRequest: {
Request: {
ServiceHeader: {
MessageTime: getIsoDateTime(),
MessageReference: getMessageReference(),
},
},
AWBNumber: {
ArrayOfAWBNumberItem: [3898464710],
},
LevelOfDetails: 'ALL_CHECK_POINTS',
PiecesEnabled: 'B',
},
},
};
const res = await trackingRequest(auth, req);
console.log(JSON.stringify(res.response, null, 4));
fs.writeFileSync('trackingRequest.response.xml', res.responseXml);
fs.writeFileSync('trackingRequest.request.xml', format(res.requestXml));