second commit

This commit is contained in:
2025-06-17 12:13:26 +05:30
parent c350c591f6
commit d813784305
16 changed files with 186 additions and 382 deletions

View File

@@ -0,0 +1,25 @@
const axios = require('axios');
const { logger } = require('../util/logger');
async function getDetails(customerNo) {
try {
const response = await axios.get(
'http://localhost:8686/kccb/cbs/custInfo/details',
{ params: { stcustno: customerNo } }
);
const details = response.data;
logger.info(details, 'response from cbs');
const processedDetails = details.map((acc) => ({
...acc,
activeAccounts: details.length,
cifNumber: customerNo,
}));
return processedDetails;
} catch (error) {
throw new Error(
'API call failed: ' + (error.response?.data?.message || error.message)
);
}
}
module.exports = { getDetails };