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:
@@ -3,11 +3,17 @@
|
||||
const axios = require('axios');
|
||||
const config = require('../../config/config');
|
||||
const logger = require('../logger');
|
||||
const { isMessagingChannelEnabled } = require('../../components/settings/messagingFlags');
|
||||
|
||||
const sendBaleMessage = async ({ chatId, body }) => {
|
||||
try {
|
||||
const targetChatId = chatId || 'default_channel';
|
||||
|
||||
if (!(await isMessagingChannelEnabled('bot'))) {
|
||||
logger.info(`[BaleBotSender] Skipped (channel disabled) → ${targetChatId}`);
|
||||
return { skipped: true, reason: 'channel_disabled' };
|
||||
}
|
||||
|
||||
if (config.BALE_BOT_TOKEN === 'mock_bale_bot_token') {
|
||||
logger.info(`[BaleBotSender MOCK] ChatID: ${targetChatId} | Message: "${body}"`);
|
||||
return { success: true, messageId: `bale_mock_${Date.now()}` };
|
||||
|
||||
Reference in New Issue
Block a user