diff options
| author | Adam Soltys <[email protected]> | 2025-09-10 19:12:35 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-09-10 19:12:36 +0000 |
| commit | 90fa6509b2c403811ed91d65d8986f47bbecf243 (patch) | |
| tree | e7a4c36e6e1ffb34b9d2d7ec0e339257dedf6962 /lib | |
| parent | 59f42b98c944e6d062fb9d106b067584df21f4ff (diff) | |
| download | coinos-server-90fa6509b2c403811ed91d65d8986f47bbecf243.tar.gz coinos-server-90fa6509b2c403811ed91d65d8986f47bbecf243.zip | |
default account id
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/payments.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/payments.ts b/lib/payments.ts index be801622..807c87fa 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -80,6 +80,7 @@ export const debit = async ({ let ref; const { id: uid, currency } = user; + if (!aid) aid = uid; const rates = await g("rates"); if (!rate) rate = rates[currency]; @@ -119,12 +120,12 @@ export const debit = async ({ ? Math.round((amount + fee + tip) * config.fee[creditType]) : 0; - if (aid && aid !== uid) ourfee = 0; + if (aid !== uid) ourfee = 0; const frozenBalance = !blacklisted || whitelisted ? 0 : await ga(`balance:${uid}`); ourfee = await db.debit( - `balance:${aid || uid}`, + `balance:${aid}`, `credit:${creditType}:${aid !== uid ? 0 : uid}`, t(user).insufficientFunds, amount || 0, @@ -167,9 +168,7 @@ export const debit = async ({ .exec(); l(user.username, "sent", type, amount); - //emit(user.id, "payment", p); - if (![PaymentType.lightning, PaymentType.bolt12].includes(type)) - nwcNotify(p, user); + if (![PaymentType.lightning, PaymentType.bolt12].includes(type)) nwcNotify(p); return p; }; |
