Merged in fix/SW-3205-mystay-anonymous-booking- (pull request #2584)

fix(SW-3205): Disabled ancillary points and saved cards for anonymous booking

* fix(SW-3205): Disabled ancillary points and saved cards for anonymous booking

* fix(SW-2903 SW-3205): Updated code to be consistent in all scenarios


Approved-by: Anton Gunnarsson
Approved-by: Matilda Landström
This commit is contained in:
Hrishikesh Vaipurkar
2025-08-01 08:27:27 +00:00
parent 33c274bce1
commit 630cc12215
3 changed files with 17 additions and 13 deletions

View File

@@ -146,7 +146,8 @@ export default async function MyStay(props: {
if (shouldFetchBreakfastPackages) {
void getPackages(packagesInput)
}
if (user) {
const isOwnBooking = user?.email === booking.guest.email
if (user && isOwnBooking) {
void getSavedPaymentCardsSafely(savedPaymentCardsInput)
}
@@ -155,7 +156,7 @@ export default async function MyStay(props: {
breakfastPackages = await getPackages(packagesInput)
}
let savedCreditCards = null
if (user) {
if (user && isOwnBooking) {
savedCreditCards = await getSavedPaymentCardsSafely(
savedPaymentCardsInput
)
@@ -193,13 +194,14 @@ export default async function MyStay(props: {
},
} satisfies BookingConfirmation
const maskedUser = user
? ({
...user,
email: maskValue.email(user.email),
phoneNumber: maskValue.phone(user.phoneNumber ?? ""),
} satisfies SafeUser)
: null
const maskedUser =
user && isOwnBooking
? ({
...user,
email: maskValue.email(user.email),
phoneNumber: maskValue.phone(user.phoneNumber ?? ""),
} satisfies SafeUser)
: null
hotel.specialAlerts = getHotelAlertsForBookingDates(
hotel.specialAlerts,