mirror of
https://github.com/lnbits/lnbits.git
synced 2025-04-17 00:01:24 +02:00
reducing the PR
This commit is contained in:
parent
e7fdd31cda
commit
a916c1ac73
@ -112,14 +112,8 @@ async def get_card_by_external_id(external_id: str) -> Optional[Card]:
|
||||
return Card.parse_obj(card)
|
||||
|
||||
|
||||
async def get_card_by_otp(otp: str, half: bool = False) -> Optional[Card]:
|
||||
if half and len(otp) == 16:
|
||||
otp = "%" + otp
|
||||
row = await db.fetchone(
|
||||
"SELECT * FROM boltcards.cards WHERE otp LIKE ?", (otp,)
|
||||
)
|
||||
else:
|
||||
row = await db.fetchone("SELECT * FROM boltcards.cards WHERE otp = ?", (otp,))
|
||||
async def get_card_by_otp(otp: str) -> Optional[Card]:
|
||||
row = await db.fetchone("SELECT * FROM boltcards.cards WHERE otp = ?", (otp,))
|
||||
if not row:
|
||||
return None
|
||||
|
||||
|
@ -3,13 +3,11 @@ import secrets
|
||||
from http import HTTPStatus
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from embit import bech32, compact
|
||||
from fastapi import Request
|
||||
from fastapi.param_functions import Query
|
||||
from fastapi.params import Depends, Query
|
||||
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
|
||||
@ -118,7 +116,6 @@ async def lnurl_callback(
|
||||
max_sat=card.tx_limit,
|
||||
extra={"tag": "boltcard", "tag": hit.id},
|
||||
)
|
||||
|
||||
return {"status": "OK"}
|
||||
except Exception as exc:
|
||||
return {"status": "ERROR", "reason": f"Payment failed - {exc}"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user