ti2-tourplan 1.0.60 → 1.0.61

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.
@@ -3305,84 +3305,6 @@ exports[`search tests searchItineraries 1`] = `
3305
3305
  Object {
3306
3306
  "bookings": Array [
3307
3307
  Object {
3308
- "AccountingDetails": Object {
3309
- "AmountDue": 0,
3310
- "CreditsTotal": 0,
3311
- "FutureBilling": 187795,
3312
- "InvoicedTotal": 0,
3313
- "ReceivedTotal": 0,
3314
- },
3315
- "AgentRef": "2356674/1",
3316
- "BookingId": 316559,
3317
- "BookingStatus": "Quotation",
3318
- "BookingType": "F",
3319
- "BookingUpdateCount": 2,
3320
- "CanAddServices": "Y",
3321
- "CanCancel": "Y",
3322
- "Consult": "",
3323
- "Currency": "GBP",
3324
- "Dialogue": "",
3325
- "Email": "",
3326
- "EnteredDate": "2024-09-12",
3327
- "IsInternetBooking": "Y",
3328
- "Name": "2356674/1 Sean Conta",
3329
- "QB": "Q",
3330
- "ReadOnly": "N",
3331
- "Ref": "ALFI393706",
3332
- "Remarks": "",
3333
- "Services": Array [
3334
- Object {
3335
- "CanAccept": "N",
3336
- "CanUpdate": "N",
3337
- "CancelDeleteStatus": "D",
3338
- "Comment": "Deluxe King Room",
3339
- "CostedInBooking": "Y",
3340
- "Date": "2025-08-13",
3341
- "Description": "Bed and Full Buffet Breakfast",
3342
- "LinePrice": 187795,
3343
- "LocationCode": "LON",
3344
- "Opt": "LONHOSANLONBFBDLX",
3345
- "OptionNumber": 77490,
3346
- "Remarks": "Passenger Notes: NA.
3347
- Service Notes: NA.",
3348
- "RoomConfigs": Object {
3349
- "RoomConfig": Object {
3350
- "Adults": 1,
3351
- "Children": 0,
3352
- "Infants": 0,
3353
- "PaxList": Object {
3354
- "PaxDetails": Object {
3355
- "Forename": "Sean",
3356
- "PaxType": "A",
3357
- "PersonId": 628199,
3358
- "Surname": "Conta",
3359
- "Title": "Mr",
3360
- },
3361
- },
3362
- "RoomType": "DB",
3363
- },
3364
- },
3365
- "SCU": "night",
3366
- "SCUqty": 4,
3367
- "SequenceNumber": 10,
3368
- "ServiceExtras": Object {
3369
- "ServiceExtra": Object {
3370
- "ChargeBasis": "Room",
3371
- "Description": "Extra Bed",
3372
- "IsCompulsory": "N",
3373
- "IsPricePerPerson": "N",
3374
- "Quantity": 1,
3375
- "SequenceNumber": 1,
3376
- },
3377
- },
3378
- "ServiceLineId": 745684,
3379
- "ServiceLineUpdateCount": 1,
3380
- "SupplierName": "Sanderson",
3381
- "paxList": Array [],
3382
- },
3383
- ],
3384
- "TotalPrice": 187795,
3385
- "TravelDate": "2025-08-13",
3386
3308
  "agentRef": "2356674/1",
3387
3309
  "bookingId": "316559",
3388
3310
  "bookingStatus": "Quotation",
package/index.js CHANGED
@@ -659,124 +659,6 @@ class BuyerPlugin {
659
659
  };
660
660
  }
661
661
 
662
-
663
- // TODO: safe to deprecate 7-14 days after release date
664
- async searchQuote({
665
- axios,
666
- token: {
667
- hostConnectEndpoint,
668
- hostConnectAgentID,
669
- hostConnectAgentPassword,
670
- },
671
- payload: {
672
- quoteName,
673
- rateId,
674
- quoteId,
675
- // existingQuoteId,
676
- // existingLineId,
677
- optionId,
678
- startDate,
679
- reference,
680
- /*
681
- paxConfigs: [{ roomType: 'DB', adults: 2 }, { roomType: 'TW', children: 2 }]
682
- */
683
- paxConfigs,
684
- /*
685
- The number of second charge units required (second charge units are discussed
686
- in the OptionInfo section). Should only be specified for options that have SCUs.
687
- Defaults to 1.
688
- */
689
- chargeUnitQuanity,
690
- extras,
691
- puInfo,
692
- doInfo,
693
- notes,
694
- QB,
695
- directHeaderPayload,
696
- directLinePayload,
697
- customFieldValues = [],
698
- },
699
- }) {
700
- const cfvPerService = customFieldValues.filter(f => f.isPerService && f.value)
701
- .reduce((acc, f) => {
702
- if (f.type === 'extended-option') {
703
- acc[f.id] = f.value.value || f.value;
704
- } else {
705
- acc[f.id] = f.value;
706
- }
707
- return acc;
708
- }, {});
709
- const model = {
710
- AddServiceRequest: {
711
- AgentID: hostConnectAgentID,
712
- Password: hostConnectAgentPassword,
713
- ...(quoteId ? {
714
- ExistingBookingInfo: { BookingId: quoteId },
715
- } : {
716
- NewBookingInfo: {
717
- Name: this.escapeInvalidXmlChars(quoteName),
718
- QB: QB || 'Q',
719
- ...(directHeaderPayload || {}),
720
- },
721
- }),
722
- ...(puInfo && (puInfo.time || puInfo.location || puInfo.flightDetails) ? {
723
- ...(puInfo.time && puInfo.time.replace(/\D/g, '') ? {
724
- puTime: puInfo.time.replace(/\D/g, ''),
725
- } : {}),
726
- puRemark: this.escapeInvalidXmlChars(`${puInfo.location ? `Location: ${puInfo.location || 'NA'},` : ''}
727
- ${puInfo.flightDetails ? `Flight: ${puInfo.flightDetails || 'NA'},` : ''}
728
- `),
729
- } : {}),
730
- ...(doInfo && (doInfo.time || doInfo.location || doInfo.flightDetails) ? {
731
- // only get numbers from doInfo.time
732
- ...(doInfo.time && doInfo.time.replace(/\D/g, '') ? {
733
- doTime: doInfo.time.replace(/\D/g, ''),
734
- } : {}),
735
- doRemark: this.escapeInvalidXmlChars(`${doInfo.location ? `Location: ${doInfo.location || 'NA'},` : ''}
736
- ${doInfo.flightDetails ? `Flight: ${doInfo.flightDetails || 'NA'},` : ''}
737
- `),
738
- } : {}),
739
- ...(extras && extras.filter(e => e.selectedExtra && e.selectedExtra.id).length ? {
740
- ExtraQuantities: {
741
- ExtraQuantityItem: extras.filter(e => e.selectedExtra && e.selectedExtra.id).map(e => ({
742
- SequenceNumber: e.selectedExtra.id,
743
- ExtraQuantity: e.quantity,
744
- })),
745
- },
746
- } : {}),
747
- Remarks: this.escapeInvalidXmlChars(notes).slice(0, 220),
748
- Opt: optionId,
749
- DateFrom: startDate,
750
- RateId: rateId || 'Default',
751
- SCUqty: (() => {
752
- const num = parseInt(chargeUnitQuanity, 10);
753
- if (isNaN(num) || num < 1) return 1;
754
- return num;
755
- })(),
756
- AgentRef: reference,
757
- RoomConfigs: this.getRoomConfigs(paxConfigs),
758
- ...(directLinePayload || {}),
759
- ...(cfvPerService || {}),
760
- },
761
- };
762
- const replyObj = await this.callTourplan({
763
- model,
764
- endpoint: hostConnectEndpoint,
765
- axios,
766
- xmlOptions: hostConnectXmlOptions,
767
- });
768
- return {
769
- message: R.path(['AddServiceReply', 'Status'], replyObj)
770
- === 'NO' ? 'Service cannot be added to quote for the requested date/stay. (e.g. no rates, block out period, on request, minimum stay etc.)' : '',
771
- quote: {
772
- id: R.path(['AddServiceReply', 'BookingId'], replyObj) || quoteId,
773
- reference: R.path(['AddServiceReply', 'Ref'], replyObj),
774
- linePrice: R.path(['AddServiceReply', 'Services', 'Service', 'LinePrice'], replyObj),
775
- lineId: R.path(['AddServiceReply', 'ServiceLineId'], replyObj),
776
- },
777
- };
778
- }
779
-
780
662
  async addServiceToItinerary({
781
663
  axios,
782
664
  token: {
@@ -1008,47 +890,27 @@ class BuyerPlugin {
1008
890
  const replyObjs = await Promise.all(allSearches);
1009
891
  const bookingHeaders = R.flatten(replyObjs.map(o => R.pathOr([], ['ListBookingsReply', 'BookingHeaders', 'BookingHeader'], o)));
1010
892
  const bookings = await Promise.map(bookingHeaders, async bookingHeader => {
1011
- const getBookingPayload = getPayload('GetBookingRequest', {
1012
- BookingId: R.prop('BookingId', bookingHeader),
1013
- ReturnAccountInfo: 'Y',
1014
- ReturnRoomConfigs: 'Y',
1015
- });
1016
- const bookingReply = await this.callTourplan(getBookingPayload);
1017
- const booking = R.path(['GetBookingReply'], bookingReply);
1018
- const newBooking = await translateItineraryBooking({
1019
- rootValue: booking,
1020
- typeDefs: itineraryBookingTypeDefs,
1021
- query: itineraryBookingQuery,
1022
- });
1023
- // TODO: safe to deprecate 7-14 days after release date
1024
- let Services = R.pathOr([], ['Services', 'Service'], booking);
1025
- if (!Array.isArray(Services)) Services = [Services];
1026
- Services = Services.map(s => {
1027
- let actualRoomConfigs = s.RoomConfigs.RoomConfig;
1028
- if (!Array.isArray(actualRoomConfigs)) actualRoomConfigs = [actualRoomConfigs];
1029
- const paxList = actualRoomConfigs.reduce((acc, roomConfig) => {
1030
- const paxDetails = R.pathOr([], ['PaxList', 'PaxDetails'], roomConfig);
1031
- if (!Array.isArray(paxDetails)) return acc;
1032
- return [...acc, ...paxDetails];
1033
- }, [])
1034
- .map(p => ({
1035
- personId: R.path(['PersonId'], p),
1036
- firstName: R.path(['Forename'], p),
1037
- lastName: R.path(['Surname'], p),
1038
- }));
1039
- return {
1040
- ...s,
1041
- paxList,
1042
- };
1043
- });
1044
- return {
1045
- ...newBooking,
1046
- ...booking,
1047
- Services,
1048
- };
893
+ try {
894
+ const getBookingPayload = getPayload('GetBookingRequest', {
895
+ BookingId: R.prop('BookingId', bookingHeader),
896
+ ReturnAccountInfo: 'Y',
897
+ ReturnRoomConfigs: 'Y',
898
+ });
899
+ const bookingReply = await this.callTourplan(getBookingPayload);
900
+ const booking = R.path(['GetBookingReply'], bookingReply);
901
+ const newBooking = await translateItineraryBooking({
902
+ rootValue: booking,
903
+ typeDefs: itineraryBookingTypeDefs,
904
+ query: itineraryBookingQuery,
905
+ });
906
+ return newBooking;
907
+ } catch (err) {
908
+ console.log('error in searchBooking', err);
909
+ return null;
910
+ }
1049
911
  }, { concurrency: 10 });
1050
912
  return {
1051
- bookings,
913
+ bookings: bookings.filter(b => b),
1052
914
  };
1053
915
  }
1054
916
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-tourplan",
3
- "version": "1.0.60",
3
+ "version": "1.0.61",
4
4
  "description": "Tourplan's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {