aboutsummaryrefslogtreecommitdiffstats
path: root/lib/invoices.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-13 21:07:55 -0800
committerAdam Soltys <[email protected]>2026-02-13 21:08:04 -0800
commitc7c6ee7ba59467b8ddcfe8196b4f7586a864f3c0 (patch)
treefccdf94755fb1b91c1de65e9d18f2f94742ebe09 /lib/invoices.ts
parentb2b9fe837db7308285909ec1b374546194405d00 (diff)
downloadcoinos-server-c7c6ee7ba59467b8ddcfe8196b4f7586a864f3c0.tar.gz
coinos-server-c7c6ee7ba59467b8ddcfe8196b4f7586a864f3c0.zip
account level currency and autowithdraw settings
Diffstat (limited to 'lib/invoices.ts')
-rw-r--r--lib/invoices.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts
index e6b6e146..bf6c511e 100644
--- a/lib/invoices.ts
+++ b/lib/invoices.ts
@@ -52,7 +52,10 @@ export const generate = async ({ invoice, user }) => {
aid = account.id;
const rates = await g("rates");
- if (!currency) currency = user.currency;
+ if (!currency) {
+ const acct = aid ? await g(`account:${aid}`) : null;
+ currency = acct?.currency || user.currency;
+ }
if (!rate) rate = rates[currency];
if (fiat) amount = Math.round((SATS * fiat) / rate);
if (amount < 0) fail("invalid amount");