fix: validate ticket type matches entitlement in series purchase
This commit is contained in:
parent
3620dad03a
commit
3b7b75ab70
2 changed files with 31 additions and 5 deletions
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue