feat(SW-2116): Use refId instead of confirmationNumber

This commit is contained in:
Michael Zetterberg
2025-05-04 11:11:15 +02:00
parent f681fa7675
commit b910b6a313
59 changed files with 491 additions and 310 deletions

View File

@@ -11,10 +11,10 @@ import {
getBookingConfirmation,
getProfileSafely,
} from "@/lib/trpc/memoizedRequests"
import { decrypt } from "@/server/routers/utils/encryption"
import { auth } from "@/auth"
import { getIntl } from "@/i18n"
import { parseRefId } from "@/utils/refId"
import { isValidSession } from "@/utils/session"
import AdditionalInfoForm from "../../FindMyBooking/AdditionalInfoForm"
@@ -32,18 +32,19 @@ import styles from "./receipt.module.css"
import { CurrencyEnum } from "@/types/enums/currency"
export async function Receipt({ refId }: { refId: string }) {
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")