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');
async function getLastTen(accountNumber) {
try {
const response = await axios.get(
`http://localhost:8688/kccb/cbs/acctstmt/details`,
{ params: { stacctno: accountNumber } }
);
const transactions = response.data;
const processedTransactions = transactions.map((tx) => ({
id: tx.stTransactionNumber,
name: tx.stTransactionDesc,
date: tx.stTransactionDate,
amount: tx.stTransactionAmount.slice(0, -3),
type: tx.stTransactionAmount.slice(-2),
}));
return processedTransactions;
} catch (error) {
throw new Error(
'API call failde: ' + (error.response?.data?.message || error.message)
);
}
}
module.exports = { getLastTen };