feat: code quality (#39)
This commit is contained in:
parent
c10bb032fd
commit
7213d5ca93
23 changed files with 2902 additions and 159 deletions
19
tasks.py
19
tasks.py
|
|
@ -1,7 +1,6 @@
|
|||
import asyncio
|
||||
import json
|
||||
|
||||
from lnbits.core import db as core_db
|
||||
from lnbits.core.crud import update_payment_extra
|
||||
from lnbits.core.models import Payment
|
||||
from lnbits.helpers import get_current_extension_name
|
||||
from lnbits.tasks import register_invoice_listener
|
||||
|
|
@ -31,17 +30,5 @@ async def on_invoice_paid(payment: Payment) -> None:
|
|||
|
||||
if hit:
|
||||
await create_refund(hit_id=hit.id, refund_amount=(payment.amount / 1000))
|
||||
await mark_webhook_sent(payment, 1)
|
||||
|
||||
|
||||
async def mark_webhook_sent(payment: Payment, status: int) -> None:
|
||||
|
||||
payment.extra["wh_status"] = status
|
||||
|
||||
await core_db.execute(
|
||||
"""
|
||||
UPDATE apipayments SET extra = ?
|
||||
WHERE hash = ?
|
||||
""",
|
||||
(json.dumps(payment.extra), payment.payment_hash),
|
||||
)
|
||||
payment.extra["wh_status"] = 1
|
||||
await update_payment_extra(payment.payment_hash, payment.extra)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue