format
This commit is contained in:
parent
66d44f95fb
commit
2cac36be17
12 changed files with 272 additions and 311 deletions
11
tasks.py
11
tasks.py
|
|
@ -29,6 +29,7 @@ async def wait_for_paid_invoices():
|
|||
|
||||
# do somethhing when an invoice related top this extension is paid
|
||||
|
||||
|
||||
async def on_invoice_paid(payment: Payment) -> None:
|
||||
logger.debug("payment received for myextension extension")
|
||||
if payment.extra.get("tag") != "MyExtension":
|
||||
|
|
@ -42,20 +43,18 @@ async def on_invoice_paid(payment: Payment) -> None:
|
|||
total = myextension.total - payment.amount
|
||||
else:
|
||||
total = myextension.total + payment.amount
|
||||
data_to_update = {
|
||||
"total": total
|
||||
}
|
||||
|
||||
data_to_update = {"total": total}
|
||||
|
||||
await update_myextension(myextension_id=myextension_id, **data_to_update)
|
||||
|
||||
# here we could send some data to a websocket on wss://<your-lnbits>/api/v1/ws/<myextension_id>
|
||||
# and then listen to it on the frontend, which we do with index.html connectWebocket()
|
||||
|
||||
|
||||
some_payment_data = {
|
||||
"name": myextension.name,
|
||||
"amount": payment.amount,
|
||||
"fee": payment.fee,
|
||||
"checking_id": payment.checking_id
|
||||
"checking_id": payment.checking_id,
|
||||
}
|
||||
|
||||
await websocketUpdater(myextension_id, str(some_payment_data))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue