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
+4 -3
View File
@@ -4,6 +4,7 @@
const axios = require('axios');
const config = require('../../config/config');
const logger = require('../logger');
const { isMessagingChannelEnabled } = require('../../components/settings/messagingFlags');
const toBoolean = (value) => {
if (typeof value === 'boolean') return value;
@@ -28,9 +29,9 @@ const sendSingleSms = async (mobile, templateId, params = []) => {
SMS_ENABLED: config.SMS_ENABLED,
});
if (!toBoolean(config.SMS_ENABLED)) {
logger.info(`[SMS] Skipped (SMS_ENABLED=false) → ${mobile} template=${templateId}`);
return { skipped: true };
if (!(await isMessagingChannelEnabled('sms'))) {
logger.info(`[SMS] Skipped (channel disabled) → ${mobile} template=${templateId}`);
return { skipped: true, reason: 'channel_disabled' };
}
if (!templateId) {