Skip to content

Commit 4994418

Browse files
authored
Merge pull request #1260 from magento-south/PRS
Issues fixed: - MAGETWO-65422 Write default configs to shared configuration file by app:config:dump - MAGETWO-69567 [Mainline] - Closing the image view window causes mini-cart to drop down - MAGETWO-69607 Edition Specific BN-Codes for 2.2.x - MAGETWO-68936 Billing Agreement page is not loaded if Vault enabled - MAGETWO-57975 Impossible use ExtensionInterfaceFactory - MAGETWO-69580 Unstable automated test Magento\Paypal\Test\TestCase\InContextExpressOnePageCheckoutTest failed on variation InContextExpressOnePageCheckoutTestVariation1 - MAGETWO-69110 Incorrect status for order placed within Authorize.net with Fraud Filters Triggered (Filter Actions = Process as normal and report filter(s) triggered) - MAGETWO-68949 [Github] "We Can't Place The Order" error #9455 - MAGETWO-69112 No request sent to Authorize.net after reordering order in admin - MAGETWO-69584 Command config:sensitive:set does not work on the cloud - MAGETWO-57846 [Github] New Order Status config in payment method is useless #5860 - MAGETWO-67632 [Github] Invalid method usage in PayPal NVP callDoReauthorization method #9336 - MAGETWO-63239 [GITHUB] No possibility to save payment transaction details - MAGETWO-69121 Loader doesn't disappear if Authorize.net transact.dll fails request - MAGETWO-64518 \Magento\CatalogRule\Model\Indexer\IndexBuilder method "doReindexFull()" causes temporary missing sale prices - MAGETWO-60533 Data passed to Magento\Framework\ObjectManager\Config\Compiled is not validated - MAGETWO-70061 Exception on EE installation on environment with default-storage-engine=MyISAM - MAGETWO-69260 Unable to create shipping label due to error of lb to kg conversion - MAGETWO-58961 Multiselect text values are not searchable using QuickSearch with ElasticSearch - MQE-155 [FT] Magento\UrlRewrite\Test\TestCase\CreateProductWithSeveralWebsitesUrlRewriteTest randomly fails on Jenkins
2 parents 3777ef4 + 4c3e910 commit 4994418

File tree

107 files changed

+4209
-1031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+4209
-1031
lines changed

app/code/Magento/Authorizenet/Model/Directpost.php

+17-1
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,11 @@ protected function processPaymentFraudStatus(\Magento\Sales\Model\Order\Payment
744744
return $this;
745745
}
746746

747-
$payment->setIsFraudDetected(true);
747+
$fdsFilterAction = (string)$fraudDetailsResponse->getFdsFilterAction();
748+
if ($this->fdsFilterActionIsReportOnly($fdsFilterAction) === false) {
749+
$payment->setIsFraudDetected(true);
750+
}
751+
748752
$payment->setAdditionalInformation('fraud_details', $fraudData);
749753
} catch (\Exception $e) {
750754
//this request is optional
@@ -989,4 +993,16 @@ private function getPsrLogger()
989993
}
990994
return $this->psrLogger;
991995
}
996+
997+
/**
998+
* Checks if filter action is Report Only. Transactions that trigger this filter are processed as normal,
999+
* but are also reported in the Merchant Interface as triggering this filter.
1000+
*
1001+
* @param string $fdsFilterAction
1002+
* @return bool
1003+
*/
1004+
private function fdsFilterActionIsReportOnly($fdsFilterAction)
1005+
{
1006+
return $fdsFilterAction === (string)$this->dataHelper->getFdsFilterActionLabel('report');
1007+
}
9921008
}

app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml

-8
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,6 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
140140
*/
141141
order.addExcludedPaymentMethod('<?= /* @noEscape */ $code ?>');
142142

