fix: Add X-header for EMandate.
wip: add message template
This commit is contained in:
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -3,6 +3,7 @@
|
||||
"MPIN",
|
||||
"occured",
|
||||
"otpgenerator",
|
||||
"TLIMIT",
|
||||
"tpassword",
|
||||
"tpin",
|
||||
"TPWORD"
|
||||
|
||||
@@ -6,5 +6,6 @@ dotenv.config({ path: path.resolve(__dirname, '../../.env') });
|
||||
module.exports = {
|
||||
port: process.env.PORT || 8080,
|
||||
dbUrl: process.env.DATABASE_URL,
|
||||
redisUrl: process.env.REDIS_URL,
|
||||
jwtSecret: process.env.JWT_SECRET,
|
||||
};
|
||||
|
||||
@@ -107,6 +107,13 @@ async function SendOtp(req, res) {
|
||||
case 'USERNAME_SAVED':
|
||||
message = templates.USERNAME_SAVED(PreferName);
|
||||
break;
|
||||
case 'TLIMIT':
|
||||
otp = generateOTP(6);
|
||||
message = templates.TLIMIT(otp);
|
||||
break;
|
||||
case 'TLIMIT_SET':
|
||||
message = templates.TLIMIT_SET(amount);
|
||||
break;
|
||||
default:
|
||||
return res.status(400).json({ error: 'Invalid OTP type' });
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ const { logger } = require('../util/logger');
|
||||
function verifyClient(req, res, next) {
|
||||
const clientHeader = req.headers['x-login-type'];
|
||||
|
||||
if (!clientHeader || (clientHeader !== 'MB' && clientHeader !== 'IB')) {
|
||||
if (!clientHeader || (clientHeader !== 'MB' && clientHeader !== 'IB' && clientHeader !== 'eMandate')) {
|
||||
logger.error(
|
||||
`Invalid or missing client header. Expected 'MB' or 'IB'. Found ${clientHeader}`
|
||||
);
|
||||
|
||||
@@ -52,7 +52,13 @@ const templates = {
|
||||
`Dear Customer, Your OTP for updating your Preferred Name is ${otp}. It is valid for 1 minute. Do not share this OTP with anyone. -KCCB`,
|
||||
|
||||
USERNAME_SAVED: (PreferName) =>
|
||||
`Dear Customer, Your Preferred Name -${PreferName} has been updated successfully. If this change was not made by you, please contact our support team immediately.`
|
||||
`Dear Customer, Your Preferred Name -${PreferName} has been updated successfully. If this change was not made by you, please contact our support team immediately.`,
|
||||
|
||||
TLIMIT :(otp) =>
|
||||
`Dear Customer,Please complete the transaction limit set with ${otp}. -KCCB`,
|
||||
|
||||
TLIMIT_SET :(amount) =>
|
||||
`Dear Customer,Your transaction limit for Internet Banking is set to Rs ${amount}. -KCCB`,
|
||||
};
|
||||
|
||||
module.exports = templates;
|
||||
Reference in New Issue
Block a user