diff --git a/apps/scandic-web/__mocks__/hotelReservation/index.ts b/apps/scandic-web/__mocks__/hotelReservation/index.ts index b86ddb470..550530b72 100644 --- a/apps/scandic-web/__mocks__/hotelReservation/index.ts +++ b/apps/scandic-web/__mocks__/hotelReservation/index.ts @@ -42,11 +42,11 @@ export const booking: SelectRateSearchParams = { export const breakfastPackage: BreakfastPackage = { code: "BRF1", description: "Breakfast with reservation", - localPrice: { currency: "SEK", price: "99", totalPrice: "99" }, + localPrice: { currency: "SEK", price: 99, totalPrice: 99 }, requestedPrice: { currency: "EUR", - price: "9", - totalPrice: "9", + price: 9, + totalPrice: 9, }, packageType: PackageTypeEnum.BreakfastAdult as const, } diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx index 712aac448..e4aa355c9 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Breakfast/index.tsx @@ -80,7 +80,7 @@ export default function Breakfast() { ancillary={{ title: intl.formatMessage({ id: "Breakfast buffet" }), price: { - total: parseInt(pkg.localPrice.price), + total: pkg.localPrice.price, currency: pkg.localPrice.currency, included: pkg.code === BreakfastPackageEnum.FREE_MEMBER_BREAKFAST, diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/PriceDetailsTable/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/PriceDetailsTable/index.tsx index ab2c019f6..535f3ee5f 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/PriceDetailsTable/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/PriceDetailsTable/index.tsx @@ -139,16 +139,16 @@ export default function PriceDetailsTable({ /> {room.roomFeatures ? room.roomFeatures.map((feature) => ( - - )) + + )) : null} {room.bedType ? ( @@ -207,9 +207,7 @@ export default function PriceDetailsTable({ })} value={formatPrice( intl, - parseInt(room.breakfast.localPrice.price) * - room.adults * - diff, + room.breakfast.localPrice.price * room.adults * diff, room.breakfast.localPrice.currency )} /> @@ -268,6 +266,6 @@ export default function PriceDetailsTable({ )} - + ) } diff --git a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx index ec9c1a15f..23da5c80a 100644 --- a/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx +++ b/apps/scandic-web/components/HotelReservation/EnterDetails/Summary/UI/index.tsx @@ -227,7 +227,7 @@ export default function SummaryUI({ {formatPrice( intl, - parseInt(feature.localPrice.price), + feature.localPrice.price, feature.localPrice.currency )} @@ -329,9 +329,7 @@ export default function SummaryUI({ {formatPrice( intl, - parseInt(room.breakfast.localPrice.price) * - adults * - diff, + room.breakfast.localPrice.price * adults * diff, room.breakfast.localPrice.currency )} diff --git a/apps/scandic-web/server/routers/hotels/output.ts b/apps/scandic-web/server/routers/hotels/output.ts index 91a0fbc11..6ae23a8d1 100644 --- a/apps/scandic-web/server/routers/hotels/output.ts +++ b/apps/scandic-web/server/routers/hotels/output.ts @@ -527,7 +527,7 @@ export const ancillaryPackagesSchema = z description: item.descriptions.html, imageUrl: item.images[0]?.imageSizes.small, price: { - total: parseInt(item.variants.ancillary.price.totalPrice), + total: item.variants.ancillary.price.totalPrice, currency: item.variants.ancillary.price.currency, }, points: item.variants.ancillaryLoyalty?.points, diff --git a/apps/scandic-web/server/routers/hotels/schemas/packages.ts b/apps/scandic-web/server/routers/hotels/schemas/packages.ts index ad309797c..affd1cfac 100644 --- a/apps/scandic-web/server/routers/hotels/schemas/packages.ts +++ b/apps/scandic-web/server/routers/hotels/schemas/packages.ts @@ -9,14 +9,14 @@ import { PackageTypeEnum } from "@/types/enums/packages" export const packagePriceSchema = z .object({ currency: z.string().default("N/A"), - price: z.string(), - totalPrice: z.string(), + price: z.number(), + totalPrice: z.number(), }) .optional() .default({ currency: "N/A", - price: "0", - totalPrice: "0", + price: 0, + totalPrice: 0, }) const inventorySchema = z.object({ diff --git a/apps/scandic-web/stores/enter-details/helpers.ts b/apps/scandic-web/stores/enter-details/helpers.ts index 85632f0b1..b77d9a250 100644 --- a/apps/scandic-web/stores/enter-details/helpers.ts +++ b/apps/scandic-web/stores/enter-details/helpers.ts @@ -205,10 +205,10 @@ export function calcTotalPrice( } const breakfastRequestedPrice = room.breakfast - ? parseInt(room.breakfast.requestedPrice?.price ?? 0) + ? (room.breakfast.requestedPrice?.price ?? 0) : 0 const breakfastLocalPrice = room.breakfast - ? parseInt(room.breakfast.localPrice?.price ?? 0) + ? (room.breakfast.localPrice?.price ?? 0) : 0 const roomFeaturesTotal = room.roomFeatures?.reduce( diff --git a/apps/scandic-web/stores/enter-details/index.ts b/apps/scandic-web/stores/enter-details/index.ts index 20714fdea..c164141e7 100644 --- a/apps/scandic-web/stores/enter-details/index.ts +++ b/apps/scandic-web/stores/enter-details/index.ts @@ -279,13 +279,11 @@ export function createDetailsStore( if (addToTotalPrice) { const breakfastTotalRequestedPrice = - parseInt(breakfast.requestedPrice.price) * + breakfast.requestedPrice.price * currentRoom.room.adults * nights const breakfastTotalPrice = - parseInt(breakfast.localPrice.price) * - currentRoom.room.adults * - nights + breakfast.localPrice.price * currentRoom.room.adults * nights state.totalPrice = { requested: state.totalPrice.requested && { currency: state.totalPrice.requested.currency, @@ -308,13 +306,11 @@ export function createDetailsStore( let currentBreakfastTotalRequestedPrice = 0 if (currentRoom.room.breakfast) { currentBreakfastTotalPrice = - parseInt(currentRoom.room.breakfast.localPrice.price) * + currentRoom.room.breakfast.localPrice.price * currentRoom.room.adults * nights currentBreakfastTotalRequestedPrice = - parseInt( - currentRoom.room.breakfast.requestedPrice.totalPrice - ) * + currentRoom.room.breakfast.requestedPrice.totalPrice * currentRoom.room.adults * nights currency = currentRoom.room.breakfast.localPrice.currency