diff options
| author | Adam Soltys <[email protected]> | 2023-06-06 00:31:54 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-06-06 00:31:59 -0700 |
| commit | 4b5c6dde01fd99fc5962420be37fb850f1fdaeb5 (patch) | |
| tree | 2f031a817bd474377b9005750ab1ceba3ab29f56 /lib/invoices.js | |
| parent | 503dd491e537389d48fe2f1ee69e1b0d68330de8 (diff) | |
| download | coinos-server-4b5c6dde01fd99fc5962420be37fb850f1fdaeb5.tar.gz coinos-server-4b5c6dde01fd99fc5962420be37fb850f1fdaeb5.zip | |
pass webhook secret
Diffstat (limited to 'lib/invoices.js')
| -rw-r--r-- | lib/invoices.js | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/invoices.js b/lib/invoices.js index 9e75abcb..031153d0 100644 --- a/lib/invoices.js +++ b/lib/invoices.js @@ -10,17 +10,28 @@ import bc from "$lib/bitcoin"; import ln from "$lib/ln"; export let generate = async ({ invoice, user, sender, memo }) => { - let { currency, tip, amount, rate, request_id, prompt, type } = invoice; + let { + currency, + tip, + amount, + rate, + request_id, + prompt, + type, + webhook, + secret + } = invoice; amount = parseInt(amount || 0); tip = parseInt(tip) || null; if (amount < 0) fail("amount out of range"); - if (!user) user = sender; - user = await getUser(user.username); + if (user) user = await getUser(user.username); + else if (sender) user = await getUser(sender.username); + else fail("user not provided"); - if (!user) fail("user not provided"); + console.log("USER", user); if (!currency) currency = user.currency; if (!rate) rate = store.rates[currency]; @@ -61,10 +72,12 @@ export let generate = async ({ invoice, user, sender, memo }) => { received: 0, request_id, prompt, + secret, text, tip, type, - uid: user.id + uid: user.id, + webhook }; l("creating invoice", user.username, amount, tip, currency, invoice.hash); |
