feat: add messaging toggles, password reset SMS, and payment discounts

Allow SuperAdmin to disable SMS, email, and bot from dashboard settings on top of env flags. Add admin password reset with credentials SMS, plus payment discounts, notes, and payable amount handling.
This commit is contained in:
2026-08-16 06:58:08 +03:30
parent a6c760c3b7
commit 72be01fee3
25 changed files with 601 additions and 43 deletions
+6
View File
@@ -3,6 +3,7 @@
const nodemailer = require('nodemailer');
const config = require('../../config/config');
const logger = require('../logger');
const { isMessagingChannelEnabled } = require('../../components/settings/messagingFlags');
let transporter = null;
@@ -25,6 +26,11 @@ const sendEmail = async ({ to, subject, body, html }) => {
try {
if (!to) throw new Error('Recipient email is required');
if (!(await isMessagingChannelEnabled('email'))) {
logger.info(`[EmailSender] Skipped (channel disabled) → ${to}`);
return { skipped: true, reason: 'channel_disabled' };
}
const mailOptions = {
from: config.EMAIL_FROM,
to,