Merged in fix/eurobonus-zod-schema (pull request #2854)
SW-3505: Fix getEuroBonusProfile schema to match OpenAPI spec * update getEuroBonusProfile schema to match OpenAPI spec * update getEuroBonusProfile schema to match OpenAPI spec * update getEuroBonusProfile schema to match OpenAPI spec Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -7,24 +7,40 @@ import { protectedProcedure } from "../../../procedures"
|
||||
|
||||
const outputSchema = z.object({
|
||||
eurobonusNumber: z.string(),
|
||||
linkStatus: z.enum(["UNLINKED", "LINKED"]),
|
||||
firstName: z.string().optional(),
|
||||
lastName: z.string().optional(),
|
||||
linkStatus: z.enum(["LINKED", "PENDING", "UNLINKED"]),
|
||||
isBlocked: z.boolean(),
|
||||
enrollmentDate: z.string(),
|
||||
birthdate: z.string(),
|
||||
mobileNumber: z.string(),
|
||||
email: z.string().email(),
|
||||
points: z.object({
|
||||
balances: z.array(z.unknown()),
|
||||
balances: z.array(
|
||||
z.object({
|
||||
expirationDate: z.string(),
|
||||
points: z.number(),
|
||||
})
|
||||
),
|
||||
total: z.number(),
|
||||
}),
|
||||
tier: z.string(),
|
||||
tierStartDate: z.string(),
|
||||
/* `null` if customer is (i.) Lifetime Gold and tier is Gold or (ii.) tier is Basic. If customer is Lifetime Gold and tier is above Gold (e.g., Diamond), there will be a tier end date */
|
||||
tierEndDate: z.string().nullable(),
|
||||
lifeTimeGold: z.boolean(),
|
||||
tierBoostRequestedByScandic: z.boolean(),
|
||||
firstName: z.string(),
|
||||
lastName: z.string(),
|
||||
whoBoosted: z.enum(["NO-BOOST", "BOOSTED"]),
|
||||
whoBoosted: z
|
||||
.enum(["NO-BOOST", "SAS", "SCANDIC", "UNKNOWN"])
|
||||
.default("UNKNOWN")
|
||||
.catch((ctx) => {
|
||||
sasLogger.warn(`Unknown whoBoosted value received: ${ctx.input}`)
|
||||
return "UNKNOWN"
|
||||
}),
|
||||
tierBoostDescription: z.string().optional(),
|
||||
tierMatchStatus: z
|
||||
.enum(["MATCHED", "FAILED", "PENDING", "UNMATCHED"])
|
||||
.optional(),
|
||||
})
|
||||
|
||||
const sasLogger = createLogger("SAS")
|
||||
|
||||
Reference in New Issue
Block a user