diff options
| author | Adam Soltys <[email protected]> | 2023-10-12 22:09:19 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-10-12 22:09:19 -0700 |
| commit | d54bcdd4f25f52b6fccbd2d7c4e8ff3f72c8aafc (patch) | |
| tree | 1f1417e3ce66e75127e7f719f650020290e4abcb | |
| parent | c6f1fc33dd7e6670a8d07928b812b9e340c7970e (diff) | |
| download | coinos-server-d54bcdd4f25f52b6fccbd2d7c4e8ff3f72c8aafc.tar.gz coinos-server-d54bcdd4f25f52b6fccbd2d7c4e8ff3f72c8aafc.zip | |
fix issue with internal invoices
| -rw-r--r-- | lib/invoices.js | 1 | ||||
| -rw-r--r-- | routes/invoices.js | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/invoices.js b/lib/invoices.js index 8ac49a79..607a67fc 100644 --- a/lib/invoices.js +++ b/lib/invoices.js @@ -81,6 +81,7 @@ export let generate = async ({ invoice, user, sender, memo }) => { l("creating invoice", id, user.username, amount, tip, currency, invoice.hash); await s(`invoice:${hash}`, id); + console.log("SETTING", invoice) await s(`invoice:${id}`, invoice); await db.lPush(`${user.id}:invoices`, id); diff --git a/routes/invoices.js b/routes/invoices.js index d1ef1a68..9cdd4dad 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -9,11 +9,19 @@ import ln from "$lib/ln"; export default { async get({ params: { id } }, res) { let pr; + let invoice = await g(`invoice:${id}`); + if (typeof invoice === "string") invoice = await g(`invoice:${invoice}`); if (invoice) { delete invoice.secret; - invoice.user = pick(await g(`user:${invoice.uid}`), ['id', 'profile', 'banner', 'currency', 'username']); + invoice.user = pick(await g(`user:${invoice.uid}`), [ + "id", + "profile", + "banner", + "currency", + "username" + ]); } else if (config.classic) { invoice = await got(`${config.classic}/invoice/${pr}`).json(); if (invoice) { |
