fix(SW-614): move filtering logic to routes
This commit is contained in:
@@ -430,6 +430,7 @@ export const hotelQueryRouter = router({
|
||||
promotionCode,
|
||||
reservationProfileType,
|
||||
attachedProfileId,
|
||||
rateCode,
|
||||
} = input
|
||||
|
||||
const params: Record<string, string | number | undefined> = {
|
||||
@@ -534,6 +535,14 @@ export const hotelQueryRouter = router({
|
||||
query: { hotelId, params: params },
|
||||
})
|
||||
)
|
||||
|
||||
if (rateCode) {
|
||||
validateAvailabilityData.data.mustBeGuaranteed =
|
||||
validateAvailabilityData.data.rateDefinitions.filter(
|
||||
(rate) => rate.rateCode === rateCode
|
||||
)[0].mustBeGuaranteed
|
||||
}
|
||||
|
||||
return validateAvailabilityData.data
|
||||
}),
|
||||
}),
|
||||
@@ -577,7 +586,7 @@ export const hotelQueryRouter = router({
|
||||
get: serviceProcedure
|
||||
.input(getlHotelDataInputSchema)
|
||||
.query(async ({ ctx, input }) => {
|
||||
const { hotelId, language, include } = input
|
||||
const { hotelId, language, include, isCardOnlyPayment } = input
|
||||
|
||||
const params: Record<string, string> = {
|
||||
hotelId,
|
||||
@@ -669,6 +678,11 @@ export const hotelQueryRouter = router({
|
||||
})
|
||||
)
|
||||
|
||||
if (isCardOnlyPayment) {
|
||||
validateHotelData.data.data.attributes.merchantInformationData.alternatePaymentOptions =
|
||||
[]
|
||||
}
|
||||
|
||||
return validateHotelData.data
|
||||
}),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user