Merge branch 'main' into universalwebsocket

This commit is contained in:
Arc
2022-11-29 11:12:28 +00:00
committed by GitHub
8 changed files with 30 additions and 27 deletions
+5 -2
View File
@@ -11,8 +11,10 @@ from urllib.parse import ParseResult, parse_qs, urlencode, urlparse, urlunparse
import httpx
import pyqrcode
from fastapi import (Depends, Header, Query, Request, WebSocket,
WebSocketDisconnect)
from fastapi.exceptions import HTTPException
from fastapi.params import Body
from loguru import logger
@@ -565,8 +567,8 @@ class DecodePayment(BaseModel):
data: str
@core_app.post("/api/v1/payments/decode")
async def api_payments_decode(data: DecodePayment):
@core_app.post("/api/v1/payments/decode", status_code=HTTPStatus.OK)
async def api_payments_decode(data: DecodePayment, response: Response):
payment_str = data.data
try:
if payment_str[:5] == "LNURL":
@@ -587,6 +589,7 @@ async def api_payments_decode(data: DecodePayment):
"min_final_cltv_expiry": invoice.min_final_cltv_expiry,
}
except:
response.status_code = HTTPStatus.BAD_REQUEST
return {"message": "Failed to decode"}