extracted payment password validator from transfer route to its own validator
This commit is contained in:
15
src/validators/payment.secret.validator.js
Normal file
15
src/validators/payment.secret.validator.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const tpasswordValidator = require('./tpassword.validator.js');
|
||||
const tpinValidator = require('./tpin.validator.js');
|
||||
|
||||
const paymentSecretValidator = async (req, res, next) => {
|
||||
const { tpin, tpassword } = req.body;
|
||||
if (tpin) {
|
||||
return tpinValidator(req, res, next);
|
||||
} else if (tpassword) {
|
||||
return tpasswordValidator(req, res, next);
|
||||
} else {
|
||||
return res.status(400).json({ error: 'tpin or tpassword is required' });
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = paymentSecretValidator;
|
||||
Reference in New Issue
Block a user