Compare commits
8 Commits
otp_bindin
...
feat-daily
| Author | SHA1 | Date | |
|---|---|---|---|
| 654b4ddaf7 | |||
| 7757b464b3 | |||
| 9f2f557b03 | |||
| 08e47e2e92 | |||
| 96af9ff264 | |||
| 75ebcf8407 | |||
| b63860e22e | |||
| 2d434b9198 |
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"MPIN",
|
"MPIN",
|
||||||
|
"occured",
|
||||||
"otpgenerator",
|
"otpgenerator",
|
||||||
"tpassword",
|
"tpassword",
|
||||||
"tpin",
|
"tpin",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const cors = require('cors');
|
|||||||
const { logger } = require('./util/logger');
|
const { logger } = require('./util/logger');
|
||||||
const routes = require('./routes');
|
const routes = require('./routes');
|
||||||
const helmet = require('helmet');
|
const helmet = require('helmet');
|
||||||
|
const { verifyClient } = require('./middlewares/clientVerifier.middleware');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ app.use(helmet());
|
|||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(express.urlencoded({ extended: true }));
|
||||||
|
|
||||||
app.use('/api', routes);
|
app.use('/api', verifyClient, routes);
|
||||||
app.get('/health', (_, res) => res.send('server is healthy'));
|
app.get('/health', (_, res) => res.send('server is healthy'));
|
||||||
app.use((err, _req, res, _next) => {
|
app.use((err, _req, res, _next) => {
|
||||||
logger.error(err, 'uncaught error');
|
logger.error(err, 'uncaught error');
|
||||||
|
|||||||
@@ -4,32 +4,107 @@ const { logger } = require('../util/logger');
|
|||||||
const db = require('../config/db');
|
const db = require('../config/db');
|
||||||
const dayjs = require('dayjs');
|
const dayjs = require('dayjs');
|
||||||
const { comparePassword } = require('../util/hash');
|
const { comparePassword } = require('../util/hash');
|
||||||
|
const customerController = require('../controllers/customer_details.controller.js');
|
||||||
|
const { setJson, getJson } = require('../config/redis');
|
||||||
|
|
||||||
|
|
||||||
async function login(req, res) {
|
async function login(req, res) {
|
||||||
const { customerNo, password } = req.body;
|
let { customerNo, userName, password, otp } = req.body;
|
||||||
const loginType = req.headers['x-login-type'] || 'standard';
|
const loginType = req.headers['x-login-type'] || 'standard';
|
||||||
|
|
||||||
if (!customerNo || !password) {
|
if ((!customerNo && !userName) || !password) {
|
||||||
return res
|
return res.status(400).json({ error: 'customerNo and password are required' });
|
||||||
.status(400)
|
|
||||||
.json({ error: 'customerNo and password are required' });
|
|
||||||
}
|
}
|
||||||
const currentTime = new Date().toISOString();
|
const currentTime = new Date().toISOString();
|
||||||
|
const MAX_ATTEMPTS = 3; // Max invalid attempts before lock
|
||||||
|
const BLOCK_DURATION = 15 * 60 * 60; // 1 day
|
||||||
try {
|
try {
|
||||||
|
// --- Step 1: Check if user is already locked ---
|
||||||
|
const blockedKey = `login:blocked:${customerNo}`;
|
||||||
|
const attemptsKey = `login:attempts:${customerNo}`;
|
||||||
|
if (!customerNo && userName) {
|
||||||
|
const result = await db.query('SELECT * FROM users WHERE preferred_name = $1', [
|
||||||
|
userName,
|
||||||
|
]);
|
||||||
|
if (result.rows.length === 0) {
|
||||||
|
logger.error("Customer not found with this user name.");
|
||||||
|
return res.status(404).json({ error: 'No user found with this username.' });
|
||||||
|
}
|
||||||
|
logger.info("Customer found with user name.");
|
||||||
|
customerNo = result.rows[0].customer_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
const userCheck = await authService.findUserByCustomerNo(customerNo);
|
||||||
|
|
||||||
|
if (loginType.toUpperCase() === 'IB') {
|
||||||
|
// check DB locked flag
|
||||||
|
if (userCheck && userCheck.locked) {
|
||||||
|
await setJson(blockedKey, true, BLOCK_DURATION);
|
||||||
|
logger.error("USER Account Locked");
|
||||||
|
return res.status(423).json({
|
||||||
|
error: 'Your account is locked. Please contact the administrator.',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Step 2: Check migration status
|
||||||
const isMigratedUser = await authService.isMigratedUser(customerNo);
|
const isMigratedUser = await authService.isMigratedUser(customerNo);
|
||||||
if (isMigratedUser)
|
if (isMigratedUser)
|
||||||
return res.status(401).json({ error: 'MIGRATED_USER_HAS_NO_PASSWORD' });
|
return res.status(401).json({ error: 'MIGRATED_USER_HAS_NO_PASSWORD' });
|
||||||
|
|
||||||
|
// --- Step 3: Validate credentials ---
|
||||||
const user = await authService.validateUser(customerNo, password);
|
const user = await authService.validateUser(customerNo, password);
|
||||||
if (!user || !password)
|
|
||||||
return res.status(401).json({ error: 'INVALID_CREDENTIALS' });
|
if (!user) {
|
||||||
|
if (loginType.toUpperCase() === 'IB') {
|
||||||
|
let attempts = (await getJson(attemptsKey)) || 0;
|
||||||
|
attempts += 1;
|
||||||
|
|
||||||
|
if (attempts >= MAX_ATTEMPTS) {
|
||||||
|
await db.query('UPDATE users SET locked = true WHERE customer_no = $1', [customerNo]);
|
||||||
|
await setJson(blockedKey, true, BLOCK_DURATION);
|
||||||
|
await setJson(attemptsKey, 0);
|
||||||
|
|
||||||
|
return res.status(423).json({
|
||||||
|
error: 'Your account has been locked due to multiple failed login attempts. Please contact the administrator.',
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await setJson(attemptsKey, attempts, BLOCK_DURATION);
|
||||||
|
return res.status(401).json({
|
||||||
|
error: `Invalid credentials. ${MAX_ATTEMPTS - attempts} attempt(s) remaining.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return res.status(401).json({ error: 'Invalid credentials.' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Step 4: If login successful, reset Redis attempts ---
|
||||||
|
await setJson(attemptsKey, 0); // reset counter
|
||||||
|
|
||||||
const FirstTimeLogin = await authService.CheckFirstTimeLogin(customerNo);
|
const FirstTimeLogin = await authService.CheckFirstTimeLogin(customerNo);
|
||||||
// For registration : if try to login first time after 7 days.
|
|
||||||
if (FirstTimeLogin && dayjs(user.created_at).diff(currentTime, 'day') > 8)
|
if (FirstTimeLogin && dayjs(user.created_at).diff(currentTime, 'day') > 8)
|
||||||
return res
|
return res.status(401).json({
|
||||||
.status(401)
|
error: 'Password Expired.Please Contact with Administrator',
|
||||||
.json({ error: 'Password Expired.Please Contact with Administrator' });
|
});
|
||||||
|
|
||||||
|
// --- Step 5: Get user details (for OTP logic) ---
|
||||||
|
const userDetails = await customerController.getDetails(customerNo);
|
||||||
|
const singleUserDetail = userDetails[0];
|
||||||
|
if (!singleUserDetail?.mobileno)
|
||||||
|
return res.status(400).json({ error: 'USER_PHONE_NOT_FOUND' });
|
||||||
|
const mobileNumber = singleUserDetail.mobileno;
|
||||||
|
|
||||||
|
// --- Step 6: OTP requirement for IB login ---
|
||||||
|
if (loginType.toUpperCase() === 'IB' && !otp) {
|
||||||
|
logger.info(`credential verified but otp required | Type: ${loginType}`);
|
||||||
|
return res.status(202).json({
|
||||||
|
status: 'OTP_REQUIRED',
|
||||||
|
mobile: mobileNumber,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Step 7: Generate token and update last login ---
|
||||||
const token = generateToken(user.customer_no);
|
const token = generateToken(user.customer_no);
|
||||||
const loginPswExpiry = user.password_hash_expiry;
|
const loginPswExpiry = user.password_hash_expiry;
|
||||||
const rights = {
|
const rights = {
|
||||||
@@ -41,10 +116,10 @@ async function login(req, res) {
|
|||||||
customerNo,
|
customerNo,
|
||||||
]);
|
]);
|
||||||
logger.info(`Login successful | Type: ${loginType}`);
|
logger.info(`Login successful | Type: ${loginType}`);
|
||||||
res.json({ token, FirstTimeLogin, loginPswExpiry, rights });
|
return res.json({ token, FirstTimeLogin, loginPswExpiry, rights });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err, `login failed | Type: ${loginType}`);
|
logger.error(err, `login failed | Type: ${loginType}`);
|
||||||
res.status(500).json({ error: 'something went wrong' });
|
return res.status(500).json({ error: 'something went wrong' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,6 +263,64 @@ async function changeTransPassword(req, res) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isUserNameExits(req, res) {
|
||||||
|
try {
|
||||||
|
const customerNo = req.user;
|
||||||
|
const user = await authService.findUserByCustomerNo(customerNo);
|
||||||
|
if (!user) {
|
||||||
|
return res.status(404).json({ error: 'USER_NOT_FOUND' });
|
||||||
|
}
|
||||||
|
const userName = await authService.CheckUserName(customerNo);
|
||||||
|
return res.json({ user_name: userName });
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
return res.status(500).json({ error: 'INTERNAL_SERVER_ERROR' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setUserName(req, res) {
|
||||||
|
const customerNo = req.user;
|
||||||
|
try {
|
||||||
|
const user = await authService.findUserByCustomerNo(customerNo);
|
||||||
|
if (!user) {
|
||||||
|
return res.status(404).json({ error: 'USER_NOT_FOUND' });
|
||||||
|
}
|
||||||
|
const userNameIsExits = await authService.CheckUserName(customerNo);
|
||||||
|
const { user_name } = req.body;
|
||||||
|
|
||||||
|
if (!user_name) {
|
||||||
|
return res.status(400).json({ error: 'Username is required' });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!userNameIsExits) {
|
||||||
|
await authService.setUserName(customerNo, user_name);
|
||||||
|
logger.info('User name has been set for first time.');
|
||||||
|
return res.json({ message: 'All set! Your username has been saved.' });
|
||||||
|
}
|
||||||
|
if (userNameIsExits) {
|
||||||
|
const historyRes = await db.query('SELECT preferred_name FROM preferred_name_history WHERE customer_no = $1 ORDER BY changed_at DESC LIMIT 5',
|
||||||
|
[customerNo]
|
||||||
|
);
|
||||||
|
// maximum 5 times can changed username
|
||||||
|
const history = historyRes.rows.map((r) => r.preferred_name.toLowerCase());
|
||||||
|
if (history.length >= 5) {
|
||||||
|
return res.status(429).json({ error: "Preferred name change limit reached -5 times" });
|
||||||
|
}
|
||||||
|
// Cannot match last 2
|
||||||
|
const lastTwo = history.slice(0, 2);
|
||||||
|
if (lastTwo.includes(user_name.toLowerCase())) {
|
||||||
|
return res.status(409).json({ error: "Preferred name cannot match last 2 preferred names" });
|
||||||
|
}
|
||||||
|
await authService.setUserName(customerNo, user_name);
|
||||||
|
logger.info('User name has been updated.');
|
||||||
|
return res.json({ message: 'All set! Your username has been updated.' });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(error);
|
||||||
|
return res.status(500).json({ error: 'CANNOT UPDATE USER NAME' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
login,
|
login,
|
||||||
tpin,
|
tpin,
|
||||||
@@ -197,4 +330,6 @@ module.exports = {
|
|||||||
fetchUserDetails,
|
fetchUserDetails,
|
||||||
changeLoginPassword,
|
changeLoginPassword,
|
||||||
changeTransPassword,
|
changeTransPassword,
|
||||||
|
isUserNameExits,
|
||||||
|
setUserName,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ async function send(
|
|||||||
ifscCode,
|
ifscCode,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
beneficiaryAcctType = 'SAVINGS',
|
beneficiaryAcctType = 'SAVINGS',
|
||||||
remarks = ''
|
remarks = '',
|
||||||
|
client
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const reqData = {
|
const reqData = {
|
||||||
@@ -42,7 +43,8 @@ async function send(
|
|||||||
amount,
|
amount,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
response.data
|
response.data,
|
||||||
|
client
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ async function send(
|
|||||||
ifscCode,
|
ifscCode,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
remarks
|
remarks,
|
||||||
|
client
|
||||||
) {
|
) {
|
||||||
const commission = 0;
|
const commission = 0;
|
||||||
try {
|
try {
|
||||||
@@ -28,7 +29,7 @@ async function send(
|
|||||||
stAddress1: '',
|
stAddress1: '',
|
||||||
stAddress2: '',
|
stAddress2: '',
|
||||||
stAddress3: '',
|
stAddress3: '',
|
||||||
narration: remarks
|
narration: remarks,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await recordInterBankTransaction(
|
await recordInterBankTransaction(
|
||||||
@@ -41,7 +42,8 @@ async function send(
|
|||||||
commission,
|
commission,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
response.data.status
|
response.data.status,
|
||||||
|
client
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -49,8 +51,6 @@ async function send(
|
|||||||
'API call failed: ' + (error.response?.data?.message || error.message)
|
'API call failed: ' + (error.response?.data?.message || error.message)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { send };
|
module.exports = { send };
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const templates = require('../util/sms_template');
|
|||||||
// Send OTP
|
// Send OTP
|
||||||
async function SendOtp(req, res) {
|
async function SendOtp(req, res) {
|
||||||
const {
|
const {
|
||||||
|
username,
|
||||||
mobileNumber,
|
mobileNumber,
|
||||||
type,
|
type,
|
||||||
amount,
|
amount,
|
||||||
@@ -20,6 +21,7 @@ async function SendOtp(req, res) {
|
|||||||
ref,
|
ref,
|
||||||
date,
|
date,
|
||||||
userOtp,
|
userOtp,
|
||||||
|
PreferName,
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
if (!mobileNumber || !type) {
|
if (!mobileNumber || !type) {
|
||||||
@@ -33,6 +35,10 @@ async function SendOtp(req, res) {
|
|||||||
let otp = null;
|
let otp = null;
|
||||||
// Pick template based on type
|
// Pick template based on type
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case 'LOGIN_OTP':
|
||||||
|
otp = generateOTP(6);
|
||||||
|
message = templates.LOGIN_OTP(otp, username);
|
||||||
|
break;
|
||||||
case 'IMPS':
|
case 'IMPS':
|
||||||
otp = generateOTP(6);
|
otp = generateOTP(6);
|
||||||
message = templates.IMPS(otp);
|
message = templates.IMPS(otp);
|
||||||
@@ -52,6 +58,10 @@ async function SendOtp(req, res) {
|
|||||||
case 'BENEFICIARY_SUCCESS':
|
case 'BENEFICIARY_SUCCESS':
|
||||||
message = templates.BENEFICIARY_SUCCESS(beneficiary);
|
message = templates.BENEFICIARY_SUCCESS(beneficiary);
|
||||||
break;
|
break;
|
||||||
|
case 'BENEFICIARY_DELETE':
|
||||||
|
otp = generateOTP(6);
|
||||||
|
message = templates.BENEFICIARY_DELETE(otp, beneficiary);
|
||||||
|
break;
|
||||||
case 'NOTIFICATION':
|
case 'NOTIFICATION':
|
||||||
message = templates.NOTIFICATION(acctFrom, acctTo, amount, ref, date);
|
message = templates.NOTIFICATION(acctFrom, acctTo, amount, ref, date);
|
||||||
break;
|
break;
|
||||||
@@ -71,6 +81,10 @@ async function SendOtp(req, res) {
|
|||||||
otp = generateOTP(6);
|
otp = generateOTP(6);
|
||||||
message = templates.CHANGE_TPWORD(otp);
|
message = templates.CHANGE_TPWORD(otp);
|
||||||
break;
|
break;
|
||||||
|
case 'SET_TPWORD':
|
||||||
|
otp = generateOTP(6);
|
||||||
|
message = templates.SET_TPWORD(otp);
|
||||||
|
break;
|
||||||
case 'CHANGE_MPIN':
|
case 'CHANGE_MPIN':
|
||||||
otp = generateOTP(6);
|
otp = generateOTP(6);
|
||||||
message = templates.CHANGE_MPIN(otp);
|
message = templates.CHANGE_MPIN(otp);
|
||||||
@@ -86,6 +100,13 @@ async function SendOtp(req, res) {
|
|||||||
otp = generateOTP(6);
|
otp = generateOTP(6);
|
||||||
message = templates.EMandate(otp);
|
message = templates.EMandate(otp);
|
||||||
break;
|
break;
|
||||||
|
case 'USERNAME_UPDATED':
|
||||||
|
otp = generateOTP(6);
|
||||||
|
message = templates.USERNAME_UPDATED(otp);
|
||||||
|
break;
|
||||||
|
case 'USERNAME_SAVED':
|
||||||
|
message = templates.USERNAME_SAVED(PreferName);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return res.status(400).json({ error: 'Invalid OTP type' });
|
return res.status(400).json({ error: 'Invalid OTP type' });
|
||||||
}
|
}
|
||||||
@@ -104,10 +125,8 @@ async function SendOtp(req, res) {
|
|||||||
if (message.includes('OTP')) {
|
if (message.includes('OTP')) {
|
||||||
await setJson(`otp:${mobileNumber}`, otp, 300);
|
await setJson(`otp:${mobileNumber}`, otp, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(`Sent OTP [${otp}] for type [${type}] to ${mobileNumber}`);
|
logger.info(`Sent OTP [${otp}] for type [${type}] to ${mobileNumber}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.status(200).json({ message: 'Message sent successfully' });
|
return res.status(200).json({ message: 'Message sent successfully' });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err, 'Error sending OTP');
|
logger.error(err, 'Error sending OTP');
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ async function send(
|
|||||||
ifscCode,
|
ifscCode,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
remarks
|
remarks,
|
||||||
|
client
|
||||||
) {
|
) {
|
||||||
const commission = 0;
|
const commission = 0;
|
||||||
try {
|
try {
|
||||||
@@ -28,7 +29,8 @@ async function send(
|
|||||||
stAddress1: '',
|
stAddress1: '',
|
||||||
stAddress2: '',
|
stAddress2: '',
|
||||||
stAddress3: '',
|
stAddress3: '',
|
||||||
narration: remarks
|
narration: remarks,
|
||||||
|
client,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
await recordInterBankTransaction(
|
await recordInterBankTransaction(
|
||||||
@@ -41,7 +43,8 @@ async function send(
|
|||||||
commission,
|
commission,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
response.data.status
|
response.data.status,
|
||||||
|
client
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ async function transfer(
|
|||||||
toAccountType,
|
toAccountType,
|
||||||
amount,
|
amount,
|
||||||
customerNo,
|
customerNo,
|
||||||
narration = ''
|
narration = '',
|
||||||
|
client
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(
|
const response = await axios.post(
|
||||||
@@ -28,7 +29,8 @@ async function transfer(
|
|||||||
toAccountNo,
|
toAccountNo,
|
||||||
toAccountType,
|
toAccountType,
|
||||||
amount,
|
amount,
|
||||||
response.data.status
|
response.data.status,
|
||||||
|
client
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
20
src/middlewares/clientVerifier.middleware.js
Normal file
20
src/middlewares/clientVerifier.middleware.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
const { logger } = require('../util/logger');
|
||||||
|
|
||||||
|
function verifyClient(req, res, next) {
|
||||||
|
const clientHeader = req.headers['x-login-type'];
|
||||||
|
|
||||||
|
if (!clientHeader || (clientHeader !== 'MB' && clientHeader !== 'IB')) {
|
||||||
|
logger.error(
|
||||||
|
`Invalid or missing client header. Expected 'MB' or 'IB'. Found ${clientHeader}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return res
|
||||||
|
.status(401)
|
||||||
|
.json({ error: 'MISSING OR INVALID CLIENT TYPE HEADER' });
|
||||||
|
}
|
||||||
|
|
||||||
|
req.client = clientHeader;
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { verifyClient };
|
||||||
28
src/middlewares/limitCheck.middleware.js
Normal file
28
src/middlewares/limitCheck.middleware.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const { logger } = require('../util/logger');
|
||||||
|
const {
|
||||||
|
getDailyLimit,
|
||||||
|
getUsedLimit,
|
||||||
|
} = require('../services/paymentLimit.service');
|
||||||
|
|
||||||
|
async function checkLimit(req, res, next) {
|
||||||
|
const { amount } = req.body;
|
||||||
|
const { user, client } = req;
|
||||||
|
const dailyLimit = await getDailyLimit(user, client);
|
||||||
|
if (!dailyLimit) {
|
||||||
|
logger.info('NO LIMIT SET FOR CUSTOMER. ALLOWING TRANSACTIONS');
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
const usedLimit = await getUsedLimit(user, client);
|
||||||
|
|
||||||
|
const remainingLimit = dailyLimit - usedLimit;
|
||||||
|
|
||||||
|
if (amount > remainingLimit) {
|
||||||
|
const midnight = new Date();
|
||||||
|
midnight.setHours(24, 0, 0, 0);
|
||||||
|
res.set('Retry-After', midnight.toUTCString());
|
||||||
|
return res.status(403).json({ error: 'Daily limit exhausted' });
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { checkLimit };
|
||||||
@@ -12,6 +12,8 @@ router.post('/login_password', authenticate, authController.setLoginPassword);
|
|||||||
router.post('/transaction_password',authenticate,authController.setTransactionPassword);
|
router.post('/transaction_password',authenticate,authController.setTransactionPassword);
|
||||||
router.post('/change/login_password',authenticate,authController.changeLoginPassword);
|
router.post('/change/login_password',authenticate,authController.changeLoginPassword);
|
||||||
router.post('/change/transaction_password',authenticate,authController.changeTransPassword);
|
router.post('/change/transaction_password',authenticate,authController.changeTransPassword);
|
||||||
|
router.get('/user_name',authenticate,authController.isUserNameExits);
|
||||||
|
router.post('/user_name',authenticate,authController.setUserName);
|
||||||
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
const customerController = require('../controllers/customer_details.controller');
|
const customerController = require('../controllers/customer_details.controller');
|
||||||
|
const {
|
||||||
|
getDailyLimit,
|
||||||
|
getUsedLimit,
|
||||||
|
setDailyLimit,
|
||||||
|
} = require('../services/paymentLimit.service');
|
||||||
const { logger } = require('../util/logger');
|
const { logger } = require('../util/logger');
|
||||||
|
const express = require('express');
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
const customerRoute = async (req, res) => {
|
const customerRoute = async (req, res) => {
|
||||||
const customerNo = req.user;
|
const customerNo = req.user;
|
||||||
@@ -12,4 +20,45 @@ const customerRoute = async (req, res) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = customerRoute;
|
const limitRoute = async (req, res) => {
|
||||||
|
const customerNo = req.user;
|
||||||
|
const client = req.client;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const dailyLimit = await getDailyLimit(customerNo, client);
|
||||||
|
if (!dailyLimit) {
|
||||||
|
return res.status(400).json({ error: 'NO DAILY LIMIT SET FOR USER' });
|
||||||
|
}
|
||||||
|
const usedLimit = await getUsedLimit(customerNo, client);
|
||||||
|
res.json({ dailyLimit: dailyLimit, usedLimit: usedLimit });
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(err, 'Unknown error encountered while checking daily limit');
|
||||||
|
res.status(500).json({ error: 'INTERNAL_SERVER_ERROR' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const limitChangeRoute = async (req, res) => {
|
||||||
|
const customerNo = req.user;
|
||||||
|
const client = req.client;
|
||||||
|
const { amount } = req.body;
|
||||||
|
const numericLimit = Number(amount);
|
||||||
|
|
||||||
|
if (!Number.isFinite(numericLimit)) {
|
||||||
|
logger.error(`Invalid new Limit, found: ${newLimit}`);
|
||||||
|
return res
|
||||||
|
.status(400)
|
||||||
|
.json({ error: 'NEW LIMIT AMOUNT IS REQUIRED WHEN SETTING LIMIT' });
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await setDailyLimit(customerNo, client, numericLimit);
|
||||||
|
return res.status(200).json({ message: 'LIMIT SET' });
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(err, 'Unexpected error while setting limit amount');
|
||||||
|
res.status(500).json({ error: 'INTERNAL SERVER ERROR' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
router.get('/', customerRoute);
|
||||||
|
router.get('/daily-limit', limitRoute);
|
||||||
|
router.post('/daily-limit', limitChangeRoute);
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
|
|||||||
@@ -3,13 +3,15 @@ const impsController = require('../controllers/imps.controller');
|
|||||||
const { logger } = require('../util/logger');
|
const { logger } = require('../util/logger');
|
||||||
const impsValidator = require('../validators/imps.validator');
|
const impsValidator = require('../validators/imps.validator');
|
||||||
const paymentSecretValidator = require('../validators/payment.secret.validator');
|
const paymentSecretValidator = require('../validators/payment.secret.validator');
|
||||||
|
const { checkLimit } = require('../middlewares/limitCheck.middleware');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(impsValidator, paymentSecretValidator);
|
router.use(impsValidator, paymentSecretValidator, checkLimit);
|
||||||
|
|
||||||
const impsRoute = async (req, res) => {
|
const impsRoute = async (req, res) => {
|
||||||
const { fromAccount, toAccount, ifscCode, amount, beneficiaryName, remarks } =
|
const { fromAccount, toAccount, ifscCode, amount, beneficiaryName, remarks } =
|
||||||
req.body;
|
req.body;
|
||||||
|
const client = req.client;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await impsController.send(
|
const result = await impsController.send(
|
||||||
@@ -20,7 +22,8 @@ const impsRoute = async (req, res) => {
|
|||||||
ifscCode,
|
ifscCode,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
'SAVINGS',
|
'SAVINGS',
|
||||||
remarks
|
remarks,
|
||||||
|
client
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.startsWith('Message produced successfully')) {
|
if (result.startsWith('Message produced successfully')) {
|
||||||
|
|||||||
@@ -26,5 +26,4 @@ router.use('/beneficiary', authenticate, beneficiaryRoute);
|
|||||||
router.use('/npci/beneficiary-response', npciResponse);
|
router.use('/npci/beneficiary-response', npciResponse);
|
||||||
router.use('/otp', otp);
|
router.use('/otp', otp);
|
||||||
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ const neftController = require('../controllers/neft.controller');
|
|||||||
const { logger } = require('../util/logger');
|
const { logger } = require('../util/logger');
|
||||||
const neftValidator = require('../validators/neft.validator.js');
|
const neftValidator = require('../validators/neft.validator.js');
|
||||||
const paymentSecretValidator = require('../validators/payment.secret.validator');
|
const paymentSecretValidator = require('../validators/payment.secret.validator');
|
||||||
|
const { checkLimit } = require('../middlewares/limitCheck.middleware');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(neftValidator, paymentSecretValidator);
|
router.use(neftValidator, paymentSecretValidator, checkLimit);
|
||||||
|
|
||||||
const neftRoute = async (req, res) => {
|
const neftRoute = async (req, res) => {
|
||||||
const {
|
const {
|
||||||
@@ -15,8 +16,9 @@ const neftRoute = async (req, res) => {
|
|||||||
amount,
|
amount,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
remarks
|
remarks,
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
const client = req.client;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await neftController.send(
|
const result = await neftController.send(
|
||||||
@@ -27,7 +29,8 @@ const neftRoute = async (req, res) => {
|
|||||||
ifscCode,
|
ifscCode,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
remarks
|
remarks,
|
||||||
|
client
|
||||||
);
|
);
|
||||||
logger.info(result);
|
logger.info(result);
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ const rtgsController = require('../controllers/rtgs.controller');
|
|||||||
const { logger } = require('../util/logger');
|
const { logger } = require('../util/logger');
|
||||||
const rtgsValidator = require('../validators/rtgs.validator.js');
|
const rtgsValidator = require('../validators/rtgs.validator.js');
|
||||||
const paymentSecretValidator = require('../validators/payment.secret.validator');
|
const paymentSecretValidator = require('../validators/payment.secret.validator');
|
||||||
|
const { checkLimit } = require('../middlewares/limitCheck.middleware');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(rtgsValidator, paymentSecretValidator);
|
router.use(rtgsValidator, paymentSecretValidator, checkLimit);
|
||||||
|
|
||||||
const rtgsRoute = async (req, res) => {
|
const rtgsRoute = async (req, res) => {
|
||||||
const {
|
const {
|
||||||
@@ -15,8 +16,9 @@ const rtgsRoute = async (req, res) => {
|
|||||||
amount,
|
amount,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
remarks
|
remarks,
|
||||||
} = req.body;
|
} = req.body;
|
||||||
|
const client = req.client;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await rtgsController.send(
|
const result = await rtgsController.send(
|
||||||
@@ -27,7 +29,8 @@ const rtgsRoute = async (req, res) => {
|
|||||||
ifscCode,
|
ifscCode,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
remarks
|
remarks,
|
||||||
|
client
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.status.startsWith('O.K.')) {
|
if (result.status.startsWith('O.K.')) {
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ const { logger } = require('../util/logger');
|
|||||||
const express = require('express');
|
const express = require('express');
|
||||||
const transferValidator = require('../validators/transfer.validator');
|
const transferValidator = require('../validators/transfer.validator');
|
||||||
const passwordValidator = require('../validators/payment.secret.validator.js');
|
const passwordValidator = require('../validators/payment.secret.validator.js');
|
||||||
|
const { checkLimit } = require('../middlewares/limitCheck.middleware');
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(passwordValidator, transferValidator);
|
router.use(passwordValidator, transferValidator, checkLimit);
|
||||||
|
|
||||||
const transferRoute = async (req, res) => {
|
const transferRoute = async (req, res) => {
|
||||||
const { fromAccount, toAccount, toAccountType, amount, remarks } = req.body;
|
const { fromAccount, toAccount, toAccountType, amount, remarks } = req.body;
|
||||||
|
const client = req.client;
|
||||||
try {
|
try {
|
||||||
const result = await transferController.transfer(
|
const result = await transferController.transfer(
|
||||||
fromAccount,
|
fromAccount,
|
||||||
@@ -16,7 +18,8 @@ const transferRoute = async (req, res) => {
|
|||||||
toAccountType,
|
toAccountType,
|
||||||
amount,
|
amount,
|
||||||
req.user,
|
req.user,
|
||||||
remarks
|
remarks,
|
||||||
|
client
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.status === 'O.K.') {
|
if (result.status === 'O.K.') {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const db = require('../config/db');
|
const db = require('../config/db');
|
||||||
const { comparePassword, hashPassword } = require('../util/hash');
|
const { comparePassword, hashPassword } = require('../util/hash');
|
||||||
const dayjs = require('dayjs');
|
const dayjs = require('dayjs');
|
||||||
|
const { logger } = require('../util/logger');
|
||||||
|
|
||||||
async function findUserByCustomerNo(customerNo) {
|
async function findUserByCustomerNo(customerNo) {
|
||||||
const result = await db.query('SELECT * FROM users WHERE customer_no = $1', [
|
const result = await db.query('SELECT * FROM users WHERE customer_no = $1', [
|
||||||
@@ -124,6 +125,47 @@ async function changeTransPassword(customerNo, trans_psw) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function CheckUserName(customerNo) {
|
||||||
|
try {
|
||||||
|
const result = await db.query('SELECT preferred_name from users WHERE customer_no = $1',
|
||||||
|
[customerNo]
|
||||||
|
);
|
||||||
|
if (result.rows.length > 0) {
|
||||||
|
return result.rows[0].preferred_name;;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
throw new Error(
|
||||||
|
`error occurred while fetch the preferred name ${error.message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setUserName(customerNo, username) {
|
||||||
|
const currentTime = dayjs().toISOString();
|
||||||
|
try {
|
||||||
|
await db.query(
|
||||||
|
'UPDATE users SET preferred_name = $1 ,updated_at = $2 WHERE customer_no = $3',
|
||||||
|
[username, currentTime, customerNo]
|
||||||
|
);
|
||||||
|
logger.info("user table updated");
|
||||||
|
await db.query(
|
||||||
|
"INSERT INTO preferred_name_history (customer_no, preferred_name) VALUES ($1, $2)",
|
||||||
|
[customerNo, username]
|
||||||
|
);
|
||||||
|
logger.info("preferred_name_history table updated");
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === '23505') {
|
||||||
|
throw new Error('PREFERRED_NAME_ALREADY_EXISTS');
|
||||||
|
}
|
||||||
|
throw new Error(
|
||||||
|
`error occured while setting new preferred name ${error.message}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
validateUser,
|
validateUser,
|
||||||
findUserByCustomerNo,
|
findUserByCustomerNo,
|
||||||
@@ -136,4 +178,7 @@ module.exports = {
|
|||||||
changeLoginPassword,
|
changeLoginPassword,
|
||||||
changeTransPassword,
|
changeTransPassword,
|
||||||
isMigratedUser,
|
isMigratedUser,
|
||||||
|
CheckUserName,
|
||||||
|
setUserName,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
38
src/services/paymentLimit.service.js
Normal file
38
src/services/paymentLimit.service.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
const db = require('../config/db');
|
||||||
|
const { logger } = require('../util/logger');
|
||||||
|
|
||||||
|
async function getDailyLimit(customerNo, clientType) {
|
||||||
|
let query = '';
|
||||||
|
if (clientType === 'IB') {
|
||||||
|
query = `SELECT inb_limit_amount AS daily_limit FROM users WHERE customer_no = $1`;
|
||||||
|
} else {
|
||||||
|
query = `SELECT mobile_limit_amount AS daily_limit FROM users WHERE customer_no = $1`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await db.query(query, [customerNo]);
|
||||||
|
return result.rows[0].daily_limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getUsedLimit(customerNo, clientType) {
|
||||||
|
let query = `SELECT SUM(amount::numeric) AS used_limit FROM transactions WHERE created_at BETWEEN CURRENT_DATE AND (CURRENT_DATE + INTERVAL '1 day') AND customer_no = $1 AND client = $2`;
|
||||||
|
const result = await db.query(query, [customerNo, clientType]);
|
||||||
|
const usedLimit = result.rows[0].used_limit;
|
||||||
|
return Number(usedLimit);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setDailyLimit(customerNo, clientType, amount) {
|
||||||
|
let query = '';
|
||||||
|
if (clientType === 'IB') {
|
||||||
|
query = `UPDATE users SET inb_limit_amount = $1 WHERE customer_no = $2`;
|
||||||
|
} else {
|
||||||
|
query = `UPDATE users SET mobile_limit_amount = $1 WHERE customer_no = $2`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await db.query(query, [amount, customerNo]);
|
||||||
|
if (result.rowCount === 0) {
|
||||||
|
throw new Error('No rows affected');
|
||||||
|
}
|
||||||
|
logger.info(`set new limit: ${result.rowCount} rows affected`);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { getDailyLimit, getUsedLimit, setDailyLimit };
|
||||||
@@ -6,11 +6,12 @@ const recordIntraBankTransaction = async (
|
|||||||
toAccount,
|
toAccount,
|
||||||
accountType,
|
accountType,
|
||||||
amount,
|
amount,
|
||||||
status
|
status,
|
||||||
|
clientType
|
||||||
) => {
|
) => {
|
||||||
const trxType = 'TRF';
|
const trxType = 'TRF';
|
||||||
const query =
|
const query =
|
||||||
'INSERT INTO transactions (customer_no, trx_type, from_account, to_account, to_account_type, amount, status) VALUES ($1, $2, $3, $4, $5, $6, $7)';
|
'INSERT INTO transactions (customer_no, trx_type, from_account, to_account, to_account_type, amount, status, client) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)';
|
||||||
await db.query(query, [
|
await db.query(query, [
|
||||||
customerNo,
|
customerNo,
|
||||||
trxType,
|
trxType,
|
||||||
@@ -19,6 +20,7 @@ const recordIntraBankTransaction = async (
|
|||||||
accountType,
|
accountType,
|
||||||
amount,
|
amount,
|
||||||
status,
|
status,
|
||||||
|
clientType,
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
const recordInterBankTransaction = async (
|
const recordInterBankTransaction = async (
|
||||||
@@ -31,10 +33,11 @@ const recordInterBankTransaction = async (
|
|||||||
commission,
|
commission,
|
||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
status
|
status,
|
||||||
|
clientType
|
||||||
) => {
|
) => {
|
||||||
const query =
|
const query =
|
||||||
'INSERT INTO transactions (customer_no, trx_type, from_account, to_account, ifsc_code, amount, commission, beneficiary_name, remitter_name, status) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)';
|
'INSERT INTO transactions (customer_no, trx_type, from_account, to_account, ifsc_code, amount, commission, beneficiary_name, remitter_name, status, client) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)';
|
||||||
await db.query(query, [
|
await db.query(query, [
|
||||||
customerNo,
|
customerNo,
|
||||||
trxType,
|
trxType,
|
||||||
@@ -46,6 +49,7 @@ const recordInterBankTransaction = async (
|
|||||||
beneficiaryName,
|
beneficiaryName,
|
||||||
remitterName,
|
remitterName,
|
||||||
status,
|
status,
|
||||||
|
clientType,
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
const templates = {
|
const templates = {
|
||||||
|
LOGIN_OTP: (otp, username) => `Dear Customer, Your username ${username} have been verified. Please enter the OTP: ${otp} to complete your login. -KCCB `,
|
||||||
|
|
||||||
IMPS: (otp) => `Dear Customer, Please complete the fund transfer with OTP ${otp} -KCCB`,
|
IMPS: (otp) => `Dear Customer, Please complete the fund transfer with OTP ${otp} -KCCB`,
|
||||||
|
|
||||||
NEFT: (otp, amount, beneficiary) =>
|
NEFT: (otp, amount, beneficiary) =>
|
||||||
@@ -8,7 +10,10 @@ const templates = {
|
|||||||
`Dear Customer, Please complete the RTGS of Rs.${amount} to ${beneficiary} with OTP:${otp} -KCCB`,
|
`Dear Customer, Please complete the RTGS of Rs.${amount} to ${beneficiary} with OTP:${otp} -KCCB`,
|
||||||
|
|
||||||
BENEFICIARY_ADD: (otp, beneficiary, ifsc) =>
|
BENEFICIARY_ADD: (otp, beneficiary, ifsc) =>
|
||||||
`Dear Customer, You have added beneficiary ${beneficiary} ${ifsc} for NEFT/RTGS. Please endorse the beneficiary with OTP ${otp} -KCCB`,
|
`Dear Customer, You have added beneficiary ${beneficiary} ${ifsc} for IMPS/NEFT/RTGS. Please endorse the beneficiary with OTP ${otp} -KCCB`,
|
||||||
|
|
||||||
|
BENEFICIARY_DELETE: (otp, beneficiary) =>
|
||||||
|
`Dear Customer, you have deleted the beneficiary ${beneficiary} for IMPS/NEFT/RTGS. Please confirm the deletion using OTP ${otp}. - KCCB`,
|
||||||
|
|
||||||
BENEFICIARY_SUCCESS: (beneficiary) =>
|
BENEFICIARY_SUCCESS: (beneficiary) =>
|
||||||
`Dear Customer, Your Beneficiary: ${beneficiary} for Net Banking is added successfully -KCCB`,
|
`Dear Customer, Your Beneficiary: ${beneficiary} for Net Banking is added successfully -KCCB`,
|
||||||
@@ -28,6 +33,9 @@ const templates = {
|
|||||||
CHANGE_TPWORD: (otp) =>
|
CHANGE_TPWORD: (otp) =>
|
||||||
`Dear Customer, Change Transaction password OTP is ${otp} -KCCB`,
|
`Dear Customer, Change Transaction password OTP is ${otp} -KCCB`,
|
||||||
|
|
||||||
|
SET_TPWORD: (otp) =>
|
||||||
|
`Dear Customer, Your Set New Transaction password OTP is ${otp} -KCCB`,
|
||||||
|
|
||||||
CHANGE_MPIN: (otp) =>
|
CHANGE_MPIN: (otp) =>
|
||||||
`Dear Customer, Change M-PIN OTP is ${otp} -KCCB`,
|
`Dear Customer, Change M-PIN OTP is ${otp} -KCCB`,
|
||||||
|
|
||||||
@@ -38,7 +46,13 @@ const templates = {
|
|||||||
`Dear Customer, Your CIF rights have been updated. Please log in again to access the features. -KCCB`,
|
`Dear Customer, Your CIF rights have been updated. Please log in again to access the features. -KCCB`,
|
||||||
|
|
||||||
EMandate: (otp) =>
|
EMandate: (otp) =>
|
||||||
`Dear Customer, Your OTP for e-Mandate is ${otp}.It is valid for 1 minute.Do not share this OTP with anyone. -KCCB`
|
`Dear Customer, Your OTP for e-Mandate is ${otp}.It is valid for 1 minute.Do not share this OTP with anyone. -KCCB`,
|
||||||
|
|
||||||
|
USERNAME_UPDATED: (otp) =>
|
||||||
|
`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.`
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = templates;
|
module.exports = templates;
|
||||||
Reference in New Issue
Block a user