[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


API Specification

Endpoint

POST /api/pelican/sync-room-rateplan

Request Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer <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)


Data Mapping

Mapping Room (Triplabook x Triplalink x Pelican HEM051)

NoTriplaBookTriplalink (Rooms)Pelican (HEM051)
1nameNameroomtypenm
5max_adultjson in descriptionmaxAdult
2, 3, 4, 6-10code, position, etc.json in description(empty)

Mapping RatePlan (Triplabook x Triplalink x Pelican HER131)

NoTriplaBookTriplalink (Rate_Plans)Pelican (HER131)
1nameNametiername
2codejson in descriptiontiercode
3start_datestartperiodfrom
4end_dateendperiodto
5activedeleted_atstsactv
6min_stayMinNight(empty)
7max_staymaxnights(empty)
11max_guestMaximum_Guests_Allowed(empty)
8, 9, 10charge_type, position, etc.json in description(empty)