Skip to content

Commit

Permalink
MAGETWO-84109: Merge branch '2.2-develop' of github.com:magento-engco…
Browse files Browse the repository at this point in the history
…m/magento2ce into MAGETWO-84109-magento-magento2-12314
  • Loading branch information
ishakhsuvarov committed May 10, 2018
2 parents 06fd0cc + 5ed3aa3 commit d514d3e
Show file tree
Hide file tree
Showing 364 changed files with 6,223 additions and 2,097 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ language: php
php:
- 7.0
- 7.1
git:
depth: 5
env:
global:
- COMPOSER_BIN_DIR=~/bin
- INTEGRATION_SETS=3
- NODE_JS_VERSION=6
- NODE_JS_VERSION=8
- MAGENTO_HOST_NAME="magento2.travis"
matrix:
- TEST_SUITE=unit
Expand Down
456 changes: 456 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The members of this team have been recognized for their outstanding commitment t
</a>

<h3>Top Contributors</h3>
Magento team thanks for any contribution that can improve our code base, documentation or increase test coverage. We always recognize our most active members, your contributions are the foundation of the Magento open source platform.
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.
<a href="https://magento.com/magento-contributors">
<img src="https://raw.githubusercontent.com/wiki/magento/magento2/images/contributors.png"/>
</a>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdminNotification/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lib-libxml": "*"
},
"type": "magento2-module",
"version": "100.2.1",
"version": "100.2.2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdvancedPricingImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"magento/framework": "101.0.*"
},
"type": "magento2-module",
"version": "100.2.1",
"version": "100.2.2",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Analytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"magento/framework": "101.0.*"
},
"type": "magento2-module",
"version": "100.2.0",
"version": "100.2.1",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Backend/Block/GlobalSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function getWidgetInitOptions()
'filterProperty' => 'name',
'preventClickPropagation' => false,
'minLength' => 2,
'submitInputOnEnter' => false,
]
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function render(\Magento\Framework\DataObject $row)
*/
protected function _getCheckboxHtml($value, $checked)
{
$id = 'id_' . rand(0, 999);
$id = 'id_' . random_int(0, 999);
$html = '<label class="data-grid-checkbox-cell-inner" for="'. $id .'">';
$html .= '<input type="checkbox" name="' . $this->getColumn()->getName() . '" ';
$html .= 'id="' . $id . '" data-role="select-row"';
Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/Backend/Model/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ public function getUrl($routePath = null, $routeParams = null)
return $result;
}

$this->getRouteParamsResolver()->unsetData('route_params');
$this->_setRoutePath($routePath);
$extraParams = $this->getRouteParamsResolver()->getRouteParams();
$routeName = $this->_getRouteName('*');
$controllerName = $this->_getControllerName(self::DEFAULT_CONTROLLER_NAME);
$actionName = $this->_getActionName(self::DEFAULT_ACTION_NAME);
Expand All @@ -226,6 +228,10 @@ public function getUrl($routePath = null, $routeParams = null)
$routeParams[self::SECRET_KEY_PARAM_NAME] = $secretKey;
}

if (!empty($extraParams)) {
$routeParams = array_merge($extraParams, $routeParams);
}

return parent::getUrl("{$routeName}/{$controllerName}/{$actionName}", $routeParams);
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"magento/module-theme": "100.2.*"
},
"type": "magento2-module",
"version": "100.2.3",
"version": "100.2.4",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
3 changes: 0 additions & 3 deletions app/code/Magento/Backend/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
</argument>
<argument name="exemptions" xsi:type="array">
<item name="dev/debug/debug_logging" xsi:type="string"/>
</argument>
</arguments>
</type>
<type name="Magento\Framework\View\Layout\Generator\Block">
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="template_hints_blocks" translate="label" type="select" sortOrder="21" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Add Block Names to Hints</label>
<label>Add Block Class Type to Hints</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
</group>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"magento/framework": "101.0.*"
},
"type": "magento2-module",
"version": "100.2.2",
"version": "100.2.3",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Braintree\Gateway\Response;

use Magento\Braintree\Gateway\SubjectReader;
use Magento\Payment\Gateway\Response\HandlerInterface;
use Magento\Sales\Model\Order\Payment;

