Block check-in for bookings not scheduled for today
All checks were successful
build-and-deploy / build-deploy (push) Successful in 36s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 36s
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user