feat(SW-2116): Use refId instead of confirmationNumber
This commit is contained in:
@@ -52,7 +52,7 @@ export default function Header({
|
||||
url: hotel.contactInformation.websiteUrl,
|
||||
}
|
||||
|
||||
const bookingUrlPath = `${myStay[lang]}?RefId=${refId}`
|
||||
const bookingUrlPath = `${myStay[lang]}?RefId=${encodeURIComponent(refId)}`
|
||||
|
||||
return (
|
||||
<header className={styles.header}>
|
||||
|
||||
@@ -20,13 +20,13 @@ import { CurrencyEnum } from "@/types/enums/currency"
|
||||
export function LinkedReservation({
|
||||
checkInTime,
|
||||
checkOutTime,
|
||||
confirmationNumber,
|
||||
refId,
|
||||
roomIndex,
|
||||
roomNumber,
|
||||
}: LinkedReservationProps) {
|
||||
const lang = useLang()
|
||||
const { data, refetch, isLoading } = trpc.booking.get.useQuery({
|
||||
confirmationNumber,
|
||||
refId,
|
||||
lang,
|
||||
})
|
||||
const {
|
||||
|
||||
@@ -8,12 +8,12 @@ import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { BookingStatusEnum } from "@/constants/booking"
|
||||
import { trpc } from "@/lib/trpc/client"
|
||||
import { getBookedHotelRoom } from "@/server/routers/booking/utils"
|
||||
import { useBookingConfirmationStore } from "@/stores/booking-confirmation"
|
||||
|
||||
import { convertToChildType } from "@/components/HotelReservation/utils/convertToChildType"
|
||||
import { getPriceType } from "@/components/HotelReservation/utils/getPriceType"
|
||||
import BookedRoomSidePeek from "@/components/SidePeeks/BookedRoomSidePeek"
|
||||
import { getBookedHotelRoom } from "@/utils/booking"
|
||||
|
||||
import styles from "./sidePeek.module.css"
|
||||
|
||||
|
||||
@@ -14,14 +14,13 @@ export default async function Rooms({
|
||||
checkInTime,
|
||||
checkOutTime,
|
||||
mainRoom,
|
||||
linkedReservations,
|
||||
}: BookingConfirmationRoomsProps) {
|
||||
const intl = await getIntl()
|
||||
|
||||
return (
|
||||
<section className={styles.rooms}>
|
||||
<div className={styles.room}>
|
||||
{linkedReservations.length ? (
|
||||
{booking.linkedReservations.length ? (
|
||||
<Typography variant="Title/Subtitle/md">
|
||||
<h2 className={styles.roomTitle}>
|
||||
{intl.formatMessage(
|
||||
@@ -42,7 +41,7 @@ export default async function Rooms({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{linkedReservations.map((reservation, idx) => (
|
||||
{booking.linkedReservations.map((reservation, idx) => (
|
||||
<div className={styles.room} key={reservation.confirmationNumber}>
|
||||
<Typography variant="Title/Subtitle/md">
|
||||
<h2 className={styles.roomTitle}>
|
||||
@@ -57,7 +56,7 @@ export default async function Rooms({
|
||||
<LinkedReservation
|
||||
checkInTime={checkInTime}
|
||||
checkOutTime={checkOutTime}
|
||||
confirmationNumber={reservation.confirmationNumber}
|
||||
refId={reservation.refId}
|
||||
roomIndex={idx + 1}
|
||||
roomNumber={idx + 2}
|
||||
/>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"
|
||||
import { encrypt } from "@/server/routers/utils/encryption"
|
||||
|
||||
import HotelDetails from "@/components/HotelReservation/BookingConfirmation/HotelDetails"
|
||||
import PaymentDetails from "@/components/HotelReservation/BookingConfirmation/PaymentDetails"
|
||||
@@ -23,22 +22,20 @@ import styles from "./bookingConfirmation.module.css"
|
||||
import type { BookingConfirmationProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation"
|
||||
|
||||
export default async function BookingConfirmation({
|
||||
confirmationNumber,
|
||||
refId,
|
||||
}: BookingConfirmationProps) {
|
||||
const bookingConfirmation = await getBookingConfirmation(confirmationNumber)
|
||||
const bookingConfirmation = await getBookingConfirmation(refId)
|
||||
|
||||
if (!bookingConfirmation) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const { booking, hotel, room, roomCategories } = bookingConfirmation
|
||||
|
||||
if (!room) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const refId = encrypt(
|
||||
`${booking.confirmationNumber},${booking.guest.lastName}`
|
||||
)
|
||||
|
||||
const intl = await getIntl()
|
||||
return (
|
||||
<BookingConfirmationProvider
|
||||
@@ -62,7 +59,6 @@ export default async function BookingConfirmation({
|
||||
checkInTime={hotel.hotelFacts.checkin.checkInTime}
|
||||
checkOutTime={hotel.hotelFacts.checkin.checkOutTime}
|
||||
mainRoom={room}
|
||||
linkedReservations={booking.linkedReservations}
|
||||
/>
|
||||
<PaymentDetails />
|
||||
<Divider color="primaryLightSubtle" />
|
||||
|
||||
@@ -64,6 +64,7 @@ export function mapRoomState(
|
||||
name: room.name,
|
||||
packages: booking.packages,
|
||||
rateDefinition: booking.rateDefinition,
|
||||
refId: booking.refId,
|
||||
roomFeatures: booking.packages.filter((p) => p.type === "RoomFeature"),
|
||||
roomPoints: booking.roomPoints,
|
||||
roomPrice: booking.roomPrice,
|
||||
|
||||
Reference in New Issue
Block a user