aboutsummaryrefslogtreecommitdiffstats
path: root/routes/payments.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-02-26 11:59:58 -0800
committerAdam Soltys <[email protected]>2025-02-26 11:59:58 -0800
commit1d541fd97210389f006e65d46ab783afbe82cea8 (patch)
tree66781ea2992fa99198ed1e450cdb9b68acfbc4d9 /routes/payments.ts
parenta14b987a392bc700975b048f37838da08e4ed255 (diff)
downloadcoinos-server-1d541fd97210389f006e65d46ab783afbe82cea8.tar.gz
coinos-server-1d541fd97210389f006e65d46ab783afbe82cea8.zip
payment types
Diffstat (limited to 'routes/payments.ts')
-rw-r--r--routes/payments.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/routes/payments.ts b/routes/payments.ts
index 9282723a..e5af18ee 100644
--- a/routes/payments.ts
+++ b/routes/payments.ts
@@ -13,7 +13,6 @@ import {
sendInternal,
sendLightning,
sendOnchain,
- types,
} from "$lib/payments";
import { emit } from "$lib/sockets";
import {
@@ -30,6 +29,8 @@ import rpc from "@coinos/rpc";
import got from "got";
import { v4 } from "uuid";
+import { PaymentType } from "$lib/types";
+
import ln from "$lib/ln";
const { URL } = process.env;
@@ -77,7 +78,7 @@ export default {
sender: user,
});
} else if (fund) {
- p = await debit({ hash, amount, memo: fund, user, type: types.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);
@@ -115,7 +116,7 @@ export default {
return p;
}
if (p.created < start || p.created > end) return;
- if (p.type === types.internal) p.with = await getUser(p.ref, fields);
+ if (p.type === PaymentType.internal) p.with = await getUser(p.ref, fields);
return p;
}),
)
@@ -164,7 +165,7 @@ export default {
params: { hash },
} = req;
const p = await getPayment(hash);
- if (p?.type === types.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);
@@ -285,7 +286,7 @@ export default {
amount,
memo: id,
ref: id,
- type: types.fund,
+ type: PaymentType.fund,
});
await db.lPush(`fund:${id}:payments`, payment.id);
@@ -311,7 +312,7 @@ export default {
for (const { address, amount, asset, category, vout } of details) {
if (!address) continue;
- if (type === types.liquid && asset !== config.liquid.btc) continue;
+ if (type === PaymentType.liquid && asset !== config.liquid.btc) continue;
if (category === "send") {
const p = await getPayment(txid);