feat: yukassa reads keys from app_settings + monthly reset endpoint
- yukassa.js: getConfig() читает YUKASSA_SHOP_ID/SECRET/RETURN_URL из app_settings (fallback env) - routes/billing.js: POST /monthly-reset — запускает processMonthlyResets() - app_settings: категория 'payments' с ключами ЮKassa - cron: 0 6 * * * zeropost-billing-reset.sh
This commit is contained in:
@@ -108,3 +108,15 @@ router.post('/webhook', express.json({ type: '*/*' }), async (req, res) => {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// POST /api/billing/monthly-reset — ежемесячный сброс кредитов (вызывается cron)
|
||||
router.post('/monthly-reset', async (req, res) => {
|
||||
try {
|
||||
const processed = await billing.processMonthlyResets();
|
||||
console.log(`[Billing] monthly reset: ${processed} users processed`);
|
||||
res.json({ ok: true, processed });
|
||||
} catch (err) {
|
||||
console.error('[Billing] monthly-reset error:', err.message);
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user