/**
* Handles response details for order cancellation request.
*/
class CancelDetailsHandler implements HandlerInterface
{
/**
* @var SubjectReader
*/
private $subjectReader;

/**
* @param SubjectReader $subjectReader
*/
public function __construct(SubjectReader $subjectReader)
{
$this->subjectReader = $subjectReader;
}

/**
* @inheritdoc
*/
public function handle(array $handlingSubject, array $response)
{
$paymentDO = $this->subjectReader->readPayment($handlingSubject);
/** @var Payment $orderPayment */
$orderPayment = $paymentDO->getPayment();
$orderPayment->setIsTransactionClosed(true);
$orderPayment->setShouldCloseParentTransaction(true);
}
}
9 changes: 5 additions & 4 deletions app/code/Magento/Braintree/Gateway/SubjectReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,20 @@ public function readPayment(array $subject)
}

/**
* Reads transaction from subject
* Reads transaction from the subject.
*
* @param array $subject
* @return \Braintree\Transaction
* @return Transaction
* @throws \InvalidArgumentException if the subject doesn't contain transaction details.
*/
public function readTransaction(array $subject)
{
if (!isset($subject['object']) || !is_object($subject['object'])) {
throw new \InvalidArgumentException('Response object does not exist');
throw new \InvalidArgumentException('Response object does not exist.');
}

if (!isset($subject['object']->transaction)
&& !$subject['object']->transaction instanceof Transaction
|| !$subject['object']->transaction instanceof Transaction
) {
throw new \InvalidArgumentException('The object is not a class \Braintree\Transaction.');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Braintree\Gateway\Validator;

use Braintree\Error\ErrorCollection;
use Braintree\Error\Validation;
use Magento\Payment\Gateway\Validator\AbstractValidator;
use Magento\Payment\Gateway\Validator\ResultInterface;
use Magento\Payment\Gateway\Validator\ResultInterfaceFactory;
use Magento\Braintree\Gateway\SubjectReader;

/**
* This validator decorates the general response validator to handle specific cases like
* an expired or already voided on Braintree side authorization transaction.
*/
class CancelResponseValidator extends AbstractValidator
{
/**
* @var int
*/
private static $acceptableTransactionCode = 91504;

/**
* @var GeneralResponseValidator
*/
private $generalResponseValidator;

/**
* @var SubjectReader
*/
private $subjectReader;

/**
* @param ResultInterfaceFactory $resultFactory
* @param GeneralResponseValidator $generalResponseValidator
*/
public function __construct(
ResultInterfaceFactory $resultFactory,
GeneralResponseValidator $generalResponseValidator,
SubjectReader $subjectReader
) {
parent::__construct($resultFactory);
$this->generalResponseValidator = $generalResponseValidator;
$this->subjectReader = $subjectReader;
}

/**
* @inheritdoc
*/
public function validate(array $validationSubject): ResultInterface
{
$result = $this->generalResponseValidator->validate($validationSubject);
if (!$result->isValid()) {
$response = $this->subjectReader->readResponseObject($validationSubject);
if ($this->isErrorAcceptable($response->errors)) {
$result = $this->createResult(true, [__('Transaction is cancelled offline.')]);
}
}

return $result;
}

/**
* Checks if error collection has an acceptable error code.
*
* @param ErrorCollection $errorCollection
* @return bool
*/
private function isErrorAcceptable(ErrorCollection $errorCollection): bool
{
$errors = $errorCollection->deepAll();
// there is should be only one acceptable error
if (count($errors) > 1) {
return false;
}

/** @var Validation $error */
$error = array_pop($errors);
return (int)$error->code === self::$acceptableTransactionCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ public function __construct(
public function beforeSave()
{
$value = $this->getValue();
if (!is_array($value)) {
try {
$value = $this->serializer->unserialize($value);
} catch (\InvalidArgumentException $e) {
$value = [];
}
}
$result = [];
foreach ($value as $data) {
if (empty($data['country_id']) || empty($data['cc_types'])) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Braintree/Model/AvsEmsCodeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AvsEmsCodeMapper implements PaymentVerificationInterface
*
* @var string
*/
private static $unavailableCode = 'U';
private static $unavailableCode = '';

/**
* List of mapping AVS codes
Expand Down

This file was deleted.

Loading

0 comments on commit d514d3e

Please sign in to comment.