Skip to content

Commit

Permalink
Merge pull request #1260 from magento-south/PRS
Browse files Browse the repository at this point in the history
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
  • Loading branch information
slavvka authored Jul 3, 2017
2 parents 3777ef4 + 4c3e910 commit 4994418
Show file tree
Hide file tree
Showing 107 changed files with 4,209 additions and 1,031 deletions.
18 changes: 17 additions & 1 deletion app/code/Magento/Authorizenet/Model/Directpost.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,11 @@ protected function processPaymentFraudStatus(\Magento\Sales\Model\Order\Payment
return $this;
}

$payment->setIsFraudDetected(true);
$fdsFilterAction = (string)$fraudDetailsResponse->getFdsFilterAction();
if ($this->fdsFilterActionIsReportOnly($fdsFilterAction) === false) {
$payment->setIsFraudDetected(true);
}

$payment->setAdditionalInformation('fraud_details', $fraudData);
} catch (\Exception $e) {
//this request is optional
Expand Down Expand Up @@ -989,4 +993,16 @@ private function getPsrLogger()
}
return $this->psrLogger;
}

/**
* Checks if filter action is Report Only. Transactions that trigger this filter are processed as normal,
* but are also reported in the Merchant Interface as triggering this filter.
*
* @param string $fdsFilterAction
* @return bool
*/
private function fdsFilterActionIsReportOnly($fdsFilterAction)
{
return $fdsFilterAction === (string)$this->dataHelper->getFdsFilterActionLabel('report');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
*/
order.addExcludedPaymentMethod('<?= /* @noEscape */ $code ?>');

<?php if (!$block->isAjaxRequest()): ?>
document.observe('dom:loaded', function(){
<?php endif; ?>

directPostModel = new directPost(
'<?= /* @noEscape */ $code ?>',
'directpost-iframe',
Expand All @@ -153,9 +149,5 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
'<?= $block->escapeUrl($block->getUrl('*/*/save', [
'_secure' => $block->getRequest()->isSecure()
]));?>');

<?php if (!$block->isAjaxRequest()): ?>
});
<?php endif; ?>
});
</script>
26 changes: 18 additions & 8 deletions app/code/Magento/Braintree/Gateway/Request/ChannelDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@
*/
namespace Magento\Braintree\Gateway\Request;

use Magento\Payment\Gateway\Request\BuilderInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Payment\Gateway\Config\Config;
use Magento\Payment\Gateway\Request\BuilderInterface;

/**
* Class BnCodeDataBuilder
*/
class ChannelDataBuilder implements BuilderInterface
{
/**
* @var ProductMetadataInterface
*/
private $productMetadata;

/**
* @var string
*/
Expand All @@ -28,23 +25,36 @@ class ChannelDataBuilder implements BuilderInterface
*/
private static $channelValue = 'Magento2_Cart_%s_BT';

/**
* @var ProductMetadataInterface
*/
private $productMetadata;

/**
* @var Config
*/
private $config;

/**
* Constructor
*
* @param ProductMetadataInterface $productMetadata
* @param Config $config
*/
public function __construct(ProductMetadataInterface $productMetadata)
public function __construct(ProductMetadataInterface $productMetadata, Config $config = null)
{
$this->productMetadata = $productMetadata;
$this->config = $config ?: ObjectManager::getInstance()->get(Config::class);
}

/**
* @inheritdoc
*/
public function build(array $buildSubject)
{
$channel = $this->config->getValue('channel');
return [
self::$channel => sprintf(self::$channelValue, $this->productMetadata->getEdition())
self::$channel => $channel ?: sprintf(self::$channelValue, $this->productMetadata->getEdition())
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

use Magento\Braintree\Gateway\Request\ChannelDataBuilder;
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Payment\Gateway\Config\Config;
use PHPUnit_Framework_MockObject_MockObject as MockObject;

/**
* Class PaymentDataBuilderTest
Expand All @@ -16,19 +18,32 @@
class ChannelDataBuilderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ProductMetadataInterface|\PHPUnit_Framework_MockObject_MockObject
* @var ProductMetadataInterface|MockObject
*/
private $productMetadataMock;
private $productMetadata;

/**
* @var Config|MockObject
*/
private $config;

/**
* @var ChannelDataBuilder
*/
private $builder;

/**
* @inheritdoc
*/
protected function setUp()
{
$this->productMetadataMock = $this->getMock(ProductMetadataInterface::class);
$this->builder = new ChannelDataBuilder($this->productMetadataMock);
$this->productMetadata = $this->getMockBuilder(ProductMetadataInterface::class)
->disableOriginalConstructor()
->getMock();
$this->config = $this->getMockBuilder(Config::class)
->disableOriginalConstructor()
->getMock();
$this->builder = new ChannelDataBuilder($this->productMetadata, $this->config);
}

/**
Expand All @@ -40,11 +55,37 @@ protected function setUp()
public function testBuild($edition, array $expected)
{
$buildSubject = [];
$this->productMetadataMock->expects(static::once())
->method('getEdition')

$this->config->method('getValue')
->with(self::equalTo('channel'))
->willReturn(null);

$this->productMetadata->method('getEdition')
->willReturn($edition);

$this->assertEquals($expected, $this->builder->build($buildSubject));
self::assertEquals($expected, $this->builder->build($buildSubject));
}

/**
* Checks a case when a channel provided via payment method configuration.
*/
public function testBuildWithChannelFromConfig()
{
$channel = 'Magento2_Cart_ConfigEdition_BT';

$this->config->method('getValue')
->with(self::equalTo('channel'))
->willReturn($channel);

$this->productMetadata->expects(self::never())
->method('getEdition');

self::assertEquals(
[
'channel' => $channel
],
$this->builder->build([])
);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/Braintree/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@
</type>
<!-- END command managers section for Vault -->

<type name="Magento\Braintree\Gateway\Request\ChannelDataBuilder">
<arguments>
<argument name="config" xsi:type="object">Magento\Braintree\Gateway\Config\Config</argument>
</arguments>
</type>

<!-- Braintree commands -->
<virtualType name="BraintreeAuthorizeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function __construct(
public function execute()
{
$this->reindex();
$this->activeTableSwitcher->switchTable($this->connection, $this->getMainTable());
$this->activeTableSwitcher->switchTable($this->connection, [$this->getMainTable()]);
return $this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function execute($ids = null)
$this->syncData($indexer, $mainTable);
}
}
$this->activeTableSwitcher->switchTable($indexer->getConnection(), $indexer->getMainTable());
$this->activeTableSwitcher->switchTable($indexer->getConnection(), [$indexer->getMainTable()]);
}
} catch (\Exception $e) {
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function execute($ids = null)
}
$this->activeTableSwitcher->switchTable(
$this->_defaultIndexerResource->getConnection(),
$this->_defaultIndexerResource->getMainTable()
[$this->_defaultIndexerResource->getMainTable()]
);
} catch (\Exception $e) {
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ class ActiveTableSwitcher
* Switch index tables from replica to active.
*
* @param \Magento\Framework\DB\Adapter\AdapterInterface $connection
* @param string $tableName
* @param array $tableNames
* @return void
*/
public function switchTable(\Magento\Framework\DB\Adapter\AdapterInterface $connection, $tableName)
public function switchTable(\Magento\Framework\DB\Adapter\AdapterInterface $connection, array $tableNames)
{
$outdatedTableName = $tableName . $this->outdatedTableSuffix;
$replicaTableName = $tableName . $this->additionalTableSuffix;
$toRename = [];
foreach ($tableNames as $tableName) {
$outdatedTableName = $tableName . $this->outdatedTableSuffix;
$replicaTableName = $tableName . $this->additionalTableSuffix;

$connection->renameTablesBatch(
[
$renameBatch = [
[
'oldName' => $tableName,
'newName' => $outdatedTableName
Expand All @@ -42,8 +43,13 @@ public function switchTable(\Magento\Framework\DB\Adapter\AdapterInterface $conn
'oldName' => $outdatedTableName,
'newName' => $replicaTableName
]
]
);
];
$toRename = array_merge($toRename, $renameBatch);
}

if (!empty($toRename)) {
$connection->renameTablesBatch($toRename);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testSwitch()
]
);

$this->model->switchTable($connectionMock, $tableName);
$this->model->switchTable($connectionMock, [$tableName]);
}

public function testGetAdditionalTableName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function execute($ids = null)
}
}
}
$this->activeTableSwitcher->switchTable($indexer->getConnection(), $indexer->getMainTable());
$this->activeTableSwitcher->switchTable($indexer->getConnection(), [$indexer->getMainTable()]);
} catch (\Exception $e) {
throw new LocalizedException(__($e->getMessage()), $e);
}
Expand Down
Loading

0 comments on commit 4994418

Please sign in to comment.