Skip to content

Commit 701ebc6

Browse files
Merge remote-tracking branch 'remotes/github/2.3-develop' into EPAM-PR-85
2 parents ba9bfd5 + 06dbbc8 commit 701ebc6

File tree

45 files changed

+1625
-174
lines changed

Some content is hidden

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

45 files changed

+1625
-174
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/grid.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ $numColumns = $block->getColumns() !== null ? count($block->getColumns()) : 0;
170170
<?php if ($block->getSortableUpdateCallback()) : ?>
171171
<?= $block->escapeJs($block->getJsObjectName()) ?>.sortableUpdateCallback = <?= /* @noEscape */ $block->getSortableUpdateCallback() ?>;
172172
<?php endif; ?>
173+
<?php if ($block->getFilterKeyPressCallback()) : ?>
174+
<?= $block->escapeJs($block->getJsObjectName()) ?>.filterKeyPressCallback = <?= /* @noEscape */ $block->getFilterKeyPressCallback() ?>;
175+
<?php endif; ?>
173176
<?= $block->escapeJs($block->getJsObjectName()) ?>.bindSortable();
174177
<?php if ($block->getRowInitCallback()) : ?>
175178
<?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>;

app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ $numColumns = count($block->getColumns());
272272
<?php if ($block->getCheckboxCheckCallback()) : ?>
273273
<?= $block->escapeJs($block->getJsObjectName()) ?>.checkboxCheckCallback = <?= /* @noEscape */ $block->getCheckboxCheckCallback() ?>;
274274
<?php endif; ?>
275+
<?php if ($block->getFilterKeyPressCallback()) : ?>
276+
<?= $block->escapeJs($block->getJsObjectName()) ?>.filterKeyPressCallback = <?= /* @noEscape */ $block->getFilterKeyPressCallback() ?>;
277+
<?php endif; ?>
275278
<?php if ($block->getRowInitCallback()) : ?>
276279
<?= $block->escapeJs($block->getJsObjectName()) ?>.initRowCallback = <?= /* @noEscape */ $block->getRowInitCallback() ?>;
277280
<?= $block->escapeJs($block->getJsObjectName()) ?>.initGridRows();

app/code/Magento/Braintree/Gateway/Validator/ErrorCodeProvider.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Braintree\Error\Validation;
1212
use Braintree\Result\Error;
1313
use Braintree\Result\Successful;
14+
use Braintree\Transaction;
1415

1516
/**
1617
* Processes errors codes from Braintree response.
@@ -38,12 +39,14 @@ public function getErrorCodes($response): array
3839
$result[] = $error->code;
3940
}
4041

41-
if (isset($response->transaction) && $response->transaction->status === 'gateway_rejected') {
42-
$result[] = $response->transaction->gatewayRejectionReason;
43-
}
42+
if (isset($response->transaction) && $response->transaction) {
43+
if ($response->transaction->status === Transaction::GATEWAY_REJECTED) {
44+
$result[] = $response->transaction->gatewayRejectionReason;
45+
}
4446

45-
if (isset($response->transaction) && $response->transaction->status === 'processor_declined') {
46-
$result[] = $response->transaction->processorResponseCode;
47+
if ($response->transaction->status === Transaction::PROCESSOR_DECLINED) {
48+
$result[] = $response->transaction->processorResponseCode;
49+
}
4750
}
4851

4952
return $result;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Product;
9+
10+
use Magento\Framework\EntityManager\HydratorInterface;
11+
12+
/**
13+
* Class is used to extract data and populate entity with data
14+
*/
15+
class Hydrator implements HydratorInterface
16+
{
17+
/**
18+
* @inheritdoc
19+
*/
20+
public function extract($entity)
21+
{
22+
return $entity->getData();
23+
}
24+
25+
/**
26+
* @inheritdoc
27+
*/
28+
public function hydrate($entity, array $data)
29+
{
30+
$lockedAttributes = $entity->getLockedAttributes();
31+
$entity->unlockAttributes();
32+
$entity->setData(array_merge($entity->getData(), $data));
33+
foreach ($lockedAttributes as $attribute) {
34+
$entity->lockAttribute($attribute);
35+
}
36+
37+
return $entity;
38+
}
39+
}

app/code/Magento/Catalog/Ui/Component/UrlInput/Product.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
use Magento\Framework\UrlInterface;
1212

