aboutsummaryrefslogtreecommitdiffstats
path: root/lib/invoices.ts
diff options
context:
space:
mode:
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");