Merged in feat/sw-2923-link-sas-referenceid (pull request #2243)

Send SAS OTP referenceId to API

* Send SAS OTP referenceId to API

API needs the referenceId to pass along to SAS
as they use it to verify that OTP was successful.


Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-06-02 08:01:23 +00:00
parent 50a6f4e28c
commit b19d849b2b
2 changed files with 6 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import { z } from "zod"
import * as api from "@/lib/api"
import { protectedProcedure } from "@/server/trpc"
import { getOTPState } from "./otp/getOTPState"
import { getSasToken } from "./getSasToken"
const outputSchema = z.object({
@@ -22,6 +23,7 @@ export const linkAccount = protectedProcedure
.output(outputSchema)
.mutation(async function ({ ctx }) {
const sasAuthToken = getSasToken()
const { referenceId } = getOTPState()
console.log("[SAS] link account")
@@ -34,6 +36,7 @@ export const linkAccount = protectedProcedure
tocDate: getCurrentDateWithoutTime(),
partnerSpecific: {
eurobonusAccessToken: sasAuthToken,
eurobonusOtpReferenceId: referenceId,
},
},
})

View File

@@ -3,6 +3,7 @@ import { z } from "zod"
import * as api from "@/lib/api"
import { protectedProcedure } from "@/server/trpc"
import { getOTPState } from "./otp/getOTPState"
import { getSasToken } from "./getSasToken"
const outputSchema = z.object({
@@ -13,6 +14,7 @@ export const unlinkAccount = protectedProcedure
.output(outputSchema)
.mutation(async function ({ ctx }) {
const sasAuthToken = getSasToken()
const { referenceId } = getOTPState()
const apiResponse = await api.post(api.endpoints.v1.Profile.unlink, {
headers: {
@@ -22,6 +24,7 @@ export const unlinkAccount = protectedProcedure
partner: "sas_eb",
partnerSpecific: {
eurobonusAccessToken: sasAuthToken,
eurobonusOtpReferenceId: referenceId,
},
},
})