feat : onboarding new CIF by giving rights through admin portal.
feat : View the user rights and update in admin portal. chore : Add some template message for OTP
This commit is contained in:
@@ -7,29 +7,31 @@ const templates = require('../util/sms_template');
|
||||
|
||||
// Send OTP
|
||||
async function SendOtp(req, res) {
|
||||
const { mobileNumber, type, amount, beneficiary, ifsc, acctFrom, acctTo, ref, date,userOtp } = req.body;
|
||||
const { mobileNumber, type, amount, beneficiary, ifsc, acctFrom, acctTo, ref, date, userOtp } = req.body;
|
||||
|
||||
if (!mobileNumber || !type) {
|
||||
return res.status(400).json({ error: 'Mobile number and type are required' });
|
||||
}
|
||||
|
||||
try {
|
||||
// const otp = generateOTP(6);
|
||||
const otp = type === 'REGISTRATION' && userOtp ? userOtp : generateOTP(6);
|
||||
let message;
|
||||
|
||||
let otp = null;
|
||||
// Pick template based on type
|
||||
switch (type) {
|
||||
case 'IMPS':
|
||||
otp = generateOTP(6);
|
||||
message = templates.IMPS(otp);
|
||||
break;
|
||||
case 'NEFT':
|
||||
otp = generateOTP(6);
|
||||
message = templates.NEFT(otp, amount, beneficiary);
|
||||
break;
|
||||
case 'RTGS':
|
||||
otp = generateOTP(6);
|
||||
message = templates.RTGS(otp, amount, beneficiary);
|
||||
break;
|
||||
case 'BENEFICIARY_ADD':
|
||||
otp = generateOTP(6);
|
||||
message = templates.BENEFICIARY_ADD(otp, beneficiary, ifsc);
|
||||
break;
|
||||
case 'BENEFICIARY_SUCCESS':
|
||||
@@ -39,10 +41,30 @@ async function SendOtp(req, res) {
|
||||
message = templates.NOTIFICATION(acctFrom, acctTo, amount, ref, date);
|
||||
break;
|
||||
case 'FORGOT_PASSWORD':
|
||||
otp = generateOTP(6);
|
||||
message = templates.FORGOT_PASSWORD(otp);
|
||||
break;
|
||||
case 'CHANGE_LPWORD':
|
||||
otp = generateOTP(6);
|
||||
message = templates.CHANGE_LPWORD(otp);
|
||||
break;
|
||||
case 'CHANGE_TPIN':
|
||||
otp = generateOTP(6);
|
||||
message = templates.CHANGE_TPIN(otp);
|
||||
break;
|
||||
case 'CHANGE_TPWORD':
|
||||
otp = generateOTP(6);
|
||||
message = templates.CHANGE_TPWORD(otp);
|
||||
break;
|
||||
case 'CHANGE_MPIN':
|
||||
otp = generateOTP(6);
|
||||
message = templates.CHANGE_MPIN(otp);
|
||||
break;
|
||||
case 'REGISTRATION':
|
||||
otp = userOtp ? userOtp : generateOTP(6);
|
||||
message = templates.REGISTRATION(otp);
|
||||
case 'RIGHT_UPDATE':
|
||||
message = templates.RIGHT_UPDATE;
|
||||
break;
|
||||
default:
|
||||
return res.status(400).json({ error: 'Invalid OTP type' });
|
||||
|
||||
Reference in New Issue
Block a user