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 { trackMyStayPageLink } from "@/utils/tracking"
|
||||||
|
|
||||||
import ActionsButton from "../ActionsButton"
|
import ActionsButton from "../ActionsButton"
|
||||||
import { dateHasPassed } from "../utils"
|
|
||||||
import Form from "./Form"
|
import Form from "./Form"
|
||||||
|
|
||||||
import styles from "./guarantee.module.css"
|
import styles from "./guarantee.module.css"
|
||||||
@@ -18,24 +17,11 @@ import styles from "./guarantee.module.css"
|
|||||||
export default function GuaranteeLateArrival() {
|
export default function GuaranteeLateArrival() {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
|
||||||
const { checkInDate, checkInTime, guaranteeInfo, isCancelled, priceType } =
|
const { isGuaranteeable } = useMyStayStore((state) => ({
|
||||||
useMyStayStore((state) => ({
|
isGuaranteeable: state.bookedRoom.isGuaranteeable,
|
||||||
checkInDate: state.bookedRoom.checkInDate,
|
}))
|
||||||
checkInTime: state.hotel.hotelFacts.checkin.checkInTime,
|
|
||||||
guaranteeInfo: state.bookedRoom.guaranteeInfo,
|
|
||||||
isCancelled: state.bookedRoom.isCancelled,
|
|
||||||
priceType: state.bookedRoom.priceType,
|
|
||||||
}))
|
|
||||||
|
|
||||||
const isRewardNight = priceType === "points"
|
if (!isGuaranteeable) {
|
||||||
|
|
||||||
const guaranteeable =
|
|
||||||
!guaranteeInfo &&
|
|
||||||
!isCancelled &&
|
|
||||||
!dateHasPassed(checkInDate, checkInTime) &&
|
|
||||||
!isRewardNight
|
|
||||||
|
|
||||||
if (!guaranteeable) {
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ export const bookingConfirmationSchema = z
|
|||||||
) && data.attributes.reservationStatus !== BookingStatusEnum.Cancelled,
|
) && data.attributes.reservationStatus !== BookingStatusEnum.Cancelled,
|
||||||
isCancelable: !!data.links.cancel,
|
isCancelable: !!data.links.cancel,
|
||||||
isModifiable: !!data.links.modify,
|
isModifiable: !!data.links.modify,
|
||||||
|
isGuaranteeable: !!data.links.guarantee,
|
||||||
canModifyAncillaries: !!data.links.addAncillary,
|
canModifyAncillaries: !!data.links.addAncillary,
|
||||||
// Typo from API
|
// Typo from API
|
||||||
cancellationNumber: data.attributes.cancelationNumber,
|
cancellationNumber: data.attributes.cancelationNumber,
|
||||||
|
|||||||
Reference in New Issue
Block a user