Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bnonni committed May 7, 2022
1 parent 6d68023 commit d458f4b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 15 additions & 1 deletion backend/api/account/accountController.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ const payInvoice = async (req, res) => {
}
};

const getAccountBalance = async (req, res) => {
try {
const response = await accountService.getAccountBalance();

debug.info(`Account Balance Response: ${JSON.stringify(response)}`);
if (!response.success) res.status(500).json(response);
else res.status(200).json(response);

} catch (error) {
debug.error(error.stack);
res.status(500).json({ message: error.message, error: error.stack });
}
};

const createInvoice = async (req, res) => {
try {
const amountMillisats = req.body.amountMillisats;
Expand All @@ -44,4 +58,4 @@ const createInvoice = async (req, res) => {
}
};

module.exports = { getAccountAllowance, payInvoice, createInvoice };
module.exports = { getAccountAllowance, payInvoice, createInvoice, getAccountBalance };
6 changes: 2 additions & 4 deletions backend/api/account/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const express = require('express');
const router = express();

const { getAccountAllowance, payInvoice, createInvoice } = require('./accountController');
const { getAccountAllowance, payInvoice, createInvoice, getAccountBalance } = require('./accountController');

const { getBalance } = require('../../sensei/nodes');

router.get('/account/balance', getBalance);
router.get('/account/balance', getAccountBalance);
router.get('/allowance', getAccountAllowance);
router.get('/payment/send', payInvoice);
router.get('/payment/receive', createInvoice);
Expand Down

0 comments on commit d458f4b

Please sign in to comment.