diff options
| author | Adam Soltys <[email protected]> | 2024-09-23 16:23:19 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-23 16:23:19 -0700 |
| commit | 12ad5c9abb74cbe35c5d07233fdd9a7b7f5c2b70 (patch) | |
| tree | 8e023771abd75a7b70e407c651aed3bcfe426ea3 /lib/invoices.ts | |
| parent | 01e1686265def675445c0f74a4b92ec4ffd71492 (diff) | |
| download | coinos-server-12ad5c9abb74cbe35c5d07233fdd9a7b7f5c2b70.tar.gz coinos-server-12ad5c9abb74cbe35c5d07233fdd9a7b7f5c2b70.zip | |
reconcile on-chain balance
Diffstat (limited to 'lib/invoices.ts')
| -rw-r--r-- | lib/invoices.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts index 4626e257..60bcba0f 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -30,13 +30,16 @@ export let generate = async ({ invoice, user }) => { secret, } = invoice; - let account = await g(`account:${aid}`); amount = parseInt(amount || 0); tip = parseInt(tip) || null; if (user) user = await getUser(user.username); if (!user) fail("user not provided"); + let account = await g(`account:${aid}`); + if (!account) account = await g(`account:${user.id}`); + if (!account) fail("account not found"); + let rates = await g("rates"); if (!currency) currency = user.currency; if (!rate) rate = rates[currency]; |
