mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 14:51:05 +01:00
Adds PoS websocket endpoint
Receives all payments to a pos
This commit is contained in:
parent
1ff76defc3
commit
97565fde02
1 changed files with 11 additions and 1 deletions
|
@ -3,7 +3,7 @@ import asyncio
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from lnbits.core.models import Payment
|
from lnbits.core.models import Payment
|
||||||
from lnbits.core.services import create_invoice, pay_invoice
|
from lnbits.core.services import create_invoice, pay_invoice, websocketUpdater
|
||||||
from lnbits.helpers import get_current_extension_name
|
from lnbits.helpers import get_current_extension_name
|
||||||
from lnbits.tasks import register_invoice_listener
|
from lnbits.tasks import register_invoice_listener
|
||||||
|
|
||||||
|
@ -26,6 +26,16 @@ async def on_invoice_paid(payment: Payment) -> None:
|
||||||
tpos = await get_tpos(payment.extra.get("tposId"))
|
tpos = await get_tpos(payment.extra.get("tposId"))
|
||||||
tipAmount = payment.extra.get("tipAmount")
|
tipAmount = payment.extra.get("tipAmount")
|
||||||
|
|
||||||
|
strippedPayment = {
|
||||||
|
"amount":payment.amount,
|
||||||
|
"fee":payment.fee,
|
||||||
|
"checking_id":payment.checking_id,
|
||||||
|
"payment_hash":payment.payment_hash,
|
||||||
|
"bolt11":payment.bolt11,
|
||||||
|
}
|
||||||
|
|
||||||
|
await websocketUpdater(payment.extra.get("tposId"), str(strippedPayment))
|
||||||
|
|
||||||
if tipAmount is None:
|
if tipAmount is None:
|
||||||
# no tip amount
|
# no tip amount
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue