feat(withdraw): type casting

This commit is contained in:
Eneko Illarramendi
2020-05-08 21:12:31 +02:00
parent 63b9741c14
commit 14d61eaf56
6 changed files with 30 additions and 20 deletions
+4 -1
View File
@@ -68,7 +68,10 @@ def api_link_retrieve(link_id):
)
def api_link_create_or_update(link_id=None):
if g.data["max_withdrawable"] < g.data["min_withdrawable"]:
return jsonify({"message": "`max_withdrawable` needs to be at least `min_withdrawable`."}), HTTPStatus.BAD_REQUEST
return (
jsonify({"message": "`max_withdrawable` needs to be at least `min_withdrawable`."}),
HTTPStatus.BAD_REQUEST,
)
if (g.data["max_withdrawable"] * g.data["uses"] * 1000) > g.wallet.balance_msat:
return jsonify({"message": "Insufficient balance."}), HTTPStatus.FORBIDDEN