Edit Booking Technical Documentation
Hybrid
On the beginning after onMounted we'll send reservation_id, encrypted_id, and access_token like booking confirmation page. App Event: doSetupData Member:
{
"access_token": "q4lJKX6o7hbTkpBVjtNg9JApnBz8YaVWI2cyscvMYKc",
"reservation_id": "123456789"
}
Guest:
{
"encrypted_id": "gbqRB"
}
Web Event: onBackClicked
Trigger when click back button or cancel in Toolbar

Reservation Data
After get reservation id or encrypted_id can use this API to load content: Member: {{ base_api }}/reservations/{reservation_id}.json Payload:
{
"access_token": "access_token",
"provider": "hungryhub"
}
Guest: {{ base_api }}/reservations/{encrypted_id}/detail.json
Figma Link: (Pat has updated the link) https://www.figma.com/file/vSGoafWjCEq95LP0GhQ0Sn/Edit-Booking?type=design&node-id=769-3152&mode=design
Available Date
To get the available date we can use this API: {{ base_api }}/restaurants/{restaurant_id}/available_dates_based_on_packages.json Payload:
{
"adult": 2, // from selected adult
"end_date": "2023-12-30",
"for_delivery": false,
"is_dine_in": true,
"kids": 1,
"minor_version": "4", // to get availability value
"restaurant_package_ids": [1459], // from selected package
"start_date": "2023-12-20"
}
Available Time
To get available time we can use this API: {{ base_api }}/restaurants/{restaurant_id}/available_start_times_based_on_packages.json Payload:
{
"minor_version": "4",
"date": "2023-12-07", // from selected date
"adult": 1,
"kids": 0,
"minor_version": 4,
"restaurant_package_ids": [2850],
"is_order_now": false
}

Occasion Data
For occasion data we can use this API:
{{ base_api }}/dining_occasions.json

Save Modified Booking
API: {{ base_api }}/reservations/modify.json Method: PUT Payload:
{
"encrypted_id": "a18nda", // for guest
"access_token": "pum1NC8yulCuDFt5bipmx8vrbuxE5mfSULvuQWX2j", // for member
"source": "website",
"provider": "hungryhub",
"reservation_id": "564726",
"reservation": {
"adult": 2,
"kids": 0,
"restaurant_id": "1124",
"date": "2023-12-31",
"start_time": "18:00",
"special_request": "smoking room",
"dining_occasion_id": "12"
},
"packages": [
{
"id": "1459",
"quantity": 1
}
]
}
Validate the available date and time for that package if not available don't make it successful
After successful update trigger this event: Event Name: onModifySuccess
{
"payment_type": "promptpay/credit_card", // leaves empty if no prepayment
"encrypted_id": "q4lJK",
"reservation_id": "123456789"
}
Affected Features
For booking confirmation we have this event to modify booking: Event Name: onModifyBookingClicked Payload:
{
"modify_url": "https://hungryhub.com/reservations/my-reservation/GY0j6.html"
}
We need to update payload like this:
{
"modify_url": "https://hungryhub.com/reservations/my-reservation/GY0j6.html",
"encrypted_id": "q4lJK",
"reservation_id": "123456789"
}
We keep the modify_url to make it still work in our existing confirmation booking
Update edit booking logic scope to cover:
Possible changes:
- Package
- Package’s Type
- Date
- Time
- PAX (adult and kids)
- Special request and occasion
- Special Menu
- Payment (amount to be paid after modification)
Flow modify booking:
- After successful modification, old reservation ID should be cancelled
- If use prepayment modification, we need to treat new reservation id as temporary if users successfully paid we cancelled the old reservation ID
- Do we need to generate a temporary reservation on the client or backend?
Calculations need to check:
- Normal Package
- Pax (Adult and Kid Price)
- Dynamic Pricing
- Mix and Match
- Come More Pay Less
- Add on packages
- Decimal price
Some calculation references can see this: https://docs.google.com/spreadsheets/d/1P4RI9-IYJNNnil7EX2qEin-MHMB8W0Kp_sXDBiK11EU/edit?gid=0#gid=0