fix for latest fastapi
This commit is contained in:
parent
422cb2f658
commit
f41c3f4044
2 changed files with 6 additions and 5 deletions
8
lnurl.py
8
lnurl.py
|
|
@ -31,7 +31,7 @@ from .nxp424 import decryptSUN, getSunMAC
|
||||||
|
|
||||||
# /boltcards/api/v1/scan?p=00000000000000000000000000000000&c=0000000000000000
|
# /boltcards/api/v1/scan?p=00000000000000000000000000000000&c=0000000000000000
|
||||||
@boltcards_ext.get("/api/v1/scan/{external_id}")
|
@boltcards_ext.get("/api/v1/scan/{external_id}")
|
||||||
async def api_scan(p, c, request: Request, external_id: str = Query(None)):
|
async def api_scan(p, c, request: Request, external_id: str):
|
||||||
# some wallets send everything as lower case, no bueno
|
# some wallets send everything as lower case, no bueno
|
||||||
p = p.upper()
|
p = p.upper()
|
||||||
c = c.upper()
|
c = c.upper()
|
||||||
|
|
@ -75,7 +75,7 @@ async def api_scan(p, c, request: Request, external_id: str = Query(None)):
|
||||||
if hits_amount > card.daily_limit:
|
if hits_amount > card.daily_limit:
|
||||||
return {"status": "ERROR", "reason": "Max daily limit spent."}
|
return {"status": "ERROR", "reason": "Max daily limit spent."}
|
||||||
hit = await create_hit(card.id, ip, agent, card.counter, ctr_int)
|
hit = await create_hit(card.id, ip, agent, card.counter, ctr_int)
|
||||||
lnurlpay = lnurl_encode(request.url_for("boltcards.lnurlp_response", hit_id=hit.id))
|
lnurlpay = lnurl_encode(str(request.url_for("boltcards.lnurlp_response", hit_id=hit.id)))
|
||||||
return {
|
return {
|
||||||
"tag": "withdrawRequest",
|
"tag": "withdrawRequest",
|
||||||
"callback": request.url_for("boltcards.lnurl_callback", hitid=hit.id),
|
"callback": request.url_for("boltcards.lnurl_callback", hitid=hit.id),
|
||||||
|
|
@ -175,7 +175,7 @@ async def api_auth(a, request: Request):
|
||||||
response_class=HTMLResponse,
|
response_class=HTMLResponse,
|
||||||
name="boltcards.lnurlp_response",
|
name="boltcards.lnurlp_response",
|
||||||
)
|
)
|
||||||
async def lnurlp_response(req: Request, hit_id: str = Query(None)):
|
async def lnurlp_response(req: Request, hit_id: str):
|
||||||
hit = await get_hit(hit_id)
|
hit = await get_hit(hit_id)
|
||||||
assert hit
|
assert hit
|
||||||
card = await get_card(hit.card_id)
|
card = await get_card(hit.card_id)
|
||||||
|
|
@ -199,7 +199,7 @@ async def lnurlp_response(req: Request, hit_id: str = Query(None)):
|
||||||
response_class=HTMLResponse,
|
response_class=HTMLResponse,
|
||||||
name="boltcards.lnurlp_callback",
|
name="boltcards.lnurlp_callback",
|
||||||
)
|
)
|
||||||
async def lnurlp_callback(hit_id: str = Query(None), amount: str = Query(None)):
|
async def lnurlp_callback(hit_id: str, amount: str = Query(None)):
|
||||||
hit = await get_hit(hit_id)
|
hit = await get_hit(hit_id)
|
||||||
assert hit
|
assert hit
|
||||||
card = await get_card(hit.card_id)
|
card = await get_card(hit.card_id)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from fastapi import Depends, HTTPException, Query
|
from fastapi import Depends, HTTPException, Query
|
||||||
|
|
||||||
|
|
@ -37,7 +38,7 @@ async def api_cards(
|
||||||
@boltcards_ext.put("/api/v1/cards/{card_id}", status_code=HTTPStatus.OK)
|
@boltcards_ext.put("/api/v1/cards/{card_id}", status_code=HTTPStatus.OK)
|
||||||
async def api_card_create_or_update(
|
async def api_card_create_or_update(
|
||||||
data: CreateCardData,
|
data: CreateCardData,
|
||||||
card_id: str = Query(None),
|
card_id: Optional[str],
|
||||||
wallet: WalletTypeInfo = Depends(require_admin_key),
|
wallet: WalletTypeInfo = Depends(require_admin_key),
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue