diff --git a/services/abonemments/AbonemmentService.js b/services/abonemments/AbonemmentService.js index 79e1b82..dd1c46d 100644 --- a/services/abonemments/AbonemmentService.js +++ b/services/abonemments/AbonemmentService.js @@ -92,6 +92,14 @@ class AbonemmentService { const normalizedRecipientEmail = this.normalizeEmail(recipientEmail); const forSelf = isForSelf !== false && !normalizedRecipientEmail; + if (typeof signingCity !== 'string' || signingCity.trim() === '') { + throw new Error('signingCity is required'); + } + + if (typeof signatureDataUrl !== 'string' || signatureDataUrl.trim() === '') { + throw new Error('signatureDataUrl is required'); + } + if (!forSelf && !normalizedRecipientEmail) { throw new Error('recipient_email is required when subscription is for another person'); } @@ -349,6 +357,14 @@ class AbonemmentService { const normalizedRecipientEmail = this.normalizeEmail(recipientEmail); console.log('[SUBSCRIBE] Normalized recipient email:', normalizedRecipientEmail); // NEW + if (typeof signingCity !== 'string' || signingCity.trim() === '') { + throw new Error('signingCity is required'); + } + + if (typeof signatureDataUrl !== 'string' || signatureDataUrl.trim() === '') { + throw new Error('signatureDataUrl is required'); + } + if (coffeeId === undefined || coffeeId === null) throw new Error('coffeeId is required'); const hasRecipientFields = recipientName || normalizedRecipientEmail || recipientNotes;