Block check-in for bookings not scheduled for today
All checks were successful
build-and-deploy / build-deploy (push) Successful in 36s

This commit is contained in:
androidlover5842
2026-02-04 16:32:31 +05:30
parent bc13816cbf
commit 0a65e022e0
2 changed files with 7 additions and 1 deletions

View File

@@ -1778,7 +1778,7 @@ BOOKING APIS
- 401 Unauthorized
- 403 Forbidden
- 404 Not Found (booking/room)
- 409 Conflict (booking not open/room unavailable)
- 409 Conflict (booking not open/room unavailable/future booking can't be checked in)
- Expected checkout API is this one:

View File

@@ -473,6 +473,12 @@ class BookingFlow(
if (booking.status != BookingStatus.OPEN) {
throw ResponseStatusException(HttpStatus.CONFLICT, "Booking not open")
}
val propertyZone = resolveZoneId(booking.property.timezone)
val today = OffsetDateTime.now(propertyZone).toLocalDate()
val expectedCheckInDate = booking.expectedCheckinAt?.atZoneSameInstant(propertyZone)?.toLocalDate()
if (expectedCheckInDate != null && expectedCheckInDate != today) {
throw ResponseStatusException(HttpStatus.CONFLICT, "Future booking can't be checked in")
}
val roomIds = request.stays.map { it.roomId }
if (roomIds.distinct().size != roomIds.size) {