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
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user