Merged in chore/remove-unused-code (pull request #2229)
Remove unused code * Remove unused scandic-web files * Remove unused exports Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
import type {
|
||||
Product,
|
||||
RateDefinition,
|
||||
} from "@/types/trpc/routers/hotel/roomAvailability"
|
||||
|
||||
/**
|
||||
* Get terms and rate title from the rate definitions when booking code rate
|
||||
* or public promotion is in play. Returns undefined when product is not available
|
||||
*
|
||||
* @param product - Either public or member product type
|
||||
* @param rateDefinitions - List of rate definitions
|
||||
* @returns RateDefinition | undefined
|
||||
*/
|
||||
export function getRateDefinition(
|
||||
product: Product,
|
||||
rateDefinitions: RateDefinition[],
|
||||
isUserLoggedIn: boolean,
|
||||
isMainRoom: boolean
|
||||
) {
|
||||
return rateDefinitions.find((rateDefinition) => {
|
||||
if ("member" in product && product.member && isUserLoggedIn && isMainRoom) {
|
||||
return rateDefinition.rateCode === product.member.rateCode
|
||||
}
|
||||
if ("corporateCheque" in product) {
|
||||
return rateDefinition.rateCode === product.corporateCheque.rateCode
|
||||
}
|
||||
if ("voucher" in product) {
|
||||
return rateDefinition.rateCode === product.voucher.rateCode
|
||||
}
|
||||
if ("public" in product && product.public) {
|
||||
return rateDefinition.rateCode === product.public.rateCode
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user