Merged in feat(SW-2083)-missing-booking-codes-scenarios-my-stay (pull request #1680)
Feat(SW-2083) missing booking codes scenarios my stay * feat(SW-2083) Show points instead of reward nights * feat(SW-2083) added support for cheque and voucher for totalPrice Approved-by: Niclas Edenvin
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import type { PriceType } from "@/types/components/hotelReservation/myStay/myStay"
|
||||
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||
|
||||
type PriceTypeParams = Pick<
|
||||
BookingConfirmation["booking"],
|
||||
"rateDefinition" | "vouchers" | "cheques"
|
||||
>
|
||||
|
||||
export function getPriceType({
|
||||
rateDefinition,
|
||||
vouchers,
|
||||
cheques,
|
||||
}: PriceTypeParams): PriceType {
|
||||
if (rateDefinition.title === "Reward Night") return "points"
|
||||
if (vouchers > 0) return "voucher"
|
||||
if (cheques > 0) return "cheque"
|
||||
return "money"
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { dt } from "@/lib/dt"
|
||||
|
||||
import { formatChildBedPreferences } from "../utils"
|
||||
import { convertToChildType } from "./convertToChildType"
|
||||
import { getPriceType } from "./getPriceType"
|
||||
|
||||
import type { BreakfastPackage } from "@/types/components/hotelReservation/breakfast"
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
@@ -76,6 +77,12 @@ export function mapRoomDetails({
|
||||
booking.rateDefinition.cancellationRule !==
|
||||
CancellationRuleEnum.CancellableBefore6PM
|
||||
|
||||
const priceType = getPriceType({
|
||||
rateDefinition: booking.rateDefinition,
|
||||
vouchers: booking.vouchers,
|
||||
cheques: booking.cheques,
|
||||
})
|
||||
|
||||
return {
|
||||
hotelId: booking.hotelId,
|
||||
roomTypeCode: booking.roomTypeCode,
|
||||
@@ -90,6 +97,8 @@ export function mapRoomDetails({
|
||||
guaranteeInfo: booking.guaranteeInfo,
|
||||
linkedReservations: booking.linkedReservations,
|
||||
bookingCode: booking.bookingCode,
|
||||
cheques: booking.cheques,
|
||||
vouchers: booking.vouchers,
|
||||
isCancelable: booking.isCancelable,
|
||||
multiRoom: booking.multiRoom,
|
||||
canChangeDate: booking.canChangeDate,
|
||||
@@ -123,6 +132,7 @@ export function mapRoomDetails({
|
||||
description: room?.bedType.mainBed.description ?? "",
|
||||
roomTypeCode: room?.bedType.code ?? "",
|
||||
},
|
||||
roomPoints: booking.roomPoints,
|
||||
roomPrice: {
|
||||
perNight: {
|
||||
local: {
|
||||
@@ -141,5 +151,6 @@ export function mapRoomDetails({
|
||||
},
|
||||
breakfast,
|
||||
isPrePaid,
|
||||
priceType,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user