return random names instead of John Doe in beneficiary validation

This commit is contained in:
2025-08-10 23:28:48 +05:30
parent cbfd1d6d09
commit de90be86a7
2 changed files with 39 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
const { logger } = require('../util/logger');
const beneficiaryService = require('../services/beneficiary.service');
const db = require('../config/db');
const randomName = require('../util/name.generator');
async function validateWithinBank(req, res) {
const { accountNumber } = req.query;
@@ -40,7 +41,8 @@ async function validateOutsideBank(req, res) {
return res.status(401).json({ error: 'invalid account number' });
//**IN PRODUCTION** poll the redis server continuously giving the refNo since the response from NPCI will be stored there
await delay(3000);
return res.json({ name: 'John Doe' });
const name = randomName();
return res.json({ name });
} catch (err) {
logger.error(err, 'beneficiary validation within bank failed');
res.status(500).json({ error: 'invalid account number' });