Skip to content

Commit c5cf025

Browse files
author
Simon Schurter
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents 64c4ec1 + 8bc4691 commit c5cf025

File tree

1,343 files changed

+27795
-17743
lines changed

Some content is hidden

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

1,343 files changed

+27795
-17743
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,10 @@ To suggest documentation improvements, click [here][4].
7272
[2]: <http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#report>
7373
[3]: <https://github.com/magento/magento2/issues>
7474
[4]: <http://devdocs.magento.com>
75+
76+
<h2>Reporting security issues</h2>
77+
78+
To report security vulnerabilities in Magento software or web sites, please e-mail <a href="mailto:security@magento.com">security@magento.com</a>. Please do not report security issues using GitHub. Be sure to encrypt your e-mail with our <a href="https://info2.magento.com/rs/magentoenterprise/images/security_at_magento.asc">encryption key</a> if it includes sensitive information. Learn more about reporting security issues <a href="https://magento.com/security/reporting-magento-security-issue">here</a>.
79+
80+
Stay up-to-date on the latest vulnerabilities and patches for Magento by signing up for <a href="https://magento.com/security/sign-up">Security Alert Notifications</a>.
81+

app/bootstrap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
umask($mask);
1616

1717
/* PHP version validation */
18-
if (version_compare(phpversion(), '5.5.0', '<') === true) {
18+
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50522) {
1919
if (PHP_SAPI == 'cli') {
20-
echo 'Magento supports PHP 5.5.0 or later. ' .
20+
echo 'Magento supports PHP 5.5.22 or later. ' .
2121
'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
2222
} else {
2323
echo <<<HTML
2424
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
25-
<p>Magento supports PHP 5.5.0 or later. Please read
25+
<p>Magento supports PHP 5.5.22 or later. Please read
2626
<a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
2727
Magento System Requirements</a>.
2828
</div>

app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,8 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product
9595
* @param \Magento\CatalogImportExport\Model\Export\Product\Type\Factory $_typeFactory
9696
* @param \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
9797
* @param \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer
98-
* @param \Magento\Framework\Model\Entity\MetadataPool $metadataPool
9998
* @param ImportProduct\StoreResolver $storeResolver
10099
* @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
101-
* @param \Magento\Framework\Model\Entity\MetadataPool $metadataPool
102100
* @throws \Magento\Framework\Exception\LocalizedException
103101
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
104102
*/
@@ -119,7 +117,6 @@ public function __construct(
119117
\Magento\CatalogImportExport\Model\Export\Product\Type\Factory $_typeFactory,
120118
\Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider,
121119
\Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer,
122-
\Magento\Framework\Model\Entity\MetadataPool $metadataPool,
123120
\Magento\CatalogImportExport\Model\Import\Product\StoreResolver $storeResolver,
124121
\Magento\Customer\Api\GroupRepositoryInterface $groupRepository
125122
) {

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ class AdvancedPricingTest extends \PHPUnit_Framework_TestCase
107107
*/
108108
protected $groupRepository;
109109

110-
/**
111-
* @var \Magento\Framework\Model\Entity\MetadataPool|\PHPUnit_Framework_MockObject_MockObject
112-
*/
113-
protected $metadataPool;
114-
115110
/**
116111
* @var \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter| \PHPUnit_Framework_MockObject_MockObject
117112
*/
@@ -290,13 +285,6 @@ protected function setUp()
290285
'',
291286
false
292287
);
293-
$this->metadataPool = $this->getMock(
294-
'\Magento\Framework\Model\Entity\MetadataPool',
295-
[],
296-
[],
297-
'',
298-
false
299-
);
300288
$this->writer = $this->getMock(
301289
'Magento\ImportExport\Model\Export\Adapter\AbstractAdapter',
302290
[
@@ -355,7 +343,6 @@ protected function setUp()
355343
$this->typeFactory,
356344
$this->linkTypeProvider,
357345
$this->rowCustomizer,
358-
$this->metadataPool,
359346
$this->storeResolver,
360347
$this->groupRepository
361348
);

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,14 +985,14 @@ private function invokeMethod($object, $method, $args = [])
985985
private function getAdvancedPricingMock($methods = [])
986986
{
987987
$metadataPoolMock = $this->getMock(
988-
\Magento\Framework\Model\Entity\MetadataPool::class,
988+
\Magento\Framework\EntityManager\MetadataPool::class,
989989
[],
990990
[],
991991
'',
992992
false
993993
);
994994
$metadataMock = $this->getMock(
995-
\Magento\Framework\Model\Entity\EntityMetadata::class,
995+
\Magento\Framework\EntityManager\EntityMetadata::class,
996996
[],
997997
[],
998998
'',

app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected function placeCheckoutOrder()
127127
);
128128
} catch (\Exception $exception) {
129129
$result->setData('error', true);
130-
$result->setData('error_messages', __('Cannot place order.'));
130+
$result->setData('error_messages', __('Unable to place order. Please try again later.'));
131131
}
132132
if ($response instanceof Http) {
133133
$response->representJson($this->jsonHelper->jsonEncode($result));

app/code/Magento/Authorizenet/Controller/Directpost/Payment/Redirect.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
*/
77
namespace Magento\Authorizenet\Controller\Directpost\Payment;
88

9+
use Magento\Framework\App\ObjectManager;
910
use Magento\Payment\Block\Transparent\Iframe;
1011

12+
/**
13+
* Class Redirect
14+
*/
1115
class Redirect extends \Magento\Authorizenet\Controller\Directpost\Payment
1216
{
1317
/**
@@ -28,9 +32,11 @@ public function execute()
2832
$this->_getDirectPostSession()->unsetData('quote_id');
2933
$params['redirect_parent'] = $helper->getSuccessOrderUrl([]);
3034
}
35+
3136
if (!empty($redirectParams['error_msg'])) {
3237
$cancelOrder = empty($redirectParams['x_invoice_num']);
3338
$this->_returnCustomerQuote($cancelOrder, $redirectParams['error_msg']);
39+
$params['error_msg'] = $redirectParams['error_msg'];
3440
}
3541

3642
if (isset($redirectParams['controller_action_name'])
@@ -40,7 +46,7 @@ public function execute()
4046
unset($params['redirect_parent']);
4147
}
4248

43-
$this->_coreRegistry->register(Iframe::REGISTRY_KEY, array_merge($params, $redirectParams));
49+
$this->_coreRegistry->register(Iframe::REGISTRY_KEY, $params);
4450
$this->_view->addPageLayoutHandles();
4551
$this->_view->loadLayout(false)->renderLayout();
4652
}

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
119119
*/
120120
protected $transactionRepository;
121121

122+
/**
123+
* @var \Psr\Log\LoggerInterface
124+
*/
125+
private $psrLogger;
126+
122127
/**
123128
* @param \Magento\Framework\Model\Context $context
124129
* @param \Magento\Framework\Registry $registry
@@ -761,7 +766,7 @@ protected function addStatusComment(\Magento\Sales\Model\Order\Payment $payment)
761766
{
762767
try {
763768
$transactionId = $this->getResponse()->getXTransId();
764-
$data = $payment->getMethodInstance()->getTransactionDetails($transactionId);
769+
$data = $this->transactionService->getTransactionDetails($this, $transactionId);
765770
$transactionStatus = (string)$data->transaction->transactionStatus;
766771
$fdsFilterAction = (string)$data->transaction->FDSFilterAction;
767772

@@ -779,6 +784,7 @@ protected function addStatusComment(\Magento\Sales\Model\Order\Payment $payment)
779784
$payment->getOrder()->addStatusHistoryComment($message);
780785
}
781786
} catch (\Exception $e) {
787+
$this->getPsrLogger()->critical($e);
782788
//this request is optional
783789
}
784790
return $this;
@@ -805,7 +811,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
805811
$order->registerCancellation($message)->save();
806812
} catch (\Exception $e) {
807813
//quiet decline
808-
$this->logger->critical($e);
814+
$this->getPsrLogger()->critical($e);
809815
}
810816
}
811817

@@ -973,4 +979,18 @@ protected function getTransactionResponse($transactionId)
973979

974980
return $response;
975981
}
982+
983+
/**
984+
* @return \Psr\Log\LoggerInterface
985+
*
986+
* @deprecated
987+
*/
988+
private function getPsrLogger()
989+
{
990+
if (null === $this->psrLogger) {
991+
$this->psrLogger = \Magento\Framework\App\ObjectManager::getInstance()
992+
->get(\Psr\Log\LoggerInterface::class);
993+
}
994+
return $this->psrLogger;
995+
}
976996
}

app/code/Magento/Authorizenet/Test/Unit/Controller/Directpost/Payment/PlaceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public function textExecuteFailedPlaceOrderDataProvider()
280280
{
281281
$objectFailed = new \Magento\Framework\DataObject();
282282
$objectFailed->setData('error', true);
283-
$objectFailed->setData('error_messages', __('Cannot place order.'));
283+
$objectFailed->setData('error_messages', __('Unable to place order. Please try again later.'));
284284

285285
return [
286286
[
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Authorizenet\Test\Unit\Controller\Directpost\Payment;
7+
8+
use Magento\Authorizenet\Controller\Directpost\Payment\Redirect;
9+
use Magento\Framework\App\RequestInterface;
10+
use Magento\Framework\App\ViewInterface;
11+
use Magento\Framework\Registry;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13+
use Magento\Payment\Block\Transparent\Iframe;
14+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
15+
16+
/**
17+
* Class RedirectTest
18+
*/
19+
class RedirectTest extends \PHPUnit_Framework_TestCase
20+
{
21+
/**
22+
* @var RequestInterface|MockObject
23+
*/
24+
private $request;
25+
26+
/**
27+
* @var ViewInterface|MockObject
28+
*/
29+
private $view;
30+
31+
/**
32+
* @var Registry|MockObject
33+
*/
34+
private $coreRegistry;
35+
36+
/**
37+
* @var Redirect
38+
*/
39+
private $controller;
40+
41+
protected function setUp()
42+
{
43+
$objectManager = new ObjectManager($this);
44+
45+
$this->request = static::getMockForAbstractClass(RequestInterface::class);
46+
47+
$this->view = static::getMockForAbstractClass(ViewInterface::class);
48+
49+
$this->coreRegistry = static::getMockBuilder(Registry::class)
50+
->disableOriginalConstructor()
51+
->setMethods(['register'])
52+
->getMock();
53+
54+
$this->controller = $objectManager->getObject(Redirect::class, [
55+
'request' => $this->request,
56+
'view' => $this->view,
57+
'coreRegistry' => $this->coreRegistry
58+
]);
59+
}
60+
61+
/**
62+
* @covers \Magento\Authorizenet\Controller\Directpost\Payment\Redirect::execute
63+
*/
64+
public function testExecute()
65+
{
66+
$url = 'http://test.com/redirect?=test';
67+
$params = [
68+
'order_success' => $url
69+
];
70+
$this->request->expects(static::once())
71+
->method('getParams')
72+
->willReturn($params);
73+
74+
$this->coreRegistry->expects(static::once())
75+
->method('register')
76+
->with(Iframe::REGISTRY_KEY, []);
77+
78+
$this->view->expects(static::once())
79+
->method('addPageLayoutHandles');
80+
$this->view->expects(static::once())
81+
->method('loadLayout')
82+
->with(false)
83+
->willReturnSelf();
84+
$this->view->expects(static::once())
85+
->method('renderLayout');
86+
87+
$this->controller->execute();
88+
}
89+
}

0 commit comments

Comments
 (0)