debugging validate dollars
This commit is contained in:
parent
db4797c044
commit
2b14627319
@ -39,12 +39,15 @@ def validate_dollars(min: float, max: float):
|
|||||||
|
|
||||||
minAsDecimal = decimal.Decimal(min)
|
minAsDecimal = decimal.Decimal(min)
|
||||||
maxAsDecimal = decimal.Decimal(max)
|
maxAsDecimal = decimal.Decimal(max)
|
||||||
|
|
||||||
|
current_app.logger.info(f"{str(dollars)} {str(minAsDecimal)} {str(dollars < minAsDecimal)}")
|
||||||
|
|
||||||
if dollars and dollars < minAsDecimal:
|
if dollars and dollars < minAsDecimal:
|
||||||
errors.append(f"dollars must be {str(minAsDecimal)} or more")
|
errors.append(f"dollars must be {str(minAsDecimal)} or more")
|
||||||
elif dollars and dollars >= maxAsDecimal:
|
elif dollars and dollars >= maxAsDecimal:
|
||||||
errors.append(f"dollars must be less than {str(maxAsDecimal)}")
|
errors.append(f"dollars must be less than {str(maxAsDecimal)}")
|
||||||
|
|
||||||
return [errors, dollars]
|
return [dollars, errors]
|
||||||
|
|
||||||
@bp.route("/btcpay", methods=("GET", "POST"))
|
@bp.route("/btcpay", methods=("GET", "POST"))
|
||||||
@account_required
|
@account_required
|
||||||
@ -56,9 +59,7 @@ def btcpay_payment():
|
|||||||
return redirect(url_for("console.account_balance"))
|
return redirect(url_for("console.account_balance"))
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
result = validate_dollars(0.01, 1000)
|
dollars, errors = validate_dollars(0.01, 1000)
|
||||||
errors = result[0]
|
|
||||||
dollars = result[1]
|
|
||||||
|
|
||||||
if len(errors) == 0:
|
if len(errors) == 0:
|
||||||
try:
|
try:
|
||||||
@ -150,9 +151,7 @@ def stripe_payment():
|
|||||||
errors = list()
|
errors = list()
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
result = validate_dollars(0.5, 1000000)
|
dollars, errors = validate_dollars(0.5, 1000000)
|
||||||
errors = result[0]
|
|
||||||
dollars = result[1]
|
|
||||||
|
|
||||||
if len(errors) == 0:
|
if len(errors) == 0:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user