[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Add default value for processor_form
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 Gerrit-Reviewer: AndyRussG Gerrit-Reviewer: Ejegg Gerrit-Reviewer: XenoRyet Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...DonationInterface[master]: Add default value for processor_form
Mepps has uploaded a new change for review. ( 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, 33 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/58/387858/1 diff --git a/adyen_gateway/adyen.adapter.php b/adyen_gateway/adyen.adapter.php index 7fae0dd..618a66a 100644 --- a/adyen_gateway/adyen.adapter.php +++ b/adyen_gateway/adyen.adapter.php @@ -43,6 +43,18 @@ ); } + function setGatewayDefaults( $options = array() ) { + if ( isset( $options['processor_form'] ) ) { + $processor_form = $options['processor_form']; + } else { + $skinCodes = $this->getSkinCodes(); + $options['processor_form'] = $skinCodes['base']; + } + $defaults = array( 'processor_form' => $skinCodes ); + + $this->addRequestData( $defaults ); + } + // FIXME: That's not what ReturnValueMap is for! // Unused? function defineReturnValueMap() { @@ -312,4 +324,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..e800528 100644 --- a/tests/phpunit/Adapter/Adyen/AdyenTest.php +++ b/tests/phpunit/Adapter/Adyen/AdyenTest.php @@ -265,4 +265,11 @@ $this->assertEquals( 'xoI76zyUFjjBzubzSPEopAgoA9Bt7PjwQAi5QHk/GKo=', $defaultSig ); $this->assertEquals( 'UKMVUkWR5GqsgfUEtqZalzh+kTa7kXyrDw9nbj4D/0Q=', $altSig ); } + + public function testGetSkinCodes() { + $init = $this->getDonorTestData(); + $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: newchange Gerrit-Change-Id: Ib8b0015bf3baee4f6dba375d9ea1f499362f1101 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: master Gerrit-Owner: Mepps ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits