diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/page.tsx index 4dae85539..ae9957e6a 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/[step]/page.tsx @@ -96,6 +96,11 @@ export default async function StepPage({ id: "Select payment method", }) + const roomPrice = + user && roomAvailability.memberRate + ? roomAvailability.memberRate?.localPrice.pricePerStay + : roomAvailability.publicRate!.localPrice.pricePerStay + return (
@@ -136,6 +141,7 @@ export default async function StepPage({ label={mustBeGuaranteed ? guaranteeWithCard : selectPaymentMethod} > = { - [BedTypeEnum.IN_ADULTS_BED]: "ParentsBed", - [BedTypeEnum.IN_CRIB]: "Crib", - [BedTypeEnum.IN_EXTRA_BED]: "ExtraBed", -} - -export function generateChildrenString(children: Child[]): string { - return `[${children - ?.map((child) => { - const age = child.age - const bedType = bedTypeMap[+child.bed] - return `${age}:${bedType}` - }) - .join(",")}]` -} - export function getPointOfInterests(hotels: HotelData[]): PointOfInterest[] { // TODO: this is just a quick transformation to get something there. May need rework return hotels.map((hotel) => ({ diff --git a/components/HotelReservation/EnterDetails/Payment/index.tsx b/components/HotelReservation/EnterDetails/Payment/index.tsx index d6ac1ac33..77821d8a2 100644 --- a/components/HotelReservation/EnterDetails/Payment/index.tsx +++ b/components/HotelReservation/EnterDetails/Payment/index.tsx @@ -31,6 +31,7 @@ import { toast } from "@/components/TempDesignSystem/Toasts" import { useHandleBookingStatus } from "@/hooks/booking/useHandleBookingStatus" import useLang from "@/hooks/useLang" +import { bedTypeMap } from "../../SelectRate/RoomSelection/utils" import GuaranteeDetails from "./GuaranteeDetails" import PaymentOption from "./PaymentOption" import { PaymentFormData, paymentSchema } from "./schema" @@ -49,7 +50,7 @@ function isPaymentMethodEnum(value: string): value is PaymentMethodEnum { } export default function Payment({ - hotelId, + roomPrice, otherPaymentOptions, savedCreditCards, mustBeGuaranteed, @@ -143,16 +144,19 @@ export default function Payment({ } initiateBooking.mutate({ - hotelId: hotelId, + hotelId: hotel, checkInDate: fromDate, checkOutDate: toDate, rooms: rooms.map((room) => ({ adults: room.adults, - children: room.children, + childrenAges: room.children?.map((child) => ({ + age: child.age, + bedType: bedTypeMap[parseInt(child.bed.toString())], + })), rateCode: room.rateCode, - roomTypeCode: bedType!.roomTypeCode, + roomTypeCode: bedType!.roomTypeCode, // A selection has been made in order to get to this step. guest: { - title: "", // TODO: do we need title? + title: "", firstName, lastName, email, @@ -170,6 +174,7 @@ export default function Payment({ room.packages?.includes(RoomPackageCodeEnum.ALLERGY_ROOM) ?? false, }, smsConfirmationRequested: data.smsConfirmation, + roomPrice, })), payment: { paymentMethod, diff --git a/server/routers/booking/input.ts b/server/routers/booking/input.ts index 61f552f57..b5bc65a30 100644 --- a/server/routers/booking/input.ts +++ b/server/routers/booking/input.ts @@ -32,6 +32,7 @@ const roomsSchema = z.array( petFriendly: z.boolean(), accessibility: z.boolean(), }), + roomPrice: z.number().or(z.string().transform((val) => Number(val))), }) ) diff --git a/types/components/hotelReservation/selectRate/section.ts b/types/components/hotelReservation/selectRate/section.ts index 66331816c..df9ec7a71 100644 --- a/types/components/hotelReservation/selectRate/section.ts +++ b/types/components/hotelReservation/selectRate/section.ts @@ -28,6 +28,7 @@ export interface BreakfastSelectionProps extends SectionProps { export interface DetailsProps extends SectionProps {} export interface PaymentProps { + roomPrice: string otherPaymentOptions: string[] savedCreditCards: CreditCard[] | null mustBeGuaranteed: boolean