uapi-json 1.16.0 → 1.16.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.
@@ -27,17 +27,15 @@ const parseFareCalculation = (str) => {
27
27
  const fareCalculation = str.match(fareCalculationPattern)[1];
28
28
  const firstOrigin = str.match(firstOriginPattern);
29
29
  const roe = str.match(/ROE((?:\d+\.)?\d+)/);
30
- return Object.assign(
31
- {
32
- fareCalculation,
33
- },
34
- firstOrigin
30
+ return {
31
+ fareCalculation,
32
+ ...(firstOrigin
35
33
  ? { firstOrigin: firstOrigin[1] }
36
- : null,
37
- roe
34
+ : null),
35
+ ...(roe
38
36
  ? { roe: roe[1] }
39
- : null
40
- );
37
+ : null)
38
+ };
41
39
  };
42
40
 
43
41
  const searchLowFaresValidate = (obj) => {
@@ -68,7 +66,7 @@ const countHistogram = (arr) => {
68
66
  }
69
67
 
70
68
  if (Object.prototype.toString.call(arr[0]) === '[object Object]') {
71
- arr = arr.map(elem => elem.Code);
69
+ arr = arr.map((elem) => elem.Code);
72
70
  }
73
71
 
74
72
  arr.sort();
@@ -92,7 +90,6 @@ function lowFaresSearchRequest(obj) {
92
90
  }, searchLowFaresValidate.call(this, obj));
93
91
  }
94
92
 
