diff --git a/lnbits/extensions/boltcards/lnurl.py b/lnbits/extensions/boltcards/lnurl.py index 9399fb36..a1630e2b 100644 --- a/lnbits/extensions/boltcards/lnurl.py +++ b/lnbits/extensions/boltcards/lnurl.py @@ -2,19 +2,21 @@ import base64 import hashlib import hmac import json -import secrets from http import HTTPStatus from io import BytesIO from typing import Optional +from loguru import logger + from embit import bech32, compact from fastapi import Request from fastapi.param_functions import Query +from starlette.exceptions import HTTPException + +import secrets +from http import HTTPStatus + from fastapi.params import Depends, Query -from lnurl import Lnurl, LnurlWithdrawResponse -from lnurl import encode as lnurl_encode # type: ignore -from lnurl.types import LnurlPayMetadata # type: ignore -from loguru import logger from starlette.exceptions import HTTPException from starlette.requests import Request from starlette.responses import HTMLResponse @@ -22,12 +24,17 @@ from starlette.responses import HTMLResponse from lnbits.core.services import create_invoice from lnbits.core.views.api import pay_invoice +from lnurl import Lnurl, LnurlWithdrawResponse +from lnurl import encode as lnurl_encode # type: ignore +from lnurl.types import LnurlPayMetadata # type: ignore + from . import boltcards_ext from .crud import ( create_hit, get_card, - get_card_by_otp, get_card_by_uid, + get_card_by_otp, + get_card, get_hit, get_hits_today, spend_hit, diff --git a/lnbits/extensions/boltcards/models.py b/lnbits/extensions/boltcards/models.py index 21096640..80e3b973 100644 --- a/lnbits/extensions/boltcards/models.py +++ b/lnbits/extensions/boltcards/models.py @@ -1,8 +1,9 @@ +from fastapi.params import Query +from pydantic import BaseModel from sqlite3 import Row from typing import Optional from fastapi import Request -from fastapi.params import Query from lnurl import Lnurl from lnurl import encode as lnurl_encode # type: ignore from lnurl.models import LnurlPaySuccessAction, UrlAction # type: ignore diff --git a/lnbits/extensions/boltcards/static/js/index.js b/lnbits/extensions/boltcards/static/js/index.js index 27536304..33704f3a 100644 --- a/lnbits/extensions/boltcards/static/js/index.js +++ b/lnbits/extensions/boltcards/static/js/index.js @@ -190,7 +190,7 @@ new Vue({ }) }) }, - openQrCodeDialog(cardId) { + openQrCodeDialog (cardId) { var card = _.findWhere(this.cards, {id: cardId}) this.qrCodeDialog.data = { link: window.location.origin + '/boltcards/api/v1/auth?a=' + card.otp, diff --git a/lnbits/extensions/boltcards/tasks.py b/lnbits/extensions/boltcards/tasks.py index a7eea026..bfe4f257 100644 --- a/lnbits/extensions/boltcards/tasks.py +++ b/lnbits/extensions/boltcards/tasks.py @@ -7,7 +7,7 @@ from lnbits.core import db as core_db from lnbits.core.models import Payment from lnbits.tasks import register_invoice_listener -from .crud import create_refund, get_hit +from .crud import get_hit, create_refund async def wait_for_paid_invoices(): diff --git a/lnbits/extensions/boltcards/templates/boltcards/index.html b/lnbits/extensions/boltcards/templates/boltcards/index.html index 73e5820b..2a613fda 100644 --- a/lnbits/extensions/boltcards/templates/boltcards/index.html +++ b/lnbits/extensions/boltcards/templates/boltcards/index.html @@ -7,7 +7,7 @@
-
+
Cards
diff --git a/lnbits/extensions/boltcards/views_api.py b/lnbits/extensions/boltcards/views_api.py index 698e1094..f1e02810 100644 --- a/lnbits/extensions/boltcards/views_api.py +++ b/lnbits/extensions/boltcards/views_api.py @@ -2,7 +2,6 @@ import secrets from http import HTTPStatus from fastapi.params import Depends, Query -from loguru import logger from starlette.exceptions import HTTPException from starlette.requests import Request @@ -14,20 +13,22 @@ from .crud import ( create_card, create_hit, delete_card, - enable_disable_card, get_card, get_card_by_otp, get_card_by_uid, get_cards, get_hits, - get_refunds, update_card, update_card_counter, update_card_otp, + enable_disable_card, + get_refunds, ) from .models import CreateCardData from .nxp424 import decryptSUN, getSunMAC +from loguru import logger + @boltcards_ext.get("/api/v1/cards") async def api_cards(