aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/payments.ts20
1 files changed, 15 insertions, 5 deletions
diff --git a/routes/payments.ts b/routes/payments.ts
index e5af18ee..2e0a5030 100644
--- a/routes/payments.ts
+++ b/routes/payments.ts
@@ -78,7 +78,13 @@ export default {
sender: user,
});
} else if (fund) {
- p = await debit({ hash, amount, memo: fund, user, type: PaymentType.fund });
+ p = await debit({
+ hash,
+ amount,
+ memo: fund,
+ user,
+ type: PaymentType.fund,
+ });
await db.incrBy(`fund:${fund}`, amount);
await db.lPush(`fund:${fund}:payments`, p.id);
l("funded fund", fund);
@@ -116,7 +122,8 @@ export default {
return p;
}
if (p.created < start || p.created > end) return;
- if (p.type === PaymentType.internal) p.with = await getUser(p.ref, fields);
+ if (p.type === PaymentType.internal)
+ p.with = await getUser(p.ref, fields);
return p;
}),
)
@@ -165,7 +172,8 @@ export default {
params: { hash },
} = req;
const p = await getPayment(hash);
- if (p?.type === PaymentType.internal) p.with = await getUser(p.ref, fields);
+ if (p?.type === PaymentType.internal)
+ p.with = await getUser(p.ref, fields);
res.send(p);
} catch (e) {
console.log(e);
@@ -262,7 +270,8 @@ export default {
amount = parseInt(amount);
if (amount < 0) fail("Invalid amount");
- await db.debit(`fund:${id}`, "", amount, 0, 0, 0);
+ const result: any = await db.debit(`fund:${id}`, "", amount, 0, 0, 0);
+ if (result.err) fail(result.err);
const rates = await g("rates");
const { currency } = user;
@@ -312,7 +321,8 @@ export default {
for (const { address, amount, asset, category, vout } of details) {
if (!address) continue;
- if (type === PaymentType.liquid && asset !== config.liquid.btc) continue;
+ if (type === PaymentType.liquid && asset !== config.liquid.btc)
+ continue;
if (category === "send") {
const p = await getPayment(txid);