diff --git a/.env.local.example b/.env.local.example
index 32ea8668e..871ea42fe 100644
--- a/.env.local.example
+++ b/.env.local.example
@@ -32,8 +32,11 @@ SEAMLESS_LOGOUT_NO="http://www.example.no/updatelogout?newweb=1"
SEAMLESS_LOGOUT_SV="http://www.example.sv/updatelogout?newweb=1"
WEBVIEW_ENCRYPTION_KEY="MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="
BOOKING_ENCRYPTION_KEY=""
-// (WEB-210) Note below both variables are required to Support Legacy encryption
+// WEB-210 NodeJS v17+ uses OPENSSL 3.0 in which the encryption algorithm “DES-ECB” is deprecated and
+// to enable support NODE_OPTIONS="--openssl-legacy-provider" is required.
NODE_OPTIONS="--openssl-legacy-provider"
+// The runtime execution is happening in AWS functions as per Netlify setup, the AWS functions need another variable
+// OPENSSL_MODULES="/var/lang/lib/ossl-modules" to enable legacy encryption support.
OPENSSL_MODULES="/var/lang/lib/ossl-modules"
PUBLIC_URL="http://localhost:3000"
diff --git a/components/MyPages/Blocks/Stays/Soonest/index.tsx b/components/MyPages/Blocks/Stays/Soonest/index.tsx
index a3d724d6f..950a72726 100644
--- a/components/MyPages/Blocks/Stays/Soonest/index.tsx
+++ b/components/MyPages/Blocks/Stays/Soonest/index.tsx
@@ -26,7 +26,7 @@ export default async function SoonestStays({
{response.data.length ? (
- {response.data.map((stay) => (
+ {response.data.map((stay: any) => (
+
(payload: T): Promise {
})
}
+const updateStaysBookingUrl = async (verifiedData: any, ctx: any) => {
+ // Tenporary API call needed till we have user name in ctx session data
+ const apiResponse = await api.get(api.endpoints.v1.profile, {
+ cache: "no-store",
+ headers: {
+ Authorization: `Bearer ${ctx.session.token.access_token}`,
+ },
+ })
+
+ // Temporary domain and lang support for current web
+ let localeDomain = env.PUBLIC_URL
+ let fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
+ switch (ctx.lang) {
+ case "sv":
+ localeDomain = localeDomain?.replace(".com", ".se")
+ fullBookingUrl = localeDomain + "/hotelreservation/din-bokning"
+ break
+ case "no":
+ localeDomain = localeDomain?.replace(".com", ".no")
+ fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
+ break
+ case "da":
+ localeDomain = localeDomain?.replace(".com", ".dk")
+ fullBookingUrl = localeDomain + "/hotelreservation/min-booking"
+ break
+ case "fi":
+ localeDomain = localeDomain?.replace(".com", ".fi")
+ fullBookingUrl = localeDomain + "/varaa-hotelli/varauksesi"
+ break
+ case "de":
+ localeDomain = localeDomain?.replace(".com", ".de")
+ fullBookingUrl = localeDomain + "/hotelreservation/my-booking"
+ break
+ default:
+ break
+ }
+
+ if (apiResponse.ok) {
+ const apiJson = await apiResponse.json()
+ if (apiJson.data?.attributes) {
+ verifiedData.data.data.forEach((stay: any) => {
+ const originalString =
+ stay.attributes.confirmationNumber.toString() +
+ "," +
+ apiJson.data.attributes.lastName
+ let encryptedBookingValue = encryptValue(originalString)
+ stay.attributes.bookingUrl =
+ fullBookingUrl + "?RefId=" + encryptedBookingValue
+ })
+ }
+ }
+ return verifiedData
+}
+
export const userQueryRouter = router({
get: protectedProcedure
.input(getUserInputSchema)
@@ -213,33 +269,10 @@ export const userQueryRouter = router({
? verifiedData.data.links.offset
: undefined
- // Tenporary till we have user name in ctx session data
- // ----
- const apiResponseUser = await api.get(api.endpoints.v1.profile, {
- cache: "no-store",
- headers: {
- Authorization: `Bearer ${ctx.session.token.access_token}`,
- },
- })
-
- if (apiResponseUser.ok) {
- const apiJsonUser = await apiResponseUser.json()
- if (apiJsonUser.data?.attributes) {
- verifiedData.data.data.forEach((stay) => {
- const originalString =
- stay.attributes.confirmationNumber.toString() +
- "," +
- apiJsonUser.data.attributes.lastName
- let bookingUrl = encryptValue(originalString)
- stay.attributes.bookingUrl =
- "/hotelreservation/my-booking?RefId=" + bookingUrl
- })
- }
- }
- // ------------------
+ const updatedData = await updateStaysBookingUrl(verifiedData, ctx)
return {
- data: verifiedData.data.data,
+ data: updatedData.data.data,
nextCursor,
}
}),
@@ -298,33 +331,10 @@ export const userQueryRouter = router({
? verifiedData.data.links.offset
: undefined
- // Tenporary till we have user name in ctx session data
- // ----
- const apiResponseUser = await api.get(api.endpoints.v1.profile, {
- cache: "no-store",
- headers: {
- Authorization: `Bearer ${ctx.session.token.access_token}`,
- },
- })
-
- if (apiResponseUser.ok) {
- const apiJsonUser = await apiResponseUser.json()
- if (apiJsonUser.data?.attributes) {
- verifiedData.data.data.forEach((stay) => {
- const originalString =
- stay.attributes.confirmationNumber.toString() +
- "," +
- apiJsonUser.data.attributes.lastName
- let bookingUrl = encryptValue(originalString)
- stay.attributes.bookingUrl =
- "/hotelreservation/my-booking?RefId=" + bookingUrl
- })
- }
- }
- // ------------------
+ const updatedData = await updateStaysBookingUrl(verifiedData, ctx)
return {
- data: verifiedData.data.data,
+ data: updatedData.data.data,
nextCursor,
}
}),