Added internal payment listener to paid invoices and splitpayments

This commit is contained in:
benarc
2021-10-18 13:24:32 +01:00
parent 3285e9d3c9
commit cf6fae2ca7
3 changed files with 7 additions and 8 deletions

View File

@@ -32,8 +32,6 @@ except ImportError: # pragma: nocover
from typing_extensions import TypedDict
class PaymentFailure(Exception):
pass
@@ -155,9 +153,10 @@ async def pay_invoice(
)
# notify receiver asynchronously
from lnbits.tasks import internal_invoice_paid
await internal_invoice_paid.send(internal_checking_id)
from lnbits.tasks import internal_invoice_queue
await internal_invoice_queue.put(internal_checking_id)
else:
# actually pay the external invoice
payment: PaymentResponse = await WALLET.pay_invoice(payment_request)

View File

@@ -3,7 +3,7 @@ import json
from lnbits.core.models import Payment
from lnbits.core.crud import create_payment
from lnbits.core import db as core_db
from lnbits.tasks import register_invoice_listener # , internal_invoice_paid
from lnbits.tasks import register_invoice_listener, internal_invoice_queue
from lnbits.helpers import urlsafe_short_hash
from .crud import get_targets
@@ -78,5 +78,5 @@ async def on_invoice_paid(payment: Payment) -> None:
)
# manually send this for now
# await internal_invoice_paid.send(internal_checking_id)
await internal_invoice_queue.put(internal_checking_id)
return

View File

@@ -53,7 +53,7 @@
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code
>curl -X GET {{ request.url_root }}api/v1/livestream -H "X-Api-Key: {{
g.user.wallets[0].inkey }}"
user.wallets[0].inkey }}"
</code>
</q-card-section>
</q-card>
@@ -79,7 +79,7 @@
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code
>curl -X PUT {{ request.url_root }}api/v1/splitpayments/targets -H
"X-Api-Key: {{ g.user.wallets[0].adminkey }}" -H 'Content-Type:
"X-Api-Key: {{ user.wallets[0].adminkey }}" -H 'Content-Type:
application/json' -d '{"targets": [{"wallet": &lt;wallet id or invoice
key&gt;, "alias": &lt;name to identify this&gt;, "percent": &lt;number
between 1 and 100&gt;}, ...]}'