Plugins Workflow
Introduction
HotelX Plugins are a separate Go application that get compiled into the main application and run natively in our servers that add or modify specific functionalities. Plugins are specified at the request level, or be configured by default.
Flows
HotelX query or mutation determine what flow is executed. Plugins can be executed in different Queries
or Mutations
:
- Search
- Quote
- Book
- Booking
- Cancel
Steps
Step is the minium container where plugins are executed sequentially.
Step | When it’s executed |
---|---|
Request | After Client requests message to HotelX. |
Request Access | Before send request to Supplier using Access and after Accesses has been calculated. |
Response Option | After Supplier responds message. For every option returned. |
Response Access | After all Access options has been responded. |
Response | Before HotelX responds message to to Client . |
Plugin Types
Plugin types supported by HotelX:
- [PRE_STEP]: First execution on every step.
- HOTEL_MAP: Hotel mapping codes.
- BOARD_MAP: Board mapping codes.
- ROOM_MAP: Room mapping codes.
- PROMOTION_MAP: Promotion mapping codes.
- AMENITY_MAP: Amenity mapping codes.
- CURRENCY_CONVERSION: Currency rate conversion.
- COMMISSION: Calculate the net price.
- AGGREGATION: Aggregate multiple
supplier
options. - MARKETS_GROUP: Groups the Search result by markets that share the same product.
- [POST_STEP]: Last execution on every step.
Plugin Names
- hotel_map: Hotel mapping codes.
- board_mapX: Board mapping codes.
- room_mapX: Room mapping codes.
- promotion_mapX: Promotion mapping codes.
- amenity_mapX: Amenity mapping codes.
- currency_exchange: Currency rate conversion.
- commission: Calculate the net price.
- cheapest_price: Aggregate multiple
supplier
options. - search_by_destination: Enables search query to request per destinations by converting destination codes to hotel codes.
- add_parameterX: Allows Add Parameter to the access created for a supplier.
- blacklist: Filter out specific hotels from the Search query.
- booking_detail_persistence: Allows to store and avoid duplicated bookings.
- market_groupX: Groups the Search result by markets that share the same product.
- preference: To give preference to the options that match the preference rules.
- safety_margin: Discards those options that have a commission higher than expected.
- genvcc: Creates a virtual credit card at Book step.
Plugin Context Execution
Once message hits HotelX, it flows over different flows and steps. That’s why plugins are executed in different contexts.
Context allows:
- Read objects involved in current query and/or mutations.
- Read objects available in all HotelX operations.
Plugin Step Execution
HotelX determines the order and the plugins executed for each step. Notice that not all the plugins available in HotelX have a plugin type. The following table shows the plugins with plugin types and also the rest of the plugins with their corresponding plugin name.
search | quote | hotelBook | hotelCancel | hotelBooking | |
---|---|---|---|---|---|
Request | [PRE_STEP] HOTEL_MAP [POST_STEP] |
[PRE_STEP] [POST_STEP] |
[PRE_STEP] booking_detail_persistence genvcc [POST_STEP] |
[PRE_STEP] [POST_STEP] |
[PRE_STEP] [POST_STEP] |
Request Access | [PRE_STEP] add_parameterX MARKETS_GROUP blacklist [POST_STEP] |
[PRE_STEP] add_parameterX [POST_STEP] |
[PRE_STEP] add_parameterX [POST_STEP] |
[PRE_STEP] add_parameterX [POST_STEP] |
[PRE_STEP] add_parameterX [POST_STEP] |
Response Option | [PRE_STEP] BOARD_MAP ROOM_MAP AMENITY_MAP PROMOTION_MAP CURRENCY_CONVERSION COMMISSION safety_margin [POST_STEP] |
[PRE_STEP]CURRENCY_CONVERSION COMMISSION [POST_STEP] |
[PRE_STEP] CURRENCY_CONVERSION COMMISSION [POST_STEP] |
[PRE_STEP] CURRENCY_CONVERSION COMMISSION [POST_STEP] |
[PRE_STEP] CURRENCY_CONVERSION COMMISSION [POST_STEP] |
Response | [PRE_STEP] AGGREGATION preference[POST_STEP] |
[PRE_STEP] [POST_STEP] |
[PRE_STEP] [POST_STEP] |
[PRE_STEP] [POST_STEP] |
[PRE_STEP] [POST_STEP] |
Ftp Endpoint
You will receive access credentials to the FTP server with your Onboarding Welcome Pack
Directory Format
Root path
The structure of the directory should be in the below format, all files should be inside this directory
/F[Folder code]_[Unique code]/HotelX_[Unique code]/
F[Folder code]_[Unique code]
- Folder code: corresponds to the folder number.
- Unique code: corresponds to the folder unique code in our system.
HotelX_[Unique code]
- Unique code: corresponds to the HotelX unique code in our system.
Example
/F**0**\_**178**/HotelX\_**179**
Updating ftp data
We have two options:
- Reprocessing the same data by renaming the file and just removing “_processed”.
Example: SourceContext_DestinationContext_entity_map_processed.csv –> example.csv - Changing the data by deleting the processed file and uploading a new one with new information.
Deleting ftp data
Uploading a new file only with headers (no information).
Code Source, Code Destination
Entities processed types:
Sequential
Type of processing sequentially, the first rule that coincides will be the one applied.
Supplier
Rules applied or indexed at the supplier level.
Access
Rules applied or indexed at the access level.
Hotel
The key to indexing is of the hotel type, we hope that the reference is by a hotel code where the type will be given by the context.
Destination
Idem hotel.
We have different combinations values from entities values this table show this combinations:
entity | chainCodes | destinationCodes | hotelCodes |
---|---|---|---|
chain | Yes | No | No |
hotel | No | No | Yes |
destination | No | Yes | No |
How to execute a plugin
A plugin execution can be specified in any request’s HotelSettingsInput and it must specify in which step it should be executed. The plugin type and name are mandatory in order to identify a plugin instance.
"plugins": [
{
"step": "PluginStepType",
"pluginsType": {
"name": "plugin name (its unique)",
"type": "PluginType",
"parameters": []
}
}
]