-
Notifications
You must be signed in to change notification settings - Fork 61
/
emulation.js
47 lines (40 loc) · 1.13 KB
/
emulation.js
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
/**
* This is an example of advnaced emulation, using several PCCs.
* In this example you can see a booking transfer from one PCC to another.
* You can use this code snippet without any warranties.
*/
const uAPI = require('../../index');
const auth = require('../../test/testconfig');
const authABCD = {
...auth,
emulatePcc: 'ABCD'
};
const authWXYZ = {
...auth,
emulatePcc: 'WXYZ'
};
const TerminalServiceABCD = uAPI.createTerminalService({
auth: authABCD,
debug: 2,
production: true,
});
const TerminalServiceWXYZ = uAPI.createTerminalService({
auth: authWXYZ,
debug: 2,
production: true,
});
const pnr = 'PNR001';
async function main() {
// Opening booking in ABCD
await TerminalServiceABCD.executeCommand(`*${pnr}`);
// Transfering booking from ABCD to WXYZ
const transferResponse = await TerminalServiceABCD.executeCommand('QEB/WXYZ/77');
if (!transferResponse.includes('ON QUEUE')) {
throw new Error('Booking was not transfered');
}
// Opening booking in WXYZ
await TerminalServiceWXYZ.executeCommand(`*${pnr}`);
// Ticketing in WXYZ
await TerminalServiceWXYZ.executeCommand('TKP');
}
main();