diff options
| author | Adam Soltys <[email protected]> | 2021-09-24 02:19:30 -0400 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-09-24 02:19:30 -0400 |
| commit | 18814242ad055ecd6f9de1d23209958e12aee69c (patch) | |
| tree | f9abc8b8716b5587c8a71700df62ebfe2098f4f6 /routes/payments.js | |
| parent | fd44b77a4ddac5beef34f65be8e5558f4b4291f9 (diff) | |
| download | coinos-server-18814242ad055ecd6f9de1d23209958e12aee69c.tar.gz coinos-server-18814242ad055ecd6f9de1d23209958e12aee69c.zip | |
always create account on issuance
Diffstat (limited to 'routes/payments.js')
| -rw-r--r-- | routes/payments.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/routes/payments.js b/routes/payments.js index 58b176d0..7ecfb36f 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -71,7 +71,8 @@ ah(async () => { .map(i => ({ amount: parseInt(i.amt_paid_sat), preimage: i.r_preimage.toString("hex"), - pr: i.payment_request.toString("hex") + pr: i.payment_request.toString("hex"), + createdAt: new Date(i.settle_date * 1000) })); const twoDaysAgo = new Date(new Date().setDate(new Date().getDate() - 2)); @@ -84,13 +85,13 @@ ah(async () => { let missed = recent.filter(i => !settled.includes(i.preimage)); for (let i = 0; i < missed.length; i++) { - let { amount, preimage, pr: text } = missed[i]; + let { amount, preimage, pr: text, createdAt } = missed[i]; let invoice = await db.Invoice.findOne({ where: { text }, include: { model: db.User, as: "user" - }, + } }); if (invoice && invoice.user_id) { @@ -115,7 +116,9 @@ ah(async () => { confirmed: true, network: "lightning", tip: invoice.tip, - invoice_id: invoice.id + invoice_id: invoice.id, + createdAt, + updatedAt: createdAt }); await account.increment({ balance: amount }); |
