Skip to content

Commit e03d067

Browse files
authored
Merge pull request #6486 from magento-l3/PRodubovyk20201222
L3 Bugfix Delivery
2 parents 24cb7ac + 6857102 commit e03d067

File tree

62 files changed

+2154
-102
lines changed

Some content is hidden

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

62 files changed

+2154
-102
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ $scriptString .= <<<script
7777
dataUrl: '{$block->escapeJs($block->escapeUrl($block->getLoadTreeUrl()))}'
7878
});
7979
80+
categoryLoader.processResponse = function (response, parent, callback) {
81+
var config = JSON.parse(response.responseText);
82+
83+
this.buildCategoryTree(parent, config);
84+
85+
if (typeof callback == "function") {
86+
callback(this, parent);
87+
}
88+
};
89+
8090
categoryLoader.buildCategoryTree = function(parent, config)
8191
{
8292
if (!config) return null;
@@ -164,8 +174,10 @@ $scriptString .= <<<script
164174
};
165175
166176
categoryLoader.on("beforeload", function(treeLoader, node) {
167-
$('{$block->escapeJs($_divId)}').fire('category:beforeLoad', {treeLoader:treeLoader});
168177
treeLoader.baseParams.id = node.attributes.id;
178+
treeLoader.baseParams.store = node.attributes.store;
179+
treeLoader.baseParams.form_key = FORM_KEY;
180+
$('{$block->escapeJs($_divId)}').fire('category:beforeLoad', {treeLoader:treeLoader});
169181
});
170182
171183
tree{$block->escapeJs($block->getId())} = new Ext.tree.TreePanel.Enhanced('{$block->escapeJs($_divId)}', {
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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\CatalogRuleGraphQl\Plugin\Pricing\Price;
9+
10+
use Magento\CatalogRule\Model\ResourceModel\Rule;
11+
use Magento\CatalogRule\Pricing\Price\CatalogRulePrice;
12+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
13+
14+
/**
15+
* Class UpdateCatalogRulePrice
16+
*
17+
* Plugin to update catalog rule price based on customer group id
18+
*/
19+
class UpdateCatalogRulePrice
20+
{
21+
/**
22+
* @var TimezoneInterface
23+
*/
24+
private $dateTime;
25+
26+
/**
27+
* @var Rule
28+
*/
29+
private $ruleResource;
30+
31+
/**
32+
* @param TimezoneInterface $dateTime
33+
* @param Rule $ruleResource
34+
*/
35+
public function __construct(
36+
TimezoneInterface $dateTime,
37+
Rule $ruleResource
38+
) {
39+
$this->dateTime = $dateTime;
40+
$this->ruleResource = $ruleResource;
41+
}
42+
43+
/**
44+
* Returns catalog rule value for logged in customer group
45+
*
46+
* @param CatalogRulePrice $catalogRulePrice
47+
* @param float|boolean $value
48+
* @return float|boolean
49+
*/
50+
public function afterGetValue(
51+
CatalogRulePrice $catalogRulePrice,
52+
$value
53+
) {
54+
$product = $catalogRulePrice->getProduct();
55+
if ($product && $product->getCustomerGroupId()) {
56+
$store = $product->getStore();
57+
$value = $this->ruleResource->getRulePrice(
58+
$this->dateTime->scopeDate($store->getId()),
59+
$store->getWebsiteId(),
60+
$product->getCustomerGroupId(),
61+
$product->getId()
62+
);
63+
$value = $value ? (float) $value : false;
64+
}
65+
66+
return $value;
67+
}
68+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9+
<type name="Magento\CatalogRule\Pricing\Price\CatalogRulePrice">
10+
<plugin name="update_catalog_rule_price_for_logged_in_customer_group" type="Magento\CatalogRuleGraphQl\Plugin\Pricing\Price\UpdateCatalogRulePrice"/>
11+
</type>
12+
</config>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
</argument>
6060
</arguments>
6161
</type>
62+
<type name="Magento\UrlRewrite\Model\UrlRewrite">
63+
<arguments>
64+
<argument name="entityToCacheTagMap" xsi:type="array">
65+
<item name="product" xsi:type="const">Magento\Catalog\Model\Product::CACHE_TAG</item>
66+
<item name="category" xsi:type="const">Magento\Catalog\Model\Category::CACHE_TAG</item>
67+
</argument>
68+
</arguments>
69+
</type>
6270
<type name="Magento\Eav\Model\Config">
6371
<arguments>
6472
<argument name="attributesForPreload" xsi:type="array">

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,11 @@
99
<type name="Magento\Cms\Model\ResourceModel\Page">
1010
<plugin name="cms_url_rewrite_plugin" type="Magento\CmsUrlRewrite\Plugin\Cms\Model\ResourceModel\Page"/>
1111
</type>
12+
<type name="Magento\UrlRewrite\Model\UrlRewrite">
13+
<arguments>
14+
<argument name="entityToCacheTagMap" xsi:type="array">
15+
<item name="cms-page" xsi:type="const">Magento\Cms\Model\Page::CACHE_TAG</item>
16+
</argument>
17+
</arguments>
18+
</type>
1219
</config>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="StorefrontCustomerOrderShipmentPage" url="sales/order/shipment/order_id/{{var1}}" area="storefront" module="Magento_Customer" parameterized="true">
12+
<section name="StorefrontCustomerOrderSection"/>
13+
</page>
14+
</pages>

app/code/Magento/Paypal/Controller/Hostedpro/ReturnAction.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ class ReturnAction extends Action implements CsrfAwareActionInterface, HttpPostA
2626
*/
2727
public function execute()
2828
{
29-
$session = $this->_objectManager->get(\Magento\Checkout\Model\Session::class);
30-
//TODO: some actions with order
31-
if ($session->getLastRealOrderId()) {
32-
$this->_redirect('checkout/onepage/success');
33-
}
29+
$this->_redirect('checkout/onepage/success');
3430
}
3531

3632
/**

app/code/Magento/Paypal/Model/Payflow/Service/Gateway.php

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ public function postRequest(DataObject $request, ConfigInterface $config)
8585
);
8686
$client->setConfig($clientConfig);
8787
$client->setMethod(\Zend_Http_Client::POST);
88-
$client->setParameterPost($request->getData());
88+
$requestData = $this->prepareRequestData($request->getData());
89+
$client->setParameterPost($requestData);
8990
$client->setHeaders(
9091
[
9192
'X-VPS-VIT-CLIENT-CERTIFICATION-ID' => '33baf5893fc2123d8b191d2d011b7fdc',
@@ -97,9 +98,7 @@ public function postRequest(DataObject $request, ConfigInterface $config)
9798

9899
try {
99100
$response = $client->request();
100-
101-
$responseArray = [];
102-
parse_str(strstr($response->getBody(), 'RESULT'), $responseArray);
101+
$responseArray = $this->parseNVP(strstr($response->getBody(), 'RESULT'));
103102

104103
$result->setData(array_change_key_case($responseArray, CASE_LOWER));
105104
$result->setData('result_code', $result->getData('result'));
@@ -115,7 +114,7 @@ public function postRequest(DataObject $request, ConfigInterface $config)
115114
} finally {
116115
$this->logger->debug(
117116
[
118-
'request' => $request->getData(),
117+
'request' => $requestData,
119118
'result' => $result->getData()
120119
],
121120
(array)$config->getValue('getDebugReplacePrivateDataKeys'),
@@ -125,4 +124,63 @@ public function postRequest(DataObject $request, ConfigInterface $config)
125124

126125
return $result;
127126
}
127+
128+
/**
129+
* Add length tag to parameters name which contains special characters: =, &
130+
*
131+
* The length tag specifies the exact number of characters and spaces (number of bytes) that appear in the value
132+
* eg ['COMPANYNAME[14]' => 'Ruff & Johnson')]
133+
*
134+
* @param array $data
135+
* @return array
136+
*/
137+
private function prepareRequestData(array $data): array
138+
{
139+
$requestData = [];
140+
foreach ($data as $k => $v) {
141+
if (strpos($v, '&') !== false || strpos($v, '=') !== false) {
142+
$requestData[$k . '[' . strlen($v) . ']'] = $v;
143+
} else {
144+
$requestData[$k] = $v;
145+
}
146+
}
147+
return $requestData;
148+
}
149+
150+
/**
151+
* Parse NVP string into array
152+
*
153+
* Use length tag (if present) to parse the key value.
154+
*
155+
* The length tag specifies the exact number of characters and spaces (number of bytes) that appear in the value
156+
* e.g COMPANYNAME[14]=Ruff & Johnson
157+
* e.g COMMENT1[7]=Level=5
158+
*
159+
* @param string $nvp
160+
* @return array
161+
*/
162+
private function parseNVP(string $nvp): array
163+
{
164+
$result = [];
165+
while (strlen($nvp) > 0) {
166+
$keyPos = strpos($nvp, '=');
167+
if ($keyPos !== false) {
168+
$key = substr($nvp, 0, $keyPos);
169+
if (preg_match('/\[(\d+)]$/', $key, $keyParts)) {
170+
$valueLength = (int) $keyParts[1];
171+
$key = substr($key, 0, strpos($key, '['));
172+
$result[$key] = substr($nvp, $keyPos + 1, $valueLength);
173+
$valuePos = $keyPos + 1 + $valueLength;
174+
} else {
175+
$valuePos = strpos($nvp, '&') ? strpos($nvp, '&') : strlen($nvp);
176+
$value = substr($nvp, $keyPos + 1, $valuePos - $keyPos - 1);
177+
$result[$key] = $value;
178+
}
179+
$nvp = substr($nvp, $valuePos + 1);
180+
} else {
181+
$nvp = '';
182+
}
183+
}
184+
return $result;
185+
}
128186
}

app/code/Magento/Paypal/Plugin/TransparentSessionChecker.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
*/
1616
class TransparentSessionChecker
1717
{
18-
private const TRANSPARENT_REDIRECT_PATH = 'paypal/transparent/redirect';
18+
/**
19+
* @var string[]
20+
*/
21+
private $disableSessionUrls = [
22+
'paypal/transparent/redirect',
23+
'paypal/hostedpro/return',
24+
];
1925

2026
/**
2127
* @var Http
@@ -45,6 +51,12 @@ public function afterCheck(SessionStartChecker $subject, bool $result): bool
4551
return false;
4652
}
4753

48-
return strpos((string)$this->request->getPathInfo(), self::TRANSPARENT_REDIRECT_PATH) === false;
54+
foreach ($this->disableSessionUrls as $url) {
55+
if (strpos((string)$this->request->getPathInfo(), $url) !== false) {
56+
return false;
57+
}
58+
}
59+
60+
return true;
4961
}
5062
}

0 commit comments

Comments
 (0)