Skip to content

Commit 388b587

Browse files
Merge branch '2.3-develop' into forward-15347
2 parents e9fa7b6 + f8b3385 commit 388b587

File tree

1,137 files changed

+29070
-38465
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,137 files changed

+29070
-38465
lines changed

.github/CONTRIBUTING.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
# Contributing to Magento 2 code
22

33
Contributions to the Magento 2 codebase are done using the fork & pull model.
4-
This contribution model has contributors maintaining their own copy of the forked codebase (which can easily be synced with the main copy). The forked repository is then used to submit a request to the base repository to “pull” a set of changes (hence the phrase “pull request”).
4+
This contribution model has contributors maintaining their own copy of the forked codebase (which can easily be synced with the main copy). The forked repository is then used to submit a request to the base repository to “pull” a set of changes. For more information on pull requests please refer to [GitHub Help](https://help.github.com/articles/about-pull-requests/).
55

6-
Contributions can take the form of new components/features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes, optimizations or just good suggestions.
6+
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 or optimizations.
77

8-
The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor for two weeks, the issue is closed.
8+
The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor within two weeks, the pull request will be closed.
99

1010

1111
## Contribution requirements
1212

13-
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v2.0/coding-standards/bk-coding-standards.html).
14-
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request to be merged quickly and without additional clarification requests.
15-
3. Commits must be accompanied by meaningful commit messages.
16-
4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug.
13+
1. Contributions must adhere to the [Magento coding standards](https://devdocs.magento.com/guides/v2.2/coding-standards/bk-coding-standards.html).
14+
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests.
15+
3. Commits must be accompanied by meaningful commit messages. Please see the [Magento Pull Request Template](https://github.com/magento/magento2/blob/2.2-develop/.github/PULL_REQUEST_TEMPLATE.md) for more information.
16+
4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug.
1717
3. PRs which include new logic or new features must be submitted along with:
18-
* Unit/integration test coverage (we will be releasing more information on writing test coverage in the near future).
19-
* Proposed [documentation](http://devdocs.magento.com) update. Documentation contributions can be submitted [here](https://github.com/magento/devdocs).
20-
4. For large features or changes, please [open an issue](https://github.com/magento/magento2/issues) and discuss first. This may prevent duplicate or unnecessary effort, and it may gain you some additional contributors.
21-
5. All automated tests are passed successfully (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
18+
* Unit/integration test coverage
19+
* Proposed [documentation](http://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs).
20+
4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input.
21+
5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green).
2222

2323
## Contribution process
2424

25-
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, fork the Magento 2 project and be able to easily send pull requests.
25+
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). This will allow you to collaborate with the Magento 2 development team, fork the Magento 2 project and send pull requests.
2626

2727
1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution.
2828
2. Review the [Contributor License Agreement](https://magento.com/legaldocuments/mca) if this is your first time contributing.
2929
3. Create and test your work.
30-
4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#pull_request).
31-
5. Once your contribution is received, Magento 2 development team will review the contribution and collaborate with you as needed to improve the quality of the contribution.
30+
4. Fork the Magento 2 repository according to the [Fork A Repository instructions](http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow the [Create A Pull Request instructions](http://devdocs.magento.com/guides/v2.2/contributor-guide/contributing.html#pull_request).
31+
5. Once your contribution is received the Magento 2 development team will review the contribution and collaborate with you as needed.
3232

3333
## Code of Conduct
3434

.github/ISSUE_TEMPLATE.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
1-
<!--- Provide a general summary of the issue in the Title above -->
2-
<!--- Before adding new issues, please, check this article https://github.com/magento/magento2/wiki/Issue-reporting-guidelines-->
1+
<!---
2+
Thank you for contributing to Magento.
3+
To help us process this issue we recommend that you add the following information:
4+
- Summary of the issue,
5+
- Information on your environment,
6+
- Steps to reproduce,
7+
- Expected and actual results,
8+
9+
Please also have a look at our guidelines article before adding a new issue https://github.com/magento/magento2/wiki/Issue-reporting-guidelines
10+
-->
311

412
### Preconditions
5-
<!--- Provide a more detailed information of environment you use -->
6-
<!--- Magento version, tag, HEAD, etc., PHP & MySQL version, etc.. -->
13+
<!---
14+
Please provide as detailed information about your environment as possible.
15+
For example Magento version, tag, HEAD, PHP & MySQL version, etc..
16+
-->
717
1.
818
2.
919

1020
### Steps to reproduce
11-
<!--- Provide a set of unambiguous steps to reproduce this bug include code, if relevant -->
21+
<!---
22+
It is important to provide a set of clear steps to reproduce this bug.
23+
If relevant please include code samples
24+
-->
1225
1.
1326
2.
1427
3.
1528

1629
### Expected result
1730
<!--- Tell us what should happen -->
18-
1.
31+
1. [Screenshots, logs or description]
1932

2033
### Actual result
2134
<!--- Tell us what happens instead -->
22-
1. [Screenshot, logs]
23-
24-
<!--- (This may be platform independent comment) -->
35+
1. [Screenshots, logs or description]

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
1-
<!--- Provide a general summary of the Pull Request in the Title above -->
1+
<!---
2+
Thank you for contributing to Magento.
3+
To help us process this pull request we recommend that you add the following information:
4+
- Summary of the pull request,
5+
- Issue(s) related to the changes made,
6+
- Manual testing scenarios,
7+
-->
8+
9+
<!--- Please provide a general summary of the Pull Request in the Title above -->
210

311
### Description
4-
<!--- Provide a description of the changes proposed in the pull request -->
12+
<!---
13+
Please provide a description of the changes proposed in the pull request.
14+
Letting us know what has changed and why it needed changing will help us validate this pull request.
15+
-->
516

617
### Fixed Issues (if relevant)
7-
<!--- Provide a list of fixed issues in the format magento/magento2#<issue_number>, if relevant -->
18+
<!---
19+
If relevant, please provide a list of fixed issues in the format magento/magento2#<issue_number>.
20+
There could be 1 or more issues linked here and it will help us find some more information about the reasoning behind this change.
21+
-->
822
1. magento/magento2#<issue_number>: Issue title
923
2. ...
1024

1125
### Manual testing scenarios
12-
<!--- Provide a set of unambiguous steps to test the proposed code change -->
26+
<!---
27+
Please provide a set of unambiguous steps to test the proposed code change.
28+
Giving us manual testing scenarios will help with the processing and validation process.
29+
-->
1330
1. ...
1431
2. ...
1532

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
global:
2323
- COMPOSER_BIN_DIR=~/bin
2424
- INTEGRATION_SETS=3
25-
- NODE_JS_VERSION=6
25+
- NODE_JS_VERSION=8
2626
- MAGENTO_HOST_NAME="magento2.travis"
2727
matrix:
2828
- TEST_SUITE=unit

COPYING.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2013-2018 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

app/code/Magento/AdminNotification/Controller/Adminhtml/System/Message/ListAction.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ public function execute()
6262
if (empty($result)) {
6363
$result[] = [
6464
'severity' => (string)\Magento\Framework\Notification\MessageInterface::SEVERITY_NOTICE,
65-
'text' => 'You have viewed and resolved all recent system notices. '
66-
. 'Please refresh the web page to clear the notice alert.',
65+
'text' => __(
66+
'You have viewed and resolved all recent system notices. '
67+
. 'Please refresh the web page to clear the notice alert.'
68+
)
6769
];
6870
}
6971
/** @var \Magento\Framework\Controller\Result\Json $resultJson */

app/code/Magento/AdminNotification/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ Severity,Severity
4848
"Date Added","Date Added"
4949
Message,Message
5050
Actions,Actions
51+
"You have viewed and resolved all recent system notices. Please refresh the web page to clear the notice alert.","You have viewed and resolved all recent system notices. Please refresh the web page to clear the notice alert."

app/code/Magento/AdvancedSearch/Model/ResourceModel/Index.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
use Magento\Framework\Model\ResourceModel\Db\Context;
1111
use Magento\Framework\EntityManager\MetadataPool;
1212
use Magento\Catalog\Api\Data\CategoryInterface;
13+
use Magento\Framework\App\ObjectManager;
14+
use Magento\Framework\Indexer\ScopeResolver\IndexScopeResolver as TableResolver;
15+
use Magento\Framework\Search\Request\Dimension;
16+
use Magento\Catalog\Model\Indexer\Category\Product\AbstractAction;
1317

1418
/**
1519
* @api
@@ -29,22 +33,30 @@ class Index extends AbstractDb
2933
*/
3034
protected $metadataPool;
3135

36+
/**
37+
* @var TableResolver
38+
*/
39+
private $tableResolver;
40+
3241
/**
3342
* Index constructor.
3443
* @param Context $context
3544
* @param StoreManagerInterface $storeManager
3645
* @param MetadataPool $metadataPool
3746
* @param null $connectionName
47+
* @param TableResolver|null $tableResolver
3848
*/
3949
public function __construct(
4050
Context $context,
4151
StoreManagerInterface $storeManager,
4252
MetadataPool $metadataPool,
43-
$connectionName = null
53+
$connectionName = null,
54+
TableResolver $tableResolver = null
4455
) {
4556
parent::__construct($context, $connectionName);
4657
$this->storeManager = $storeManager;
4758
$this->metadataPool = $metadataPool;
59+
$this->tableResolver = $tableResolver ?: ObjectManager::getInstance()->get(TableResolver::class);
4860
}
4961

5062
/**
@@ -116,8 +128,17 @@ public function getCategoryProductIndexData($storeId = null, $productIds = null)
116128
{
117129
$connection = $this->getConnection();
118130

131+
$catalogCategoryProductDimension = new Dimension(\Magento\Store\Model\Store::ENTITY, $storeId);
132+
133+
$catalogCategoryProductTableName = $this->tableResolver->resolve(
134+
AbstractAction::MAIN_INDEX_TABLE,
135+
[
136+
$catalogCategoryProductDimension
137+
]
138+
);
139+
119140
$select = $connection->select()->from(
120-
[$this->getTable('catalog_category_product_index')],
141+
[$catalogCategoryProductTableName],
121142
['category_id', 'product_id', 'position', 'store_id']
122143
)->where(
123144
'store_id = ?',

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

Lines changed: 57 additions & 18 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
@@ -134,18 +143,19 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
134143
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
135144
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
136145
* @param \Magento\Authorizenet\Helper\Data $dataHelper
137-
* @param Directpost\Request\Factory $requestFactory
138-
* @param Directpost\Response\Factory $responseFactory
146+
* @param \Magento\Authorizenet\Model\Directpost\Request\Factory $requestFactory
147+
* @param \Magento\Authorizenet\Model\Directpost\Response\Factory $responseFactory
139148
* @param \Magento\Authorizenet\Model\TransactionService $transactionService
140149
* @param \Magento\Framework\HTTP\ZendClientFactory $httpClientFactory
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(
@@ -161,16 +171,17 @@ public function __construct(
161171
\Magento\Authorizenet\Helper\Data $dataHelper,
162172
\Magento\Authorizenet\Model\Directpost\Request\Factory $requestFactory,
163173
\Magento\Authorizenet\Model\Directpost\Response\Factory $responseFactory,
164-
TransactionService $transactionService,
165-
ZendClientFactory $httpClientFactory,
174+
\Magento\Authorizenet\Model\TransactionService $transactionService,
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)