mirror of
https://github.com/lnbits/lnbits.git
synced 2025-08-03 15:32:22 +02:00
Added internal payment listener to paid invoices and splitpayments
This commit is contained in:
@@ -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)
|
||||
|
@@ -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
|
||||
|
@@ -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": <wallet id or invoice
|
||||
key>, "alias": <name to identify this>, "percent": <number
|
||||
between 1 and 100>}, ...]}'
|
||||
|
Reference in New Issue
Block a user