PNRManager

This plugin takes care of all the PNR-related service operations by exposing a PNR manager class that contains all the necessary methods. The PNRManager class can be accessed invoking 'getPNRManager' method, which this plugin produces.

Exposed method
  • getPNRManager: It is the plugin that manages the PNR and adds different types of segments and carpassive observations. The method is exposed by the following one:

Copy
const pnrManager = methodsHelper.invoke('getPNRManager');

Methods types

Passive segment

Passive segment is a booking that is not currently available in the system but the system knows that it exists and will be available in the future.

A passive segment can also be a segment that does not actually belong to the GDS system. For example, if you hire a chauffeur, or a limousine. The travel agent contracts the service from the cruise or limousine company, and adds a passive segment to the booking (only to indicate that the travel booking also includes that).

Another example is, for example, NDC segments. If you look at it, in NDC bookings the segments are passive. It is the same example of cruises, they are segments "contracted" from third parties, which do not belong to the GDS.

Copy
interface CarPassive {
  CarRentalSegment?: CarRentalSegment;
  CarBookingParameters?: CarBookingParameters;
  SegmentPosition: number;
}

You have a example in the car section.

Remark

Remark is a note that users add to a reservation. They can be added, inserted in the required position, modified, and deleted.

Copy
type Remark = {
  Operation: 'Delete' | 'Modify' | 'Add' | 'Insert';
  NoteType: string;
  Text?: string;
  Number?: number;
  RemarkCategory?: RemarkCategory;
  InvoiceRemarksType?:
    | 'FreeformText'
    | 'DesignYourOwn'
    | 'CannedRemarks'
    | 'AgencyAccount'
    | 'ReplaceSignOnCode'
    | 'AccountingFreeText'
    | 'FareSave'
    | 'TicketNumberField'
    | 'BackOfficeAccountingField'
    | 'DefaultInvoiceLayout'
    | 'FaringAgent'
    | 'SACustomerNumber'
    | 'SDCustomerNumber'
    | 'CACustomerNumber'
    | 'CDCustomerNumber'
    | 'PhoneFieldOverride'
    | 'DollarSaver'
    | 'PrepaidTicketFee'
    | 'PrepaidTicketNumber'
    | 'PrepaidFeeWaived'
    | 'SeerviceFee'
    | 'CanadianRoutingCode'
    | 'UDIDS1'
    | 'UDIDS2'
    | 'StoredInvoice'
    | 'InvoiceDocumentsAccount';
};

You have a example in the remark section.

Methods

The getPNRManager class contains the following methods:

RetrievePNR

 

getActivePnr should be used instead of RetrievePNR.

Clean

With that method you can delete the queue by type, at the moment "carPassiveSegment", "remark". Function signature:

