feat: SW-2028 Implemented validation for not enough points details page
This commit is contained in:
@@ -575,7 +575,8 @@ function findProduct(product: Products, rateDefinition: RateDefinition) {
|
||||
export async function getSelectedRoomAvailability(
|
||||
input: z.input<typeof selectedRoomAvailabilityInputSchema>,
|
||||
lang: string,
|
||||
serviceToken: string
|
||||
serviceToken: string,
|
||||
userPoints?: number
|
||||
) {
|
||||
const {
|
||||
adults,
|
||||
@@ -696,9 +697,10 @@ export async function getSelectedRoomAvailability(
|
||||
}
|
||||
|
||||
if (Array.isArray(product)) {
|
||||
const redemptionProduct = product.find(
|
||||
(r) => r.redemption.rateCode === rateDefinition.rateCode
|
||||
)
|
||||
const redemptionProduct = userPoints ? product.find(
|
||||
(r) => r.redemption.rateCode === rateDefinition.rateCode &&
|
||||
r.redemption.localPrice.pointsPerStay <= userPoints
|
||||
) : undefined
|
||||
if (!redemptionProduct) {
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user