{intl.formatMessage(
- { id: "Distance to city centre" },
+ { id: "Distance in km to city centre" },
{ number: distanceToCentre }
)}
diff --git a/components/ContentType/HotelPage/IntroSection/index.tsx b/components/ContentType/HotelPage/IntroSection/index.tsx
index 010530f74..fe2db96c0 100644
--- a/components/ContentType/HotelPage/IntroSection/index.tsx
+++ b/components/ContentType/HotelPage/IntroSection/index.tsx
@@ -25,7 +25,7 @@ export default async function IntroSection({
const { streetAddress, city } = address
const { distanceToCentre } = location
const formattedDistanceText = intl.formatMessage(
- { id: "Distance to city centre" },
+ { id: "Distance in km to city centre" },
{ number: distanceToCentre }
)
const lang = getLang()
diff --git a/components/Current/Header/header.module.css b/components/Current/Header/header.module.css
index 91b5581a4..90e35642b 100644
--- a/components/Current/Header/header.module.css
+++ b/components/Current/Header/header.module.css
@@ -1,5 +1,6 @@
.header {
display: grid;
+ background-color: var(--Main-Grey-White);
}
@media screen and (max-width: 1366px) {
diff --git a/components/HotelReservation/HotelCard/index.tsx b/components/HotelReservation/HotelCard/index.tsx
index e93a24ef3..451de4630 100644
--- a/components/HotelReservation/HotelCard/index.tsx
+++ b/components/HotelReservation/HotelCard/index.tsx
@@ -104,7 +104,7 @@ export default function HotelCard({
{intl.formatMessage(
- { id: "Distance to city centre" },
+ { id: "Distance in km to city centre" },
{ number: hotelData.location.distanceToCentre }
)}
diff --git a/components/TempDesignSystem/Select/select.module.css b/components/TempDesignSystem/Select/select.module.css
index 8c551b13a..f6d2dfade 100644
--- a/components/TempDesignSystem/Select/select.module.css
+++ b/components/TempDesignSystem/Select/select.module.css
@@ -10,11 +10,29 @@
gap: var(--Spacing-x-half);
}
-.select[data-focused="true"] {
+.select[data-focused="true"],
+.select[data-focused="true"].discreet {
border: 1px solid var(--Scandic-Blue-90);
outline: none;
}
+.select.discreet {
+ border: 1px solid transparent;
+}
+
+.select.discreet .input {
+ background-color: unset;
+ color: var(--Base-Text-High-contrast);
+ gap: var(--Spacing-x1);
+}
+
+.select.discreet .inputContentWrapper {
+ align-items: center;
+ justify-content: flex-end;
+ flex-direction: row;
+ font-weight: 500;
+}
+
.input {
align-items: center;
background-color: var(--UI-Opacity-White-100);
@@ -72,7 +90,7 @@
}
.listBoxItem.showRadioButton:before {
- display: flex;
+ flex-shrink: 0;
content: "";
margin-right: var(--Spacing-x-one-and-half);
background-color: white;
diff --git a/components/TempDesignSystem/Select/select.ts b/components/TempDesignSystem/Select/select.ts
index 0b7b7fc06..942223277 100644
--- a/components/TempDesignSystem/Select/select.ts
+++ b/components/TempDesignSystem/Select/select.ts
@@ -11,6 +11,7 @@ export interface SelectProps
value?: string | number
maxHeight?: number
showRadioButton?: boolean
+ discreet?: boolean
}
export type SelectPortalContainer = HTMLDivElement | undefined
diff --git a/i18n/dictionaries/da.json b/i18n/dictionaries/da.json
index 4486b9e51..6529382a8 100644
--- a/i18n/dictionaries/da.json
+++ b/i18n/dictionaries/da.json
@@ -98,7 +98,8 @@
"Disabled booking options text": "Koder, checks og bonusnætter er endnu ikke tilgængelige på den nye hjemmeside.",
"Discard changes": "Kassér ændringer",
"Discard unsaved changes?": "Slette ændringer, der ikke er gemt?",
- "Distance to city centre": "{number} km til centrum",
+ "Distance in km to city centre": "{number} km til centrum",
+ "Distance to city centre": "Afstand til centrum",
"Distance to hotel": "Afstand til hotel",
"Do you want to start the day with Scandics famous breakfast buffé?": "Vil du starte dagen med Scandics berømte morgenbuffet?",
"Done": "Færdig",
@@ -120,6 +121,7 @@
"Failed to delete credit card, please try again later.": "Kunne ikke slette kreditkort. Prøv venligst igen senere.",
"Fair": "Messe",
"Filter": "Filter",
+ "Filter by": "Filtrer efter",
"Find booking": "Find booking",
"Find hotels": "Find hotel",
"First name": "Fornavn",
@@ -204,12 +206,14 @@
"My pages menu": "Mine sider menu",
"My payment cards": "Mine betalingskort",
"My wishes": "Mine ønsker",
+ "Name": "Navn",
"Nearby": "I nærheden",
"Nearby companies": "Nærliggende virksomheder",
"New password": "Nyt kodeord",
"Next": "Næste",
"Nights needed to level up": "Nætter nødvendige for at komme i niveau",
"No": "Nej",
+ "No availability": "Ingen tilgængelighed",
"No breakfast": "Ingen morgenmad",
"No content published": "Intet indhold offentliggjort",
"No matching location found": "Der blev ikke fundet nogen matchende placering",
@@ -258,6 +262,7 @@
"Practical information": "Praktisk information",
"Previous": "Forudgående",
"Previous victories": "Tidligere sejre",
+ "Price": "Pris",
"Price details": "Prisoplysninger",
"Proceed to login": "Fortsæt til login",
"Proceed to payment method": "Fortsæt til betalingsmetode",
@@ -331,6 +336,7 @@
"Thank you": "Tak",
"Theatre": "Teater",
"There are no rooms available that match your request": "Der er ingen ledige værelser, der matcher din anmodning",
+ "There are no rooms available that match your request.": "Der er ingen værelser tilgængelige, der matcher din forespørgsel.",
"There are no transactions to display": "Der er ingen transaktioner at vise",
"Things nearby HOTEL_NAME": "Ting i nærheden af {hotelName}",
"To get the member price {amount} {currency}, log in or join when completing the booking.": "For at få medlemsprisen {amount} {currency}, log ind eller tilmeld dig, når du udfylder bookingen.",
@@ -342,6 +348,7 @@
"Transaction date": "Overførselsdato",
"Transactions": "Transaktioner",
"Transportations": "Transport",
+ "TripAdvisor rating": "TripAdvisor vurdering",
"Tripadvisor reviews": "{rating} ({count} anmeldelser på Tripadvisor)",
"Type of bed": "Sengtype",
"Type of room": "Værelsestype",
diff --git a/i18n/dictionaries/de.json b/i18n/dictionaries/de.json
index ee34c0c1b..f69e9bb0e 100644
--- a/i18n/dictionaries/de.json
+++ b/i18n/dictionaries/de.json
@@ -98,7 +98,8 @@
"Disabled booking options text": "Codes, Schecks und Bonusnächte sind auf der neuen Website noch nicht verfügbar.",
"Discard changes": "Änderungen verwerfen",
"Discard unsaved changes?": "Nicht gespeicherte Änderungen verwerfen?",
- "Distance to city centre": "{number} km zum Stadtzentrum",
+ "Distance in km to city centre": "{number} km zum Stadtzentrum",
+ "Distance to city centre": "Entfernung zum Stadtzentrum",
"Distance to hotel": "Entfernung zum Hotel",
"Do you want to start the day with Scandics famous breakfast buffé?": "Möchten Sie den Tag mit Scandics berühmtem Frühstücksbuffet beginnen?",
"Done": "Fertig",
@@ -120,6 +121,7 @@
"Failed to delete credit card, please try again later.": "Kreditkarte konnte nicht gelöscht werden. Bitte versuchen Sie es später noch einmal.",
"Fair": "Messe",
"Filter": "Filter",
+ "Filter by": "Filtern nach",
"Find booking": "Buchung finden",
"Find hotels": "Hotels finden",
"First name": "Vorname",
@@ -202,12 +204,14 @@
"My pages menu": "Meine Seite Menü",
"My payment cards": "Meine Zahlungskarten",
"My wishes": "Meine Wünsche",
+ "Name": "Name",
"Nearby": "In der Nähe",
"Nearby companies": "Nahe gelegene Unternehmen",
"New password": "Neues Kennwort",
"Next": "Nächste",
"Nights needed to level up": "Nächte, die zum Levelaufstieg benötigt werden",
"No": "Nein",
+ "No availability": "Keine Verfügbarkeit",
"No breakfast": "Kein Frühstück",
"No content published": "Kein Inhalt veröffentlicht",
"No matching location found": "Kein passender Standort gefunden",
@@ -256,6 +260,7 @@
"Practical information": "Praktische Informationen",
"Previous": "Früher",
"Previous victories": "Bisherige Siege",
+ "Price": "Preis",
"Price details": "Preisdetails",
"Proceed to login": "Weiter zum Login",
"Proceed to payment method": "Weiter zur Zahlungsmethode",
@@ -330,6 +335,7 @@
"Thank you": "Danke",
"Theatre": "Theater",
"There are no rooms available that match your request": "Es sind keine Zimmer verfügbar, die Ihrer Anfrage entsprechen",
+ "There are no rooms available that match your request.": "Es sind keine Zimmer verfügbar, die Ihrer Anfrage entsprechen.",
"There are no transactions to display": "Es sind keine Transaktionen zum Anzeigen vorhanden",
"Things nearby HOTEL_NAME": "Dinge in der Nähe von {hotelName}",
"To get the member price {amount} {currency}, log in or join when completing the booking.": "Um den Mitgliederpreis von {amount} {currency} zu erhalten, loggen Sie sich ein oder treten Sie Scandic Friends bei, wenn Sie die Buchung abschließen.",
@@ -341,6 +347,7 @@
"Transaction date": "Transaktionsdatum",
"Transactions": "Transaktionen",
"Transportations": "Transportmittel",
+ "TripAdvisor rating": "TripAdvisor-Bewertung",
"Tripadvisor reviews": "{rating} ({count} Bewertungen auf Tripadvisor)",
"Type of bed": "Bettentyp",
"Type of room": "Zimmerart",
diff --git a/i18n/dictionaries/en.json b/i18n/dictionaries/en.json
index 6d3712067..049adce52 100644
--- a/i18n/dictionaries/en.json
+++ b/i18n/dictionaries/en.json
@@ -106,7 +106,8 @@
"Disabled booking options text": "Codes, cheques and reward nights aren't available on the new website yet.",
"Discard changes": "Discard changes",
"Discard unsaved changes?": "Discard unsaved changes?",
- "Distance to city centre": "{number} km to city centre",
+ "Distance in km to city centre": "{number} km to city centre",
+ "Distance to city centre": "Distance to city centre",
"Distance to hotel": "Distance to hotel",
"Do you want to start the day with Scandics famous breakfast buffé?": "Do you want to start the day with Scandics famous breakfast buffé?",
"Done": "Done",
@@ -129,6 +130,7 @@
"Failed to delete credit card, please try again later.": "Failed to delete credit card, please try again later.",
"Fair": "Fair",
"Filter": "Filter",
+ "Filter by": "Filter by",
"Find booking": "Find booking",
"Find hotels": "Find hotels",
"First name": "First name",
@@ -221,12 +223,14 @@
"My pages menu": "My pages menu",
"My payment cards": "My payment cards",
"My wishes": "My wishes",
+ "Name": "Name",
"Nearby": "Nearby",
"Nearby companies": "Nearby companies",
"New password": "New password",
"Next": "Next",
"Nights needed to level up": "Nights needed to level up",
"No": "No",
+ "No availability": "No availability",
"No breakfast": "No breakfast",
"No content published": "No content published",
"No matching location found": "No matching location found",
@@ -279,6 +283,7 @@
"Practical information": "Practial information",
"Previous": "Previous",
"Previous victories": "Previous victories",
+ "Price": "Price",
"Price details": "Price details",
"Price excl VAT": "Price excl VAT",
"Price incl VAT": "Price incl VAT",
@@ -360,6 +365,7 @@
"Thank you": "Thank you",
"Theatre": "Theatre",
"There are no rooms available that match your request": "There are no rooms available that match your request",
+ "There are no rooms available that match your request.": "There are no rooms available that match your request.",
"There are no transactions to display": "There are no transactions to display",
"Things nearby HOTEL_NAME": "Things nearby {hotelName}",
"To get the member price {amount} {currency}, log in or join when completing the booking.": "To get the member price {amount} {currency}, log in or join when completing the booking.",
@@ -371,6 +377,7 @@
"Transaction date": "Transaction date",
"Transactions": "Transactions",
"Transportations": "Transportations",
+ "TripAdvisor rating": "TripAdvisor rating",
"Tripadvisor reviews": "{rating} ({count} reviews on Tripadvisor)",
"Type of bed": "Type of bed",
"Type of room": "Type of room",
diff --git a/i18n/dictionaries/fi.json b/i18n/dictionaries/fi.json
index a067b87f5..30b5afff0 100644
--- a/i18n/dictionaries/fi.json
+++ b/i18n/dictionaries/fi.json
@@ -98,7 +98,8 @@
"Disabled booking options text": "Koodit, sekit ja palkintoillat eivät ole vielä saatavilla uudella verkkosivustolla.",
"Discard changes": "Hylkää muutokset",
"Discard unsaved changes?": "Hylkäätkö tallentamattomat muutokset?",
- "Distance to city centre": "{number} km Etäisyys kaupunkiin",
+ "Distance in km to city centre": "{number} km Etäisyys kaupunkiin",
+ "Distance to city centre": "Etäisyys kaupungin keskustaan",
"Distance to hotel": "Etäisyys hotelliin",
"Do you want to start the day with Scandics famous breakfast buffé?": "Haluatko aloittaa päiväsi Scandicsin kuuluisalla aamiaisbuffella?",
"Done": "Valmis",
@@ -120,6 +121,7 @@
"Failed to delete credit card, please try again later.": "Luottokortin poistaminen epäonnistui, yritä myöhemmin uudelleen.",
"Fair": "Messukeskus",
"Filter": "Suodatin",
+ "Filter by": "Suodatusperuste",
"Find booking": "Etsi varaus",
"Find hotels": "Etsi hotelleja",
"First name": "Etunimi",
@@ -204,12 +206,14 @@
"My pages menu": "Omat sivut -valikko",
"My payment cards": "Minun maksukortit",
"My wishes": "Toiveeni",
+ "Name": "Nimi",
"Nearby": "Lähistöllä",
"Nearby companies": "Läheiset yritykset",
"New password": "Uusi salasana",
"Next": "Seuraava",
"Nights needed to level up": "Yöt, joita tarvitaan tasolle",
"No": "Ei",
+ "No availability": "Ei saatavuutta",
"No breakfast": "Ei aamiaista",
"No content published": "Ei julkaistua sisältöä",
"No matching location found": "Vastaavaa sijaintia ei löytynyt",
@@ -258,6 +262,7 @@
"Practical information": "Käytännön tietoa",
"Previous": "Aikaisempi",
"Previous victories": "Edelliset voitot",
+ "Price": "Hinta",
"Price details": "Hintatiedot",
"Proceed to login": "Jatka kirjautumiseen",
"Proceed to payment method": "Siirry maksutavalle",
@@ -332,6 +337,7 @@
"Thank you": "Kiitos",
"Theatre": "Teatteri",
"There are no rooms available that match your request": "Pyyntöäsi vastaavia huoneita ei ole saatavilla",
+ "There are no rooms available that match your request.": "Ei huoneita saatavilla, jotka vastaavat pyyntöäsi.",
"There are no transactions to display": "Näytettäviä tapahtumia ei ole",
"Things nearby HOTEL_NAME": "Lähellä olevia asioita {hotelName}",
"To get the member price {amount} {currency}, log in or join when completing the booking.": "Jäsenhintaan saavat sisäänkirjautuneet tai liittyneet jäsenet.",
@@ -343,6 +349,7 @@
"Transaction date": "Tapahtuman päivämäärä",
"Transactions": "Tapahtumat",
"Transportations": "Kuljetukset",
+ "TripAdvisor rating": "TripAdvisor-luokitus",
"Tripadvisor reviews": "{rating} ({count} arvostelua TripAdvisorissa)",
"Type of bed": "Vuodetyyppi",
"Type of room": "Huonetyyppi",
diff --git a/i18n/dictionaries/no.json b/i18n/dictionaries/no.json
index 98d778f4c..5db8c271f 100644
--- a/i18n/dictionaries/no.json
+++ b/i18n/dictionaries/no.json
@@ -97,7 +97,8 @@
"Disabled booking options text": "Koder, checks og belønningsnætter er enda ikke tilgjengelige på den nye nettsiden.",
"Discard changes": "Forkaste endringer",
"Discard unsaved changes?": "Forkaste endringer som ikke er lagret?",
- "Distance to city centre": "{number} km til sentrum",
+ "Distance in km to city centre": "{number} km til sentrum",
+ "Distance to city centre": "Avstand til sentrum",
"Distance to hotel": "Avstand til hotell",
"Do you want to start the day with Scandics famous breakfast buffé?": "Vil du starte dagen med Scandics berømte frokostbuffé?",
"Done": "Ferdig",
@@ -119,6 +120,7 @@
"Failed to delete credit card, please try again later.": "Kunne ikke slette kredittkortet, prøv igjen senere.",
"Fair": "Messe",
"Filter": "Filter",
+ "Filter by": "Filtrer etter",
"Find booking": "Finn booking",
"Find hotels": "Finn hotell",
"First name": "Fornavn",
@@ -202,12 +204,14 @@
"My pages menu": "Mine sider-menyen",
"My payment cards": "Mine betalingskort",
"My wishes": "Mine ønsker",
+ "Name": "Navn",
"Nearby": "I nærheten",
"Nearby companies": "Nærliggende selskaper",
"New password": "Nytt passord",
"Next": "Neste",
"Nights needed to level up": "Netter som trengs for å komme opp i nivå",
"No": "Nei",
+ "No availability": "Ingen tilgjengelighet",
"No breakfast": "Ingen frokost",
"No content published": "Ingen innhold publisert",
"No matching location found": "Fant ingen samsvarende plassering",
@@ -256,6 +260,7 @@
"Practical information": "Praktisk informasjon",
"Previous": "Tidligere",
"Previous victories": "Tidligere seire",
+ "Price": "Pris",
"Price details": "Prisdetaljer",
"Proceed to login": "Fortsett til innlogging",
"Proceed to payment method": "Fortsett til betalingsmetode",
@@ -329,6 +334,7 @@
"Thank you": "Takk",
"Theatre": "Teater",
"There are no rooms available that match your request": "Det er ingen tilgjengelige rom som samsvarer med forespørselen din",
+ "There are no rooms available that match your request.": "Det er ingen rom tilgjengelige som matcher din forespørsel.",
"There are no transactions to display": "Det er ingen transaksjoner å vise",
"Things nearby HOTEL_NAME": "Ting i nærheten av {hotelName}",
"To get the member price {amount} {currency}, log in or join when completing the booking.": "For å få medlemsprisen {amount} {currency}, logg inn eller bli med når du fullfører bestillingen.",
@@ -340,6 +346,7 @@
"Transaction date": "Transaksjonsdato",
"Transactions": "Transaksjoner",
"Transportations": "Transport",
+ "TripAdvisor rating": "TripAdvisor vurdering",
"Tripadvisor reviews": "{rating} ({count} anmeldelser på Tripadvisor)",
"Type of bed": "Sengtype",
"Type of room": "Romtype",
diff --git a/i18n/dictionaries/sv.json b/i18n/dictionaries/sv.json
index 01c293426..e466c1524 100644
--- a/i18n/dictionaries/sv.json
+++ b/i18n/dictionaries/sv.json
@@ -97,7 +97,8 @@
"Disabled booking options text": "Koder, bonuscheckar och belöningsnätter är inte tillgängliga på den nya webbplatsen än.",
"Discard changes": "Ignorera ändringar",
"Discard unsaved changes?": "Vill du ignorera ändringar som inte har sparats?",
- "Distance to city centre": "{number} km till centrum",
+ "Distance in km to city centre": "{number} km till centrum",
+ "Distance to city centre": "Avstånd till centrum",
"Distance to hotel": "Avstånd till hotell",
"Do you want to start the day with Scandics famous breakfast buffé?": "Vill du starta dagen med Scandics berömda frukostbuffé?",
"Done": "Klar",
@@ -119,6 +120,7 @@
"Failed to delete credit card, please try again later.": "Det gick inte att ta bort kreditkortet, försök igen senare.",
"Fair": "Mässa",
"Filter": "Filter",
+ "Filter by": "Filtrera på",
"Find booking": "Hitta bokning",
"Find hotels": "Hitta hotell",
"First name": "Förnamn",
@@ -202,12 +204,14 @@
"My pages menu": "Mina sidor meny",
"My payment cards": "Mina betalningskort",
"My wishes": "Mina önskningar",
+ "Name": "Namn",
"Nearby": "I närheten",
"Nearby companies": "Närliggande företag",
"New password": "Nytt lösenord",
"Next": "Nästa",
"Nights needed to level up": "Nätter som behövs för att gå upp i nivå",
"No": "Nej",
+ "No availability": "Ingen tillgänglighet",
"No breakfast": "Ingen frukost",
"No content published": "Inget innehåll publicerat",
"No matching location found": "Ingen matchande plats hittades",
@@ -256,6 +260,7 @@
"Practical information": "Praktisk information",
"Previous": "Föregående",
"Previous victories": "Tidigare segrar",
+ "Price": "Pris",
"Price details": "Prisdetaljer",
"Proceed to login": "Fortsätt till inloggning",
"Proceed to payment method": "Gå vidare till betalningsmetod",
@@ -329,6 +334,7 @@
"Thank you": "Tack",
"Theatre": "Teater",
"There are no rooms available that match your request": "Det finns inga tillgängliga rum som matchar din förfrågan",
+ "There are no rooms available that match your request.": "Det finns inga rum tillgängliga som matchar din begäran.",
"There are no transactions to display": "Det finns inga transaktioner att visa",
"Things nearby HOTEL_NAME": "Saker i närheten av {hotelName}",
"To get the member price {amount} {currency}, log in or join when completing the booking.": "För att få medlemsprisen {amount} {currency}, logga in eller bli medlem när du slutför bokningen.",
@@ -340,6 +346,7 @@
"Transaction date": "Transaktionsdatum",
"Transactions": "Transaktioner",
"Transportations": "Transport",
+ "TripAdvisor rating": "TripAdvisor-betyg",
"Tripadvisor reviews": "{rating} ({count} recensioner på Tripadvisor)",
"Type of bed": "Sängtyp",
"Type of room": "Rumstyp",
diff --git a/server/routers/booking/mutation.ts b/server/routers/booking/mutation.ts
index 2edbd5bdd..dc3bad0fe 100644
--- a/server/routers/booking/mutation.ts
+++ b/server/routers/booking/mutation.ts
@@ -2,7 +2,7 @@ import { metrics } from "@opentelemetry/api"
import * as api from "@/lib/api"
import { getVerifiedUser } from "@/server/routers/user/query"
-import { router, serviceProcedure } from "@/server/trpc"
+import { router, safeProtectedServiceProcedure } from "@/server/trpc"
import { getMembership } from "@/utils/user"
@@ -35,95 +35,93 @@ async function getMembershipNumber(
}
export const bookingMutationRouter = router({
- create: serviceProcedure.input(createBookingInput).mutation(async function ({
- ctx,
- input,
- }) {
- const { checkInDate, checkOutDate, hotelId } = input
+ create: safeProtectedServiceProcedure
+ .input(createBookingInput)
+ .mutation(async function ({ ctx, input }) {
+ const accessToken = ctx.session?.token.access_token ?? ctx.serviceToken
+ const { checkInDate, checkOutDate, hotelId } = input
- // TODO: add support for user token OR service token in procedure
- // then we can fetch membership number if user token exists
- const loggingAttributes = {
- // membershipNumber: await getMembershipNumber(ctx.session),
- checkInDate,
- checkOutDate,
- hotelId,
- }
-
- createBookingCounter.add(1, { hotelId, checkInDate, checkOutDate })
-
- console.info(
- "api.booking.create start",
- JSON.stringify({
- query: loggingAttributes,
- })
- )
- const headers = {
- Authorization: `Bearer ${ctx.serviceToken}`,
- }
-
- const apiResponse = await api.post(api.endpoints.v1.Booking.bookings, {
- headers,
- body: input,
- })
-
- if (!apiResponse.ok) {
- const text = await apiResponse.text()
- createBookingFailCounter.add(1, {
- hotelId,
+ const loggingAttributes = {
+ membershipNumber: await getMembershipNumber(ctx.session),
checkInDate,
checkOutDate,
- error_type: "http_error",
- error: JSON.stringify({
- status: apiResponse.status,
- }),
- })
- console.error(
- "api.booking.create error",
+ hotelId,
+ }
+
+ createBookingCounter.add(1, { hotelId, checkInDate, checkOutDate })
+
+ console.info(
+ "api.booking.create start",
JSON.stringify({
query: loggingAttributes,
- error: {
+ })
+ )
+ const headers = {
+ Authorization: `Bearer ${accessToken}`,
+ }
+
+ const apiResponse = await api.post(api.endpoints.v1.Booking.bookings, {
+ headers,
+ body: input,
+ })
+
+ if (!apiResponse.ok) {
+ const text = await apiResponse.text()
+ createBookingFailCounter.add(1, {
+ hotelId,
+ checkInDate,
+ checkOutDate,
+ error_type: "http_error",
+ error: JSON.stringify({
status: apiResponse.status,
- statusText: apiResponse.statusText,
- error: text,
- },
+ }),
})
- )
- return null
- }
+ console.error(
+ "api.booking.create error",
+ JSON.stringify({
+ query: loggingAttributes,
+ error: {
+ status: apiResponse.status,
+ statusText: apiResponse.statusText,
+ error: text,
+ },
+ })
+ )
+ return null
+ }
- const apiJson = await apiResponse.json()
- const verifiedData = createBookingSchema.safeParse(apiJson)
- if (!verifiedData.success) {
- createBookingFailCounter.add(1, {
+ const apiJson = await apiResponse.json()
+ const verifiedData = createBookingSchema.safeParse(apiJson)
+ if (!verifiedData.success) {
+ createBookingFailCounter.add(1, {
+ hotelId,
+ checkInDate,
+ checkOutDate,
+ error_type: "validation_error",
+ })
+
+ console.error(
+ "api.booking.create validation error",
+ JSON.stringify({
+ query: loggingAttributes,
+ error: verifiedData.error,
+ })
+ )
+ return null
+ }
+
+ createBookingSuccessCounter.add(1, {
hotelId,
checkInDate,
checkOutDate,
- error_type: "validation_error",
})
- console.error(
- "api.booking.create validation error",
+ console.info(
+ "api.booking.create success",
JSON.stringify({
query: loggingAttributes,
- error: verifiedData.error,
})
)
- return null
- }
-
- createBookingSuccessCounter.add(1, {
- hotelId,
- checkInDate,
- checkOutDate,
- })
-
- console.info(
- "api.booking.create success",
- JSON.stringify({
- query: loggingAttributes,
- })
- )
- return verifiedData.data
- }),
+ return verifiedData.data
+ }),
})