feat: added transactions record keeping feature
This commit is contained in:
52
src/services/recordkeeping.service.js
Normal file
52
src/services/recordkeeping.service.js
Normal file
@@ -0,0 +1,52 @@
|
||||
const db = require('../config/db');
|
||||
|
||||
const recordIntraBankTransaction = async (
|
||||
customerNo,
|
||||
fromAccount,
|
||||
toAccount,
|
||||
accountType,
|
||||
amount,
|
||||
status
|
||||
) => {
|
||||
const trxType = 'TRF';
|
||||
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)';
|
||||
await db.query(query, [
|
||||
customerNo,
|
||||
trxType,
|
||||
fromAccount,
|
||||
toAccount,
|
||||
accountType,
|
||||
amount,
|
||||
status,
|
||||
]);
|
||||
};
|
||||
const recordInterBankTransaction = async (
|
||||
customerNo,
|
||||
trxType,
|
||||
fromAccount,
|
||||
toAccount,
|
||||
ifscCode,
|
||||
amount,
|
||||
commission,
|
||||
beneficiaryName,
|
||||
remitterName,
|
||||
status
|
||||
) => {
|
||||
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)';
|
||||
await db.query(query, [
|
||||
customerNo,
|
||||
trxType,
|
||||
fromAccount,
|
||||
toAccount,
|
||||
ifscCode,
|
||||
amount,
|
||||
commission,
|
||||
beneficiaryName,
|
||||
remitterName,
|
||||
status,
|
||||
]);
|
||||
};
|
||||
|
||||
module.exports = { recordIntraBankTransaction, recordInterBankTransaction };
|
||||
Reference in New Issue
Block a user