[update] - on server push

This commit is contained in:
satyam70288
2024-09-18 12:12:18 +00:00
parent f5f87237f9
commit 9648f7af4b
5 changed files with 53 additions and 8 deletions

View File

@@ -3,7 +3,8 @@
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "nodemon src/index",
"start": "node src/index",
"dev": "nodemon src/index",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],

View File

@@ -11,7 +11,23 @@ module.exports = {
'Content-Type': 'text/plain',
'apikey': 'COIbAAYzt0SMosd3fFexJlk42uqnPvvu',
'x-forwarded-for': '77.68.102.23',
'Content-Length': Buffer.byteLength(encryptedData).toString()
'Content-Length': 684
}
}
)
return data
},
RegistrationStatus: async (encryptedData) => {
const { data } = await axios.post(
'https://apibankingonesandbox.icicibank.com/api/Corporate/CIB_SV/v1/RegistrationStatus',
encryptedData,
{
headers: {
'accept': "*",
'Content-Type': 'text/plain',
'apikey': 'COIbAAYzt0SMosd3fFexJlk42uqnPvvu',
'x-forwarded-for': '77.68.102.23',
'Content-Length': 684
}
}
)

View File

@@ -44,9 +44,9 @@ try {
// byPassOTP: envVars?.BY_PASS_OTP,
mysql: {
development: {
username: "root",
password: "root",
database: "optifii",
username: "mymotukuser",
password: "password_Carrot11",
database: "optifii_sprint",
host: "127.0.0.1",
port: 3306,
dialect: "mysql",

View File

@@ -17,16 +17,14 @@ module.exports = {
"URN": "TESTING123",
"ALIASID": ""
};
const jsonString = JSON.stringify(jsonData);
// Encrypt JSON data with the public key
const buffer = Buffer.from(jsonString, 'utf-8');
const encrypted = crypto.publicEncrypt(
{
key: publicKeyPem,
padding: crypto.constants.RSA_PKCS1_PADDING
},
buffer
Buffer.from(JSON.stringify(jsonData))
);
// Encode encrypted bytes to Base64
@@ -36,4 +34,33 @@ module.exports = {
res.status(200).json(data);
}),
RegistrationStatus: AsyncHandler(async (req, res) => {
const publicKeyPath = path.join(__dirname, 'public_key.pem');
const publicKeyPem = fs.readFileSync(publicKeyPath, 'utf8');
const jsonData = {
"AGGRNAME": "CIBTESTING",
"AGGRID": "TXBCIBTEST001",
"CORPID": "TXBCORP1",
"USERID": "USER1",
"URN": "TESTING123",
};
// Encrypt JSON data with the public key
const encrypted = crypto.publicEncrypt(
{
key: publicKeyPem,
padding: crypto.constants.RSA_PKCS1_PADDING
},
Buffer.from(JSON.stringify(jsonData))
);
// Encode encrypted bytes to Base64
const base64Encrypted = encrypted.toString('base64');
const data = await iciciApi.RegistrationStatus(base64Encrypted)
res.status(200).json(data);
}),
}

View File

@@ -3,5 +3,6 @@ const { bankDetailsController } = require('../../controllers')
const userRoutes = require('express').Router()
userRoutes.post('/registration', bankDetailsController.Registration)
userRoutes.post('/registration-status', bankDetailsController.Registration)
module.exports = userRoutes