Merged in feat/sw-1948-point-transfer-endpoint (pull request #2353)
feat(SW-1948):Add SAS point transfer endpoint * Add SAS point transfer endpoint Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -123,6 +123,7 @@ export async function GET(
|
||||
"booking",
|
||||
"profile_link",
|
||||
"profile_matchtier",
|
||||
"profile_point_transfer",
|
||||
"availability",
|
||||
],
|
||||
/**
|
||||
|
||||
@@ -82,6 +82,7 @@ export async function GET(
|
||||
"availability",
|
||||
"profile_link",
|
||||
"profile_matchtier",
|
||||
"profile_point_transfer",
|
||||
].join(" "),
|
||||
loginKey: loginKey,
|
||||
for_origin: publicURL,
|
||||
|
||||
@@ -262,15 +262,22 @@ async function handleTransferPoints({
|
||||
})
|
||||
)
|
||||
|
||||
if (!res || error) {
|
||||
if (!res || error || res.transferState === "error") {
|
||||
console.error("[SAS] transfer points error", error)
|
||||
return {
|
||||
// TODO better errors?
|
||||
url: `/${lang}/sas-x-scandic/error`,
|
||||
type: "replace",
|
||||
}
|
||||
}
|
||||
|
||||
if (res.transferState === "notLinked") {
|
||||
console.warn("[SAS] transfer points not linked")
|
||||
return {
|
||||
url: `/${lang}/sas-x-scandic/link`,
|
||||
type: "replace",
|
||||
}
|
||||
}
|
||||
|
||||
console.log("[SAS] transfer points response", res)
|
||||
|
||||
return {
|
||||
|
||||
@@ -20,9 +20,11 @@ import styles from "./transferSuccess.module.css"
|
||||
import type { LangParams, PageArgs, SearchParams } from "@/types/params"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
export default async function SASxScandicTransferSuccessPage(props: PageArgs<LangParams> & SearchParams<{ p?: string }>) {
|
||||
const searchParams = await props.searchParams;
|
||||
const params = await props.params;
|
||||
export default async function SASxScandicTransferSuccessPage(
|
||||
props: PageArgs<LangParams> & SearchParams<{ p?: string }>
|
||||
) {
|
||||
const searchParams = await props.searchParams
|
||||
const params = await props.params
|
||||
const intl = await getIntl()
|
||||
const { lang } = params
|
||||
const addedPoints = Number(searchParams.p) || 0
|
||||
@@ -75,7 +77,6 @@ async function TransactionCard({
|
||||
const profile = await getProfileSafely()
|
||||
const transferredPoints = intl.formatNumber(addedPoints)
|
||||
|
||||
// TODO is this updated immediately?
|
||||
const totalPoints = profile?.membership?.currentPoints ?? 0
|
||||
|
||||
const showBonusNight = totalPoints > 10_000
|
||||
|
||||
Reference in New Issue
Block a user