npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tourstream/tstr-booking-manager-connector

v8.1.0

Published

This library enables your IBE to connect with the FTI booking manager.

Downloads

12

Readme

=== Booking Manager Connector ===

This project provides a JS module to enable an IBE to communicate with the FTI360 Booking Manager.

How to install

There are different ways to use this package.

per package manager

npm install @tourstream/tstr-booking-manager-connector --save

import BookingManagerConnector from 'tstr-booking-manager-connector';

let bmConnector = new BookingManagerConnector(instanceOptions);

or link the source

<script src="https://assets.gcloud.fti-group.com/tstr-booking-manager-connector/<versionNumber>/bookingManagerConnector.min.js"></script>

<script>
  var bmConnector = new BookingManagerConnector.default(instanceOptions);
</script>

versionNumber has to be one of the provided versions. Alternatively you can use 'latest' to use the latest version.

Supported instanceOptions

You can check the default options with BookingManagerConnector.DEFAULT_OPTIONS.

{
  debug: false,                 // en-/disable debugging
  useDateFormat: 'YYYY-MM-DD',  // the date format you want to use
  useTimeFormat: 'HH:mm',       // the time format you want to use
}

The formats are according to momentjs date format.

Interface

The connector provides several functions for the communication with the BM.

bmConnector.connect();                    // establish the connection to the BM
bmConnector.addToBasket(dataObject);      // add an item to the basket of the BM (the user/TA have to do the CRS transfer manually)
bmConnector.directCheckout(dataObject);   // handover an item to the BM and mark it for "direct checkout" (the BM will do the CRS transfer automatically after "done" is executed)
bmConnector.done();                       // tell the BM to process the items and proceed with the BM workflow

Every method returns a promise.

The dataObject structure

In general the dataObject must have at least one property to identify the type of your item:

{
  type: BookingManagerConnector.DATA_TYPES[*]
}

Currently the connector supports following types:

  • 'car'
  • 'hotel'
  • 'roundtrip'
  • 'camper'

Depending on the type the structure of the dataObject differs.

example for type 'car'

{
  type: BookingManagerConnector.DATA_TYPES.car,
  rental: {
    status: 'OK',
    editUrl: 'example://url-for.editing/?the=item',
    availabilityUrl: 'example://url-to-do.an/availability/check',
    conditionUrl: 'example://url-to-the.conditions',
    price: 506,
    currencyCode: 'EUR',
    pnr: '15faz',
  },
  vehicle: {
    code: 'E2',
    category: 'SMALL_CAR',
    name: 'Chevrolet Spark 2-4T AU',
    imageUrl: 'example://url-to-vehicle.img',
    sipp: 'MBMN',
  },
  renter: {
    code: 'USA81',
    name: 'Alamo',
    logoUrl: 'example://url-to-renter.logo',
  },
  pickUp: {
    type: 'station',
    date: '2017-12-28', 
    time: '09:15', 
    locationCode: 'MIA3',
    name: 'Alamo',
    address: '4332 Collins Avenue, Miami South Beach',
    phoneNumber: '(305) 532-8257',
    latitude: '25.8149316',
    longitude: '-80.1230047',
  },
  dropOff: {
    type: 'hotel',
    date: '2018-01-04', 
    time: '13:40', 
    locationCode: 'SFOH',
    name: 'Best Hotel',
    address: 'hotel street 1, 12345 hotel city',
    phoneNumber: '+49 172 678 0832 09',
    latitude: '37.6213129',
    longitude: '-122.3789554',
  },
  services: [
    'included service',
    '...',
  ],
  extras: [
    {
      type: 'additionalDriver',
      amount: 3,
      totalPrice: 210,
      currencyCode: 'USD',
      exchangeTotalPrice: 189.11,
      exchangeCurrencyCode: 'EUR',
    },
    {
      type: 'childCareSeat',
      option: 3,
    },
    {
      type: 'oneWayFee',
      totalPrice: 0,
      currencyCode: 'USD',
      exchangeTotalPrice: 0,
      exchangeCurrencyCode: 'EUR',
    },
    ...,
  ], 
  travellers: [
    {
      type: TravellerType,
      firstName: 'john',
      lastName: 'doe',
      dateOfBirth: '1983-11-08',
    },
    {
      type: TravellerType,
      dateOfBirth: '2002-02-22',
    },
    {
      type: TravellerType,
    },
    ...
  ],
}

example for type 'hotel'

