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:
Ник (Claude)
2026-06-11 19:40:10 +03:00
parent 9baa0f0959
commit 4580264de9
2 changed files with 29 additions and 7 deletions
+12
View File
@@ -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 });
}
});