diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/BookingAlert/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/BookingAlert/index.tsx index ba0bb3780..dd25baae3 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/BookingAlert/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/BookingAlert/index.tsx @@ -36,6 +36,10 @@ function useBookingErrorAlert() { const selectRateReturnUrl = getSelectRateReturnUrl() + useEffect(() => { + setShowAlert(!!errorCode) + }, [errorCode]) + function getErrorMessage(errorCode: string | null) { switch (errorCode) { case BookingErrorCodeEnum.TransactionCancelled: @@ -43,6 +47,7 @@ function useBookingErrorAlert() { defaultMessage: "You have now cancelled your payment.", }) case BookingErrorCodeEnum.AvailabilityError: + case BookingErrorCodeEnum.NoAvailabilityForRateAndRoomType: return intl.formatMessage({ defaultMessage: "Unfortunately, one of the rooms you selected is sold out. Please choose another room to proceed.", @@ -121,7 +126,8 @@ export default function BookingAlert({ isVisible = false }: BookingAlertProps) { if (!showAlert) return null const isAvailabilityError = - errorCode === BookingErrorCodeEnum.AvailabilityError + errorCode === BookingErrorCodeEnum.AvailabilityError || + errorCode === BookingErrorCodeEnum.NoAvailabilityForRateAndRoomType return (
diff --git a/apps/scandic-web/constants/booking.ts b/apps/scandic-web/constants/booking.ts index c15000e29..aeb57f524 100644 --- a/apps/scandic-web/constants/booking.ts +++ b/apps/scandic-web/constants/booking.ts @@ -75,6 +75,7 @@ export enum BookingErrorCodeEnum { TransactionFailed = "TransactionFailed", BookingStateError = "BookingStateError", MembershipFailedError = "MembershipFailedError", + NoAvailabilityForRateAndRoomType = "NoAvailabilityForRateAndRoomType", } export const PAYMENT_METHOD_TITLES: Record<