21 lines
527 B
TypeScript
21 lines
527 B
TypeScript
import { RateTypeEnum } from "@/types/enums/rateType"
|
|
import type { Product } from "@/types/trpc/routers/hotel/roomAvailability"
|
|
|
|
export function isBookingCodeRate(product: Product) {
|
|
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
|
|
}
|
|
}
|