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:
Joakim Jäderberg
2025-09-23 13:03:44 +00:00
parent c46e71d76e
commit 3a1cf12638

View File

@@ -7,24 +7,40 @@ import { protectedProcedure } from "../../../procedures"
const outputSchema = z.object({ const outputSchema = z.object({
eurobonusNumber: z.string(), 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(), isBlocked: z.boolean(),
enrollmentDate: z.string(), enrollmentDate: z.string(),
birthdate: z.string(), birthdate: z.string(),
mobileNumber: z.string(), mobileNumber: z.string(),
email: z.string().email(), email: z.string().email(),
points: z.object({ points: z.object({
balances: z.array(z.unknown()), balances: z.array(
z.object({
expirationDate: z.string(),
points: z.number(),
})
),
total: z.number(), total: z.number(),
}), }),
tier: z.string(), tier: z.string(),
tierStartDate: 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(), tierEndDate: z.string().nullable(),
lifeTimeGold: z.boolean(), lifeTimeGold: z.boolean(),
tierBoostRequestedByScandic: z.boolean(), tierBoostRequestedByScandic: z.boolean(),
firstName: z.string(), whoBoosted: z
lastName: z.string(), .enum(["NO-BOOST", "SAS", "SCANDIC", "UNKNOWN"])
whoBoosted: z.enum(["NO-BOOST", "BOOSTED"]), .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") const sasLogger = createLogger("SAS")