From 5d2b8cfe9b7c4f44c8800ac87eb475740beb6380 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 9 Jan 2022 14:27:17 -0500 Subject: [PATCH] require at least $5 --- fosspay/blueprints/html.py | 3 +++ scripts/index.js | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/fosspay/blueprints/html.py b/fosspay/blueprints/html.py index 1e5eeaf..7f6fe87 100644 --- a/fosspay/blueprints/html.py +++ b/fosspay/blueprints/html.py @@ -220,6 +220,9 @@ def donate(): except: return { "success": False, "reason": "Invalid request" }, 400 + if amount < 500: + return { "success": False, "reason": "Please select at least $5 to offset processing fees" } + [_, domain] = email.split("@") if domain in email_blacklist: return { "success": True, "new_account": False } diff --git a/scripts/index.js b/scripts/index.js index 0041b77..9e4f342 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -67,6 +67,13 @@ return; } + if (donation.amount < 500) { + var errors = document.getElementById("errors"); + errors.classList.remove("hidden"); + errors.querySelector("p").textContent = "Please select at least $5 to offset processing fees."; + return; + } + donation.comment = document.getElementById("comments").value; var handler = StripeCheckout.configure({