|
|
|
@ -14,12 +14,14 @@ exports.listInvoices = (req, res, next) => {
|
|
|
|
|
error: (undefined === body || search_idx > -1) ? 'Error From Server!' : body.error
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
body.invoices.forEach(invoice => {
|
|
|
|
|
invoice.creation_date_str = (undefined === invoice.creation_date) ? '' : common.convertTimestampToDate(invoice.creation_date);
|
|
|
|
|
invoice.settle_date_str = (undefined === invoice.settle_date) ? '' : common.convertTimestampToDate(invoice.settle_date);
|
|
|
|
|
invoice.btc_value = (undefined === invoice.value) ? 0 : common.convertToBTC(invoice.value);
|
|
|
|
|
invoice.btc_amt_paid_sat = (undefined === invoice.amt_paid_sat) ? 0 : common.convertToBTC(invoice.amt_paid_sat);
|
|
|
|
|
});
|
|
|
|
|
if (undefine !== body.invoices) {
|
|
|
|
|
body.invoices.forEach(invoice => {
|
|
|
|
|
invoice.creation_date_str = (undefined === invoice.creation_date) ? '' : common.convertTimestampToDate(invoice.creation_date);
|
|
|
|
|
invoice.settle_date_str = (undefined === invoice.settle_date) ? '' : common.convertTimestampToDate(invoice.settle_date);
|
|
|
|
|
invoice.btc_value = (undefined === invoice.value) ? 0 : common.convertToBTC(invoice.value);
|
|
|
|
|
invoice.btc_amt_paid_sat = (undefined === invoice.amt_paid_sat) ? 0 : common.convertToBTC(invoice.amt_paid_sat);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
console.log('\nInvoices Received: ' + JSON.stringify(body));
|
|
|
|
|
res.status(200).json(body);
|
|
|
|
|
}
|
|
|
|
|