forked from okev/ndc-js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample.js
24 lines (21 loc) · 1.05 KB
/
example.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
'use strict';
var NDC = require('./'),
testData = require('./test/test-data');
testData.config[0].APIAuthKey = testData.config[1].APIAuthKey = process.env.API_KEY;
var kronos = new NDC(testData.config[0]),
usdtravel = new NDC(testData.config[1]);
// var message = usdtravel.messages.FlightPrice(testData.FlightPrice[0]);
// var message = kronos.messages.SeatAvailability(testData.SeatAvailability[0]);
// var message = kronos.messages.ServiceList(testData.ServiceList[0]);
// var message = kronos.messages.ServicePrice(testData.ServicePrice[0]);
// var message = kronos.messages.OrderCreate(testData.OrderCreate[0]);
// var message = kronos.messages.OrderList(testData.OrderList[0]);
// var message = kronos.messages.OrderRetrieve(testData.OrderRetrieve[0]);
// require('fs').writeFileSync('/tmp/debug.xml', message.toXML(true, true));
var message = kronos.messages.OrderCreate(testData.OrderCreate[0]);
message.request(function (err, data) {
if (err) {
return console.error(err);
}
console.log('>>>', JSON.stringify(data, null, ' '));
}, true);