IReservationService
Red Apps are able to obtain the Reservation data from the PNR (Passenger Name Record) model.
Acquiring IReservationService
In order to be used, the IReservationService
has to be imported:
import {IReservationService} from "sabre-ngv-reservation/services/IReservationService";
Once imported, it can be obtained in a standard way:
const reservationService: IReservationService = getService(IReservationService);
Usage
This service provides only one method:
getReservation(): Promise<CommandMessageReservationRs>
It returns all data that PNR contains. See CommandMessageReservationRs
in TS docs to check available data in model.
Receiving PNR data with IReservationService
can look like this:
const reservationPromise: Promise<CommandMessageReservationRs> = reservationService.getReservation();
reservationPromise.then((commandMessageReservationRs: CommandMessageReservationRs) => {
const reservation = commandMessageReservationRs['Data'];
// insert code for handling received data
}).catch((error) => {
console.error("Error while receiving reservation", error);
});
Note
|
Sample com.sabre.redapp.example3.web.reservation presents details of receiving reservation model and displaying them in modal. |