feat: add validation for signingCity and signatureDataUrl in subscription methods
This commit is contained in:
parent
b87b999455
commit
aabcd8a753
@ -92,6 +92,14 @@ class AbonemmentService {
|
|||||||
const normalizedRecipientEmail = this.normalizeEmail(recipientEmail);
|
const normalizedRecipientEmail = this.normalizeEmail(recipientEmail);
|
||||||
const forSelf = isForSelf !== false && !normalizedRecipientEmail;
|
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) {
|
if (!forSelf && !normalizedRecipientEmail) {
|
||||||
throw new Error('recipient_email is required when subscription is for another person');
|
throw new Error('recipient_email is required when subscription is for another person');
|
||||||
}
|
}
|
||||||
@ -349,6 +357,14 @@ class AbonemmentService {
|
|||||||
const normalizedRecipientEmail = this.normalizeEmail(recipientEmail);
|
const normalizedRecipientEmail = this.normalizeEmail(recipientEmail);
|
||||||
console.log('[SUBSCRIBE] Normalized recipient email:', normalizedRecipientEmail); // NEW
|
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');
|
if (coffeeId === undefined || coffeeId === null) throw new Error('coffeeId is required');
|
||||||
|
|
||||||
const hasRecipientFields = recipientName || normalizedRecipientEmail || recipientNotes;
|
const hasRecipientFields = recipientName || normalizedRecipientEmail || recipientNotes;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user