diff options
| author | Adam Soltys <[email protected]> | 2026-02-13 23:47:26 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-13 23:47:26 -0800 |
| commit | ddbe2e8afa46f3c8906b0abe0683998f85ab2e68 (patch) | |
| tree | 4f364934ee893494a5e08572c867c247f34b0374 /lib | |
| parent | c7c6ee7ba59467b8ddcfe8196b4f7586a864f3c0 (diff) | |
| download | coinos-server-ddbe2e8afa46f3c8906b0abe0683998f85ab2e68.tar.gz coinos-server-ddbe2e8afa46f3c8906b0abe0683998f85ab2e68.zip | |
ark payment notifications
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/payments.ts | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/payments.ts b/lib/payments.ts index e1254bad..d5819e30 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -520,16 +520,29 @@ const pay = async ({ aid = undefined, amount, to, user }) => { }); if (to.startsWith("ark") || to.startsWith("tark")) { - const fee = Math.max(5, Math.round(amount * 0.02)); - amount -= fee; const txid = await sendArk(to, amount); - return debit({ + const p = await debit({ hash: txid, - amount: amount + fee, - fee, + amount, user, type: PaymentType.ark, }); + + const vault = await g(`arkaddr:${to}`); + if (vault) { + const { rate, currency } = await getUserRate(user); + await createArkPayment({ + aid: vault.aid, + uid: vault.uid, + amount, + hash: txid, + rate, + currency, + extraHashMappings: [txid], + }); + } + + return p; } let fee; |
