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 };

View File

@@ -1,9 +0,0 @@
const { logger } = require('../util/logger');
const detailsObject = require('./rajatDetails_wt.json');
function getDetails(user) {
logger.info(user);
return detailsObject;
}
module.exports = { getDetails };

View File

@@ -1,116 +0,0 @@
[
{
"stAccountNo": "50067217630",
"stAccountType": "SA",
"stBookingNumber": "SAVING CHQ FOR NONME",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "SAVING CHQ FOR NONME",
"stApprovedAmount": null,
"stAvailableBalance": "933.84",
"stCurrentBalance": "933.84",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50077736845",
"stAccountType": "TD",
"stBookingNumber": "TD-LTD-NM-IND -1 Yrs",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "TD-LTD-NM-IND -1 Yrs",
"stApprovedAmount": null,
"stAvailableBalance": "10000.00",
"stCurrentBalance": "10000.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50077742351",
"stAccountType": "LN",
"stBookingNumber": "DL-AGAINST DEPOSIT",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "DL-AGAINST DEPOSIT",
"stApprovedAmount": "10000.00",
"stAvailableBalance": "10236.00",
"stCurrentBalance": "10236.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50077756089",
"stAccountType": "TD",
"stBookingNumber": "TD-LTD-NM-IND -1 Yrs",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "TD-LTD-NM-IND -1 Yrs",
"stApprovedAmount": null,
"stAvailableBalance": "10000.00",
"stCurrentBalance": "10000.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50077842356",
"stAccountType": "LN",
"stBookingNumber": "DL-AGAINST DEPOSIT",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "DL-AGAINST DEPOSIT",
"stApprovedAmount": "10000.00",
"stAvailableBalance": "10215.00",
"stCurrentBalance": "10215.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50078072406",
"stAccountType": "LN",
"stBookingNumber": "TL-PERSONAL",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "TL-PERSONAL",
"stApprovedAmount": "200000.00",
"stAvailableBalance": "200825.00",
"stCurrentBalance": "200825.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"activeAccounts": 6,
"cifNumber": "30022497139"
}
]

View File

@@ -1,212 +0,0 @@
[
{
"stAccountNo": "50067217630",
"stAccountType": "SA",
"stBookingNumber": "SAVING CHQ FOR NONME",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "SAVING CHQ FOR NONME",
"stApprovedAmount": null,
"stAvailableBalance": "933.84",
"stCurrentBalance": "933.84",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"transactions": [
{
"id": "abcd",
"name": "John Doe",
"date": "31-05-2025 09:05:31",
"type": "CR",
"amount": 612
},
{
"id": "efgh",
"name": "John Cena",
"date": "20-05-2025 09:05:20",
"type": "DR",
"amount": 10
}
],
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50077736845",
"stAccountType": "TD",
"stBookingNumber": "TD-LTD-NM-IND -1 Yrs",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "TD-LTD-NM-IND -1 Yrs",
"stApprovedAmount": null,
"stAvailableBalance": "10000.00",
"stCurrentBalance": "10000.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"transactions": [
{
"id": "abcd",
"name": "John Doe",
"date": "31-05-2025 09:05:31",
"type": "CR",
"amount": 10
},
{
"id": "efgh",
"name": "John Cena",
"date": "20-05-2025 09:05:20",
"type": "DR",
"amount": 662
}
],
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50077742351",
"stAccountType": "LN",
"stBookingNumber": "DL-AGAINST DEPOSIT",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "DL-AGAINST DEPOSIT",
"stApprovedAmount": "10000.00",
"stAvailableBalance": "10236.00",
"stCurrentBalance": "10236.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"transactions": [
{
"id": "abcd",
"name": "John Doe",
"date": "31-05-2025 09:05:31",
"type": "CR",
"amount": 676
},
{
"id": "efgh",
"name": "John Cena",
"date": "20-05-2025 09:05:20",
"type": "DR",
"amount": 684
}
],
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50077756089",
"stAccountType": "TD",
"stBookingNumber": "TD-LTD-NM-IND -1 Yrs",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "TD-LTD-NM-IND -1 Yrs",
"stApprovedAmount": null,
"stAvailableBalance": "10000.00",
"stCurrentBalance": "10000.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"transactions": [
{
"id": "abcd",
"name": "John Doe",
"date": "31-05-2025 09:05:31",
"type": "CR",
"amount": 698
},
{
"id": "efgh",
"name": "John Cena",
"date": "20-05-2025 09:05:20",
"type": "DR",
"amount": 706
}
],
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50077842356",
"stAccountType": "LN",
"stBookingNumber": "DL-AGAINST DEPOSIT",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "DL-AGAINST DEPOSIT",
"stApprovedAmount": "10000.00",
"stAvailableBalance": "10215.00",
"stCurrentBalance": "10215.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"transactions": [
{
"id": "abcd",
"name": "John Doe",
"date": "31-05-2025 09:05:31",
"type": "CR",
"amount": 721
},
{
"id": "efgh",
"name": "John Cena",
"date": "20-05-2025 09:05:20",
"type": "DR",
"amount": 729
}
],
"activeAccounts": 6,
"cifNumber": "30022497139"
},
{
"stAccountNo": "50078072406",
"stAccountType": "LN",
"stBookingNumber": "TL-PERSONAL",
"stBranchNo": "00002 ",
"stCurrency": "INR",
"stProductType": "TL-PERSONAL",
"stApprovedAmount": "200000.00",
"stAvailableBalance": "200825.00",
"stCurrentBalance": "200825.00",
"custdob": "02051982",
"custname": "RAJAT MAHARANA",
"mobileno": "919418573848",
"custaddress": "DATA CENTRE KCCB CIVIL BAZAR D/SHALA DHARAMSHALA KANGRA",
"pincode": "176215",
"id": "AMSPM8798H",
"transactions": [
{
"id": "abcd",
"name": "John Doe",
"date": "31-05-2025 09:05:31",
"type": "CR",
"amount": 10
},
{
"id": "efgh",
"name": "John Cena",
"date": "20-05-2025 09:05:20",
"type": "DR",
"amount": 751
}
],
"activeAccounts": 6,
"cifNumber": "30022497139"
}
]

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 };