From 8dce04b9317542f9a9ec6fba0d764cc9f606abc6 Mon Sep 17 00:00:00 2001 From: Christel Westerberg Date: Wed, 12 Nov 2025 12:40:23 +0000 Subject: [PATCH] Merged in fix/STAY-22-GLA-check (pull request #3134) fix: Let API handle logic for if a booking is guaranteeable or not * fix: Let API handle logic for if a booking is guaranteeable or not Approved-by: Bianca Widstam Approved-by: Erik Tiekstra --- .../Actions/GuaranteeLateArrival/index.tsx | 22 ++++--------------- packages/trpc/lib/routers/booking/output.ts | 1 + 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/index.tsx index 5cce3d3f4..0bde2f589 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/ReferenceCard/Actions/Upcoming/ManageStay/Actions/GuaranteeLateArrival/index.tsx @@ -10,7 +10,6 @@ import Modal from "@/components/HotelReservation/MyStay/Modal" import { trackMyStayPageLink } from "@/utils/tracking" import ActionsButton from "../ActionsButton" -import { dateHasPassed } from "../utils" import Form from "./Form" import styles from "./guarantee.module.css" @@ -18,24 +17,11 @@ import styles from "./guarantee.module.css" export default function GuaranteeLateArrival() { const intl = useIntl() - const { checkInDate, checkInTime, guaranteeInfo, isCancelled, priceType } = - useMyStayStore((state) => ({ - checkInDate: state.bookedRoom.checkInDate, - checkInTime: state.hotel.hotelFacts.checkin.checkInTime, - guaranteeInfo: state.bookedRoom.guaranteeInfo, - isCancelled: state.bookedRoom.isCancelled, - priceType: state.bookedRoom.priceType, - })) + const { isGuaranteeable } = useMyStayStore((state) => ({ + isGuaranteeable: state.bookedRoom.isGuaranteeable, + })) - const isRewardNight = priceType === "points" - - const guaranteeable = - !guaranteeInfo && - !isCancelled && - !dateHasPassed(checkInDate, checkInTime) && - !isRewardNight - - if (!guaranteeable) { + if (!isGuaranteeable) { return null } diff --git a/packages/trpc/lib/routers/booking/output.ts b/packages/trpc/lib/routers/booking/output.ts index fa09920a4..bb4597bc2 100644 --- a/packages/trpc/lib/routers/booking/output.ts +++ b/packages/trpc/lib/routers/booking/output.ts @@ -230,6 +230,7 @@ export const bookingConfirmationSchema = z ) && data.attributes.reservationStatus !== BookingStatusEnum.Cancelled, isCancelable: !!data.links.cancel, isModifiable: !!data.links.modify, + isGuaranteeable: !!data.links.guarantee, canModifyAncillaries: !!data.links.addAncillary, // Typo from API cancellationNumber: data.attributes.cancelationNumber,