implemented quick pay within bank

This commit is contained in:
2025-06-25 23:46:17 +05:30
parent d813784305
commit e3bd1657c0
14 changed files with 262 additions and 13 deletions

View File

@@ -0,0 +1,20 @@
const transferValidator = async (req, res, next) => {
const { fromAccount, toAccount, toAccountType, amount } = req.body;
const accountTypes = ['SB', 'LN'];
if (!fromAccount || fromAccount.length != 11) {
return res.status(400).json({ error: 'INVALID_ACCOUNT_NUMBER_FORMAT' });
}
if (!toAccount || toAccount.length != 11) {
return res.status(400).json({ error: 'INVALID_ACCOUNT_NUMBER_FORMAT' });
}
if (!accountTypes || !accountTypes.includes(toAccountType)) {
return res.status(400).json({ error: 'INVALID_ACCOUNT_TYPE' });
}
if (!amount || amount <= 0) {
return res.status(400).json({ error: 'INVALID_AMOUNT' });
}
next();
};
module.exports = transferValidator;