From cb5c3bfcef36349efe6e6e16642bef371631e0f7 Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Wed, 19 Mar 2025 11:01:56 +0100 Subject: [PATCH] feat: SW-1589 Obtain bookingCode from booking object via store --- .../HotelReservation/EnterDetails/Payment/PaymentClient.tsx | 4 +--- apps/scandic-web/server/routers/booking/input.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx index 2fc000efe..23e2300f0 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Payment/PaymentClient.tsx @@ -73,7 +73,6 @@ export default function PaymentClient({ const lang = useLang() const intl = useIntl() const searchParams = useSearchParams() - const bookingCode = searchParams.get("bookingCode") const { booking, canProceedToPayment, rooms, totalPrice } = useEnterDetailsStore((state) => ({ @@ -342,7 +341,7 @@ export default function PaymentClient({ memberPrice: room.roomRate.memberRate?.localPrice.pricePerStay, publicPrice: room.roomRate.publicRate?.localPrice.pricePerStay, }, - bookingCode, + bookingCode: booking.bookingCode, roomTypeCode: room.bedType!.roomTypeCode, // A selection has been made in order to get to this step. smsConfirmationRequested: data.smsConfirmation, specialRequest: { @@ -363,7 +362,6 @@ export default function PaymentClient({ rooms, booking, isFlexRate, - bookingCode, ] ) diff --git a/apps/scandic-web/server/routers/booking/input.ts b/apps/scandic-web/server/routers/booking/input.ts index 65aaa1d19..33c034938 100644 --- a/apps/scandic-web/server/routers/booking/input.ts +++ b/apps/scandic-web/server/routers/booking/input.ts @@ -7,7 +7,7 @@ const roomsSchema = z .array( z.object({ adults: z.number().int().nonnegative(), - bookingCode: z.string().nullable(), + bookingCode: z.string().optional(), childrenAges: z .array( z.object({