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 * as api from "@/lib/api"
|
||||||
import { protectedProcedure } from "@/server/trpc"
|
import { protectedProcedure } from "@/server/trpc"
|
||||||
|
|
||||||
|
import { getOTPState } from "./otp/getOTPState"
|
||||||
import { getSasToken } from "./getSasToken"
|
import { getSasToken } from "./getSasToken"
|
||||||
|
|
||||||
const outputSchema = z.object({
|
const outputSchema = z.object({
|
||||||
@@ -22,6 +23,7 @@ export const linkAccount = protectedProcedure
|
|||||||
.output(outputSchema)
|
.output(outputSchema)
|
||||||
.mutation(async function ({ ctx }) {
|
.mutation(async function ({ ctx }) {
|
||||||
const sasAuthToken = getSasToken()
|
const sasAuthToken = getSasToken()
|
||||||
|
const { referenceId } = getOTPState()
|
||||||
|
|
||||||
console.log("[SAS] link account")
|
console.log("[SAS] link account")
|
||||||
|
|
||||||
@@ -34,6 +36,7 @@ export const linkAccount = protectedProcedure
|
|||||||
tocDate: getCurrentDateWithoutTime(),
|
tocDate: getCurrentDateWithoutTime(),
|
||||||
partnerSpecific: {
|
partnerSpecific: {
|
||||||
eurobonusAccessToken: sasAuthToken,
|
eurobonusAccessToken: sasAuthToken,
|
||||||
|
eurobonusOtpReferenceId: referenceId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { z } from "zod"
|
|||||||
import * as api from "@/lib/api"
|
import * as api from "@/lib/api"
|
||||||
import { protectedProcedure } from "@/server/trpc"
|
import { protectedProcedure } from "@/server/trpc"
|
||||||
|
|
||||||
|
import { getOTPState } from "./otp/getOTPState"
|
||||||
import { getSasToken } from "./getSasToken"
|
import { getSasToken } from "./getSasToken"
|
||||||
|
|
||||||
const outputSchema = z.object({
|
const outputSchema = z.object({
|
||||||
@@ -13,6 +14,7 @@ export const unlinkAccount = protectedProcedure
|
|||||||
.output(outputSchema)
|
.output(outputSchema)
|
||||||
.mutation(async function ({ ctx }) {
|
.mutation(async function ({ ctx }) {
|
||||||
const sasAuthToken = getSasToken()
|
const sasAuthToken = getSasToken()
|
||||||
|
const { referenceId } = getOTPState()
|
||||||
|
|
||||||
const apiResponse = await api.post(api.endpoints.v1.Profile.unlink, {
|
const apiResponse = await api.post(api.endpoints.v1.Profile.unlink, {
|
||||||
headers: {
|
headers: {
|
||||||
@@ -22,6 +24,7 @@ export const unlinkAccount = protectedProcedure
|
|||||||
partner: "sas_eb",
|
partner: "sas_eb",
|
||||||
partnerSpecific: {
|
partnerSpecific: {
|
||||||
eurobonusAccessToken: sasAuthToken,
|
eurobonusAccessToken: sasAuthToken,
|
||||||
|
eurobonusOtpReferenceId: referenceId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user