PR Fixes
This commit is contained in:
@@ -20,12 +20,17 @@ export default async function PaymentCallbackPage({
|
||||
searchParams,
|
||||
}: PageArgs<
|
||||
LangParams,
|
||||
{ status: "error" | "success" | "cancel"; confirmationNumber?: string }
|
||||
{
|
||||
status: "error" | "success" | "cancel"
|
||||
confirmationNumber?: string
|
||||
hotel?: string
|
||||
}
|
||||
>) {
|
||||
console.log(`[payment-callback] callback started`)
|
||||
const lang = params.lang
|
||||
const status = searchParams.status
|
||||
const confirmationNumber = searchParams.confirmationNumber
|
||||
const hotelId = searchParams.hotel
|
||||
|
||||
if (status === "success" && confirmationNumber) {
|
||||
const confirmationUrl = `${bookingConfirmation(lang)}?${BOOKING_CONFIRMATION_NUMBER}=${confirmationNumber}`
|
||||
@@ -50,7 +55,7 @@ export default async function PaymentCallbackPage({
|
||||
)
|
||||
trackPaymentEvent({
|
||||
event: "paymentFail",
|
||||
hotelId: searchObject.get("hotel"),
|
||||
hotelId,
|
||||
errorMessage:
|
||||
bookingStatus?.metadata?.errorMessage ??
|
||||
`No error message found for booking ${confirmationNumber}, status: ${status}`,
|
||||
@@ -63,14 +68,14 @@ export default async function PaymentCallbackPage({
|
||||
searchObject.set("errorCode", PaymentErrorCodeEnum.Cancelled.toString())
|
||||
trackPaymentEvent({
|
||||
event: "paymentCancel",
|
||||
hotelId: searchObject.get("hotel"),
|
||||
hotelId,
|
||||
})
|
||||
}
|
||||
if (status === "error") {
|
||||
searchObject.set("errorCode", PaymentErrorCodeEnum.Failed.toString())
|
||||
trackPaymentEvent({
|
||||
event: "paymentFail",
|
||||
hotelId: searchObject.get("hotel"),
|
||||
hotelId,
|
||||
errorMessage: `Failed to get booking status for ${confirmationNumber}, status: ${status}`,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user