fix(BOOK-584): show discounted if specialrate or member * fix(BOOK-584): show discounted if specialrate or member Approved-by: Anton Gunnarsson
24 lines
592 B
TypeScript
24 lines
592 B
TypeScript
import { RateTypeEnum } from "@scandic-hotels/common/constants/rateType"
|
|
|
|
import type { Product } from "@scandic-hotels/trpc/types/roomAvailability"
|
|
|
|
export function isSpecialRate(product: Product | undefined | null) {
|
|
if (!product) return false
|
|
|
|
if (
|
|
"corporateCheque" in product ||
|
|
"redemption" in product ||
|
|
"voucher" in product
|
|
) {
|
|
return true
|
|
} else {
|
|
if (product.public) {
|
|
return product.public.rateType !== RateTypeEnum.Regular
|
|
}
|
|
if (product.member) {
|
|
return product.member.rateType !== RateTypeEnum.Regular
|
|
}
|
|
return false
|
|
}
|
|
}
|