Skip to content

Commit ebcb103

Browse files
committed
Merge remote-tracking branch 'magento2/2.3-develop' into PR-M23-06-28-19
2 parents 566424c + 7514a0e commit ebcb103

File tree

56 files changed

+2806
-185
lines changed

Some content is hidden

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

56 files changed

+2806
-185
lines changed

app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1111
<test name="AdminLoginTest">
1212
<annotations>
1313
<features value="Backend"/>
@@ -24,4 +24,4 @@
2424
<seeInCurrentUrl url="{{AdminLoginPage.url}}" stepKey="seeAdminLoginUrl"/>
2525
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
2626
</test>
27-
</tests>
27+
</tests>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminPrivacyPolicyTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Checks to see if privacy policy url is in the admin page and every sub page"/>
15+
<title value="There should be a privacy policy url in the admin page and every sub page"/>
16+
<description value="There should be a privacy policy url in the admin page and every sub page"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-17787"/>
19+
<group value="backend"/>
20+
<group value="login"/>
21+
</annotations>
22+
23+
<!-- Logging in Magento admin and checking for Privacy policy footer in dashboard -->
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
25+
<closeAdminNotification stepKey="closeAdminNotification"/>
26+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkDashboard"/>
27+
28+
<!-- Checking for Privacy policy footer in salesOrderPage -->
29+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesOrder">
30+
<argument name="menuUiId" value="magento-sales-sales"/>
31+
<argument name="submenuUiId" value="magento-sales-sales-order"/>
32+
</actionGroup>
33+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkSalesOrder"/>
34+
35+
<!-- Checking for Privacy policy footer in catalogProductsPage -->
36+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCatalogProducts">
37+
<argument name="menuUiId" value="magento-catalog-catalog"/>
38+
<argument name="submenuUiId" value="magento-catalog-catalog-products"/>
39+
</actionGroup>
40+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkCatalogProducts"/>
41+
42+
<!-- Checking for Privacy policy footer in customersAllCustomersPage -->
43+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCustomersAllCustomers">
44+
<argument name="menuUiId" value="magento-customer-customer"/>
45+
<argument name="submenuUiId" value="magento-customer-customer-manage"/>
46+
</actionGroup>
47+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkCustomersAllCustomers"/>
48+
49+
<!-- Checking for Privacy policy footer in marketingCatalogPriceRulePage -->
50+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingCatalogPriceRule">
51+
<argument name="menuUiId" value="magento-backend-marketing"/>
52+
<argument name="submenuUiId" value="magento-catalogrule-promo-catalog"/>
53+
</actionGroup>
54+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkMarketingCatalogPriceRule"/>
55+
56+
<!-- Checking for Privacy policy footer in contentBlocksPage -->
57+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentBlocks">
58+
<argument name="menuUiId" value="magento-backend-content"/>
59+
<argument name="submenuUiId" value="magento-cms-cms-block"/>
60+
</actionGroup>
61+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkContentBlocks"/>
62+
63+
<!-- Checking for Privacy policy footer in reportSearcbTermsPage -->
64+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsSearchTerms">
65+
<argument name="menuUiId" value="magento-reports-report"/>
66+
<argument name="submenuUiId" value="magento-search-report-search-term"/>
67+
</actionGroup>
68+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkReportsSearchTerms"/>
69+
70+
<!-- Checking for Privacy policy footer in storesAllStoresPage -->
71+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresAllStores">
72+
<argument name="menuUiId" value="magento-backend-stores"/>
73+
<argument name="submenuUiId" value="magento-backend-system-store"/>
74+
</actionGroup>
75+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkStoresAllStores"/>
76+
77+
<!-- Checking for Privacy policy footer in systemImportPage -->
78+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemImport">
79+
<argument name="menuUiId" value="magento-backend-system"/>
80+
<argument name="submenuUiId" value="magento-importexport-system-convert-import"/>
81+
</actionGroup>
82+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkSystemImport"/>
83+
84+
<!-- Checking for Privacy policy footer in findPartnersAndExtensionsPage -->
85+
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToFindPartnersAndExtensions">
86+
<argument name="menuUiId" value="magento-marketplace-partners"/>
87+
<argument name="submenuUiId" value="magento-marketplace-partners"/>
88+
</actionGroup>
89+
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkFindPartnersAndExtensions"/>
90+
</test>
91+
</tests>
92+
93+

