fix(STAY-67): redirect to webview after guarantee on my stay * fix(STAY-67): redirect to webview after guarantee on my stay * fix(STAY-67): add callback page for guarantee on webview Approved-by: Linus Flood
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { notFound } from "next/navigation"
|
|
|
|
import { logger } from "@scandic-hotels/common/logger"
|
|
|
|
import { myStay } from "@/constants/routes/webviews"
|
|
|
|
import GuaranteeCallbackPage from "@/components/GuaranteeCallback"
|
|
|
|
import type { PaymentCallbackStatusEnum } from "@scandic-hotels/common/constants/paymentCallbackStatusEnum"
|
|
|
|
import type { LangParams, PageArgs } from "@/types/params"
|
|
|
|
export default async function GuaranteePaymentWebViewCallbackPage(
|
|
props: PageArgs<
|
|
LangParams,
|
|
{
|
|
status?: PaymentCallbackStatusEnum
|
|
RefId?: string
|
|
confirmationNumber?: string
|
|
ancillary?: string
|
|
}
|
|
>
|
|
) {
|
|
const searchParams = await props.searchParams
|
|
const params = await props.params
|
|
logger.debug(`[gla-payment-callback] callback started`)
|
|
const lang = params.lang
|
|
const status = searchParams.status
|
|
const confirmationNumber = searchParams.confirmationNumber
|
|
const refId = searchParams.RefId
|
|
if (!status || !confirmationNumber || !refId) {
|
|
notFound()
|
|
}
|
|
const myStayUrl = `${myStay[lang]}?RefId=${encodeURIComponent(refId)}`
|
|
|
|
return (
|
|
<GuaranteeCallbackPage
|
|
status={status}
|
|
confirmationNumber={confirmationNumber}
|
|
refId={refId}
|
|
myStayUrl={myStayUrl}
|
|
lang={lang}
|
|
isAncillaryFlow={!!searchParams.ancillary}
|
|
/>
|
|
)
|
|
}
|