From be3b79b729549d085e2802d410952180e1d250df Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 20 Apr 2022 14:16:30 -0600 Subject: [PATCH] Fix rounding --- public/actions/submit.php | 2 +- public/static/signup.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/actions/submit.php b/public/actions/submit.php index 4d4e82f..1ff438d 100644 --- a/public/actions/submit.php +++ b/public/actions/submit.php @@ -238,7 +238,7 @@ $database->action(function ($database) { // Add Stripe fees // https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers if ($SETTINGS["prices"]["add_stripe_fees"]) { - $duecard = ($duecard + 0.30) / (1 - 0.029); + $duecard = number_format(($duecard + 0.30) / (1 - 0.029), 2) * 1.0; } echo "\nCost $dueusd total: $duecard to Stripe, $campcoupons as coupons\n"; diff --git a/public/static/signup.js b/public/static/signup.js index 9bf4739..8d0583a 100644 --- a/public/static/signup.js +++ b/public/static/signup.js @@ -124,7 +124,7 @@ function updateTotal() { cardcharge = (cardcharge + 0.3) / (1 - 0.029); } - totalcharge = Math.max(cardcharge + couponcharge, 0); + totalcharge = Math.max(cardcharge + couponcharge, 0).toFixed(2); // The server will refuse to finish the registration if this doesn't match // the backend-calculated amount, don't bother being a haxxor