fix: validate ticket type matches entitlement in series purchase

This commit is contained in:
Jennie Robinson Faber 2026-04-04 12:31:58 +01:00
parent 3620dad03a
commit 3b7b75ab70
2 changed files with 31 additions and 5 deletions

View file

@ -53,6 +53,14 @@ export default defineEventHandler(async (event) => {
const { ticketInfo } = validation;
// Validate submitted ticket type matches entitlement (prevents price mismatch)
if (body.ticketType && body.ticketType !== ticketInfo.ticketType) {
throw createError({
statusCode: 422,
statusMessage: `Ticket type mismatch: you are entitled to "${ticketInfo.ticketType}" but submitted "${body.ticketType}"`,
})
}
// For paid tickets, require payment ID
if (!ticketInfo.isFree && !paymentId) {
throw createError({