forked from Travelport-Ukraine/uapi-json
-
Notifications
You must be signed in to change notification settings - Fork 1
/
book.js
74 lines (68 loc) · 1.52 KB
/
book.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
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
const uAPI = require('../../index');
const config = require('../../test/testconfig');
const AirService = uAPI.createAirService(
{
auth: config,
debug: 2,
production: true,
}
);
const params = {
legs: [
{
from: 'IEV',
to: 'PAR',
departureDate: '2016-11-10',
},
{
from: 'PAR',
to: 'IEV',
departureDate: '2016-11-20',
},
],
passengers: {
ADT: 1,
},
requestId: 'test-request',
platingCarier: 'PS'
};
AirService.shop(params)
.then(
(results) => {
const fromSegments = results['0'].directions['0']['0'].segments;
const toSegments = results['0'].directions['1']['0'].segments;
const book = {
segments: fromSegments.concat(toSegments),
rule: 'SIP',
passengers: [{
lastName: 'SKYWALKER',
firstName: 'ANAKIN',
passCountry: 'UA',
passNumber: 'ES221731',
birthDate: '1968-07-25',
gender: 'M',
ageCategory: 'ADT',
}],
phone: {
countryCode: '38',
location: 'IEV',
number: '0660419905',
},
deliveryInformation: {
name: 'Anakin Skywalker',
street: 'Sands street, 42',
zip: '42042',
country: 'Galactic Empire',
city: 'Mos Eisley',
},
allowWaitlist: true,
};
return AirService.book(book).then(
res => console.log(res),
err => console.log(err)
);
}
)
.catch(
err => console.log('err', err)
);