implemented quick pay within bank
This commit is contained in:
29
src/controllers/transfer.controller.js
Normal file
29
src/controllers/transfer.controller.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const axios = require('axios');
|
||||
|
||||
async function transfer(
|
||||
fromAccountNo,
|
||||
toAccountNo,
|
||||
toAccountType,
|
||||
amount,
|
||||
narration = 'tranfer from mobile'
|
||||
) {
|
||||
try {
|
||||
const response = await axios.post(
|
||||
'http://localhost:8689/kccb/Interbankfundtranfer',
|
||||
{
|
||||
fromAccountNo,
|
||||
toAccountNo,
|
||||
toAccountType,
|
||||
amount,
|
||||
narration,
|
||||
}
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
'API call failed: ' + (error.response?.data?.message || error.message)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { transfer };
|
Reference in New Issue
Block a user