13+
/**
14+
* Returns configuration for product Url Input type
15+
*/
1316
class Product implements \Magento\Ui\Model\UrlInput\ConfigInterface
1417
{
1518
/**
@@ -27,7 +30,7 @@ public function __construct(UrlInterface $urlBuilder)
2730
}
2831

2932
/**
30-
* {@inheritdoc}
33+
* @inheritdoc
3134
*/
3235
public function getConfig(): array
3336
{
@@ -46,6 +49,7 @@ public function getConfig(): array
4649
'template' => 'ui/grid/filters/elements/ui-select',
4750
'searchUrl' => $this->urlBuilder->getUrl('catalog/product/search'),
4851
'filterPlaceholder' => __('Product Name or SKU'),
52+
'filterRateLimitMethod' => 'notifyWhenChangesStop',
4953
'isDisplayEmptyPlaceholder' => true,
5054
'emptyOptionsHtml' => __('Start typing to find products'),
5155
'missingValuePlaceholder' => __('Product with ID: %s doesn\'t exist'),

app/code/Magento/Catalog/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@
867867
<argument name="hydrators" xsi:type="array">
868868
<item name="Magento\Catalog\Api\Data\CategoryInterface" xsi:type="string">Magento\Framework\EntityManager\AbstractModelHydrator</item>
869869
<item name="Magento\Catalog\Api\Data\CategoryTreeInterface" xsi:type="string">Magento\Framework\EntityManager\AbstractModelHydrator</item>
870-
<item name="Magento\Catalog\Api\Data\ProductInterface" xsi:type="string">Magento\Framework\EntityManager\AbstractModelHydrator</item>
870+
<item name="Magento\Catalog\Api\Data\ProductInterface" xsi:type="string">Magento\Catalog\Model\Product\Hydrator</item>
871871
</argument>
872872
</arguments>
873873
</type>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\CatalogGraphQl\Plugin;
9+
10+
use Magento\Catalog\Model\Product;
11+
use Magento\Framework\Message\MessageInterface;
12+
use Magento\Framework\View\DesignLoader as ViewDesignLoader;
13+
use Magento\Framework\Message\ManagerInterface;
14+
use Magento\Catalog\Block\Product\ImageFactory;
15+
16+
/**
17+
* Load necessary design files for GraphQL
18+
*/
19+
class DesignLoader
20+
{
21+
/**
22+
* @var DesignLoader
23+
*/
24+
private $designLoader;
25+
26+
/**
27+
* @var ManagerInterface
28+
*/
29+
private $messageManager;
30+
31+
/**
32+
* @param ViewDesignLoader $designLoader
33+
* @param ManagerInterface $messageManager
34+
*/
35+
public function __construct(
36+
ViewDesignLoader $designLoader,
37+
ManagerInterface $messageManager
38+
) {
39+
$this->designLoader = $designLoader;
40+
$this->messageManager = $messageManager;
41+
}
42+
43+
/**
44+
* Before create load the design files
45+
*
46+
* @param ImageFactory $subject
47+
* @param Product $product
48+
* @param string $imageId
49+
* @param array|null $attributes
50+
*
51+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
52+
*/
53+
public function beforeCreate(
54+
ImageFactory $subject,
55+
Product $product,
56+
string $imageId,
57+
array $attributes = null
58+
) {
59+
try {
60+
$this->designLoader->load();
61+
} catch (\Magento\Framework\Exception\LocalizedException $e) {
62+
if ($e->getPrevious() instanceof \Magento\Framework\Config\Dom\ValidationException) {
63+
/** @var MessageInterface $message */
64+
$message = $this->messageManager
65+
->createMessage(MessageInterface::TYPE_ERROR)
66+
->setText($e->getMessage());
67+
$this->messageManager->addUniqueMessages([$message]);
68+
}
69+
}
70+
}
71+
}

app/code/Magento/CatalogGraphQl/etc/graphql/di.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,8 @@
137137
</argument>
138138
</arguments>
139139
</type>
140+
141+
<type name="Magento\Catalog\Block\Product\ImageFactory">
142+
<plugin name="designLoader" type="Magento\CatalogGraphQl\Plugin\DesignLoader" />
143+
</type>
140144
</config>

app/code/Magento/Checkout/view/frontend/web/js/model/address-converter.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ define([
99
'jquery',
1010
'Magento_Checkout/js/model/new-customer-address',
1111
'Magento_Customer/js/customer-data',
12-
'mage/utils/objects'
13-
], function ($, address, customerData, mageUtils) {
12+
'mage/utils/objects',
13+
'underscore'
14+
], function ($, address, customerData, mageUtils, _) {
1415
'use strict';
1516

1617
var countryData = customerData.get('directory-data');
@@ -60,13 +61,15 @@ define([
6061
delete addressData['region_id'];
6162

6263
if (addressData['custom_attributes']) {
63-
addressData['custom_attributes'] = Object.entries(addressData['custom_attributes'])
64-
.map(function (customAttribute) {
64+
addressData['custom_attributes'] = _.map(
65+
addressData['custom_attributes'],
66+
function (value, key) {
6567
return {
66-
'attribute_code': customAttribute[0],
67-
'value': customAttribute[1]
68+
'attribute_code': key,
69+
'value': value
6870
};
69-
});
71+
}
72+
);
7073
}
7174

7275
return address(addressData);

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,21 @@
254254
<data key="state">Côtes-d'Armor</data>
255255
<data key="postcode">12345</data>
256256
</entity>
257+
<entity name="updateCustomerChinaAddress" type="address">
258+
<data key="firstname">Xian</data>
259+
<data key="lastname">Shai</data>
260+
<data key="company">Hunan Fenmian</data>
261+
<data key="telephone">+86 851 8410 4337</data>
262+
<array key="street">
263+
<item>Nanyuan Rd, Wudang</item>
264+
<item>Hunan Fenmian</item>
265+
</array>
266+
<data key="country_id">CN</data>
267+
<data key="country">China</data>
268+
<data key="city">Guiyang</data>
269+
<data key="state">Guizhou Sheng</data>
270+
<data key="postcode">550002</data>
271+
</entity>
257272
<entity name="updateCustomerNoXSSInjection" type="address">
258273
<data key="firstname">Jany</data>
259274
<data key="lastname">Doe</data>
@@ -345,4 +360,19 @@
345360
<data key="default_shipping">Yes</data>
346361
<requiredEntity type="region">RegionAE</requiredEntity>
347362
</entity>
363+
<entity name="updateCustomerBelgiumAddress" type="address">
364+
<data key="firstname">John</data>
365+
<data key="lastname">Doe</data>
366+
<data key="company">Magento</data>
367+
<array key="street">
368+
<item>Chaussee de Wavre</item>
369+
<item>318</item>
370+
</array>
371+
<data key="city">Bihain</data>
372+
<data key="state">Hainaut</data>
373+
<data key="country_id">BE</data>
374+
<data key="country">Belgium</data>
375+
<data key="postcode">6690</data>
376+
<data key="telephone">0477-58-77867</data>
377+
</entity>
348378
</entities>

0 commit comments

Comments
 (0)