From aabcd8a75360e3b744f86a9d963e8acc21bd6a70 Mon Sep 17 00:00:00 2001 From: seaznCode Date: Fri, 20 Mar 2026 16:27:46 +0100 Subject: [PATCH] feat: add validation for signingCity and signatureDataUrl in subscription methods --- services/abonemments/AbonemmentService.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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;