Merge pull request #559 from lnbits/withdrawpayzerocheck
Added check so number must be more than zero
This commit is contained in:
commit
911fe92e03
2 changed files with 10 additions and 0 deletions
|
|
@ -76,6 +76,11 @@ async def api_link_create_or_update(
|
||||||
link_id=None,
|
link_id=None,
|
||||||
wallet: WalletTypeInfo = Depends(get_key_type),
|
wallet: WalletTypeInfo = Depends(get_key_type),
|
||||||
):
|
):
|
||||||
|
if data.min < 1:
|
||||||
|
raise HTTPException(
|
||||||
|
detail="Min must be more than 1.", status_code=HTTPStatus.BAD_REQUEST
|
||||||
|
)
|
||||||
|
|
||||||
if data.min > data.max:
|
if data.min > data.max:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
detail="Min is greater than max.", status_code=HTTPStatus.BAD_REQUEST
|
detail="Min is greater than max.", status_code=HTTPStatus.BAD_REQUEST
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,11 @@ async def api_link_create_or_update(
|
||||||
link_id: str = None,
|
link_id: str = None,
|
||||||
wallet: WalletTypeInfo = Depends(require_admin_key),
|
wallet: WalletTypeInfo = Depends(require_admin_key),
|
||||||
):
|
):
|
||||||
|
if data.min_withdrawable < 1:
|
||||||
|
raise HTTPException(
|
||||||
|
detail="Min must be more than 1.", status_code=HTTPStatus.BAD_REQUEST
|
||||||
|
)
|
||||||
|
|
||||||
if data.max_withdrawable < data.min_withdrawable:
|
if data.max_withdrawable < data.min_withdrawable:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
detail="`max_withdrawable` needs to be at least `min_withdrawable`.",
|
detail="`max_withdrawable` needs to be at least `min_withdrawable`.",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue