From 5229a86c27102240d478bfcbbe528165b28c03ff Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Tue, 2 Apr 2024 08:39:09 +0000 Subject: [PATCH] fixup! Add stripe donate form --- www/includes/easyparliament/helper-donate.php | 16 ++-------------- .../templates/html/donate/_stripe_donate.php | 12 ++++++------ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/www/includes/easyparliament/helper-donate.php b/www/includes/easyparliament/helper-donate.php index 0ba2bc27c5..2246471bd0 100644 --- a/www/includes/easyparliament/helper-donate.php +++ b/www/includes/easyparliament/helper-donate.php @@ -45,13 +45,6 @@ function giftaid_decision() } } -function contact_decision() -{ - return isset($_POST["contact_permission"]) - ? $_POST["contact_permission"] - : "No"; -} - # Stripe function stripe_post($path, $data) @@ -78,7 +71,7 @@ function stripe_session_ajax($successPage, $cancelPage) $utm_medium = $_POST["utm_medium"]; $utm_campaign = $_POST["utm_campaign"]; $full_name = $_POST["full_name"]; - $contact_permission = contact_decision(); + $contact_permission = $_POST["contact_permission"] ?? "No"; # backward compatibility if ($howoften == "recurring") { @@ -228,9 +221,4 @@ function get_checked($value, $checked_value, $echo = true) function wp_esc_attr($text) { return htmlspecialchars($text, ENT_QUOTES, "UTF-8"); -} - -function get_or_default($name, $default_value = "") -{ - return isset($_GET[$name]) ? $_GET[$name] : $default_value; -} +} \ No newline at end of file diff --git a/www/includes/easyparliament/templates/html/donate/_stripe_donate.php b/www/includes/easyparliament/templates/html/donate/_stripe_donate.php index 7504770fcf..eb14a5e165 100644 --- a/www/includes/easyparliament/templates/html/donate/_stripe_donate.php +++ b/www/includes/easyparliament/templates/html/donate/_stripe_donate.php @@ -30,10 +30,10 @@ $default_type = 'annually'; # use the how-often parameter if set, if not default to option at end of line (options are 'monthly', 'annually', or 'one-off') -$initial_payment_type = isset($_GET['how-often']) ? $_GET['how-often'] : $default_type; +$initial_payment_type = $_GET['how-often'] ?? $default_type; # use the how-much parameter if set, if not default to default amount for initial payment type -$how_much = isset($_GET['how-much']) ? $_GET['how-much'] : $default_amounts[$initial_payment_type]; +$how_much = $_GET['how-much'] ?? $default_amounts[$initial_payment_type]; # if how-much is not in the allowed values for the current payment type, set to 'other', and set $other_how_much to the value of how-much if (!array_key_exists($how_much, $payment_amounts[$initial_payment_type])) { @@ -139,10 +139,10 @@ class="donate--amount inline-radio-label"

Payment methods available: Card, PayPal, Apple Pay, Google Pay, Direct Debit

- - - - + + + +