Skip to content

Commit 1f3aedd

Browse files
authored
Merge pull request #1 from magento/2.2-develop
Issue 15121
2 parents 7c02acb + 714d31c commit 1f3aedd

File tree

2,385 files changed

+77287
-62828
lines changed

Some content is hidden

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

2,385 files changed

+77287
-62828
lines changed

.php_cs.dist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Pre-commit hook installation:
9-
* vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit
10-
*/
117
$finder = PhpCsFixer\Finder::create()
128
->name('*.phtml')
139
->exclude('dev/tests/functional/generated')

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ language: php
1515
php:
1616
- 7.0
1717
- 7.1
18+
git:
19+
depth: 5
1820
env:
1921
global:
2022
- COMPOSER_BIN_DIR=~/bin
2123
- INTEGRATION_SETS=3
22-
- NODE_JS_VERSION=6
24+
- NODE_JS_VERSION=8
2325
- MAGENTO_HOST_NAME="magento2.travis"
2426
matrix:
2527
- TEST_SUITE=unit

CHANGELOG.md

Lines changed: 456 additions & 0 deletions
Large diffs are not rendered by default.

COPYING.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2013-2017 Magento, Inc.
1+
Copyright © 2013-present Magento, Inc.
22

33
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license
44

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=develop)](https://travis-ci.org/magento/magento2)
1+
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=2.2-develop)](https://travis-ci.org/magento/magento2)
2+
[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
23
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
34
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)
45
<h2>Welcome</h2>
5-
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting edge, feature-rich eCommerce solution that gets results.
6+
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.
67

78
## Magento system requirements
8-
[Magento system requirements](http://devdocs.magento.com/magento-system-requirements.html)
9+
[Magento system requirements](http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements2.html)
910

1011
## Install Magento
1112
To install Magento, see either:
1213

13-
* [Magento DevBox](https://magento.com/tech-resources/download), the easiest way to get started with Magento.
14-
* [Installation guide](http://devdocs.magento.com/guides/v2.0/install-gde/bk-install-guide.html)
14+
* [Installation guide](http://devdocs.magento.com/guides/v2.2/install-gde/bk-install-guide.html)
1515

1616
<h2>Contributing to the Magento 2 code base</h2>
1717
Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations, or just good suggestions.
@@ -22,11 +22,24 @@ To learn about issues, click [here][2]. To open an issue, click [here][3].
2222

2323
To suggest documentation improvements, click [here][4].
2424

25-
[1]: <http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html>
26-
[2]: <http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#report>
25+
[1]: <http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html>
26+
[2]: <http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#report>
2727
[3]: <https://github.com/magento/magento2/issues>
2828
[4]: <http://devdocs.magento.com>
2929

30+
<h3>Community Maintainers</h3>
31+
The members of this team have been recognized for their outstanding commitment to maintaining and improving Magento. Magento has granted them permission to accept, merge, and reject pull requests, as well as review issues, and thanks these Community Maintainers for their valuable contributions.
32+
33+
<a href="https://magento.com/magento-contributors#maintainers">
34+
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/maintainers.png"/>
35+
</a>
36+
37+
<h3>Top Contributors</h3>
38+
Magento is thankful for any contribution that can improve our code base, documentation or increase test coverage. We always recognize our most active members, as their contributions are the foundation of the Magento Open Source platform.
39+
<a href="https://magento.com/magento-contributors">
40+
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/contributors.png"/>
41+
</a>
42+
3043
<h3>Labels applied by the Magento team</h3>
3144

3245
| Label | Description |

app/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) {
1515
if (PHP_SAPI == 'cli') {
1616
echo 'Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. ' .
17-
'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
17+
'Please read http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html';
1818
} else {
1919
echo <<<HTML
2020
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
2121
<p>Magento supports PHP 7.0.2, 7.0.4, and 7.0.6 or later. Please read
22-
<a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
22+
<a target="_blank" href="http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html">
2323
Magento System Requirements</a>.
2424
</div>
2525
HTML;

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public function execute()
3939
$this->messageManager->addException($e, __("We couldn't remove the messages because of an error."));
4040
}
4141
}
42-
$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
42+
$this->_redirect('adminhtml/*/');
4343
}
4444
}

app/code/Magento/AdminNotification/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-admin-notification",
33
"description": "N/A",
44
"require": {
5-
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
5+
"php": "~7.0.13|~7.1.0",
66
"magento/module-store": "100.2.*",
77
"magento/module-backend": "100.2.*",
88
"magento/module-media-storage": "100.2.*",
@@ -11,7 +11,7 @@
1111
"lib-libxml": "*"
1212
},
1313
"type": "magento2-module",
14-
"version": "100.2.1",
14+
"version": "100.2.2",
1515
"license": [
1616
"OSL-3.0",
1717
"AFL-3.0"

app/code/Magento/AdvancedPricingImportExport/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-advanced-pricing-import-export",
33
"description": "N/A",
44
"require": {
5-
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
5+
"php": "~7.0.13|~7.1.0",
66
"magento/module-catalog": "102.0.*",
77
"magento/module-catalog-inventory": "100.2.*",
88
"magento/module-eav": "101.0.*",
@@ -13,7 +13,7 @@
1313
"magento/framework": "101.0.*"
1414
},
1515
"type": "magento2-module",
16-
"version": "100.2.1",
16+
"version": "100.2.2",
1717
"license": [
1818
"OSL-3.0",
1919
"AFL-3.0"

app/code/Magento/Analytics/Block/Adminhtml/System/Config/CollectionTimeLabel.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,45 @@
55
*/
66
namespace Magento\Analytics\Block\Adminhtml\System\Config;
77

8+
use Magento\Framework\App\ObjectManager;
9+
810
/**
911
* Provides label with default Time Zone
1012
*/
1113
class CollectionTimeLabel extends \Magento\Config\Block\System\Config\Form\Field
1214
{
1315
/**
14-
* Add default time zone to comment
16+
* @var \Magento\Framework\Locale\ResolverInterface
17+
*/
18+
private $localeResolver;
19+
20+
/**
21+
* @param \Magento\Backend\Block\Template\Context $context
22+
* @param array $data
23+
* @param \Magento\Framework\Locale\ResolverInterface|null $localeResolver
24+
*/
25+
public function __construct(
26+
\Magento\Backend\Block\Template\Context $context,
27+
array $data = [],
28+
\Magento\Framework\Locale\ResolverInterface $localeResolver = null
29+
) {
30+
$this->localeResolver = $localeResolver ?:
31+
ObjectManager::getInstance()->get(\Magento\Framework\Locale\ResolverInterface::class);
32+
parent::__construct($context, $data);
33+
}
34+
35+
/**
36+
* Add current time zone to comment, properly translated according to locale
1537
*
1638
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
1739
* @return string
1840
*/
1941
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
2042
{
2143
$timeZoneCode = $this->_localeDate->getConfigTimezone();
22-
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)->getDisplayName();
44+
$locale = $this->localeResolver->getLocale();
45+
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)
46+
->getDisplayName(false, \IntlTimeZone::DISPLAY_LONG, $locale);
2347
$element->setData(
2448
'comment',
2549
sprintf("%s (%s)", $getLongTimeZoneName, $timeZoneCode)

app/code/Magento/Analytics/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "magento/module-analytics",
33
"description": "N/A",
44
"require": {
5-
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
5+
"php": "~7.0.13|~7.1.0",
66
"magento/module-backend": "100.2.*",
77
"magento/module-config": "101.0.*",
88
"magento/module-integration": "100.2.*",
99
"magento/module-store": "100.2.*",
1010
"magento/framework": "101.0.*"
1111
},
1212
"type": "magento2-module",
13-
"version": "100.2.0",
13+
"version": "100.2.1",
1414
"license": [
1515
"OSL-3.0",
1616
"AFL-3.0"

app/code/Magento/Authorization/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-authorization",
33
"description": "Authorization module provides access to Magento ACL functionality.",
44
"require": {
5-
"php": "7.0.2|7.0.4|~7.0.6|~7.1.0",
5+
"php": "~7.0.13|~7.1.0",
66
"magento/module-backend": "100.2.*",
77
"magento/framework": "101.0.*"
88
},

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

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*/
66
namespace Magento\Authorizenet\Model;
77

8-
use Magento\Framework\HTTP\ZendClientFactory;
8+
use Magento\Framework\App\ObjectManager;
99
use Magento\Payment\Model\Method\ConfigInterface;
1010
use Magento\Payment\Model\Method\TransparentInterface;
11-
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
1211

1312
/**
1413
* Authorize.net DirectPost payment method model.
@@ -102,7 +101,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
102101
protected $response;
103102

104103
/**
105-
* @var OrderSender
104+
* @var \Magento\Sales\Model\Order\Email\Sender\OrderSender
106105
*/
107106
protected $orderSender;
108107

@@ -123,6 +122,16 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
123122
*/
124123
private $psrLogger;
125124

125+
/**
126+
* @var \Magento\Sales\Api\PaymentFailuresInterface
127+
*/
128+
private $paymentFailures;
129+
130+
/**
131+
* @var \Magento\Sales\Model\Order
132+
*/
133+
private $order;
134+
126135
/**
127136
* @param \Magento\Framework\Model\Context $context
128137
* @param \Magento\Framework\Registry $registry
@@ -141,11 +150,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
141150
* @param \Magento\Sales\Model\OrderFactory $orderFactory
142151
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
143152
* @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
144-
* @param OrderSender $orderSender
153+
* @param \Magento\Sales\Model\Order\Email\Sender\OrderSender $orderSender
145154
* @param \Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository
146155
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
147156
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
148157
* @param array $data
158+
* @param \Magento\Sales\Api\PaymentFailuresInterface|null $paymentFailures
149159
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
150160
*/
151161
public function __construct(
@@ -162,15 +172,16 @@ public function __construct(
162172
\Magento\Authorizenet\Model\Directpost\Request\Factory $requestFactory,
163173
\Magento\Authorizenet\Model\Directpost\Response\Factory $responseFactory,
164174
TransactionService $transactionService,
165-
ZendClientFactory $httpClientFactory,
175+
\Magento\Framework\HTTP\ZendClientFactory $httpClientFactory,
166176
\Magento\Sales\Model\OrderFactory $orderFactory,
167177
\Magento\Store\Model\StoreManagerInterface $storeManager,
168178
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
169179
\Magento\Sales\Model\Order\Email\Sender\OrderSender $orderSender,
170180
\Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository,
171181
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
172182
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
173-
array $data = []
183+
array $data = [],
184+
\Magento\Sales\Api\PaymentFailuresInterface $paymentFailures = null
174185
) {
175186
$this->orderFactory = $orderFactory;
176187
$this->storeManager = $storeManager;
@@ -179,6 +190,8 @@ public function __construct(
179190
$this->orderSender = $orderSender;
180191
$this->transactionRepository = $transactionRepository;
181192
$this->_code = static::METHOD_CODE;
193+
$this->paymentFailures = $paymentFailures ? : ObjectManager::getInstance()
194+
->get(\Magento\Sales\Api\PaymentFailuresInterface::class);
182195

183196
parent::__construct(
184197
$context,
@@ -561,13 +574,10 @@ public function process(array $responseData)
561574
$this->validateResponse();
562575

563576
$response = $this->getResponse();
564-
//operate with order
565-
$orderIncrementId = $response->getXInvoiceNum();
566577
$responseText = $this->dataHelper->wrapGatewayError($response->getXResponseReasonText());
567578
$isError = false;
568-
if ($orderIncrementId) {
569-
/* @var $order \Magento\Sales\Model\Order */
570-
$order = $this->orderFactory->create()->loadByIncrementId($orderIncrementId);
579+
if ($this->getOrderIncrementId()) {
580+
$order = $this->getOrderFromResponse();
571581
//check payment method
572582
$payment = $order->getPayment();
573583
if (!$payment || $payment->getMethod() != $this->getCode()) {
@@ -632,9 +642,10 @@ public function checkResponseCode()
632642
return true;
633643
case self::RESPONSE_CODE_DECLINED:
634644
case self::RESPONSE_CODE_ERROR:
635-
throw new \Magento\Framework\Exception\LocalizedException(
636-
$this->dataHelper->wrapGatewayError($this->getResponse()->getXResponseReasonText())
637-
);
645+
$errorMessage = $this->dataHelper->wrapGatewayError($this->getResponse()->getXResponseReasonText());
646+
$order = $this->getOrderFromResponse();
647+
$this->paymentFailures->handle((int)$order->getQuoteId(), $errorMessage);
648+
throw new \Magento\Framework\Exception\LocalizedException($errorMessage);
638649
default:
639650
throw new \Magento\Framework\Exception\LocalizedException(
640651
__('There was a payment authorization error.')
@@ -988,12 +999,40 @@ protected function getTransactionResponse($transactionId)
988999
private function getPsrLogger()
9891000
{
9901001
if (null === $this->psrLogger) {
991-
$this->psrLogger = \Magento\Framework\App\ObjectManager::getInstance()
1002+
$this->psrLogger = ObjectManager::getInstance()
9921003
->get(\Psr\Log\LoggerInterface::class);
9931004
}
9941005
return $this->psrLogger;
9951006
}
9961007

1008+
/**
1009+
* Fetch order by increment id from response.
1010+
*
1011+
* @return \Magento\Sales\Model\Order
1012+
*/
1013+
private function getOrderFromResponse(): \Magento\Sales\Model\Order
1014+
{
1015+
if (!$this->order) {
1016+
$this->order = $this->orderFactory->create();
1017+
1018+
if ($incrementId = $this->getOrderIncrementId()) {
1019+
$this->order = $this->order->loadByIncrementId($incrementId);
1020+
}
1021+
}
1022+
1023+
return $this->order;
1024+
}
1025+
1026+
/**
1027+
* Fetch order increment id from response.
1028+
*
1029+
* @return string
1030+
*/
1031+
private function getOrderIncrementId(): string
1032+
{
1033+
return $this->getResponse()->getXInvoiceNum();
1034+
}
1035+
9971036
/**
9981037
* Checks if filter action is Report Only. Transactions that trigger this filter are processed as normal,
9991038
* but are also reported in the Merchant Interface as triggering this filter.

0 commit comments

Comments
 (0)