Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Request/uapi-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ module.exports = function uapiRequest(
errorHandler,
parseFunction,
debugMode = false,
options = {}
options = {},
production = true
) {
// Assign default value
auth.provider = auth.provider || '1G';
auth.region = auth.region || 'emea';

const config = configInit(auth.region);
const config = configInit(auth.region, production);
const log = options.logFunction || console.log;

// Performing checks
Expand Down
77 changes: 51 additions & 26 deletions src/Services/Air/AirService.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const templates = require('./templates');

module.exports = function (settings) {
const {
auth, debug, production, options
auth, debug, production = true, options
} = settings;
const config = getConfig(auth.region, production);

Expand All @@ -20,7 +20,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_LOW_FARE_SEARCH_REQUEST,
debug,
options
options,
production
),
searchLowFaresAsync: uApiRequest(
config.AirService.url,
Expand All @@ -31,7 +32,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_LOW_FARE_SEARCH_REQUEST,
debug,
options
options,
production
),
searchLowFaresRetrieve: uApiRequest(
config.AirService.url,
Expand All @@ -42,7 +44,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_LOW_FARE_SEARCH_REQUEST,
debug,
options
options,
production
),
availability: uApiRequest(
config.AirService.url,
Expand All @@ -53,7 +56,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_AVAILABILITY,
debug,
options
options,
production
),
airPrice: uApiRequest(
config.AirService.url,
Expand All @@ -64,7 +68,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_PRICE_REQUEST,
debug,
options
options,
production
),
lookupFareRules: uApiRequest(
config.AirService.url,
Expand All @@ -75,7 +80,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_PRICE_FARE_RULES_REQUEST,
debug,
options
options,
production
),
airPricePricingSolutionXML: uApiRequest(
config.AirService.url,
Expand All @@ -86,7 +92,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_PRICE_REQUEST_PRICING_SOLUTION_XML,
debug,
options
options,
production
),
createReservation: uApiRequest(
config.AirService.url,
Expand All @@ -97,7 +104,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_CREATE_RESERVATION_REQUEST,
debug,
options
options,
production
),
ticket: uApiRequest(
config.AirService.url,
Expand All @@ -108,7 +116,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_TICKET_REQUEST,
debug,
options
options,
production
),
getUniversalRecordByPNR: uApiRequest(
config.UniversalRecord.url,
Expand All @@ -119,7 +128,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.UNIVERSAL_RECORD_RETRIEVE_REQUEST,
debug,
options
options,
production
),
importUniversalRecordByPNR: uApiRequest(
config.UniversalRecord.url,
Expand All @@ -130,7 +140,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_IMPORT_REQUEST,
debug,
options
options,
production
),
getUniversalRecord: uApiRequest(
config.UniversalRecord.url,
Expand All @@ -141,7 +152,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.UNIVERSAL_RECORD_RETRIEVE_REQUEST,
debug,
options
options,
production
),
gdsQueue: uApiRequest(
config.GdsQueueService.url,
Expand All @@ -152,7 +164,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.GDS_QUEUE_PLACE_RESPONSE,
debug,
options
options,
production
),
foid: uApiRequest(
config.UniversalRecord.url,
Expand All @@ -163,7 +176,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.UNIVERSAL_RECORD_FOID,
debug,
options
options,
production
),
addSegments: uApiRequest(
config.UniversalRecord.url,
Expand All @@ -174,7 +188,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.UNIVERSAL_RECORD_MODIFY,
debug,
options
options,
production
),
cancelUR: uApiRequest(
config.UniversalRecord.url,
Expand All @@ -185,7 +200,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_CANCEL_UR,
debug,
options
options,
production
),
flightInfo: uApiRequest(
config.FlightService.url,
Expand All @@ -196,7 +212,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_FLIGHT_INFORMATION,
debug,
options
options,
production
),
getTicket: uApiRequest(
config.AirService.url,
Expand All @@ -207,7 +224,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_GET_TICKET,
debug,
options
options,
production
),
getTickets: uApiRequest(
config.AirService.url,
Expand All @@ -218,7 +236,8 @@ module.exports = function (settings) {
AirParser.AIR_GET_TICKETS_ERROR_HANDLER,
AirParser.AIR_GET_TICKETS,
debug,
options
options,
production
),
cancelTicket: uApiRequest(
config.AirService.url,
Expand All @@ -229,7 +248,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_CANCEL_TICKET,
debug,
options
options,
production
),
cancelBooking: uApiRequest(
config.AirService.url,
Expand All @@ -240,7 +260,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_CANCEL_PNR,
debug,
options
options,
production
),

exchangeQuote: uApiRequest(
Expand All @@ -252,7 +273,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_EXCHANGE_QUOTE,
debug,
options
options,
production
),

exchangeBooking: uApiRequest(
Expand All @@ -264,7 +286,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_EXCHANGE,
debug,
options
options,
production
),

getEMDList: uApiRequest(
Expand All @@ -276,7 +299,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_EMD_LIST,
debug,
options
options,
production
),

getEMDItem: uApiRequest(
Expand All @@ -288,7 +312,8 @@ module.exports = function (settings) {
AirParser.AIR_ERRORS,
AirParser.AIR_EMD_ITEM,
debug,
options
options,
production
)
};
};
14 changes: 9 additions & 5 deletions src/Services/Hotels/HotelsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const templates = require('./templates');

module.exports = function (settings) {
const {
auth, debug, production, options
auth, debug, production = true, options
} = validateServiceSettings(settings);
const config = getConfig(auth.region, production);
return {
Expand All @@ -21,7 +21,8 @@ module.exports = function (settings) {
HotelsParser.HOTELS_ERROR,
HotelsParser.HOTELS_SEARCH_REQUEST,
debug,
options
options,
production
),
rates: uApiRequest(
config.HotelsService.url,
Expand All @@ -32,7 +33,8 @@ module.exports = function (settings) {
HotelsParser.HOTELS_ERROR,
HotelsParser.HOTELS_RATE_REQUEST,
debug,
options
options,
production
),
book: uApiRequest(
config.HotelsService.url,
Expand All @@ -43,7 +45,8 @@ module.exports = function (settings) {
HotelsParser.HOTELS_ERROR,
HotelsParser.HOTELS_BOOK_REQUEST,
debug,
options
options,
production
),
cancelBook: uApiRequest(
config.UniversalRecord.url,
Expand All @@ -54,7 +57,8 @@ module.exports = function (settings) {
HotelsParser.HOTELS_ERROR,
HotelsParser.HOTELS_CANCEL_BOOK_REQUEST,
debug,
options
options,
production
),
};
};
11 changes: 7 additions & 4 deletions src/Services/Terminal/TerminalService.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const templates = require('./templates');

module.exports = function (settings) {
const {
auth, debug, production, options
auth, debug, production = true, options
} = settings;
const config = getConfig(auth.region, production);

Expand All @@ -21,7 +21,8 @@ module.exports = function (settings) {
TerminalParser.TERMINAL_ERROR,
TerminalParser.CREATE_SESSION,
debug,
options
options,
production
),
executeCommand: uApiRequest(
config.TerminalService.url,
Expand All @@ -32,7 +33,8 @@ module.exports = function (settings) {
TerminalParser.TERMINAL_ERROR,
TerminalParser.TERMINAL_REQUEST,
debug,
options
options,
production
),
closeSession: uApiRequest(
config.TerminalService.url,
Expand All @@ -43,7 +45,8 @@ module.exports = function (settings) {
TerminalParser.TERMINAL_ERROR,
TerminalParser.CLOSE_SESSION,
debug,
options
options,
production
),
};
};
8 changes: 5 additions & 3 deletions src/Services/Utils/UtilsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const templates = require('./templates');

module.exports = function (settings) {
const {
auth, debug, production, options
auth, debug, production = true, options
} = validateServiceSettings(settings);
const config = getConfig(auth.region, production);
return {
Expand All @@ -22,7 +22,8 @@ module.exports = function (settings) {
UtilsParser.UTILS_ERROR,
UtilsParser.CURRENCY_CONVERSION,
debug,
options
options,
production
),
referenceData: uApiRequest(
config.UtilService.url,
Expand All @@ -33,7 +34,8 @@ module.exports = function (settings) {
UtilsParser.UTILS_ERROR,
UtilsParser.REFERENCE_DATATYPE,
debug,
options
options,
production
),
};
};