Mwalker has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73383


Change subject: Coerce values to null and log banner
......................................................................

Coerce values to null and log banner

Change-Id: I40a05f0e04d4476143f43157681fd2673d9dcc17
---
M special/GatewayFormChooser.php
1 file changed, 11 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/83/73383/1

diff --git a/special/GatewayFormChooser.php b/special/GatewayFormChooser.php
index 8ffb6a1..377c5ee 100644
--- a/special/GatewayFormChooser.php
+++ b/special/GatewayFormChooser.php
@@ -18,14 +18,15 @@
        function execute( $par ) {
 
                // Set the country parameter
-               $country = $this->getRequest()->getVal( 'country', null );
-               $currency = $this->getRequest()->getVal( 'currency', null );
-               $paymentMethod = $this->getRequest()->getVal( 'paymentmethod', 
null );
-               $paymentSubMethod = $this->getRequest()->getVal( 'submethod', 
null );
+               $coerceNull = function( $val ) { return ( $val === '' ) ? null 
: $val; };
+               $country = $coerceNull( $this->getRequest()->getVal( 'country', 
null ) );
+               $currency = $coerceNull( $this->getRequest()->getVal( 
'currency', null ) );
+               $paymentMethod = $coerceNull( $this->getRequest()->getVal( 
'paymentmethod', null ) );
+               $paymentSubMethod = $coerceNull( $this->getRequest()->getVal( 
'submethod', null ) );
                $recurring = $this->getRequest()->getVal( 'recurring', false );
-               $gateway = $this->getRequest()->getVal( 'gateway', null );
-               
-               //This is clearly going to go away before we deploy this 
bizniss. 
+               $gateway = $coerceNull( $this->getRequest()->getVal( 'gateway', 
null ) );
+
+               //This is clearly going to go away before we deploy this 
bizniss.
                $testNewGetAll = $this->getRequest()->getVal( 'testGetAll', 
false );
                if ( $testNewGetAll ){
                        $forms = self::getAllValidForms( $country, $currency, 
$paymentMethod, $paymentSubMethod, $recurring, $gateway );
@@ -40,8 +41,10 @@
                $form = self::pickOneForm( $forms, $currency, $country );
 
                if ( $form === null ) {
+                       $utmSource = $this->getRequest()->getVal( 'utm_source', 
'' );
+
                        GatewayAdapter::log(
-                               "Not able to find a valid form for country 
'$country', currency '$currency', method '$paymentMethod', submethod 
'$paymentSubMethod', recurring: '$recurring', gateway '$gateway'",
+                               "Not able to find a valid form for country 
'$country', currency '$currency', method '$paymentMethod', submethod 
'$paymentSubMethod', recurring: '$recurring', gateway '$gateway' for utm source 
'$utmSource'",
                                LOG_ERR
                        );
                        $this->getOutput()->showErrorPage( 
'donate_interface-error-msg-general', 'donate_interface-error-no-form' );

-- 
To view, visit https://gerrit.wikimedia.org/r/73383
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40a05f0e04d4476143f43157681fd2673d9dcc17
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to