added beneficiary routes
This commit is contained in:
16
src/services/beneficiary.service.js
Normal file
16
src/services/beneficiary.service.js
Normal 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 };
|
||||
Reference in New Issue
Block a user