Ejegg has uploaded a new change for review.

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

Change subject: Fix appending country to TY page URL
......................................................................

Fix appending country to TY page URL

Use wfAppendQuery instead of duplicated logic.  Also, fix building
return URL for GlobalCollect bank transfer messages.

Bug: T126814
Change-Id: Idd948b4f04a875cb9f1907d21eff598c7abc1597
---
M gateway_common/gateway.adapter.php
M globalcollect_gateway/globalcollect_gateway.body.php
2 files changed, 17 insertions(+), 9 deletions(-)


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

diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index 1e5b0ae..1d57910 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -502,12 +502,8 @@
                if ( $page ) {
                        $page = $this->appendLanguageAndMakeURL( $page );
                }
-               $separator = '&';
-               if ( strstr( $page, '?' ) === false ) {
-                       $separator = '?';
-               }
                $country = $this->getData_Unstaged_Escaped( 'country' );
-               return $page . "{$separator}country={$country}";
+               return wfAppendQuery( $page, array( 'country' => $country ) );
        }
 
        /**
diff --git a/globalcollect_gateway/globalcollect_gateway.body.php 
b/globalcollect_gateway/globalcollect_gateway.body.php
index 2302072..1a5ffa2 100644
--- a/globalcollect_gateway/globalcollect_gateway.body.php
+++ b/globalcollect_gateway/globalcollect_gateway.body.php
@@ -95,9 +95,15 @@
 
                $return .= Xml::closeElement( 'table' ); // close $id . '_table'
 
-               $queryString = '?payment_method=' . 
$this->adapter->getPaymentMethod() . '&payment_submethod=' . 
$this->adapter->getPaymentSubmethod();
+               $queryParams = array(
+                       'payment_method' => $this->adapter->getPaymentMethod(),
+                       'payment_submethod' => 
$this->adapter->getPaymentSubmethod(),
+               );
 
-               $encUrl = Xml::encodeJsVar( $this->adapter->getThankYouPage() . 
$queryString );
+               $encUrl = Xml::encodeJsVar( wfAppendQuery(
+                       $this->adapter->getThankYouPage(),
+                       $queryParams
+               ) );
 
                $link = Html::input('MyButton', $this->msg( 
'donate_interface-bt-finished')->text(), 'button', array( 'onclick' => 
"window.location = $encUrl" ) );
 
@@ -161,9 +167,15 @@
                $return .= Xml::closeElement ( 'tr' );
                $return .= Xml::closeElement ( 'table' ); //close info table
 
-               $queryString = '?payment_method=' . 
$this->adapter->getPaymentMethod() . '&payment_submethod=' . 
$this->adapter->getPaymentSubmethod();
+               $queryParams = array(
+                       'payment_method' => $this->adapter->getPaymentMethod(),
+                       'payment_submethod' => 
$this->adapter->getPaymentSubmethod(),
+               );
 
-               $encUrl = Xml::encodeJsVar( $this->adapter->getThankYouPage() . 
$queryString );
+               $encUrl = Xml::encodeJsVar( wfAppendQuery(
+                       $this->adapter->getThankYouPage(),
+                       $queryParams
+               ) );
 
                $link = Html::input('MyButton', 'finished', 'button', array( 
'onclick' => "window.location = $encUrl" ) );
 

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

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

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

Reply via email to