26 lines
701 B
TypeScript
26 lines
701 B
TypeScript
import type { Product } from "@scandic-hotels/trpc/types/roomAvailability"
|
|
|
|
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 getPublicPrice(roomRate: Product) {
|
|
if ("public" in roomRate && roomRate.public) {
|
|
return {
|
|
amount: roomRate.public.localPrice.pricePerStay,
|
|
currency: roomRate.public.localPrice.currency,
|
|
pricePerNight: roomRate.public.localPrice.pricePerNight,
|
|
}
|
|
}
|
|
|
|
return null
|
|
}
|