reducing the PR

This commit is contained in:
Gene Takavic 2022-12-16 11:17:59 +01:00
parent e7fdd31cda
commit a916c1ac73
2 changed files with 2 additions and 11 deletions

View File

@ -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

View File

@ -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}"}