Merged in feat/SW-2643-aa-tracking-phone-number-email- (pull request #2617)

feat: SW-2643 Tracking added mobile and email hash in booking cofirmation

* feat: SW-2643 Tracking added mobile and email hash in booking cofirmation


Approved-by: Matilda Landström
This commit is contained in:
Hrishikesh Vaipurkar
2025-08-12 12:19:49 +00:00
parent 3262a71184
commit 4c9790b938
2 changed files with 9 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
import { createHash } from "crypto"
import { differenceInCalendarDays, format, isWeekend } from "date-fns" import { differenceInCalendarDays, format, isWeekend } from "date-fns"
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency" import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
@@ -169,6 +170,8 @@ export function getTracking(
: "no" : "no"
: "na", : "na",
guaranteedProduct: isGuaranteedFlexBooking ? "room" : "na", guaranteedProduct: isGuaranteedFlexBooking ? "room" : "na",
emailId: getSHAHash(booking.guest.email),
mobileNumber: getSHAHash(booking.guest.phoneNumber),
} }
const paymentInfo: TrackingSDKPaymentInfo = { const paymentInfo: TrackingSDKPaymentInfo = {
@@ -208,3 +211,7 @@ function constructRateCodeName(room: Room) {
.filter(Boolean) .filter(Boolean)
.join(" - ") .join(" - ")
} }
function getSHAHash(key: string) {
return createHash("sha256").update(key).digest("hex")
}

View File

@@ -95,6 +95,8 @@ export type TrackingSDKHotelInfo = {
totalPrice?: number | string totalPrice?: number | string
lateArrivalGuarantee?: string lateArrivalGuarantee?: string
guaranteedProduct?: string guaranteedProduct?: string
emailId?: string // Encrypted hash value on booking confirmation page
mobileNumber?: string // Encrypted hash value on booking confirmation page
} }
export type Ancillary = { export type Ancillary = {