app/code/Magento/Backend/view/adminhtml/layout/default.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,17 @@
6060
</container>
6161
<container name="legal.system" htmlTag="div" htmlClass="footer-legal-system col-m-6">
6262
<block class="Magento\Backend\Block\Page\Footer" name="version" as="version" />
63+
<block class="Magento\Framework\View\Element\Template" name="privacyPolicy" as="privacyPolicy" template="Magento_Backend::page/privacyPolicy.phtml">
64+
<arguments>
65+
<argument name="privacypolicy_url" xsi:type="string">https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf</argument>
66+
</arguments>
67+
</block>
6368
<block class="Magento\Framework\View\Element\Template" name="report" as="report" template="Magento_Backend::page/report.phtml">
6469
<arguments>
6570
<argument name="bugreport_url" xsi:type="string">https://github.com/magento/magento2/issues</argument>
6671
</arguments>
6772
</block>
73+
6874
</container>
6975
</container>
7076
</referenceContainer>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
?>
8+
9+
<a class="link-report" href="<?= $block->escapeUrl($block->getPrivacypolicyUrl()) ?>" id="footer_privacy" target="_blank">
10+
<?= $block->escapeHtml(__('Privacy Policy')) ?>
11+
</a> |

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* @SuppressWarnings(PHPMD.TooManyFields)
3939
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
4040
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
41+
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
4142
* @since 100.0.2
4243
*/
4344
class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
@@ -1508,6 +1509,7 @@ public function getImagesFromRow(array $rowData)
15081509
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
15091510
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
15101511
* @throws LocalizedException
1512+
* phpcs:disable Generic.Metrics.NestingLevel
15111513
*/
15121514
protected function _saveProducts()
15131515
{
@@ -2487,6 +2489,12 @@ public function validateRow(array $rowData, $rowNum)
24872489
*/
24882490
private function isNeedToValidateUrlKey($rowData)
24892491
{
2492+
if (!empty($rowData[self::COL_SKU]) && empty($rowData[self::URL_KEY])
2493+
&& $this->getBehavior() === Import::BEHAVIOR_APPEND
2494+
&& $this->isSkuExist($rowData[self::COL_SKU])) {
2495+
return false;
2496+
}
2497+
24902498
return (!empty($rowData[self::URL_KEY]) || !empty($rowData[self::COL_NAME]))
24912499
&& (empty($rowData[self::COL_VISIBILITY])
24922500
|| $rowData[self::COL_VISIBILITY]
@@ -2810,7 +2818,8 @@ protected function getUrlKey($rowData)
28102818
return trim(strtolower($urlKey));
28112819
}
28122820

2813-
if (!empty($rowData[self::COL_NAME])) {
2821+
if (!empty($rowData[self::COL_NAME])
2822+
&& (array_key_exists(self::URL_KEY, $rowData) || !$this->isSkuExist($rowData[self::COL_SKU]))) {
28142823
return $this->productUrl->formatUrlKey($rowData[self::COL_NAME]);
28152824
}
28162825

app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,8 @@ public function execute(Observer $observer)
255255
protected function _populateForUrlGeneration($rowData)
256256
{
257257
$newSku = $this->import->getNewSku($rowData[ImportProduct::COL_SKU]);
258-
if (empty($newSku) || !isset($newSku['entity_id'])) {
259-
return null;
260-
}
261-
if ($this->import->getRowScope($rowData) == ImportProduct::SCOPE_STORE
262-
&& empty($rowData[self::URL_KEY_ATTRIBUTE_CODE])) {
258+
$oldSku = $this->import->getOldSku();
259+
if (!$this->isNeedToPopulateForUrlGeneration($rowData, $newSku, $oldSku)) {
263260
return null;
264261
}
265262
$rowData['entity_id'] = $newSku['entity_id'];
@@ -292,6 +289,27 @@ protected function _populateForUrlGeneration($rowData)
292289
return $this;
293290
}
294291

292+
/**
293+
* Check is need to populate data for url generation
294+
*
295+
* @param array $rowData
296+
* @param array $newSku
297+
* @param array $oldSku
298+
* @return bool
299+
*/
300+
private function isNeedToPopulateForUrlGeneration($rowData, $newSku, $oldSku): bool
301+
{
302+
if ((empty($newSku) || !isset($newSku['entity_id']))
303+
|| ($this->import->getRowScope($rowData) == ImportProduct::SCOPE_STORE
304+
&& empty($rowData[self::URL_KEY_ATTRIBUTE_CODE]))
305+
|| (array_key_exists($rowData[ImportProduct::COL_SKU], $oldSku)
306+
&& !isset($rowData[self::URL_KEY_ATTRIBUTE_CODE])
307+
&& $this->import->getBehavior() === ImportExport::BEHAVIOR_APPEND)) {
308+
return false;
309+
}
310+
return true;
311+
}
312+
295313
/**
296314
* Add store id to product data.
297315
*

app/code/Magento/Paypal/Controller/Transparent/Response.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
use Magento\Paypal\Model\Payflow\Transparent;
2020
use Magento\Sales\Api\PaymentFailuresInterface;
2121
use Magento\Framework\Session\Generic as Session;
22+
use Magento\Framework\App\Action\HttpPostActionInterface;
2223

2324
/**
25+
* Class for requesting the response result form the paypal controller.
2426
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2527
*/
26-
class Response extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface
28+
class Response extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface, HttpPostActionInterface
2729
{
2830
/**
2931
* Core registry
@@ -112,6 +114,8 @@ public function validateForCsrf(RequestInterface $request): ?bool
112114
}
113115

114116
/**
117+
* Saves the payment in quote
118+
*
115119
* @return ResultInterface
116120
*/
117121
public function execute()
@@ -120,7 +124,7 @@ public function execute()
120124
try {
121125
$response = $this->transaction->getResponseObject($this->getRequest()->getPostValue());
122126
$this->responseValidator->validate($response, $this->transparent);
123-
$this->transaction->savePaymentInQuote($response);
127+
$this->transaction->savePaymentInQuote($response, (int)$this->sessionTransparent->getQuoteId());
124128
} catch (LocalizedException $exception) {
125129
$parameters['error'] = true;
126130
$parameters['error_msg'] = $exception->getMessage();

app/code/Magento/Paypal/Model/Payflow/Service/Request/SecureToken.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Paypal\Model\Payflow\Service\Request;
710

811
use Magento\Framework\Math\Random;
@@ -13,7 +16,7 @@
1316
use Magento\Quote\Model\Quote;
1417

1518
/**
16-
* Class SecureToken
19+
* Class for requesting a secure Payflow Pro token from Paypal
1720
*/
1821
class SecureToken
1922
{
@@ -42,7 +45,6 @@ public function __construct(
4245
Random $mathRandom,
4346
Transparent $transparent
4447
) {
45-
4648
$this->url = $url;
4749
$this->mathRandom = $mathRandom;
4850
$this->transparent = $transparent;
@@ -52,11 +54,12 @@ public function __construct(
5254
* Get the Secure Token from Paypal for TR
5355
*
5456
* @param Quote $quote
57+
* @param string[] $urls
5558
*
5659
* @return DataObject
5760
* @throws \Exception
5861
*/
59-
public function requestToken(Quote $quote)
62+
public function requestToken(Quote $quote, array $urls = [])
6063
{
6164
$this->transparent->setStore($quote->getStoreId());
6265
$request = $this->transparent->buildBasicRequest();
@@ -67,9 +70,9 @@ public function requestToken(Quote $quote)
6770
$request->setCurrency($quote->getBaseCurrencyCode());
6871
$request->setCreatesecuretoken('Y');
6972
$request->setSecuretokenid($this->mathRandom->getUniqueHash());
70-
$request->setReturnurl($this->url->getUrl('paypal/transparent/response'));
71-
$request->setErrorurl($this->url->getUrl('paypal/transparent/response'));
72-
$request->setCancelurl($this->url->getUrl('paypal/transparent/response'));
73+
$request->setReturnurl($urls['return_url'] ?? $this->url->getUrl('paypal/transparent/response'));
74+
$request->setErrorurl($urls['error_url'] ?? $this->url->getUrl('paypal/transparent/response'));
75+
$request->setCancelurl($urls['cancel_url'] ?? $this->url->getUrl('paypal/transparent/response'));
7376
$request->setDisablereceipt('TRUE');
7477
$request->setSilenttran('TRUE');
7578

app/code/Magento/Paypal/Model/Payflow/Service/Response/Transaction.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\Framework\Intl\DateTimeFactory;
1212
use Magento\Payment\Model\Method\Logger;
1313
use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface;
14-
use Magento\Framework\Session\Generic;
1514
use Magento\Paypal\Model\Payflowpro;
1615
use Magento\Quote\Api\CartRepositoryInterface;
1716
use Magento\Paypal\Model\Payflow\Transparent;
@@ -25,11 +24,6 @@
2524
*/
2625
class Transaction
2726
{
28-
/**
29-
* @var Generic
30-
*/
31-
protected $sessionTransparent;
32-
3327
/**
3428
* @var CartRepositoryInterface
3529
*/
@@ -61,7 +55,6 @@ class Transaction
6155
private $dateTimeFactory;
6256

6357
/**
64-
* @param Generic $sessionTransparent
6558
* @param CartRepositoryInterface $quoteRepository
6659
* @param Transparent $transparent
6760
* @param PaymentMethodManagementInterface $paymentManagement
@@ -70,15 +63,13 @@ class Transaction
7063
* @param DateTimeFactory $dateTimeFactory
7164
*/
7265
public function __construct(
73-
Generic $sessionTransparent,
7466
CartRepositoryInterface $quoteRepository,
7567
Transparent $transparent,
7668
PaymentMethodManagementInterface $paymentManagement,
7769
HandlerInterface $errorHandler,
7870
Logger $logger,
7971
DateTimeFactory $dateTimeFactory
8072
) {
81-
$this->sessionTransparent = $sessionTransparent;
8273
$this->quoteRepository = $quoteRepository;
8374
$this->transparent = $transparent;
8475
$this->paymentManagement = $paymentManagement;
@@ -111,13 +102,13 @@ public function getResponseObject($gatewayTransactionResponse)
111102
* Saves payment information in quote.
112103
*
113104
* @param DataObject $response
105+
* @param int $cartId
114106
* @return void
115107
* @throws \InvalidArgumentException
116108
*/
117-
public function savePaymentInQuote($response)
109+
public function savePaymentInQuote($response, $cartId)
118110
{
119-
$quote = $this->quoteRepository->get($this->sessionTransparent->getQuoteId());
120-
111+
$quote = $this->quoteRepository->get($cartId);
121112
$payment = $this->paymentManagement->get($quote->getId());
122113
if (!$payment instanceof Payment) {
123114
throw new \InvalidArgumentException("Variable must contain instance of \\Quote\\Payment.");

0 commit comments

Comments
 (0)