fix(BOOK-584): show discounted if specialrate or member * fix(BOOK-584): show discounted if specialrate or member Approved-by: Anton Gunnarsson
28 lines
785 B
TypeScript
28 lines
785 B
TypeScript
import { isSpecialRate } from "../../../SelectRate/RoomsContainer/RateSummary/utils"
|
|
|
|
import type { Product } from "@scandic-hotels/trpc/types/roomAvailability"
|
|
|
|
import type { Room } from "../../../../stores/enter-details/types"
|
|
|
|
export function getMemberPrice(roomRate: Product) {
|
|
if ("member" in roomRate && roomRate.member) {
|
|
return {
|
|
amount: roomRate.member.localPrice.pricePerStay,
|
|
currency: roomRate.member.localPrice.currency,
|
|
pricePerNight: roomRate.member.localPrice.pricePerNight,
|
|
}
|
|
}
|
|
|
|
return null
|
|
}
|
|
|
|
export function isDiscounted(room: Room): boolean {
|
|
return !!(
|
|
room.guest.join ||
|
|
room.guest.membershipNo ||
|
|
room.roomRate.rateDefinition.isCampaignRate ||
|
|
room.roomRate.bookingCode ||
|
|
isSpecialRate(room.roomRate)
|
|
)
|
|
}
|