feat(SW-2116): Use refId instead of confirmationNumber
This commit is contained in:
@@ -14,7 +14,6 @@ import {
|
||||
getProfileSafely,
|
||||
getSavedPaymentCardsSafely,
|
||||
} from "@/lib/trpc/memoizedRequests"
|
||||
import { decrypt } from "@/server/routers/utils/encryption"
|
||||
|
||||
import { auth } from "@/auth"
|
||||
import AdditionalInfoForm from "@/components/HotelReservation/FindMyBooking/AdditionalInfoForm"
|
||||
@@ -35,6 +34,7 @@ import Image from "@/components/Image"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
import MyStayProvider from "@/providers/MyStay"
|
||||
import { parseRefId } from "@/utils/refId"
|
||||
import { isValidSession } from "@/utils/session"
|
||||
import { getCurrentWebUrl } from "@/utils/url"
|
||||
|
||||
@@ -54,18 +54,19 @@ export default async function MyStay({
|
||||
notFound()
|
||||
}
|
||||
|
||||
const value = decrypt(refId)
|
||||
if (!value) {
|
||||
const { confirmationNumber, lastName } = parseRefId(refId)
|
||||
|
||||
if (!confirmationNumber) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const session = await auth()
|
||||
const isLoggedIn = isValidSession(session)
|
||||
|
||||
const [confirmationNumber, lastName] = value.split(",")
|
||||
const bv = cookies().get("bv")?.value
|
||||
let bookingConfirmation
|
||||
if (isLoggedIn) {
|
||||
bookingConfirmation = await getBookingConfirmation(confirmationNumber)
|
||||
bookingConfirmation = await getBookingConfirmation(refId)
|
||||
} else if (bv) {
|
||||
const params = new URLSearchParams(bv)
|
||||
const firstName = params.get("firstName")
|
||||
@@ -110,9 +111,7 @@ export default async function MyStay({
|
||||
const fromDate = dt(booking.checkInDate).format("YYYY-MM-DD")
|
||||
const toDate = dt(booking.checkOutDate).format("YYYY-MM-DD")
|
||||
|
||||
const linkedReservationsPromise = getLinkedReservations({
|
||||
rooms: booking.linkedReservations,
|
||||
})
|
||||
const linkedReservationsPromise = getLinkedReservations(booking.refId)
|
||||
|
||||
const ancillariesInput = {
|
||||
fromDate,
|
||||
@@ -184,7 +183,7 @@ export default async function MyStay({
|
||||
breakfastPackages={breakfastPackages}
|
||||
lang={params.lang}
|
||||
linkedReservationsPromise={linkedReservationsPromise}
|
||||
refId={refId}
|
||||
refId={booking.refId}
|
||||
roomCategories={roomCategories}
|
||||
savedCreditCards={savedCreditCards}
|
||||
>
|
||||
@@ -212,7 +211,6 @@ export default async function MyStay({
|
||||
packages={breakfastPackages}
|
||||
user={user}
|
||||
savedCreditCards={savedCreditCards}
|
||||
refId={refId}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user