uapi-json 1.14.11 → 1.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/Air.md CHANGED
@@ -48,7 +48,8 @@ Low Fare Shop functionality combines air availability and a fare quote request t
48
48
  | maxSolutions | `number` | Maximum number of solutions. <i>Optional.</i> |.
49
49
  | permittedCarriers | `Array<String>` | Array of carriers' codes. <i>Optional. Can not be used when `preferredCarriers` is set</i> |
50
50
  | preferredCarriers | `Array<String>` | Array of carriers' codes. <i>Optional. Can not be used when `permittedCarriers` is set</i> |
51
- | allowDirectAccess | `Boolean` | When passed, first carrier is taken from the carriers list and the search is done in carrier specific display.
51
+ | allowDirectAccess | `Boolean` | When passed, first carrier is taken from the carriers list and the search is done in carrier specific display. <i>Optional.</i> |
52
+ | returnFirstAvailableOnly | `Boolean` | When passed, next days availability is returned if available. <i>Optional.</i> |
52
53
  | preferredConnectionPoints | `Array<String>` | Array of IATA codes. <i>Optional.</i> |
53
54
  | prohibitedConnectionPoints | `Array<String>` | Array of IATA codes. <i>Optional.</i> |
54
55
  | permittedConnectionPoints | `Array<String>` | Array of IATA codes. <i>Optional.</i> |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uapi-json",
3
- "version": "1.14.11",
3
+ "version": "1.15.1",
4
4
  "description": "Travelport Universal API",
5
5
  "main": "src/",
6
6
  "files": [
@@ -39,6 +39,7 @@ Object.assign(AirValidationError, createErrorsList({
39
39
  PlatingCarrierInvalid: 'Plating Carrier Invalid',
40
40
  SearchIdMissing: 'SearchId is missing',
41
41
  VersionMissing: 'Version is missing in request',
42
+ ReturnFirstAvailableOnlyInvalid: 'Invalid value provided for returnFirstAvailableOnly',
42
43
  AllowDirectAccessInvalid: 'Invalid value provided for allowDirectAccess',
43
44
  AllowDirectAccessCarriersNotSpecified: 'Carriers not specified for carrier specific display',
44
45
  EMDItemNumberMissing: 'Missing EMD number. See data.',
@@ -8,7 +8,8 @@ module.exports = {
8
8
  validators.passengers,
9
9
  validators.legs,
10
10
  validators.carriers,
11
- validators.allowDirectAccess
11
+ validators.allowDirectAccess,
12
+ validators.returnFirstAvailableOnly
12
13
  ),
13
14
  transform(
14
15
  transformers.convertPassengersObjectToArray
@@ -22,7 +22,10 @@ module.exports = `
22
22
  <com:CityOrAirport Code="{{to}}" PreferCity="true"/>
23
23
  </air:SearchDestination>
24
24
  <air:SearchDepTime PreferredTime="{{departureDate}}"/>
25
- <air:AirLegModifiers {{#if ../allowDirectAccess}}AllowDirectAccess="true"{{/if}}>
25
+ <air:AirLegModifiers
26
+ {{#if ../allowDirectAccess}}AllowDirectAccess="true"{{/if}}
27
+ {{#if ../returnFirstAvailableOnly}}ReturnFirstAvailableOnly="true"{{/if}}
28
+ >
26
29
  {{#*inline "connectionPoint"}}
27
30
  <com:ConnectionPoint>
28
31
  <com:CityOrAirport Code="{{connection}}" />
@@ -20,6 +20,7 @@ const platingCarrier = require('./platingCarrier');
20
20
  const searchId = require('./search-id');
21
21
  const version = require('./version');
22
22
  const allowDirectAccess = require('./allow-direct-access');
23
+ const returnFirstAvailableOnly = require('./return-first-available-only');
23
24
  const emdNumber = require('./emd-number');
24
25
  const carriers = require('./carriers');
25
26
 
@@ -29,6 +30,7 @@ module.exports = {
29
30
  pricingSolutionXml,
30
31
  paramsIsObject,
31
32
  allowDirectAccess,
33
+ returnFirstAvailableOnly,
32
34
  fop,
33
35
  fopCreditCard,
34
36
  pnr,
@@ -0,0 +1,8 @@
1
+ const { AirValidationError } = require('../AirErrors');
2
+
3
+ module.exports = (params) => {
4
+ const { returnFirstAvailableOnly } = params;
5
+ if (returnFirstAvailableOnly !== undefined && (typeof returnFirstAvailableOnly) !== 'boolean') {
6
+ throw new AirValidationError.ReturnFirstAvailableOnlyInvalid(params);
7
+ }
8
+ };
@@ -21,8 +21,11 @@ const DEFAULT_RETRY_TIMES = 3;
21
21
 
22
22
  const UNEXPECTED_TERMINAL_ERRORS = [
23
23
  'NO PREVIOUS OR ORIGINAL REQUEST',
24
+ 'OPTIONS ERROR',
24
25
  ];
25
26
 
27
+ const isFinancialCommand = command => /^F.*/.test(command);
28
+
26
29
  // Adding event handler on beforeExit and exit process events to process open terminals
27
30
  process.on('beforeExit', () => {
28
31
  Promise.all(
@@ -232,7 +235,11 @@ module.exports = function (settings) {
232
235
  });
233
236
 
234
237
  if (UNEXPECTED_TERMINAL_ERRORS.some(e => response.includes(e))) {
235
- throw new TerminalRuntimeError.TerminalUnexpectedError({ screen: response });
238
+ const errorObject = isFinancialCommand(command)
239
+ ? new TerminalRuntimeError.TerminalUnexpectedFinancialError({ screen: response })
240
+ : new TerminalRuntimeError.TerminalUnexpectedError({ screen: response });
241
+
242
+ throw errorObject;
236
243
  }
237
244
 
238
245
  return response;
@@ -47,7 +47,8 @@ Object.assign(TerminalRuntimeError, createErrorsList({
47
47
  ErrorClosingSession: 'Error closing session',
48
48
  NoAgreement: ['There is no agreement between current pcc and you trying to reach', errorCodes.Validation],
49
49
  TerminalAuthIssue: ['Temporary terminal auth issue. Please, try again later', errorCodes.Validation],
50
- TerminalUnexpectedError: ['Terminal unexpected error. Please, try again later', errorCodes.Validation],
50
+ TerminalUnexpectedError: ['Unexpected error message is returned by Travelport system. Please check PNR and try again later.', errorCodes.Validation],
51
+ TerminalUnexpectedFinancialError: ['Unexpected error message is returned by Travelport system. Please check PNR and new Fare calculation. If the problem persists, contact your local helpdesk.', errorCodes.Validation],
51
52
  }, TerminalRuntimeError));
52
53
 
53
54
  module.exports = {