fix: send totalPrice to create booking
This commit is contained in:
@@ -96,6 +96,11 @@ export default async function StepPage({
|
||||
id: "Select payment method",
|
||||
})
|
||||
|
||||
const roomPrice =
|
||||
user && roomAvailability.memberRate
|
||||
? roomAvailability.memberRate?.localPrice.pricePerStay
|
||||
: roomAvailability.publicRate!.localPrice.pricePerStay
|
||||
|
||||
return (
|
||||
<section>
|
||||
<HistoryStateManager />
|
||||
@@ -136,6 +141,7 @@ export default async function StepPage({
|
||||
label={mustBeGuaranteed ? guaranteeWithCard : selectPaymentMethod}
|
||||
>
|
||||
<Payment
|
||||
roomPrice={roomPrice}
|
||||
otherPaymentOptions={
|
||||
hotelData.data.attributes.merchantInformationData
|
||||
.alternatePaymentOptions
|
||||
|
||||
@@ -4,13 +4,15 @@ import { env } from "@/env/server"
|
||||
import { getLocations } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import SelectHotelMap from "@/components/HotelReservation/SelectHotel/SelectHotelMap"
|
||||
import { getHotelReservationQueryParams } from "@/components/HotelReservation/SelectRate/RoomSelection/utils"
|
||||
import {
|
||||
generateChildrenString,
|
||||
getHotelReservationQueryParams,
|
||||
} from "@/components/HotelReservation/SelectRate/RoomSelection/utils"
|
||||
import { MapModal } from "@/components/MapModal"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
|
||||
import {
|
||||
fetchAvailableHotels,
|
||||
generateChildrenString,
|
||||
getCentralCoordinates,
|
||||
getPointOfInterests,
|
||||
} from "../../utils"
|
||||
|
||||
@@ -3,7 +3,7 @@ import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import { BedTypeEnum } from "@/types/components/bookingWidget/enums"
|
||||
import { ChildBedMapEnum } from "@/types/components/bookingWidget/enums"
|
||||
import type { AvailabilityInput } from "@/types/components/hotelReservation/selectHotel/availabilityInput"
|
||||
import type { HotelData } from "@/types/components/hotelReservation/selectHotel/hotelCardListingProps"
|
||||
import type { Filter } from "@/types/components/hotelReservation/selectHotel/hotelFilters"
|
||||
@@ -50,22 +50,6 @@ export function getFiltersFromHotels(hotels: HotelData[]) {
|
||||
return filterList
|
||||
}
|
||||
|
||||
const bedTypeMap: Record<number, string> = {
|
||||
[BedTypeEnum.IN_ADULTS_BED]: "ParentsBed",
|
||||
[BedTypeEnum.IN_CRIB]: "Crib",
|
||||
[BedTypeEnum.IN_EXTRA_BED]: "ExtraBed",
|
||||
}
|
||||
|
||||
export function generateChildrenString(children: Child[]): string {
|
||||
return `[${children
|
||||
?.map((child) => {
|
||||
const age = child.age
|
||||
const bedType = bedTypeMap[+child.bed]
|
||||
return `${age}:${bedType}`
|
||||
})
|
||||
.join(",")}]`
|
||||
}
|
||||
|
||||
export function getPointOfInterests(hotels: HotelData[]): PointOfInterest[] {
|
||||
// TODO: this is just a quick transformation to get something there. May need rework
|
||||
return hotels.map((hotel) => ({
|
||||
|
||||
Reference in New Issue
Block a user