95
-
96
93
  const ticketParse = function (obj) {
97
94
  let checkResponseMessage = false;
98
95
  let checkTickets = false;
@@ -148,7 +145,7 @@ const ticketParse = function (obj) {
148
145
  return checkResponseMessage && checkTickets;
149
146
  };
150
147
 
151
- const nullParsing = obj => obj;
148
+ const nullParsing = (obj) => obj;
152
149
 
153
150
  function fillAirFlightInfoResponseItem(data) {
154
151
  const item = data['air:FlightInfoDetail'];
@@ -222,7 +219,7 @@ function airPrice(obj) {
222
219
  let pricingSolution = 0;
223
220
  if (priceKeys.length > 1) {
224
221
  console.log('More than one solution found in booking. Resolving the cheapest one.');
225
- const solutions = priceKeys.map(key => pricingSolutions[key]);
222
+ const solutions = priceKeys.map((key) => pricingSolutions[key]);
226
223
 
227
224
  [pricingSolution] = solutions.sort(
228
225
  (a, b) => parseFloat(a.TotalPrice.slice(3)) - parseFloat(b.TotalPrice.slice(3))
@@ -259,9 +256,9 @@ function airPrice(obj) {
259
256
 
260
257
  const trips = segs.map((segment) => {
261
258
  const tripFlightDetails = Object.keys(segment['air:FlightDetails'])
262
- .map(flightDetailsRef => segment['air:FlightDetails'][flightDetailsRef]);
259
+ .map((flightDetailsRef) => segment['air:FlightDetails'][flightDetailsRef]);
263
260
 
264
- const [bookingInfo] = thisFare['air:BookingInfo'].filter(info => info.SegmentRef === segment.Key);
261
+ const [bookingInfo] = thisFare['air:BookingInfo'].filter((info) => info.SegmentRef === segment.Key);
265
262
  const fareInfo = thisFare['air:FareInfo'][bookingInfo.FareInfoRef];
266
263
 
267
264
  const baggage = format.getBaggageInfo(thisFare['air:BaggageAllowances']['air:BaggageAllowanceInfo'][leg]);
@@ -294,22 +291,20 @@ function airPrice(obj) {
294
291
  const taxesInfo = thisFare['air:TaxInfo']
295
292
  ? Object.keys(thisFare['air:TaxInfo'])
296
293
  .map(
297
- taxKey => Object.assign(
298
- {
299
- value: thisFare['air:TaxInfo'][taxKey].Amount,
300
- type: thisFare['air:TaxInfo'][taxKey].Category,
301
- },
302
- thisFare['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`]
294
+ (taxKey) => ({
295
+ value: thisFare['air:TaxInfo'][taxKey].Amount,
296
+ type: thisFare['air:TaxInfo'][taxKey].Category,
297
+ ...(thisFare['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`]
303
298
  ? {
304
299
  details: thisFare['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`].map(
305
- taxDetail => ({
300
+ (taxDetail) => ({
306
301
  airport: taxDetail.OriginAirport,
307
302
  value: taxDetail.Amount,
308
303
  })
309
304
  ),
310
305
  }
311
- : null
312
- )
306
+ : null)
307
+ })
313
308
  )
314
309
  : [];
315
310
 
@@ -360,7 +355,6 @@ function airPriceRspPricingSolutionXML(obj) {
360
355
  [pricingSolution] = pricingSolutions;
361
356
  }
362
357
 
363
-
364
358
  // remove segment references and add real segments (required)
365
359
  delete (pricingSolution['air:AirSegmentRef']);
366
360
 
@@ -370,7 +364,7 @@ function airPriceRspPricingSolutionXML(obj) {
370
364
 
371
365
  // delete existing air passenger types for each fare (map stored in passengersPerReservations)
372
366
  const pricingInfos = pricingSolution['air:AirPricingInfo'].map(
373
- info => Object.assign({}, info, { 'air:PassengerType': [] })
367
+ (info) => ({ ...info, 'air:PassengerType': [] })
374
368
  );
375
369
 
376
370
  this.env.passengers.forEach((passenger, index) => {
@@ -385,7 +379,7 @@ function airPriceRspPricingSolutionXML(obj) {
385
379
  return false;
386
380
  });
387
381
 
388
- const pricingInfo = pricingInfos.find(info => info.$.Key === reservationKey);
382
+ const pricingInfo = pricingInfos.find((info) => info.$.Key === reservationKey);
389
383
 
390
384
  pricingInfo['air:PassengerType'].push({
391
385
  $: {
@@ -532,7 +526,7 @@ const AirErrorHandler = function (rsp) {
532
526
  }
533
527
 
534
528
  const airSegmentErrors = errorInfo['air:AirSegmentError'] || [];
535
- const messages = airSegmentErrors.map(err => err['air:ErrorMessage']);
529
+ const messages = airSegmentErrors.map((err) => err['air:ErrorMessage']);
536
530
 
537
531
  if (messages.indexOf('Booking is not complete due to waitlisted segment') !== -1) {
538
532
  throw new AirRuntimeError.SegmentWaitlisted(rsp);
@@ -617,13 +611,13 @@ function getTicketFromEtr(etr, obj, allowNoProviderLocatorCodeRetrieval = false)
617
611
  (ticket) => {
618
612
  if (ticket['air:ExchangedTicketInfo']) {
619
613
  ticket['air:ExchangedTicketInfo'].forEach(
620
- t => exchangedTickets.push(t.Number)
614
+ (t) => exchangedTickets.push(t.Number)
621
615
  );
622
616
  }
623
617
 
624
618
  const coupons = Object.keys(ticket['air:Coupon']).map(
625
619
  (couponKey) => {
626
- const allCouponsIndex = allCoupons.findIndex(ac => ac.key === couponKey);
620
+ const allCouponsIndex = allCoupons.findIndex((ac) => ac.key === couponKey);
627
621
  const coupon = allCoupons[allCouponsIndex];
628
622
  const nextCoupon = allCoupons[allCouponsIndex + 1];
629
623
 
@@ -637,7 +631,7 @@ function getTicketFromEtr(etr, obj, allowNoProviderLocatorCodeRetrieval = false)
637
631
  if (fare.FareBasis === coupon.FareBasis
638
632
  && airPricingInfo['air:BookingInfo']) {
639
633
  const bInfo = airPricingInfo['air:BookingInfo'].find(
640
- info => info.FareInfoRef === fareKey
634
+ (info) => info.FareInfoRef === fareKey
641
635
  );
642
636
 
643
637
  if (bInfo) {
@@ -669,22 +663,20 @@ function getTicketFromEtr(etr, obj, allowNoProviderLocatorCodeRetrieval = false)
669
663
 
670
664
  const taxes = (airPricingInfo && airPricingInfo['air:TaxInfo'])
671
665
  ? Object.keys(airPricingInfo['air:TaxInfo']).map(
672
- taxKey => Object.assign(
673
- {
674
- type: airPricingInfo['air:TaxInfo'][taxKey].Category,
675
- value: airPricingInfo['air:TaxInfo'][taxKey].Amount,
676
- },
677
- airPricingInfo['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`]
666
+ (taxKey) => ({
667
+ type: airPricingInfo['air:TaxInfo'][taxKey].Category,
668
+ value: airPricingInfo['air:TaxInfo'][taxKey].Amount,
669
+ ...(airPricingInfo['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`]
678
670
  ? {
679
671
  details: airPricingInfo['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`].map(
680
- taxDetail => ({
672
+ (taxDetail) => ({
681
673
  airport: taxDetail.OriginAirport,
682
674
  value: taxDetail.Amount,
683
675
  })
684
676
  ),
685
677
  }
686
- : null
687
- )
678
+ : null)
679
+ })
688
680
  )
689
681
  : [];
690
682
  const priceSource = airPricingInfo || etr;
@@ -697,32 +689,30 @@ function getTicketFromEtr(etr, obj, allowNoProviderLocatorCodeRetrieval = false)
697
689
  const fareCalcSource = etr['air:FareCalc'].match(fareCalculationPattern)
698
690
  ? etr['air:FareCalc']
699
691
  : airPricingInfo['air:FareCalc'];
700
- const response = Object.assign(
701
- {
702
- uapi_ur_locator: obj.UniversalRecordLocatorCode,
703
- uapi_reservation_locator: etr['air:AirReservationLocatorCode'],
704
- pnr: etr.ProviderLocatorCode,
705
- ticketNumber: tickets[0].ticketNumber,
706
- platingCarrier: etr.PlatingCarrier,
707
- ticketingPcc: etr.PseudoCityCode,
708
- issuedAt: etr.IssuedDate,
709
- farePricingMethod: airPricingInfo ? airPricingInfo.PricingMethod : null,
710
- farePricingType: airPricingInfo ? airPricingInfo.PricingType : null,
711
- priceInfoAvailable,
712
- priceInfoDetailsAvailable: (airPricingInfo !== null),
713
- taxes: priceSource.Taxes,
714
- taxesInfo: taxes,
715
- passengers,
716
- tickets,
717
- iataNumber,
718
- formOfPayment,
719
- // Flags
720
- noAdc: !etr.TotalPrice,
721
- isConjunctionTicket: tickets.length > 1,
722
- tourCode,
723
- },
724
- parseFareCalculation(fareCalcSource),
725
- commission
692
+ const response = {
693
+ uapi_ur_locator: obj.UniversalRecordLocatorCode,
694
+ uapi_reservation_locator: etr['air:AirReservationLocatorCode'],
695
+ pnr: etr.ProviderLocatorCode,
696
+ ticketNumber: tickets[0].ticketNumber,
697
+ platingCarrier: etr.PlatingCarrier,
698
+ ticketingPcc: etr.PseudoCityCode,
699
+ issuedAt: etr.IssuedDate,
700
+ farePricingMethod: airPricingInfo ? airPricingInfo.PricingMethod : null,
701
+ farePricingType: airPricingInfo ? airPricingInfo.PricingType : null,
702
+ priceInfoAvailable,
703
+ priceInfoDetailsAvailable: (airPricingInfo !== null),
704
+ taxes: priceSource.Taxes,
705
+ taxesInfo: taxes,
706
+ passengers,
707
+ tickets,
708
+ iataNumber,
709
+ formOfPayment,
710
+ // Flags
711
+ noAdc: !etr.TotalPrice,
712
+ isConjunctionTicket: tickets.length > 1,
713
+ tourCode,
714
+ ...parseFareCalculation(fareCalcSource),
715
+ ...(commission
726
716
  ? {
727
717
  commission: {
728
718
  type: commission.Type === 'PercentBase' ? 'Z' : 'ZA',
@@ -731,19 +721,19 @@ function getTicketFromEtr(etr, obj, allowNoProviderLocatorCodeRetrieval = false)
731
721
  : parseFloat(commission.Amount.slice(3))
732
722
  },
733
723
  }
734
- : null,
735
- priceInfoAvailable
724
+ : null),
725
+ ...(priceInfoAvailable
736
726
  ? {
737
727
  totalPrice: priceSource.TotalPrice
738
728
  || `${(priceSource.EquivalentBasePrice || priceSource.BasePrice).slice(0, 3)}0`,
739
729
  basePrice: priceSource.BasePrice,
740
730
  equivalentBasePrice: priceSource.EquivalentBasePrice,
741
731
  }
742
- : null,
743
- exchangedTickets.length > 0
732
+ : null),
733
+ ...(exchangedTickets.length > 0
744
734
  ? { exchangedTickets }
745
- : null
746
- );
735
+ : null)
736
+ };
747
737
 
748
738
  return response;
749
739
  }
@@ -776,16 +766,15 @@ const airGetTicket = function (obj, parseParams = {
776
766
 
777
767
  if (multipleTickets) {
778
768
  return Object.values(etr)
779
- .map(innerEtr => (
769
+ .map((innerEtr) => (
780
770
  getTicketFromEtr.call(this, innerEtr, obj, parseParams.allowNoProviderLocatorCodeRetrieval)
781
771
  ));
782
772
  }
783
773
 
784
-
785
774
  return getTicketFromEtr.call(this, etr, obj, parseParams.allowNoProviderLocatorCodeRetrieval);
786
775
  };
787
776
 
788
- const responseHasNoTickets = rsp => (
777
+ const responseHasNoTickets = (rsp) => (
789
778
  rsp.faultcode !== undefined
790
779
  && rsp.faultstring !== undefined
791
780
  && /has no tickets/.test(rsp.faultstring)
@@ -845,7 +834,7 @@ function airCancelPnr(obj) {
845
834
  const messages = obj[`common_${this.uapi_version}:ResponseMessage`] || [];
846
835
  if (
847
836
  messages.some(
848
- message => message._ === 'Itinerary Cancelled'
837
+ (message) => message._ === 'Itinerary Cancelled'
849
838
  )
850
839
  ) {
851
840
  return true;
@@ -854,7 +843,7 @@ function airCancelPnr(obj) {
854
843
  }
855
844
 
856
845
  function formSupplierLocatorBlock(supplierLocator) {
857
- return supplierLocator.map(info => ({
846
+ return supplierLocator.map((info) => ({
858
847
  createDate: info.CreateDateTime,
859
848
  supplierCode: info.SupplierCode,
860
849
  locatorCode: info.SupplierLocatorCode,
@@ -958,7 +947,7 @@ function extractBookings(obj) {
958
947
  : [];
959
948
 
960
949
  const passiveReservation = record['passive:PassiveReservation']
961
- ? record['passive:PassiveReservation'].find(res => res.ProviderReservationInfoRef === providerInfoKey)
950
+ ? record['passive:PassiveReservation'].find((res) => res.ProviderReservationInfoRef === providerInfoKey)
962
951
  : null;
963
952
 
964
953
  if (!providerInfo) {
@@ -1006,7 +995,7 @@ function extractBookings(obj) {
1006
995
 
1007
996
  const supplierLocator = booking[`common_${this.uapi_version}:SupplierLocator`] || [];
1008
997
  const segments = indexedSegments
1009
- ? indexedSegments.map(segment => ({
998
+ ? indexedSegments.map((segment) => ({
1010
999
  ...format.formatTrip(segment, segment['air:FlightDetails']),
1011
1000
  index: segment.index,
1012
1001
  status: segment.Status,
@@ -1018,7 +1007,7 @@ function extractBookings(obj) {
1018
1007
  const serviceSegments = indexedServiceSegments
1019
1008
  ? indexedServiceSegments.map((s) => {
1020
1009
  const remark = passiveReservation['passive:PassiveRemark'].find(
1021
- r => r.PassiveSegmentRef === s.Key
1010
+ (r) => r.PassiveSegmentRef === s.Key
1022
1011
  );
1023
1012
 
1024
1013
  try {
@@ -1028,13 +1017,13 @@ function extractBookings(obj) {
1028
1017
 
1029
1018
  return null;
1030
1019
  }
1031
- }).filter(v => v)
1020
+ }).filter((v) => v)
1032
1021
  : [];
1033
1022
 
1034
1023
  const fareQuotesCommon = {};
1035
1024
  const tickets = (booking['air:DocumentInfo'] && booking['air:DocumentInfo']['air:TicketInfo']) ? (
1036
1025
  booking['air:DocumentInfo']['air:TicketInfo'].map(
1037
- ticket => ({
1026
+ (ticket) => ({
1038
1027
  number: ticket.Number,
1039
1028
  passengers: [{
1040
1029
  firstName: ticket[`common_${this.uapi_version}:Name`].First,
@@ -1055,7 +1044,7 @@ function extractBookings(obj) {
1055
1044
  const pricingInfo = booking['air:AirPricingInfo'][key];
1056
1045
 
1057
1046
  const uapiSegmentRefs = (pricingInfo['air:BookingInfo'] || []).map(
1058
- segment => segment.SegmentRef
1047
+ (segment) => segment.SegmentRef
1059
1048
  );
1060
1049
 
1061
1050
  const uapiPassengerRefs = pricingInfo[`common_${this.uapi_version}:BookingTravelerRef`];
@@ -1063,7 +1052,7 @@ function extractBookings(obj) {
1063
1052
  const fareInfo = pricingInfo['air:FareInfo'];
1064
1053
 
1065
1054
  const baggage = fareInfo && Object.keys(fareInfo).map(
1066
- fareLegKey => format.getBaggage(fareInfo[fareLegKey]['air:BaggageAllowance'])
1055
+ (fareLegKey) => format.getBaggage(fareInfo[fareLegKey]['air:BaggageAllowance'])
1067
1056
  );
1068
1057
 
1069
1058
  const passengersCount = (pricingInfo['air:PassengerType'] || [])
@@ -1073,22 +1062,20 @@ function extractBookings(obj) {
1073
1062
 
1074
1063
  const taxesInfo = pricingInfo['air:TaxInfo']
1075
1064
  ? Object.keys(pricingInfo['air:TaxInfo']).map(
1076
- taxKey => Object.assign(
1077
- {
1078
- value: pricingInfo['air:TaxInfo'][taxKey].Amount,
1079
- type: pricingInfo['air:TaxInfo'][taxKey].Category,
1080
- },
1081
- pricingInfo['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`]
1065
+ (taxKey) => ({
1066
+ value: pricingInfo['air:TaxInfo'][taxKey].Amount,
1067
+ type: pricingInfo['air:TaxInfo'][taxKey].Category,
1068
+ ...(pricingInfo['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`]
1082
1069
  ? {
1083
1070
  details: pricingInfo['air:TaxInfo'][taxKey][`common_${this.uapi_version}:TaxDetail`].map(
1084
- taxDetail => ({
1071
+ (taxDetail) => ({
1085
1072
  airport: taxDetail.OriginAirport,
1086
1073
  value: taxDetail.Amount,
1087
1074
  })
1088
1075
  ),
1089
1076
  }
1090
- : null
1091
- )
1077
+ : null)
1078
+ })
1092
1079
  )
1093
1080
  : [];
1094
1081
 
@@ -1108,72 +1095,64 @@ function extractBookings(obj) {
1108
1095
 
1109
1096
  const endorsement = fareInfo && firstFareInfo[`common_${this.uapi_version}:Endorsement`]
1110
1097
  ? firstFareInfo[`common_${this.uapi_version}:Endorsement`]
1111
- .map(end => end.Value)
1098
+ .map((end) => end.Value)
1112
1099
  .join(' ')
1113
1100
  : null;
1114
1101
 
1115
- fareQuotesCommon[pricingInfo.AirPricingInfoGroup] = Object.assign(
1116
- {
1117
- uapi_segment_refs: uapiSegmentRefs,
1118
- effectiveDate: fareInfo && firstFareInfo.EffectiveDate,
1119
- endorsement,
1120
- tourCode,
1121
- },
1122
- platingCarrier
1102
+ fareQuotesCommon[pricingInfo.AirPricingInfoGroup] = {
1103
+ uapi_segment_refs: uapiSegmentRefs,
1104
+ effectiveDate: fareInfo && firstFareInfo.EffectiveDate,
1105
+ endorsement,
1106
+ tourCode,
1107
+ ...(platingCarrier
1123
1108
  ? { platingCarrier }
1124
- : null
1125
- );
1109
+ : null)
1110
+ };
1126
1111
 
1127
1112
  const pricingInfoPassengers = (uapiPassengerRefs || []).map(
1128
1113
  (ref) => {
1129
1114
  const ticket = tickets.find(
1130
- t => t.uapi_passenger_ref === ref && t.uapi_pricing_info_ref === key
1115
+ (t) => t.uapi_passenger_ref === ref && t.uapi_pricing_info_ref === key
1131
1116
  );
1132
- return Object.assign(
1133
- {
1134
- uapi_passenger_ref: ref,
1135
- isTicketed: !!ticket,
1136
- },
1137
- ticket
1117
+ return {
1118
+ uapi_passenger_ref: ref,
1119
+ isTicketed: !!ticket,
1120
+ ...(ticket
1138
1121
  ? { ticketNumber: ticket.number }
1139
- : null
1140
- );
1122
+ : null)
1123
+ };
1141
1124
  }
1142
1125
  );
1143
1126
 
1144
- return Object.assign(
1145
- {
1146
- uapi_pricing_info_ref: key,
1147
- passengers: pricingInfoPassengers,
1148
- uapi_pricing_info_group: pricingInfo.AirPricingInfoGroup,
1149
- farePricingMethod: pricingInfo.PricingMethod,
1150
- farePricingType: pricingInfo.PricingType,
1151
- totalPrice: pricingInfo.TotalPrice,
1152
- basePrice: pricingInfo.BasePrice,
1153
- equivalentBasePrice: pricingInfo.EquivalentBasePrice,
1154
- taxes: pricingInfo.Taxes,
1155
- passengersCount,
1156
- taxesInfo,
1157
- baggage,
1158
- timeToReprice: pricingInfo.LatestTicketingTime,
1159
- },
1160
- parseFareCalculation(pricingInfo['air:FareCalc'])
1161
- );
1127
+ return {
1128
+ uapi_pricing_info_ref: key,
1129
+ passengers: pricingInfoPassengers,
1130
+ uapi_pricing_info_group: pricingInfo.AirPricingInfoGroup,
1131
+ farePricingMethod: pricingInfo.PricingMethod,
1132
+ farePricingType: pricingInfo.PricingType,
1133
+ totalPrice: pricingInfo.TotalPrice,
1134
+ basePrice: pricingInfo.BasePrice,
1135
+ equivalentBasePrice: pricingInfo.EquivalentBasePrice,
1136
+ taxes: pricingInfo.Taxes,
1137
+ passengersCount,
1138
+ taxesInfo,
1139
+ baggage,
1140
+ timeToReprice: pricingInfo.LatestTicketingTime,
1141
+ ...parseFareCalculation(pricingInfo['air:FareCalc'])
1142
+ };
1162
1143
  }
1163
1144
  ).filter(Boolean);
1164
1145
 
1165
- const fareQuotesGrouped = pricingInfos.reduce(
1166
- (acc, pricingInfo) => Object.assign(acc, {
1167
- [pricingInfo.uapi_pricing_info_group]: (acc[pricingInfo.uapi_pricing_info_group] || [])
1168
- .concat(pricingInfo),
1169
- }), {}
1170
- );
1146
+ const fareQuotesGrouped = pricingInfos.reduce((acc, pricingInfo) => Object.assign(acc, {
1147
+ [pricingInfo.uapi_pricing_info_group]: (acc[pricingInfo.uapi_pricing_info_group] || [])
1148
+ .concat(pricingInfo),
1149
+ }), {});
1171
1150
 
1172
1151
  const fareQuotes = Object.keys(fareQuotesGrouped).map((key) => {
1173
1152
  const fqGroup = fareQuotesGrouped[key];
1174
1153
  const fqGroupPassengers = fqGroup.reduce(
1175
1154
  (acc, fq) => acc.concat(
1176
- fq.passengers.map(p => p.uapi_passenger_ref)
1155
+ fq.passengers.map((p) => p.uapi_passenger_ref)
1177
1156
  ),
1178
1157
  []
1179
1158
  );
@@ -1189,30 +1168,28 @@ function extractBookings(obj) {
1189
1168
  (fq, index) => ({ ...fq, index: index + 1 })
1190
1169
  );
1191
1170
 
1192
- return Object.assign(
1193
- {
1194
- type: 'uAPI',
1195
- pnr: providerInfo.LocatorCode,
1196
- version: Number(record.Version),
1197
- uapi_ur_locator: record.LocatorCode,
1198
- uapi_reservation_locator: booking.LocatorCode,
1199
- airlineLocatorInfo: formSupplierLocatorBlock(supplierLocator),
1200
- createdAt: providerInfo.CreateDate,
1201
- hostCreatedAt: providerInfo.HostCreateDate,
1202
- modifiedAt: providerInfo.ModifiedDate,
1203
- fareQuotes,
1204
- segments: format.setReferencesForSegments(segments),
1205
- serviceSegments,
1206
- passengers,
1207
- emails,
1208
- bookingPCC: providerInfo.OwningPCC,
1209
- tickets,
1210
- },
1211
- splitBookings.length > 0
1171
+ return {
1172
+ type: 'uAPI',
1173
+ pnr: providerInfo.LocatorCode,
1174
+ version: Number(record.Version),
1175
+ uapi_ur_locator: record.LocatorCode,
1176
+ uapi_reservation_locator: booking.LocatorCode,
1177
+ airlineLocatorInfo: formSupplierLocatorBlock(supplierLocator),
1178
+ createdAt: providerInfo.CreateDate,
1179
+ hostCreatedAt: providerInfo.HostCreateDate,
1180
+ modifiedAt: providerInfo.ModifiedDate,
1181
+ fareQuotes,
1182
+ segments: format.setReferencesForSegments(segments),
1183
+ serviceSegments,
1184
+ passengers,
1185
+ emails,
1186
+ bookingPCC: providerInfo.OwningPCC,
1187
+ tickets,
1188
+ ...(splitBookings.length > 0
1212
1189
  ? { splitBookings }
1213
- : null,
1214
- messages ? { messages } : null
1215
- );
1190
+ : null),
1191
+ ...(messages ? { messages } : null)
1192
+ };
1216
1193
  });
1217
1194
  }
1218
1195
 
@@ -1299,7 +1276,7 @@ function exchangeQuote(req) {
1299
1276
  const exchangeDetails = json['air:AirExchangeBundle'].map((bundle) => {
1300
1277
  const exchange = bundle[exchangeInfoRoot];
1301
1278
  const taxes = exchange[`common_${this.uapi_version}:PaidTax`]
1302
- .map(tax => ({ type: tax.Code, value: tax.Amount }));
1279
+ .map((tax) => ({ type: tax.Code, value: tax.Amount }));
1303
1280
 
1304
1281
  return {
1305
1282
  ...format.formatAirExchangeBundle(exchange),
@@ -1338,14 +1315,12 @@ function exchangeQuote(req) {
1338
1315
  };
1339
1316
  });
1340
1317
 
1341
- return Object.assign(
1342
- {
1343
- ...format.formatPrices(pricing),
1344
- bookingInfo,
1345
- uapi_pricing_info_ref: pricing.Key,
1346
- },
1347
- parseFareCalculation(pricing['air:FareCalc'])
1348
- );
1318
+ return {
1319
+ ...format.formatPrices(pricing),
1320
+ bookingInfo,
1321
+ uapi_pricing_info_ref: pricing.Key,
1322
+ ...parseFareCalculation(pricing['air:FareCalc'])
1323
+ };
1349
1324
  });
1350
1325
 
1351
1326
  const airPricingDetails = solution['air:PricingDetails'];
@@ -1386,7 +1361,7 @@ function availability(rsp) {
1386
1361
 
1387
1362
  const connectedSegments = itinerarySolution['air:Connection']
1388
1363
  ? itinerarySolution['air:Connection'].map(
1389
- s => parseInt(s.SegmentIndex, 10)
1364
+ (s) => parseInt(s.SegmentIndex, 10)
1390
1365
  )
1391
1366
  : [];
1392
1367
 
@@ -1394,9 +1369,9 @@ function availability(rsp) {
1394
1369
  let leg = [];
1395
1370
  itinerarySolution['air:AirSegmentRef'].forEach((segmentRef, key) => {
1396
1371
  const segment = rsp['air:AirSegmentList'][segmentRef];
1397
- const isConnected = connectedSegments.find(s => s === key);
1372
+ const isConnected = connectedSegments.find((s) => s === key);
1398
1373
  const availInfoList = segment['air:AirAvailInfo'] || [];
1399
- const availInfo = availInfoList.find(info => info.ProviderCode === this.provider);
1374
+ const availInfo = availInfoList.find((info) => info.ProviderCode === this.provider);
1400
1375
 
1401
1376
  if (!availInfo) {
1402
1377
  return;
@@ -1417,7 +1392,7 @@ function availability(rsp) {
1417
1392
  .reduce((acc, x) => {
1418
1393
  const codes = x.BookingCounts
1419
1394
  .split('|')
1420
- .map(item => ({
1395
+ .map((item) => ({
1421
1396
  bookingClass: item[0],
1422
1397
  cabin: x.CabinClass,
1423
1398
  seats: item[1].trim(),
@@ -1504,7 +1479,7 @@ function getEMDList(obj) {
1504
1479
  processUAPIError.call(this, obj, 'Unable to retrieve EMD list');
1505
1480
  }
1506
1481
 
1507
- return Object.values(eMDSummaryInfo).map(val => (getEMDListItem.call(this, val)));
1482
+ return Object.values(eMDSummaryInfo).map((val) => (getEMDListItem.call(this, val)));
1508
1483
  }
1509
1484
 
1510
1485
  function getEMDItem(obj) {
@@ -113,8 +113,8 @@ module.exports = {
113
113
  transform()
114
114
  ),
115
115
 
116
- AIR_CANCEL_UR: params => params,
117
- UNIVERSAL_RECORD_FOID: params => params,
116
+ AIR_CANCEL_UR: (params) => params,
117
+ UNIVERSAL_RECORD_FOID: (params) => params,
118
118
  UNIVERSAL_RECORD_MODIFY: compose(
119
119
  validate(
120
120
  validators.pnr,
@@ -18,7 +18,7 @@ module.exports = (params) => {
18
18
  && (
19
19
  !Array.isArray(carriers)
20
20
  || carriers.length === 0
21
- || carriers.some(c => !carrierRegExp.test(c))
21
+ || carriers.some((c) => !carrierRegExp.test(c))
22
22
  )
23
23
  ) {
24
24
  throw new AirValidationError.CarriersIsInvalid(params);
@@ -12,12 +12,12 @@ function isIata(str) {
12
12
 
13
13
  function validateIsArray(params, prop) {
14
14
  if (params[prop]
15
- && (!Array.isArray(params[prop]) || params[prop].find(item => !isIata(item)))
15
+ && (!Array.isArray(params[prop]) || params[prop].find((item) => !isIata(item)))
16
16
  ) {
17
17
  throw new AirValidationError.IncorrectConnectionsFormat(params);
18
18
  }
19
19
  }
20
20
 
21
21
  module.exports = (params) => {
22
- connectionsFields.forEach(cf => validateIsArray(params, cf));
22
+ connectionsFields.forEach((cf) => validateIsArray(params, cf));
23
23
  };