Skip to content

Commit 971809c

Browse files
author
Yushkin, Dmytro
committed
MAGETWO-39777: [IE] PayPal Express Checkout is always displayed as disabled
- fix for Payflow Config class
1 parent ddc85d8 commit 971809c

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

app/code/Magento/Paypal/Model/AbstractConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ abstract class AbstractConfig implements ConfigInterface
4747
/**
4848
* @var string
4949
*/
50-
private $pathPattern;
50+
protected $pathPattern;
5151

5252
/**
5353
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig

app/code/Magento/Paypal/Model/PayflowConfig.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Class PayflowConfig
1212
* @todo ELiminate current configuration class
1313
*/
14-
class PayflowConfig extends AbstractConfig
14+
class PayflowConfig extends Config
1515
{
1616
/**#@-*/
1717

@@ -89,4 +89,19 @@ public function isMethodActive($method)
8989
return parent::isMethodActive(Config::METHOD_PAYMENT_PRO)
9090
|| parent::isMethodActive(Config::METHOD_PAYFLOWPRO);
9191
}
92+
93+
/**
94+
* Map any supported payment method into a config path by specified field name
95+
*
96+
* @param string $fieldName
97+
* @return string|null
98+
*/
99+
protected function _getSpecificConfigPath($fieldName)
100+
{
101+
if ($this->pathPattern) {
102+
return sprintf($this->pathPattern, $this->_methodCode, $fieldName);
103+
}
104+
105+
return "payment/{$this->_methodCode}/{$fieldName}";
106+
}
92107
}

app/code/Magento/Paypal/Test/Unit/Model/PayflowConfigTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Paypal\Test\Unit\Model;
77

88
use Magento\Framework\App\Config\ScopeConfigInterface;
9+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
910
use Magento\Paypal\Model\PayflowConfig;
1011
use Magento\Payment\Model\MethodInterface;
1112
use Magento\Payment\Model\Method\AbstractMethod;
@@ -41,7 +42,14 @@ protected function setUp()
4142
$this->methodInterfaceMock = $this->getMockBuilder('Magento\Payment\Model\MethodInterface')
4243
->getMockForAbstractClass();
4344

44-
$this->config = new PayflowConfig($this->scopeConfigMock);
45+
$om = new ObjectManager($this);
46+
$this->config = $om->getObject(
47+
'Magento\Paypal\Model\PayflowConfig',
48+
[
49+
'scopeConfig' => $this->scopeConfigMock,
50+
]
51+
);
52+
// $this->config = new PayflowConfig($this->scopeConfigMock);
4553
}
4654

4755
/**
@@ -163,6 +171,11 @@ public function testIsMethodActive(array $expectsMethods, $currentMethod, $resul
163171
{
164172
$this->config->setStoreId(5);
165173

174+
$this->scopeConfigMock->expects($this->any())
175+
->method('getValue')
176+
->with('paypal/general/merchant_country')
177+
->will($this->returnValue('US'));
178+
166179
$i = 0;
167180
foreach ($expectsMethods as $method => $isActive) {
168181
$this->scopeConfigMock->expects($this->at($i++))

0 commit comments

Comments
 (0)