mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-27 20:36:16 +02:00
added path name to lnurlpos
This commit is contained in:
@@ -23,7 +23,11 @@ from .crud import (
|
|||||||
from lnbits.utils.exchange_rates import fiat_amount_as_satoshis
|
from lnbits.utils.exchange_rates import fiat_amount_as_satoshis
|
||||||
|
|
||||||
|
|
||||||
@lnurlpos_ext.get("/api/v1/lnurl/{nonce}/{payload}/{pos_id}")
|
@lnurlpos_ext.get(
|
||||||
|
"/api/v1/lnurl/{nonce}/{payload}/{pos_id}",
|
||||||
|
response_class=HTMLResponse,
|
||||||
|
name="lnurlpos.lnurl_response",
|
||||||
|
)
|
||||||
async def lnurl_response(
|
async def lnurl_response(
|
||||||
request: Request,
|
request: Request,
|
||||||
nonce: str = Query(None),
|
nonce: str = Query(None),
|
||||||
@@ -46,7 +50,6 @@ async def lnurl_response(
|
|||||||
decryptedAmount = float(int.from_bytes(res[2:6], "little") / 100)
|
decryptedAmount = float(int.from_bytes(res[2:6], "little") / 100)
|
||||||
decryptedPin = int.from_bytes(res[:2], "little")
|
decryptedPin = int.from_bytes(res[:2], "little")
|
||||||
if type(decryptedAmount) != float:
|
if type(decryptedAmount) != float:
|
||||||
|
|
||||||
raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Not an amount.")
|
raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Not an amount.")
|
||||||
price_msat = (
|
price_msat = (
|
||||||
await fiat_amount_as_satoshis(decryptedAmount, pos.currency)
|
await fiat_amount_as_satoshis(decryptedAmount, pos.currency)
|
||||||
@@ -72,10 +75,15 @@ async def lnurl_response(
|
|||||||
"minSendable": price_msat,
|
"minSendable": price_msat,
|
||||||
"maxSendable": price_msat,
|
"maxSendable": price_msat,
|
||||||
}
|
}
|
||||||
|
print(payResponse)
|
||||||
return json.dumps(payResponse)
|
return json.dumps(payResponse)
|
||||||
|
|
||||||
|
|
||||||
@lnurlpos_ext.get("/api/v1/lnurl/cb/{paymentid}")
|
@lnurlpos_ext.get(
|
||||||
|
"/api/v1/lnurl/cb/{paymentid}",
|
||||||
|
response_class=HTMLResponse,
|
||||||
|
name="lnurlpos.lnurl_callback",
|
||||||
|
)
|
||||||
async def lnurl_callback(paymentid: str = Query(None)):
|
async def lnurl_callback(paymentid: str = Query(None)):
|
||||||
lnurlpospayment = await get_lnurlpospayment(paymentid)
|
lnurlpospayment = await get_lnurlpospayment(paymentid)
|
||||||
pos = await get_lnurlpos(lnurlpospayment.posid)
|
pos = await get_lnurlpos(lnurlpospayment.posid)
|
||||||
|
Reference in New Issue
Block a user