Skip to content

Commit b3fe531

Browse files
committed
MAGETWO-53714: BNCODE is not send in PayPal solutions properly for CE and EE
1 parent 7e91f4e commit b3fe531

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ abstract class AbstractConfig implements ConfigInterface
5454
/**
5555
* @var ProductMetadataInterface
5656
*/
57-
private $productMetadata;
57+
protected $productMetadata;
5858

5959
/**
6060
* @var string

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ public function buildBasicRequest()
623623
$request->setPartner($this->getConfigData('partner'));
624624
$request->setPwd($this->getConfigData('pwd'));
625625
$request->setVerbosity($this->getConfigData('verbosity'));
626-
$request->setData('BNCODE', $config->getBuildNotationCode());
626+
$request->setData('BUTTONSOURCE', $config->getBuildNotationCode());
627627
$request->setTender(self::TENDER_CC);
628628

629629
return $request;

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Magento\Framework\App\Config\ScopeConfigInterface;
99
use Magento\Store\Model\ScopeInterface as ModelScopeInterface;
1010
use Magento\Payment\Model\MethodInterface;
11+
use Magento\Framework\App\ProductMetadataInterface;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1113

1214
/**
1315
* Class AbstractConfigTest
@@ -290,10 +292,18 @@ public function testIsMethodActive()
290292

291293
public function testGetBuildNotationCode()
292294
{
293-
$this->scopeConfigMock->expects($this->once())
294-
->method('getValue')
295-
->with('paypal/bncode');
295+
$productMetadata = $this->getMock(ProductMetadataInterface::class, [], [], '', false);
296+
$productMetadata->expects($this->once())
297+
->method('getEdition')
298+
->will($this->returnValue('SomeEdition'));
299+
300+
$objectManagerHelper = new ObjectManagerHelper($this);
301+
$objectManagerHelper->setBackwardCompatibleProperty(
302+
$this->config,
303+
'productMetadata',
304+
$productMetadata
305+
);
296306

297-
$this->config->getBuildNotationCode();
307+
$this->assertEquals('Magento_Cart_SomeEdition', $this->config->getBuildNotationCode());
298308
}
299309
}

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,6 @@ public function testGetCountryMethods()
9999
$this->assertNotContains(Config::METHOD_WPP_BML, $this->model->getCountryMethods('DE'));
100100
}
101101

102-
public function testGetBuildNotationCode()
103-
{
104-
$this->model->setMethod('payflow_direct');
105-
$this->model->setStoreId(123);
106-
$this->scopeConfig->expects($this->once())
107-
->method('getValue')
108-
->with('paypal/bncode', ScopeInterface::SCOPE_STORE, 123)
109-
->will($this->returnValue('some BN code'));
110-
$this->assertEquals('some BN code', $this->model->getBuildNotationCode());
111-
}
112-
113102
public function testIsMethodActive()
114103
{
115104
$this->assertFalse($this->model->isMethodActive('payflow_direct'));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function testInitialize()
146146
'partner' => null,
147147
'pwd' => null,
148148
'verbosity' => null,
149-
'BNCODE' => 'build notation code',
149+
'BUTTONSOURCE' => 'build notation code',
150150
'tender' => 'C',
151151
],
152152
$this->returnSelf()

0 commit comments

Comments
 (0)