Copy
clean(hostConnectionId: string, key: string) {
Example
Copy
const hostConnectionId = 'EVO_1G_DU7_9FA7C5';
pnrManager.clean(hostConnectionId, 'carPassiveSegment');

Run

This asynchronous method makes a service call to fes-pnr-management to obtain all passive segments, such as cars, hotels, or helicopters, and clears all the saved requests. If you do not make the correct request, the saved requests remain. Function signature:

Copy
function run: (hostConnectionId: string) => Promise<SuccessResponse[]>;
Example
Copy
pnrManager.addCarPassiveSegment(mockPassiveCarSegment);
const { response } = await pnrManager.run();

Car

AddCarPassiveSegment

With that method you can add a car segment in the queue. Function signature:

Copy
addCarPassiveSegment(carPassive: CarPassive, hostConnectionId: string) {
Example
Copy
const mockPassiveCarSegment = {
  CarRentalSegment: {
    Location: { Code: 'ROM' },
    LocationCategory: 3,
    LocationNumber: 63,
    StartDateTime: '2022-05-30 12:01',
    EndDateTime: '2022-05-31 12:03',
    Vendor: { Code: 'ZE' },
    CarType: { PseudoTypeCode: 'SCMR' },
    SegmentStatus: 'BK',
    SegmentNumberOfCars: 1,
    ConfirmationNumber: '12345',
    RateTotal: {
      RateType: '1',
      UnitRateAmount: 1200,
      Currency: { Code: 'EUR', DecimalDigits: 2 },
      IncludedMileagePerDayUnit: 2,
      IncludedMileagePerDay: 400,
      ExtraMileageRate: 0.73,
    },
    RateCode: 'A543',
    AssociateRemarks: [{ Text: 'Free Text for the remark' }],
  },
  CarBookingParameters: {
    DropLocation: 'MILC62',
    FirstNameOverride: 'GUARDIOLA',
    LastNameOverride: 'PEP',
  },
  SegmentPosition: -1,
};
const hostConnectionId = 'EVO_1G_DU7_9FA7C5';
pnrManager.addCarPassiveSegment(mockPassiveCarSegment, hostConnectionId);

Remark

AddRemark

With that method you can add a Remark in the queue. Function signature:

Copy
addRemark(remark: Remark, hostConnectionId: string)
Example
Copy
const remark = {
  Operation: 'Add',
  NoteType: 'General',
  Text: 'General test',
  RemarkCategory: {
    Code: 'YY',
  },
};
const hostConnectionId = 'EVO_1G_DU7_9FA7C5';
pnrManager.addRemark(mockRemark, hostConnectionId);

InsertRemark

With that method you can insert a Remark in the queue. Function signature:

Copy
insertRemark(remark: Remark, hostConnectionId: string)
Example
Copy
const remark = {
  Operation: 'Insert',
  NoteType: 'General',
  Number: 1,
  Text: 'General test',
  RemarkCategory: {
    Code: 'YY',
  },
};
const hostConnectionId = 'EVO_1G_DU7_9FA7C5';
pnrManager.insertRemark(mockRemark, hostConnectionId);

DeleteRemark

With that method you can delete a Remark from the queue. Function signature:

Copy
deleteRemark(remark: Remark, hostConnectionId: string)
Example
Copy
const mockRemarkDelete = {
  Operation: 'Delete',
  NoteType: 'General',
  Text: 'General test',
  Number: 1,
  RemarkCategory: {
    Code: 'YY',
  },
};
const hostConnectionId = 'EVO_1G_DU7_9FA7C5';
pnrManager.deleteRemark(mockRemarkDelete, hostConnectionId);

ModifyRemark

With that method you can modify a Remark from the queue. Function signature:

Copy
modifyRemark(remark: Remark, hostConnectionId: string)
Example
Copy
const mockRemarkModify = {
  Operation: 'Modify',
  NoteType: 'General',
  Text: 'General test',
  Number: 1,
  RemarkCategory: {
    Code: 'YY',
  },
};
const hostConnectionId = 'EVO_1G_DU7_9FA7C5';
pnrManager.modifyRemark(mockRemarkModify, hostConnectionId);

Request

The queue used by pnrManager is of type Runrequest, which will contain both carpassive and remarks.

Copy
RunRequest = {
  car: {
    url: string;
    carPassiveRequests: CarPassiveRequest;
  };
  remark: {
    url: string;
    remarkRequests: RemarkRequest;
  };
};

The car parameter (carPassiveRequests) is a Record of CarPassive[].

Copy
interface CarPassive {
  CarRentalSegment?: CarRentalSegment;
  CarBookingParameters?: CarBookingParameters;
  SegmentPosition: number;
}

The parameter remark (remarkRequests) is a record of Remark[].

Copy
type Remark = {
  Operation: 'Delete' | 'Modify' | 'Add' | 'Insert';
  NoteType: string;
  Text?: string;
  Number?: number;
  RemarkCategory?: RemarkCategory;
  InvoiceRemarksType?:
    | 'FreeformText'
    | 'DesignYourOwn'
    | 'CannedRemarks'
    | 'AgencyAccount'
    | 'ReplaceSignOnCode'
    | 'AccountingFreeText'
    | 'FareSave'
    | 'TicketNumberField'
    | 'BackOfficeAccountingField'
    | 'DefaultInvoiceLayout'
    | 'FaringAgent'
    | 'SACustomerNumber'
    | 'SDCustomerNumber'
    | 'CACustomerNumber'
    | 'CDCustomerNumber'
    | 'PhoneFieldOverride'
    | 'DollarSaver'
    | 'PrepaidTicketFee'
    | 'PrepaidTicketNumber'
    | 'PrepaidFeeWaived'
    | 'SeerviceFee'
    | 'CanadianRoutingCode'
    | 'UDIDS1'
    | 'UDIDS2'
    | 'StoredInvoice'
    | 'InvoiceDocumentsAccount';
};

Depending on the Operation or the NoteType selected, we need to put some specific params or we don't have to put them.

Depending on Operation field:

  • If Operation == "Add" -> Number field is not required. We can put that Number field, but the remark will be added at the end.

  • If Operation == "Modify" -> Number field is mandatory. We need to specify the remark number that we want to modify.

  • If Operation == "Delete" -> Number field is mandatory. We need to specify the remark number that we want to delete.

  • If Operation == "Insert" -> Number field is mandatory. We need to specify the remark number that we want to insert. That operation adds the remark in the position that we specify.

Depending on NoteType field:

  • If NoteType == "Invoice" -> InvoiceRemarksType field is mandatory.

  • If NoteType == "General" -> RemarkCategory.Code can have any value.

  • If NoteType == "Confidential" or "Historical" -> RemarkCategory.Code can be only a single character.

Responses

We have different types of responses, depending on the objects that are sent in the queue.

Car

Car's response

Copy
{
  "SegmentSellResult": {
    "SegmentNumber": 1,
    "InformationMessages": [],
    "WarningMessages": [],
    "ErrorMessages": []
  },
  "BookingFile": {},
  "Successful": true
}

Remark

Remark's response

Copy
{
  "BookingFile": {},
  "Successful": true
}