[BNL-738] Get Room and Rateplan Triplabook and Sync
By: Sukerta Wayan | Date: Nov 22, 2025 | Priority: High
User Story / Objective
As a Pelican–CM Hub system, I want to automatically fetch and synchronize room and rateplan data from TriplaBook whenever new data arrives in Pelican, so that manual mapping in TriplaLink and TriplaBook is no longer required and data remains consistent across systems.
Requirements & Flow
- Endpoint: Pelican will call
POST /api/pelican/sync-room-rateplan.
- Payload: Must contain Pelican IDs.
- Flow: Validate request → Call TriplaBook API → Store data in Pelican DB & Link DB → Store mappings → Ensure transaction safety (Rollback on failure).
API Specification
Endpoint
POST
/api/pelican/sync-room-rateplan
Request Headers
| Header | Value |
Content-Type | application/json |
Authorization | Bearer <token> |
Request Body
{
"pelican_id": "HT12323435"
}
API Responses
200 OK Success Response
{
"success": true,
"message": "Rooms and rateplans synced successfully",
"data": {
"rooms": [
{
"id": 201,
"link_room_id": 1001,
"pelican_room_id": 301,
"triplabook_room_id": 701,
"name": "Deluxe Room"
}
],
"rateplans": [
{
"id": 301,
"link_rateplan_id": 2001,
"pelican_rateplan_id": 401,
"triplabook_rateplan_id": 801,
"name": "Room Only"
}
]
}
}
400 Bad Request Error Response
{
"success": false,
"message": "Validation failed",
"errors": {
"property_id": "required",
"triplabook_id": "required",
"pelican_id": "required"
}
}
500 Internal Server Error Error Response
{
"success": false,
"message": "Failed to sync room and rateplan. Transaction rolled back."
}
Tables Involved (Pelican DB & Link DB)
- Pelican DB:
rooms (HEM051), rateplans (HER131)
- Link DB:
rooms, rateplans, external_site_room (ID mapping), external_site_map (Property mapping)
Data Mapping
Mapping Room (Triplabook x Triplalink x Pelican HEM051)
| No | TriplaBook | Triplalink (Rooms) | Pelican (HEM051) |
| 1 | name | Name | roomtypenm |
| 5 | max_adult | json in description | maxAdult |
| 2, 3, 4, 6-10 | code, position, etc. | json in description | (empty) |
Mapping RatePlan (Triplabook x Triplalink x Pelican HER131)
| No | TriplaBook | Triplalink (Rate_Plans) | Pelican (HER131) |
| 1 | name | Name | tiername |
| 2 | code | json in description | tiercode |
| 3 | start_date | start | periodfrom |
| 4 | end_date | end | periodto |
| 5 | active | deleted_at | stsactv |
| 6 | min_stay | MinNight | (empty) |
| 7 | max_stay | maxnights | (empty) |
| 11 | max_guest | Maximum_Guests_Allowed | (empty) |
| 8, 9, 10 | charge_type, position, etc. | json in description | (empty) |