aboutsummaryrefslogtreecommitdiffstats
path: root/routes/payments.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-20 10:04:08 -0700
committerAdam Soltys <[email protected]>2024-09-20 10:04:08 -0700
commit01e1686265def675445c0f74a4b92ec4ffd71492 (patch)
tree2d90795be17f5d15345540af80b9f2ca5261389c /routes/payments.ts
parent718e3541cffe2103512b19f4945dfcc79813555d (diff)
downloadcoinos-server-01e1686265def675445c0f74a4b92ec4ffd71492.tar.gz
coinos-server-01e1686265def675445c0f74a4b92ec4ffd71492.zip
rename account id
Diffstat (limited to 'routes/payments.ts')
-rw-r--r--routes/payments.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/routes/payments.ts b/routes/payments.ts
index 2046cfb4..02056eeb 100644
--- a/routes/payments.ts
+++ b/routes/payments.ts
@@ -73,13 +73,13 @@ export default {
async list(req, res) {
let {
user: { id },
- query: { account, start, end, limit, offset },
+ query: { aid, start, end, limit, offset },
} = req;
if (limit) limit = parseInt(limit);
offset = parseInt(offset) || 0;
- let payments = (await db.lRange(`${account || id}:payments`, 0, -1)) || [];
+ let payments = (await db.lRange(`${aid || id}:payments`, 0, -1)) || [];
payments = (
await Promise.all(
payments.map(async (id) => {
@@ -282,15 +282,15 @@ export default {
if (typeof p === "string") p = await g(`payment:${p}`);
if (!p) {
- let account;
+ let aid;
let bal = await g(`balance:${wallet}`);
- if (bal !== null) account = wallet;
+ if (bal !== null) aid = wallet;
await credit({
hash: address,
amount: sats(amount),
ref: `${txid}:${vout}`,
type,
- account,
+ aid,
});
} else if (confirmations >= 1) {
let id = `payment:${txid}:${vout}`;
@@ -312,8 +312,8 @@ export default {
.multi()
.set(`invoice:${iid}`, JSON.stringify(invoice))
.set(`payment:${p.id}`, JSON.stringify(p))
- .decrBy(`pending:${p.account || p.uid}`, p.amount)
- .incrBy(`balance:${p.account || p.uid}`, p.amount)
+ .decrBy(`pending:${p.aid || p.uid}`, p.amount)
+ .incrBy(`balance:${p.aid || p.uid}`, p.amount)
.exec();
emit(p.uid, "payment", p);