143-
<?php if (!$block->isAjaxRequest()): ?>
144-
document.observe('dom:loaded', function(){
145-
<?php endif; ?>
146-
147143
directPostModel = new directPost(
148144
'<?= /* @noEscape */ $code ?>',
149145
'directpost-iframe',
@@ -153,9 +149,5 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
153149
'<?= $block->escapeUrl($block->getUrl('*/*/save', [
154150
'_secure' => $block->getRequest()->isSecure()
155151
]));?>');
156-
157-
<?php if (!$block->isAjaxRequest()): ?>
158-
});
159-
<?php endif; ?>
160152
});
161153
</script>

app/code/Magento/Braintree/Gateway/Request/ChannelDataBuilder.php

+18-8
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,16 @@
55
*/
66
namespace Magento\Braintree\Gateway\Request;
77

8-
use Magento\Payment\Gateway\Request\BuilderInterface;
8+
use Magento\Framework\App\ObjectManager;
99
use Magento\Framework\App\ProductMetadataInterface;
10+
use Magento\Payment\Gateway\Config\Config;
11+
use Magento\Payment\Gateway\Request\BuilderInterface;
1012

1113
/**
1214
* Class BnCodeDataBuilder
1315
*/
1416
class ChannelDataBuilder implements BuilderInterface
1517
{
16-
/**
17-
* @var ProductMetadataInterface
18-
*/
19-
private $productMetadata;
20-
2118
/**
2219
* @var string
2320
*/
@@ -28,23 +25,36 @@ class ChannelDataBuilder implements BuilderInterface
2825
*/
2926
private static $channelValue = 'Magento2_Cart_%s_BT';
3027

28+
/**
29+
* @var ProductMetadataInterface
30+
*/
31+
private $productMetadata;
32+
33+
/**
34+
* @var Config
35+
*/
36+
private $config;
37+
3138
/**
3239
* Constructor
3340
*
3441
* @param ProductMetadataInterface $productMetadata
42+
* @param Config $config
3543
*/
36-
public function __construct(ProductMetadataInterface $productMetadata)
44+
public function __construct(ProductMetadataInterface $productMetadata, Config $config = null)
3745
{
3846
$this->productMetadata = $productMetadata;
47+
$this->config = $config ?: ObjectManager::getInstance()->get(Config::class);
3948
}
4049

4150
/**
4251
* @inheritdoc
4352
*/
4453
public function build(array $buildSubject)
4554
{
55+
$channel = $this->config->getValue('channel');
4656
return [
47-
self::$channel => sprintf(self::$channelValue, $this->productMetadata->getEdition())
57+
self::$channel => $channel ?: sprintf(self::$channelValue, $this->productMetadata->getEdition())
4858
];
4959
}
5060
}

app/code/Magento/Braintree/Test/Unit/Gateway/Request/ChannelDataBuilderTest.php

+48-7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
use Magento\Braintree\Gateway\Request\ChannelDataBuilder;
99
use Magento\Framework\App\ProductMetadataInterface;
10+
use Magento\Payment\Gateway\Config\Config;
11+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
1012

1113
/**
1214
* Class PaymentDataBuilderTest
@@ -16,19 +18,32 @@
1618
class ChannelDataBuilderTest extends \PHPUnit_Framework_TestCase
1719
{
1820
/**
19-
* @var ProductMetadataInterface|\PHPUnit_Framework_MockObject_MockObject
21+
* @var ProductMetadataInterface|MockObject
2022
*/
21-
private $productMetadataMock;
23+
private $productMetadata;
24+
25+
/**
26+
* @var Config|MockObject
27+
*/
28+
private $config;
2229

2330
/**
2431
* @var ChannelDataBuilder
2532
*/
2633
private $builder;
2734

35+
/**
36+
* @inheritdoc
37+
*/
2838
protected function setUp()
2939
{
30-
$this->productMetadataMock = $this->getMock(ProductMetadataInterface::class);
31-
$this->builder = new ChannelDataBuilder($this->productMetadataMock);
40+
$this->productMetadata = $this->getMockBuilder(ProductMetadataInterface::class)
41+
->disableOriginalConstructor()
42+
->getMock();
43+
$this->config = $this->getMockBuilder(Config::class)
44+
->disableOriginalConstructor()
45+
->getMock();
46+
$this->builder = new ChannelDataBuilder($this->productMetadata, $this->config);
3247
}
3348

3449
/**
@@ -40,11 +55,37 @@ protected function setUp()
4055
public function testBuild($edition, array $expected)
4156
{
4257
$buildSubject = [];
43-
$this->productMetadataMock->expects(static::once())
44-
->method('getEdition')
58+
59+
$this->config->method('getValue')
60+
->with(self::equalTo('channel'))
61+
->willReturn(null);
62+
63+
$this->productMetadata->method('getEdition')
4564
->willReturn($edition);
4665

47-
$this->assertEquals($expected, $this->builder->build($buildSubject));
66+
self::assertEquals($expected, $this->builder->build($buildSubject));
67+
}
68+
69+
/**
70+
* Checks a case when a channel provided via payment method configuration.
71+
*/
72+
public function testBuildWithChannelFromConfig()
73+
{
74+
$channel = 'Magento2_Cart_ConfigEdition_BT';
75+
76+
$this->config->method('getValue')
77+
->with(self::equalTo('channel'))
78+
->willReturn($channel);
79+
80+
$this->productMetadata->expects(self::never())
81+
->method('getEdition');
82+
83+
self::assertEquals(
84+
[
85+
'channel' => $channel
86+
],
87+
$this->builder->build([])
88+
);
4889
}
4990

5091
/**

app/code/Magento/Braintree/etc/di.xml

+6
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@
187187
</type>
188188
<!-- END command managers section for Vault -->
189189

190+
<type name="Magento\Braintree\Gateway\Request\ChannelDataBuilder">
191+
<arguments>
192+
<argument name="config" xsi:type="object">Magento\Braintree\Gateway\Config\Config</argument>
193+
</arguments>
194+
</type>
195+
190196
<!-- Braintree commands -->
191197
<virtualType name="BraintreeAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
192198
<arguments>

app/code/Magento/Catalog/Model/Indexer/Category/Product/Action/Full.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function __construct(
9595
public function execute()
9696
{
9797
$this->reindex();
98-
$this->activeTableSwitcher->switchTable($this->connection, $this->getMainTable());
98+
$this->activeTableSwitcher->switchTable($this->connection, [$this->getMainTable()]);
9999
return $this;
100100
}
101101

app/code/Magento/Catalog/Model/Indexer/Product/Eav/Action/Full.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function execute($ids = null)
9797
$this->syncData($indexer, $mainTable);
9898
}
9999
}
100-
$this->activeTableSwitcher->switchTable($indexer->getConnection(), $indexer->getMainTable());
100+
$this->activeTableSwitcher->switchTable($indexer->getConnection(), [$indexer->getMainTable()]);
101101
}
102102
} catch (\Exception $e) {
103103
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);

app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Full.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function execute($ids = null)
150150
}
151151
$this->activeTableSwitcher->switchTable(
152152
$this->_defaultIndexerResource->getConnection(),
153-
$this->_defaultIndexerResource->getMainTable()
153+
[$this->_defaultIndexerResource->getMainTable()]
154154
);
155155
} catch (\Exception $e) {
156156
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);

app/code/Magento/Catalog/Model/ResourceModel/Indexer/ActiveTableSwitcher.php

+14-8
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ class ActiveTableSwitcher
2020
* Switch index tables from replica to active.
2121
*
2222
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
23-
* @param string $tableName
23+
* @param array $tableNames
2424
* @return void
2525
*/
26-
public function switchTable(\Magento\Framework\DB\Adapter\AdapterInterface $connection, $tableName)
26+
public function switchTable(\Magento\Framework\DB\Adapter\AdapterInterface $connection, array $tableNames)
2727
{
28-
$outdatedTableName = $tableName . $this->outdatedTableSuffix;
29-
$replicaTableName = $tableName . $this->additionalTableSuffix;
28+
$toRename = [];
29+
foreach ($tableNames as $tableName) {
30+
$outdatedTableName = $tableName . $this->outdatedTableSuffix;
31+
$replicaTableName = $tableName . $this->additionalTableSuffix;
3032

31-
$connection->renameTablesBatch(
32-
[
33+
$renameBatch = [
3334
[
3435
'oldName' => $tableName,
3536
'newName' => $outdatedTableName
@@ -42,8 +43,13 @@ public function switchTable(\Magento\Framework\DB\Adapter\AdapterInterface $conn
4243
'oldName' => $outdatedTableName,
4344
'newName' => $replicaTableName
4445
]
45-
]
46-
);
46+
];
47+
$toRename = array_merge($toRename, $renameBatch);
48+
}
49+
50+
if (!empty($toRename)) {
51+
$connection->renameTablesBatch($toRename);
52+
}
4753
}
4854

4955
/**

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Indexer/ActiveTableSwitcherTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testSwitch()
4242
]
4343
);
4444

45-
$this->model->switchTable($connectionMock, $tableName);
45+
$this->model->switchTable($connectionMock, [$tableName]);
4646
}
4747

4848
public function testGetAdditionalTableName()

app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Full.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function execute($ids = null)
159159
}
160160
}
161161
}
162-
$this->activeTableSwitcher->switchTable($indexer->getConnection(), $indexer->getMainTable());
162+
$this->activeTableSwitcher->switchTable($indexer->getConnection(), [$indexer->getMainTable()]);
163163
} catch (\Exception $e) {
164164
throw new LocalizedException(__($e->getMessage()), $e);
165165
}

0 commit comments

Comments
 (0)