Merged in feat/sw-1314-transfer-sas-points (pull request #1508)
SW-1314 Transfer SAS points Approved-by: Linus Flood
This commit is contained in:
@@ -5,6 +5,7 @@ import { verifyOtp } from "./otp/verify/verifyOtp"
|
||||
import { linkAccount } from "./linkAccount"
|
||||
import { performLevelUpgrade } from "./performLevelUpgrade"
|
||||
import { unlinkAccount } from "./unlinkAccount"
|
||||
import { transferPoints } from "./transferPoints"
|
||||
|
||||
export const sasRouter = router({
|
||||
verifyOtp,
|
||||
@@ -12,4 +13,5 @@ export const sasRouter = router({
|
||||
linkAccount,
|
||||
unlinkAccount,
|
||||
performLevelUpgrade,
|
||||
transferPoints,
|
||||
})
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { z } from "zod"
|
||||
|
||||
// import * as api from "@/lib/api"
|
||||
import { protectedProcedure } from "@/server/trpc"
|
||||
|
||||
import { getSasToken } from "./getSasToken"
|
||||
|
||||
const outputSchema = z.object({
|
||||
transferState: z.enum(["success"]),
|
||||
})
|
||||
|
||||
const transferPointsInputSchema = z.object({
|
||||
points: z.number(),
|
||||
})
|
||||
|
||||
export const transferPoints = protectedProcedure
|
||||
.output(outputSchema)
|
||||
.input(transferPointsInputSchema)
|
||||
.mutation(async function ({ ctx, input }) {
|
||||
const sasAuthToken = getSasToken()
|
||||
|
||||
console.log("[SAS] transfer points")
|
||||
console.log({ sasAuthToken })
|
||||
console.log({ points: input.points })
|
||||
|
||||
// const apiResponse = await api.post(api.endpoints.v1.Profile.link, {
|
||||
// headers: {
|
||||
// Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
// },
|
||||
// body: {
|
||||
// partner: "sas_eb",
|
||||
// tocDate: getCurrentDateWithoutTime(),
|
||||
// partnerSpecific: {
|
||||
// eurobonusAccessToken: sasAuthToken,
|
||||
// },
|
||||
// },
|
||||
// })
|
||||
|
||||
console.log(`[SAS] transfer points success`)
|
||||
return { transferState: "success" }
|
||||
})
|
||||
Reference in New Issue
Block a user