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:
@@ -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,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user