refactor: added remaining time in beneficiary cooldown failure response
This commit is contained in:
@@ -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',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user