Files
ICICI_backend/src/api/ICICI/icici.api.js
2024-10-11 13:20:53 +05:30

65 lines
2.5 KiB
JavaScript

const axios = require("axios");
const config = require("../../config/config");
const instance = axios.create({
baseURL: config.icici.baseURL,
headers: {
'accept': "*",
'Content-Type': 'text/plain',
'apikey': config.icici.apikey,
'x-forwarded-for': config.icici.x_forwarded_for,
'Content-Length': 684,
}
})
module.exports = {
createOtp: async (encryptedData) => {
try {
const { data } = await instance.post('/api/Corporate/CIB_SV/v1/Create', encryptedData); // Assuming `url` is relative to baseURL
return data;
} catch (error) {
console.error("Error during registration API call:", error.message); // Log error message
throw error; // Throw the actual error object
}
},
balanceInquiry: async (encryptedData) => {
try {
const { data } = await instance.post('/api/Corporate/CIB_SV/v1/BalanceInquiry', encryptedData); // Assuming `url` is relative to baseURL
return data;
} catch (error) {
console.error("Error during Balance Inquiry API call:", error.message); // Log error message
throw error; // Throw the actual error object
}
},
transactionOTP: async (encryptedData) => {
try {
const { data } = await instance.post('/api/Corporate/CIB_SV/v1/TransactionOTP', encryptedData); // Assuming `url` is relative to baseURL
console.log("transactionOTP", data)
return data;
} catch (error) {
console.error("Error during transaction OTP API call:", error.message); // Log error message
throw error; // Throw the actual error object
}
},
accountStatement: async (encryptedData) => {
try {
const {data} = await instance.post('/api/Corporate/CIB_SV/v1/AccountStatement', encryptedData); // Assuming `url` is relative to baseURL
return data;
} catch (error) {
console.error("Error during account statement API call:", error.message); // Log error message
throw error; // Throw the actual error object
}
},
RegistrationStatus: async (encryptedData) => {
try {
const { data } = await instance.post('registration-status', encryptedData);
return data;
} catch (error) {
throw new Error('Error during registration status API call');
}
},
};