diff --git a/components/HotelReservation/EnterDetails/Breakfast/index.tsx b/components/HotelReservation/EnterDetails/Breakfast/index.tsx index 3881340e0..00d5ab4cc 100644 --- a/components/HotelReservation/EnterDetails/Breakfast/index.tsx +++ b/components/HotelReservation/EnterDetails/Breakfast/index.tsx @@ -78,8 +78,8 @@ export default function Breakfast({ packages }: BreakfastProps) { ? intl.formatMessage( { id: "breakfast.price.free" }, { - amount: pkg.localPrice?.price, - currency: pkg.localPrice?.currency, + amount: pkg.localPrice.price, + currency: pkg.localPrice.currency, free: (str) => {str}, strikethrough: (str) => {str}, } @@ -87,8 +87,8 @@ export default function Breakfast({ packages }: BreakfastProps) { : intl.formatMessage( { id: "breakfast.price" }, { - amount: pkg.localPrice?.price, - currency: pkg.localPrice?.currency, + amount: pkg.localPrice.price, + currency: pkg.localPrice.currency, } ) } diff --git a/components/HotelReservation/SelectRate/RoomSelection/RateSummary/index.tsx b/components/HotelReservation/SelectRate/RoomSelection/RateSummary/index.tsx index 745f864cc..320fccfc5 100644 --- a/components/HotelReservation/SelectRate/RoomSelection/RateSummary/index.tsx +++ b/components/HotelReservation/SelectRate/RoomSelection/RateSummary/index.tsx @@ -37,8 +37,8 @@ export default function RateSummary({ (pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM ) - const petRoomPrice = petRoomPackage?.localPrice?.totalPrice ?? null - const petRoomCurrency = petRoomPackage?.localPrice?.currency ?? null + const petRoomPrice = petRoomPackage?.localPrice.totalPrice ?? null + const petRoomCurrency = petRoomPackage?.localPrice.currency ?? null const checkInDate = new Date(roomsAvailability.checkInDate) const checkOutDate = new Date(roomsAvailability.checkOutDate) diff --git a/server/routers/hotels/output.ts b/server/routers/hotels/output.ts index aed677b57..957ed20ad 100644 --- a/server/routers/hotels/output.ts +++ b/server/routers/hotels/output.ts @@ -780,7 +780,11 @@ const breakfastPackagePriceSchema = z price: z.string(), totalPrice: z.string(), }) - .optional() // TODO: Remove optional when the API change has been deployed + .default({ + currency: CurrencyEnum.SEK, + price: "0", + totalPrice: "0", + }) // TODO: Remove optional and default when the API change has been deployed export const breakfastPackageSchema = z.object({ code: z.string(), diff --git a/server/routers/hotels/schemas/packages.ts b/server/routers/hotels/schemas/packages.ts index b4ff7d57e..738da80ce 100644 --- a/server/routers/hotels/schemas/packages.ts +++ b/server/routers/hotels/schemas/packages.ts @@ -1,6 +1,7 @@ import { z } from "zod" import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter" +import { CurrencyEnum } from "@/types/enums/currency" export const getRoomPackagesInputSchema = z.object({ hotelId: z.string(), @@ -13,11 +14,16 @@ export const getRoomPackagesInputSchema = z.object({ export const packagePriceSchema = z .object({ - currency: z.string(), + currency: z.nativeEnum(CurrencyEnum), price: z.string(), totalPrice: z.string(), }) - .optional() // TODO: Remove optional when the API change has been deployed + .optional() + .default({ + currency: CurrencyEnum.SEK, + price: "0", + totalPrice: "0", + }) // TODO: Remove optional and default when the API change has been deployed export const packagesSchema = z.object({ code: z.nativeEnum(RoomPackageCodeEnum),