added beneficiary routes

This commit is contained in:
2025-07-17 12:32:36 +05:30
parent 09c40dfaba
commit 32f6430a5c
4 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
const { logger } = require('../util/logger');
async function validateWithinBank(accountNo) {
const url = `http://localhost:8687/kccb/cbs/acctInfo/details?stacctno=${accountNo}`;
try {
const response = await fetch(url);
const data = await response.json();
const customerName = data.customername;
return customerName;
} catch (error) {
logger.error(error, 'error while fetching customer details');
throw new Error('unable to fetch customer name');
}
}
module.exports = { validateWithinBank };