From f9e0d2cebfe0ccfe63e4e16ed0fba8bee9e048c1 Mon Sep 17 00:00:00 2001 From: arcbtc Date: Fri, 16 Aug 2024 05:52:55 +0100 Subject: [PATCH] lnaddress working, removed invoice choice --- helpers.py | 4 ++-- views_api.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/helpers.py b/helpers.py index 1f7f183..498e229 100644 --- a/helpers.py +++ b/helpers.py @@ -12,10 +12,10 @@ async def register_atm_payment(device, p): lnurldevicepayment = await get_recent_lnurldevicepayment(p) # If the payment is already registered and been paid, return None if lnurldevicepayment and lnurldevicepayment.payload == lnurldevicepayment.payhash: - return None + return None, None # If the payment is already registered and not been paid, return lnurlpayment record elif lnurldevicepayment and lnurldevicepayment.payload != lnurldevicepayment.payhash: - return lnurldevicepayment + return lnurldevicepayment, None # else create a new lnurlpayment record else: data = base64.urlsafe_b64decode(p) diff --git a/views_api.py b/views_api.py index e200281..09e6af9 100644 --- a/views_api.py +++ b/views_api.py @@ -171,6 +171,7 @@ async def get_lnurldevice_payment_lightning( # If its an lnaddress or lnurlp get the request from callback elif ln[:5] == "lnurl" or "@" in ln and "." in ln.split("@")[-1]: data = await api_lnurlscan(ln) + logger.debug(data) if data.get("status") == "ERROR": raise HTTPException( status_code=HTTPStatus.BAD_REQUEST, detail=data.get("reason") @@ -190,7 +191,7 @@ async def get_lnurldevice_payment_lightning( else: raise HTTPException( status_code=HTTPStatus.NOT_FOUND, - detail="Wrong format for payment, could not be made. Use invoice, LNaddress or LNURLp", + detail="Wrong format for payment, could not be made. Use LNaddress or LNURLp", ) # Finally log the payment and make the payment @@ -204,7 +205,7 @@ async def get_lnurldevice_payment_lightning( payment = await pay_invoice( wallet_id=lnurldevice.wallet, payment_request=ln, - max_sat=price_msat / 1000, + max_sat=price_msat, extra={"tag": "lnurldevice", "id": lnurldevicepayment.id}, ) assert payment