Login / Sign Up

Embedded PMS Booking Javascript Bridge

Jamie McDonald

HXP Admin

If you PMS Booking solution is to be used with the holidaymaker™ url embeds module, you have the ability to ‘callback’ to the app once a booking is complete to notify the app that the process has finished, but to also potentially log the user in with their new booking.

The new booking would be added in these circumstances :

  • The user is using the app after choosing ‘Just Browsing’ therefore do not have a current booking
  • The user is using the app logged in with a current booking, however that booking is now in the past

The booking can only successfully be queried if it is available from the standard data sources of those PMS solutions within holidaymaker™. Even if you know the booking would not be available yet, or the user is not in either of the above circumstances, the callback is still beneficial, as it is then marked (anonymously) in our stats and analytics engines.

The following PMSs are supported:

  • RMS Cloud
  • ParcVu
  • Booking Experts
  • GemaPark
  • CampManager
  • Elite Dynamics
  • Prophet Bookings
  • Bespoke PMSs – With booking ID / Surname API available
  • Bespoke PMSs – With app set to ‘manual’ booking mode

Note: In a future release of the holidaymaker™ app surfaces, for PMSs which do not support multiple bookings, you will have the ability to add multiple bookings to your app, so this will open up a 3rd segment of users where the booking will be added : The user is using the app logged in with a current or future booking, and this booking will be added to their set of bookings

Accessing the Bridge

The bridge is added to the Android or iOS web view when loaded within the app – the name of this is HMPMSBridge

This currently includes a single function called bookingComplete(bookingJSON) – This should be sent a string of JSON defined below (not an object)

The bridge is normally found in either the JS window, or in the webkit message handlers

Example

var bookingJSON = {
   // ...
};

var definedBridge = null;
if (window.webkit && window.webkit.messageHandlers) {
  definedBridge = window.webkit.messageHandlers['HMPMSBridge'];
} else {
  definedBridge = window['HMPMSBridge'];
}

if (definedBridge != null) {
  definedBridge.bookingComplete(JSON.stringify(bookingJSON));
}

Expected Booking JSON

Properties for all PMSs

  • type : String : PMS Enumeration used within holidaymaker™ with the following valid options : prophet | parcvu | gemapark | elitedynamics | rms | campmanager | bespokepms | manual – (booking experts should use ‘parcvu‘)
  • total : Double : Total of the booking order. Can also be sent as a string if required by your solution
  • amountPaid : Double : Amount the user has just paid when making the booking. This may be different than the total if they have only paid a deposit
  • bookingID : String : Booking ID of new booking – This would be the end user visible ID they would normally use to add a booking to the app, or would be rendered in the app. This is also used as a fallback to add the booking to the app if they have been set to to manual mode
  • arrival : Date String : Arrival date of booking formatted as ‘YYYY-MM-DD’ – This is used in the confirmation message shown to the user in the app, as well as a fallback to add the booking to the app if they have been set to to manual mode
  • departure : Date String : Departure date of booking formatted as ‘YYYY-MM-DD’ – This is only used as a fallback to add the booking to the app if they have been set to to manual mode

Properties just for GemaPark or Prophet Bookings

  • customer : String : An encrypted version of the GemaPark or PRBok customer hash / token of the user who completed the booking used to sign them in without a password

Properties just for  Campamanger or Prophet Bookings

  • park : String : The group-site key of the park booked for. Only applicable to multi-park holidaymaker™ installs – definitions of these keys would be provided to you by holidaymaker™ on a client by client basis

Properties for other PMSs

  • lastName : String : Last name / surname of booked customer – used to login with the current booking ID

Note: Normally the surname and booking ID of a user is used when they add a booking to the app for most of our PMSs – however some clients may choose to use our ‘manual booking’ option if they have high number of guests who may book on an OTA such as Hoseasons. On this option the user instead adds their own arrival, departure, first name, and booking ID to the app to create a ‘sudo login’ for them. This information should also be sent as we may change clients between these two modes remotely.

Warning: Both GemaPark and Prophet Bookings use a password for authentication, however we are able to login to these using a customer hash/token. For security this should not be sent via javascript in a raw form and instead should be encrypted with some kind of time sensitivity. We can then add a hook to our infrastructure to then decrypt this before attempting the login to their APIs.

//Many PMSs would use surname, and booking id to login,  with the extra information for manual login fall back and user feedback message in the app
var bookingJSON = {
  type: 'parcvu',
  total: 450.5,
  amountPaid: 110.5,
  firstName: "Jamie",  
  lastName: "KeyDigital",
  bookingID: "11223344", 
  arrival: "2024-11-11", 
  departure: "2024-11-15"
};

//Campmanager is very similar, however also requires the 'park' key, so holidaymaker knows which park to attempt to login with
var bookingJSON = {
  type: 'campmanager',
  total: 450.5,
  amountPaid: 110.5,
  firstName: "Jamie",  
  lastName: "KeyDigital",
  bookingID: "11223344", 
  arrival: "2024-11-11", 
  departure: "2024-11-15",
  park: "key-park-one"
};

//GemaPark does not require the 'lastName', or the 'park', but does require an encrypted 'customer' token to attempt the login
var bookingJSON = {
  type: 'gemapark',
  total: 450.5,
  amountPaid: 110.5,
  firstName: "Jamie",  
  bookingID: "11223344", 
  arrival: "2024-11-11", 
  departure: "2024-11-15",
  customer: "an-encrypted-user-token" 
};

//Prophet bookings requires both the additional 'park' node as well as the 'customer' encrypted user token
var bookingJSON = {
  type: 'prophet',
  total: 450.5,
  amountPaid: 110.5,
  firstName: "Jamie",  
  bookingID: "11223344", 
  arrival: "2024-11-11", 
  departure: "2024-11-15",
  park: "key-park-one",
  customer: "an-encrypted-user-token" 
};

// ...

//Trigger on page ready/load or similar
var definedBridge = null;
if (window.webkit && window.webkit.messageHandlers) {
  definedBridge = window.webkit.messageHandlers['HMPMSBridge'];
} else {
  definedBridge = window['HMPMSBridge'];
}

if (definedBridge != null) {
  definedBridge.bookingComplete(JSON.stringify(bookingJSON));
}

Note: The information provided to the app in this JSON packet is disposed of after the trigger has been made. However if the login process is triggered using this information, some of that information would be retained within the app itself, in the same way a user had manually logged in using that same data.

If you require additions to your privacy policy, or require additions to the privacy policies used for the specific clients mobile apps, then please speak to your contacts at holidaymaker™ and we will gladly make, or assist with changes and additions