fix: always use totalPrice to display roomCharge
This commit is contained in:
@@ -4,6 +4,8 @@ import {
|
||||
} from "@/server/routers/hotels/schemas/packages"
|
||||
|
||||
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
|
||||
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
|
||||
import { PackageTypeEnum } from "@/types/enums/packages"
|
||||
import type { Package } from "@/types/requests/packages"
|
||||
import type { Room } from "@/types/stores/booking-confirmation"
|
||||
|
||||
@@ -15,16 +17,20 @@ export function mapToPrice(rooms: (Room | null)[], nights: number) {
|
||||
if (room.cheques) {
|
||||
price = {
|
||||
corporateCheque: {
|
||||
additionalPricePerStay: room.roomPrice ? room.roomPrice : undefined,
|
||||
currency: room.roomPrice ? room.currencyCode : undefined,
|
||||
additionalPricePerStay: room.totalPrice
|
||||
? room.totalPrice
|
||||
: undefined,
|
||||
currency: room.totalPrice ? room.currencyCode : undefined,
|
||||
numberOfCheques: room.cheques,
|
||||
},
|
||||
}
|
||||
} else if (room.roomPoints) {
|
||||
price = {
|
||||
redemption: {
|
||||
additionalPricePerStay: room.roomPrice ? room.roomPrice : undefined,
|
||||
currency: room.roomPrice ? room.currencyCode : undefined,
|
||||
additionalPricePerStay: room.totalPrice
|
||||
? room.totalPrice
|
||||
: undefined,
|
||||
currency: room.totalPrice ? room.currencyCode : undefined,
|
||||
pointsPerNight: room.roomPoints / nights,
|
||||
pointsPerStay: room.roomPoints,
|
||||
},
|
||||
@@ -40,7 +46,7 @@ export function mapToPrice(rooms: (Room | null)[], nights: number) {
|
||||
regular: {
|
||||
currency: room.currencyCode,
|
||||
pricePerNight: room.roomPrice / nights,
|
||||
pricePerStay: room.roomPrice,
|
||||
pricePerStay: room.totalPrice,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -53,7 +59,10 @@ export function mapToPrice(rooms: (Room | null)[], nights: number) {
|
||||
price: room.breakfast?.unitPrice,
|
||||
totalPrice: room.breakfast?.totalPrice,
|
||||
},
|
||||
packageType: room.breakfast?.type,
|
||||
packageType:
|
||||
room.breakfast?.code === BreakfastPackageEnum.REGULAR_BREAKFAST
|
||||
? PackageTypeEnum.BreakfastAdult
|
||||
: "",
|
||||
requestedPrice: {
|
||||
currency: room.breakfast?.currency,
|
||||
price: room.breakfast?.unitPrice,
|
||||
|
||||
Reference in New Issue
Block a user