Fix Webhooks on withdraw (#2)
* make webhook toggle not undefined
* undefined toggle at update and stringify webhook
* remove comment
* remove json stringify
* json validation serverside
* Fix updating withdraw links with webhook info
* make webhook toggle not undefined
* undefined toggle at update and stringify webhook
* remove comment
* remove json stringify
* Fix updating withdraw links with webhook info
* fix: use arrow functions
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
parent
44e79baee1
commit
c4cb176f10
2 changed files with 35 additions and 26 deletions
19
views_api.py
19
views_api.py
|
|
@ -1,5 +1,6 @@
|
|||
from http import HTTPStatus
|
||||
from typing import Optional
|
||||
import json
|
||||
|
||||
from fastapi import Depends, HTTPException, Query, Request
|
||||
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl
|
||||
|
|
@ -84,6 +85,24 @@ async def api_link_create_or_update(
|
|||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
)
|
||||
|
||||
if data.webhook_body:
|
||||
try:
|
||||
json.loads(data.webhook_body)
|
||||
except:
|
||||
raise HTTPException(
|
||||
detail="`webhook_body` can not parse JSON.",
|
||||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
)
|
||||
|
||||
if data.webhook_headers:
|
||||
try:
|
||||
json.loads(data.webhook_headers)
|
||||
except:
|
||||
raise HTTPException(
|
||||
detail="`webhook_headers` can not parse JSON.",
|
||||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
)
|
||||
|
||||
if link_id:
|
||||
link = await get_withdraw_link(link_id, 0)
|
||||
if not link:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue