feat: add support for bought children breakfast package

This commit is contained in:
Simon Emanuelsson
2025-05-13 11:30:49 +02:00
committed by Simon.Emanuelsson
parent aceb88cb1a
commit b7c78a53b5
9 changed files with 229 additions and 68 deletions

View File

@@ -31,30 +31,50 @@ export function mapRoomDetails({
.startOf("day")
.diff(dt(booking.checkInDate).startOf("day"), "days")
const validBreakfastPackages: string[] = [
const validBreakfastPackagesAdults: string[] = [
BreakfastPackageEnum.REGULAR_BREAKFAST,
BreakfastPackageEnum.ANCILLARY_CHILD_PAYING_BREAKFAST,
BreakfastPackageEnum.ANCILLARY_REGULAR_BREAKFAST,
]
const breakfastPackage = booking.packages.find((pkg) =>
validBreakfastPackages.includes(pkg.code)
const breakfastPackageAdults = booking.packages.find((pkg) =>
validBreakfastPackagesAdults.includes(pkg.code)
)
// We don't get `requestedPrice` in packages
const breakfast: Omit<BreakfastPackage, "requestedPrice"> | null =
breakfastPackage
breakfastPackageAdults
? {
code: breakfastPackage.code,
description: breakfastPackage.description,
code: breakfastPackageAdults.code,
description: breakfastPackageAdults.description,
localPrice: {
currency: breakfastPackage.currency,
price: breakfastPackage.unitPrice,
totalPrice: breakfastPackage.totalPrice,
currency: breakfastPackageAdults.currency,
price: breakfastPackageAdults.unitPrice,
totalPrice: breakfastPackageAdults.totalPrice,
},
packageType: PackageTypeEnum.BreakfastAdult,
}
: null
const validBreakfastPackagesChildren: string[] = [
BreakfastPackageEnum.ANCILLARY_CHILD_PAYING_BREAKFAST,
]
const breakfastPackageChildren = booking.packages.find((pkg) =>
validBreakfastPackagesChildren.includes(pkg.code)
)
// We don't get `requestedPrice` in packages
const breakfastChildren: Omit<BreakfastPackage, "requestedPrice"> | null =
breakfastPackageChildren
? {
code: breakfastPackageChildren.code,
description: breakfastPackageChildren.description,
localPrice: {
currency: breakfastPackageChildren.currency,
price: breakfastPackageChildren.unitPrice,
totalPrice: breakfastPackageChildren.totalPrice,
},
packageType: PackageTypeEnum.BreakfastChildren,
}
: null
const isCancelled = booking.reservationStatus === BookingStatusEnum.Cancelled
const childrenAsString = formatChildBedPreferences({
@@ -120,6 +140,7 @@ export function mapRoomDetails({
},
bookingCode: booking.bookingCode,
breakfast,
breakfastChildren,
canChangeDate: booking.canChangeDate,
cancellationNumber: booking.cancellationNumber,
checkInDate: booking.checkInDate,