{
  type: BookingManagerConnector.DATA_TYPES.hotel,
  booking: {
    fromDate: '2017-09-20',
    toDate: '2017-09-27',
    editUrl: 'example://url-for.editing/?the=item',
    availabilityUrl: 'example://url-to-do.an/availability/check',
    price: 208,
    currencyCode: 'EUR',
  },
  hotel: {
    externalCode: 'MUC20S',
    category: 3,
    name: 'Hotel ibis Muenchen City Sued',
    imageUrl: 'example://url-to-hotel.img',
    address: 'Raintaler Str.47, 81539, Munich, DE',
    latitude: '48.139497',
    longitude: '11.563788',
  },
  room: {
    code: 'DZ',
    quantity: 2,
    occupancy: 3,
    mealCode: 'U',
  },
  travellers: [
    {
      type: TravellerType,
      firstName: 'john',
      lastName: 'doe',
      dateOfBirth: '1983-11-08',
    },
    {
      type: TravellerType,
      dateOfBirth: '2002-02-22',
    },
    {
      type: TravellerType,
    },
    ...
  ],
  services: ['parking', 'spa_fitness', ...],
}

example for type 'roundtrip'

{
  type: BookingManagerConnector.DATA_TYPES.roundTrip,
  booking: {
    id: 'E2784NQXTHEN',
    fromDate: '2017-12-05',
    toDate: '2017-12-16',
    price: 860,
    currencyCode: 'EUR',
  },
  trip: {
    destination: 'YYZ',
    alias: 'Die Küste Südkaliforniens (ab San Francisco)',
    imageUrl: 'example://url-to-round-trip.img',
  },
  route: [
    {
      type: 'accommodation',
      fromDate: '2018-05-03',
      toDate: '2018-05-05',
      location: 'Santa Maria',
      hotel: 'Travelodge Santa Maria',
      rooms: [
        {
          name: 'Double/Twin Room',
          quantity: 2,
        },
        {
          name: 'Princess Suite',
        },
        ...
      ],
      latitude: '48.139497',
      longitude: '11.563788',
    },
    {
        type: 'transfer',
        description: 'Transfer San Francisco Flughafen - San Francisco Hotel',
    },
    ...
  ],
  travellers: [
    {
      type: TravellerType,
      firstName: 'john',
      lastName: 'doe',
      dateOfBirth: '1983-11-08',
    },
    {
      type: TravellerType,
      dateOfBirth: '2002-02-22',
    },
    {
      type: TravellerType,
    },
    ...
  ],
}

example for type 'camper'

{
  type: BookingManagerConnector.DATA_TYPES.camper,
  rental: {
    status: 'OK',
    editUrl: 'example://url-for.editing/?the=item',
    availabilityUrl: 'example://url-to-do.an/availability/check',
    conditionUrl: 'example://url-to-the.conditions',
    price: 506,
    currencyCode: 'EUR',
    milesIncludedPerDay: 300,
    milesPackagesIncluded: 5,
  },
  vehicle: {
    code: 'FS',
    category: 'VAN',
    name: 'Deluxe Campervan',
    imageUrl: 'example://url-to-vehicle.img',
  },
  renter: {
    code: 'PRT02',
    name: 'Avis',
    logoUrl: 'example://url-to-renter.logo',
  },
  pickUp: {
    type: 'station',
    date: '2017-12-28', 
    time: '09:15', 
    locationCode: 'LIS1',
    name: 'Avis',
    address: '4332 Collins Avenue, Miami South Beach',
    phoneNumber: '(305) 532-8257',
    latitude: '25.8149316',
    longitude: '-80.1230047',
  },
  dropOff: {
    type: 'station',
    date: '2017-12-28', 
    locationCode: 'LIS2',
    name: 'Avis',
    address: '4332 Collins Avenue, Miami South Beach',
    phoneNumber: '(305) 532-8257',
    latitude: '37.6213129',
    longitude: '-122.3789554',
  },
  services: [
    'included service',
    '...',
  ],
  extras: [
    {
      name: 'Extra Name',
      type: 'equipment',
      code: 'ECX0001',
      amount: 3,
      totalPrice: 210,
      currencyCode: 'USD',
      exchangeTotalPrice: 189.11,
      exchangeCurrencyCode: 'EUR',
    },
    {
      name: 'Early Bird Special',
      type: 'special',
      code: 'USA740',
      amount: 1,
    },
    {
      name: 'Reiserücktrittsversicherung Plus',
      type: 'insurance',
      code: '13361',
    },
    ...,
  ], 
  travellers: [
    {
      type: TravellerType,
      firstName: 'john',
      lastName: 'doe',
      dateOfBirth: '1983-11-08',
    },
    {
      type: TravellerType,
      dateOfBirth: '2002-02-22',
    },
    {
      type: TravellerType,
    },
    ...
  ],
}

Debugging

The connector provides some debugging output - either you set the connectionOption debug to true or you add the parameter "&debug" to your URL. You will see the debug output in the browser console.

How to test ...

... the code

Write a test and execute npm run test - the unit tests will tell you, if everything is fine. Personal goal: Try to increase the test coverage to ~100%.

... the connector

We prepared a test file. Just execute npm run serve and use the provided URL.

... your implementation

You can open your implementation in the Staging-System of the BM and execute your tests.