booking create: manage booking rates flow

This commit is contained in:
androidlover5842
2026-01-29 12:09:43 +05:30
parent 29065cee22
commit 5f522ca3ab
17 changed files with 1033 additions and 18 deletions

121
AGENTS.md
View File

@@ -63,7 +63,7 @@ Response: List of BookingListItem with id, status, guestId, source, times, count
### Check-in (creates RoomStay)
POST /properties/{propertyId}/bookings/{bookingId}/check-in
Auth: ADMIN/MANAGER/STAFF
Auth: ADMIN/MANAGER
Body
Required:
@@ -75,7 +75,7 @@ Optional:
- checkInAt (String)
- transportMode (String enum)
- nightlyRate (Long)
- rateSource (PRESET|NEGOTIATED|OTA)
- rateSource (MANUAL|RATE_PLAN|OTA)
- ratePlanCode (String)
- currency (String)
- notes (String)
@@ -84,8 +84,8 @@ Optional:
"roomIds": ["uuid1","uuid2"],
"checkInAt": "2026-01-28T12:00:00+05:30",
"nightlyRate": 2500,
"rateSource": "NEGOTIATED",
"ratePlanCode": "WEEKEND",
"rateSource": "MANUAL",
"ratePlanCode": "EP",
"currency": "INR",
"notes": "Late arrival"
}
@@ -95,7 +95,7 @@ Optional:
### Pre-assign room stay
POST /properties/{propertyId}/bookings/{bookingId}/room-stays
Auth: ADMIN/MANAGER/STAFF
Auth: ADMIN/MANAGER
Body
Required:
@@ -107,7 +107,7 @@ Required:
Optional:
- nightlyRate (Long)
- rateSource (PRESET|NEGOTIATED|OTA)
- rateSource (MANUAL|RATE_PLAN|OTA)
- ratePlanCode (String)
- currency (String)
- notes (String)
@@ -117,13 +117,63 @@ Optional:
"fromAt": "2026-01-29T12:00:00+05:30",
"toAt": "2026-01-30T10:00:00+05:30",
"nightlyRate": 2800,
"rateSource": "PRESET",
"ratePlanCode": "WEEKEND",
"rateSource": "RATE_PLAN",
"ratePlanCode": "EP",
"currency": "INR"
}
---
### Active room stays
GET /properties/{propertyId}/room-stays/active
Auth: any member except AGENT-only
Response: list of ActiveRoomStayResponse
[
{
"roomStayId":"uuid",
"bookingId":"uuid",
"guestId":"uuid-or-null",
"guestName":"Name",
"guestPhone":"+9111...",
"roomId":"uuid",
"roomNumber":"101",
"roomTypeName":"DELUXE",
"fromAt":"2026-01-29T12:00:00+05:30",
"checkinAt":"2026-01-29T12:05:00+05:30",
"expectedCheckoutAt":"2026-01-30T10:00:00+05:30"
}
]
---
### Change room (move guest)
POST /properties/{propertyId}/room-stays/{roomStayId}/change-room
Auth: ADMIN/MANAGER/STAFF
Body
{
"newRoomId":"uuid",
"movedAt":"2026-01-30T15:00:00+05:30",
"idempotencyKey":"any-unique-string"
}
Response
{
"oldRoomStayId":"uuid",
"newRoomStayId":"uuid",
"oldRoomId":"uuid",
"newRoomId":"uuid",
"movedAt":"2026-01-30T15:00:00+05:30"
}
---
## 2) Guests
### Create guest + link to booking
@@ -310,7 +360,7 @@ Required:
- effectiveAt (String, ISO-8601)
- nightlyRate (Long)
- rateSource (PRESET|NEGOTIATED|OTA)
- rateSource (MANUAL|RATE_PLAN|OTA)
Optional:
@@ -320,7 +370,7 @@ Optional:
{
"effectiveAt": "2026-01-30T12:00:00+05:30",
"nightlyRate": 2000,
"rateSource": "NEGOTIATED",
"rateSource": "MANUAL",
"currency": "INR"
}
@@ -330,6 +380,57 @@ Response
---
### Check-out (closes all active stays on booking)
POST /properties/{propertyId}/bookings/{bookingId}/check-out
Auth: ADMIN/MANAGER
Body
{ "checkOutAt":"2026-01-30T10:00:00+05:30", "notes":"optional" }
Response: 204 No Content
---
### Bulk check-in (creates multiple room stays)
POST /properties/{propertyId}/bookings/{bookingId}/check-in/bulk
Body:
{
"stays": [
{
"roomId": "uuid",
"checkInAt": "2026-01-29T12:00:00+05:30",
"checkOutAt": "2026-01-30T10:00:00+05:30",
"nightlyRate": 6000,
"rateSource": "MANUAL",
"ratePlanCode": "EP",
"currency": "INR"
},
{
"roomId": "uuid",
"checkInAt": "2026-01-29T12:00:00+05:30",
"checkOutAt": "2026-01-30T10:00:00+05:30",
"nightlyRate": 8000,
"rateSource": "MANUAL",
"ratePlanCode": "EP",
"currency": "INR"
}
]
}
Behavior
- Creates one RoomStay per stay with its own rate.
- Sets booking CHECKED_IN, checkinAt = earliest stay check-in.
- If any checkOutAt provided, booking expectedCheckoutAt = latest of those.
- Rejects duplicate room IDs.
- Rejects invalid stay date range (checkOutAt <= checkInAt).
- Blocks occupied rooms.
## 6) Payments + Balance
### Add payment