refactor: added remaining time in beneficiary cooldown failure response

This commit is contained in:
2025-11-08 02:22:26 +05:30
parent 55c822487b
commit c021d6033c

View File

@@ -16,9 +16,10 @@ async function checkBeneficiaryCooldown(req, res, next) {
const createdAt = new Date(beneficiary['created_at']);
if (createdAt > cooldownPeriod) {
const remaining = (now - createdAt) / (60 * 1000);
logger.warn('TRANSACTION_FAILED_BENEFICIARY_COOLDOWN_ACTIVE');
logger.warn('TRANSACTION_FAILED BENEFICIARY_COOLDOWN_ACTIVE');
return res.status(403).json({
error: `beneficiary cooldown period active. Retry after ${remaining} minutes`,
remaining,
error: 'beneficiary cooldown period active',
});
}
}