jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/387858 )

Change subject: Add default value for processor_form
......................................................................


Add default value for processor_form

Bug: T177893
Change-Id: Ib8b0015bf3baee4f6dba375d9ea1f499362f1101
---
M adyen_gateway/adyen.adapter.php
M adyen_gateway/adyen_gateway.body.php
M gateway_common/gateway.adapter.php
M tests/phpunit/Adapter/Adyen/AdyenTest.php
4 files changed, 32 insertions(+), 6 deletions(-)

Approvals:
  jenkins-bot: Verified
  Ejegg: Looks good to me, approved



diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php
index 7fae0dd..9a68fdb 100644
--- a/adyen_gateway/adyen.adapter.php
+++ b/adyen_gateway/adyen.adapter.php
@@ -43,6 +43,16 @@
                );
        }
 
+       function setGatewayDefaults( $options = array() ) {
+               if ( $this->getData_Unstaged_Escaped( 'processor_form' ) == 
null ) {
+                       $skinCodes = $this->getSkinCodes();
+                       $processor_form = $skinCodes['base'];
+                       $this->addRequestData(
+                               array( 'processor_form' => $processor_form )
+                       );
+               }
+       }
+
        // FIXME: That's not what ReturnValueMap is for!
        // Unused?
        function defineReturnValueMap() {
@@ -312,4 +322,16 @@
                return ( $calculated_sig === $requestVars[ 'merchantSig' ] );
        }
 
+       /**
+        * Reformat skin codes array to access by Name
+        */
+       public function getSkinCodes() {
+               $skins = $this->accountInfo['skins'];
+               $skinCodes = array();
+               foreach ( $skins as $code => $skin ) {
+                       $skinCodes[$skin['Name']] = $code;
+               }
+               return $skinCodes;
+       }
+
 }
diff --git a/adyen_gateway/adyen_gateway.body.php 
b/adyen_gateway/adyen_gateway.body.php
index 3a5ed78..6cac331 100644
--- a/adyen_gateway/adyen_gateway.body.php
+++ b/adyen_gateway/adyen_gateway.body.php
@@ -26,11 +26,7 @@
 
        public function setClientVariables( &$vars ) {
                parent::setClientVariables( $vars );
-               $skins = $this->adapter->getAccountConfig( 'Skins' );
-               $skinCodes = array();
-               foreach ( $skins as $code => $skin ) {
-                       $skinCodes[$skin['Name']] = $code;
-               }
+               $skinCodes = $this->adapter->getSkinCodes();
                $vars['wgAdyenGatewaySkinCodes'] = $skinCodes;
        }
 }
diff --git a/gateway_common/gateway.adapter.php 
b/gateway_common/gateway.adapter.php
index 396648a..a4c82ef 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -1247,7 +1247,7 @@
        }
 
        function setGatewayDefaults( $options = array() ) {
- }
+       }
 
        public function getCurrencies( $options = array() ) {
                return $this->config['currencies'];
diff --git a/tests/phpunit/Adapter/Adyen/AdyenTest.php 
b/tests/phpunit/Adapter/Adyen/AdyenTest.php
index d02e186..20cc8ab 100644
--- a/tests/phpunit/Adapter/Adyen/AdyenTest.php
+++ b/tests/phpunit/Adapter/Adyen/AdyenTest.php
@@ -265,4 +265,12 @@
                $this->assertEquals( 
'xoI76zyUFjjBzubzSPEopAgoA9Bt7PjwQAi5QHk/GKo=', $defaultSig );
                $this->assertEquals( 
'UKMVUkWR5GqsgfUEtqZalzh+kTa7kXyrDw9nbj4D/0Q=', $altSig );
        }
+
+       public function testGetSkinCodes() {
+               $init = $this->getDonorTestData();
+               unset( $init['processor_form'] );
+               $gateway = $this->getFreshGatewayObject( $init );
+               $skinCodes = $gateway->getSkinCodes();
+               $this->assertEquals( $skinCodes['base'], 'testskin' );
+       }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib8b0015bf3baee4f6dba375d9ea1f499362f1101
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Mepps <me...@wikimedia.org>
Gerrit-Reviewer: AndyRussG <andrew.green...@gmail.com>
Gerrit-Reviewer: Ejegg <ej...@ejegg.com>
Gerrit-Reviewer: XenoRyet <dkozlow...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to