Merged in fix/SW-1997-tracking-correct-price-or-points (pull request #1869)

fix(SW-1997): only add points or card if payed with

* fix(SW-1997): only add points or card if payed with

* fix(SW-1997): use buildAncillaries function


Approved-by: Michael Zetterberg
This commit is contained in:
Bianca Widstam
2025-04-28 09:05:55 +00:00
parent 7c191aa875
commit 416a95d592
2 changed files with 45 additions and 43 deletions

View File

@@ -5,9 +5,13 @@ import { useEffect } from "react"
import { PaymentCallbackStatusEnum } from "@/constants/booking"
import { readGlaFromSessionStorage } from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/helpers"
import {
clearGlaSessionStorage,
readGlaFromSessionStorage,
} from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/helpers"
import LoadingSpinner from "@/components/LoadingSpinner"
import { trackEvent } from "@/utils/tracking/base"
import { buildAncillaries } from "@/utils/tracking/myStay"
import {
buildAncillaryPackages,
@@ -42,22 +46,16 @@ export default function TrackGuarantee({
trackEvent({
event,
paymentInfo: { status },
ancillaries: packages.map((pkg) => ({
hotelId: selectedAncillary?.hotelId,
productId: pkg.code,
productUnits: pkg.quantity,
productPoints: selectedAncillary?.points,
productDeliveryTime: formData?.deliveryTime,
productPrice: selectedAncillary?.price.total,
currency: selectedAncillary?.price.currency,
productName: selectedAncillary?.title,
productCategory: selectedAncillary?.categoryName,
})),
hotelInfo: {
hotelId: selectedAncillary?.hotelId,
lateArrivalGuarantee: "yes",
guaranteedProduct: "room + ancillary",
},
ancillaries: buildAncillaries(
packages,
selectedAncillary,
formData?.deliveryTime
),
})
}
@@ -75,6 +73,7 @@ export default function TrackGuarantee({
...(errorMessage && { errorMessage }),
},
})
clearGlaSessionStorage()
}
switch (status) {
@@ -88,6 +87,7 @@ export default function TrackGuarantee({
guaranteedProduct: "room",
},
})
clearGlaSessionStorage()
break
case PaymentCallbackStatusEnum.Cancel: