[update] - on server push
This commit is contained in:
@@ -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": [],
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user