Skip to content

Commit fc93892

Browse files
committed
Merge remote-tracking branch 'performance-ce/ims-phase1' into CABPI-364
2 parents 6b2f3ad + 6e5c5ab commit fc93892

File tree

50 files changed

+1549
-275
lines changed

Some content is hidden

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

50 files changed

+1549
-275
lines changed

app/code/Magento/AdminAdobeIms/Console/Command/AdminAdobeImsEnableCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
160160
self::TWO_FACTOR_AUTH_ARGUMENT
161161
);
162162

163-
if ($clientId && $clientSecret && $organizationId) {
163+
if ($clientId && $clientSecret && $organizationId && $isTwoFactorAuthEnabled) {
164164
$enabled = $this->enableModule($clientId, $clientSecret, $organizationId, $isTwoFactorAuthEnabled);
165165
if ($enabled) {
166166
$output->writeln(__('Admin Adobe IMS integration is enabled'));
@@ -169,7 +169,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
169169
}
170170

171171
throw new LocalizedException(
172-
__('The Client ID, Client Secret and Organization ID are required ' .
172+
__('The Client ID, Client Secret, Organization ID and 2FA Auth are required ' .
173173
'when enabling the Admin Adobe IMS Module')
174174
);
175175
} catch (\Exception $e) {
@@ -189,6 +189,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
189189
* @param string $organizationId
190190
* @param bool $isTwoFactorAuthEnabled
191191
* @return bool
192+
* @throws LocalizedException
192193
* @throws InvalidArgumentException
193194
*/
194195
private function enableModule(

app/code/Magento/AdminAdobeIms/Service/ImsConfig.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Framework\App\Config\Storage\WriterInterface;
1717
use Magento\Framework\App\Config\ScopeConfigInterface;
1818
use Magento\Framework\Encryption\EncryptorInterface;
19+
use Magento\Framework\Exception\LocalizedException;
1920
use Magento\Framework\UrlInterface;
2021

2122
class ImsConfig extends Config
@@ -30,7 +31,6 @@ class ImsConfig extends Config
3031
public const XML_PATH_VALIDATE_TOKEN_URL = 'adobe_ims/integration/validate_token_url';
3132
public const XML_PATH_LOGOUT_URL = 'adobe_ims/integration/logout_url';
3233
public const XML_PATH_CERTIFICATE_PATH = 'adobe_ims/integration/certificate_path';
33-
public const XML_PATH_ADOBE_IMS_2FA_ENABLED = 'adobe_ims/integration/adobe_ims_2fa_enabled';
3434
public const XML_PATH_ADMIN_AUTH_URL_PATTERN = 'adobe_ims/integration/admin/auth_url_pattern';
3535
public const XML_PATH_ADMIN_REAUTH_URL_PATTERN = 'adobe_ims/integration/admin/reauth_url_pattern';
3636
public const XML_PATH_ADMIN_ADOBE_IMS_SCOPES = 'adobe_ims/integration/admin/scopes';
@@ -110,13 +110,20 @@ public function loggingEnabled(): bool
110110
* @param string $organizationId
111111
* @param bool $isAdobeIms2FAEnabled
112112
* @return void
113+
* @throws LocalizedException
113114
*/
114115
public function enableModule(
115116
string $clientId,
116117
string $clientSecret,
117118
string $organizationId,
118119
bool $isAdobeIms2FAEnabled
119120
): void {
121+
if (!$isAdobeIms2FAEnabled) {
122+
throw new LocalizedException(
123+
__('2FA Auth is required when enabling the Admin Adobe IMS Module')
124+
);
125+
}
126+
120127
$this->updateConfig(
121128
self::XML_PATH_ENABLED,
122129
'1'
@@ -136,11 +143,6 @@ public function enableModule(
136143
self::XML_PATH_PRIVATE_KEY,
137144
$clientSecret
138145
);
139-
140-
$this->updateConfig(
141-
self::XML_PATH_ADOBE_IMS_2FA_ENABLED,
142-
(string) $isAdobeIms2FAEnabled
143-
);
144146
}
145147

146148
/**
@@ -158,7 +160,6 @@ public function disableModule(): void
158160
$this->deleteConfig(self::XML_PATH_ORGANIZATION_ID);
159161
$this->deleteConfig(self::XML_PATH_API_KEY);
160162
$this->deleteConfig(self::XML_PATH_PRIVATE_KEY);
161-
$this->deleteConfig(self::XML_PATH_ADOBE_IMS_2FA_ENABLED);
162163
}
163164

164165
/**
@@ -198,7 +199,7 @@ public function getValidateTokenUrl(string $code, string $tokenType): string
198199
* @param string $value
199200
* @return void
200201
*/
201-
public function updateConfig(string $path, string $value): void
202+
private function updateConfig(string $path, string $value): void
202203
{
203204
$this->writer->save(
204205
$path,
@@ -213,7 +214,7 @@ public function updateConfig(string $path, string $value): void
213214
* @param string $value
214215
* @return void
215216
*/
216-
public function updateSecureConfig(string $path, string $value): void
217+
private function updateSecureConfig(string $path, string $value): void
217218
{
218219
$value = str_replace(['\n', '\r'], ["\n", "\r"], $value);
219220

@@ -233,7 +234,7 @@ public function updateSecureConfig(string $path, string $value): void
233234
* @param string $path
234235
* @return void
235236
*/
236-
public function deleteConfig(string $path): void
237+
private function deleteConfig(string $path): void
237238
{
238239
$this->writer->delete($path);
239240
}
@@ -286,7 +287,7 @@ public function getAdminAdobeImsReAuthUrl(): string
286287
*
287288
* @return string
288289
*/
289-
public function getScopes(): string
290+
private function getScopes(): string
290291
{
291292
return implode(
292293
',',

app/code/Magento/AdminAdobeIms/Test/Unit/Command/AdminAdobeImsEnableCommandTest.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ protected function setUp(): void
102102
* @param InvokedCountMatcher$enableMethodCallExpection
103103
* @param InvokedCountMatcher $cleanMethodCallExpection
104104
* @param string $outputMessage
105+
* @param bool $isTwoFactorAuthEnabled
105106
* @return void
106107
* @throws Exception
107108
* @dataProvider cliCommandProvider
@@ -110,7 +111,8 @@ public function testAdminAdobeImsModuleEnableWillClearCacheWhenSuccessful(
110111
bool $testAuthMode,
111112
InvokedCountMatcher $enableMethodCallExpection,
112113
InvokedCountMatcher $cleanMethodCallExpection,
113-
string $outputMessage
114+
string $outputMessage,
115+
bool $isTwoFactorAuthEnabled
114116
): void {
115117
$inputMock = $this->getMockBuilder(InputInterface::class)
116118
->getMockForAbstractClass();
@@ -123,6 +125,7 @@ public function testAdminAdobeImsModuleEnableWillClearCacheWhenSuccessful(
123125
$this->imsCommandOptionService->method('getOrganizationId')->willReturn('orgId');
124126
$this->imsCommandOptionService->method('getClientId')->willReturn('clientId');
125127
$this->imsCommandOptionService->method('getClientSecret')->willReturn('clientSecret');
128+
$this->imsCommandOptionService->method('isTwoFactorAuthEnabled')->willReturn($isTwoFactorAuthEnabled);
126129

127130
$this->imsConnectionMock->method('testAuth')
128131
->willReturn($testAuthMode);
@@ -161,15 +164,33 @@ public function cliCommandProvider(): array
161164
true,
162165
$this->once(),
163166
$this->once(),
164-
'Admin Adobe IMS integration is enabled'
167+
'Admin Adobe IMS integration is enabled',
168+
true
165169
],
166170
[
167171
false,
168172
$this->never(),
169173
$this->never(),
170-
'<error>The Client ID, Client Secret and Organization ID are required ' .
171-
'when enabling the Admin Adobe IMS Module</error>'
174+
'<error>The Client ID, Client Secret, Organization ID and 2FA Auth are required ' .
175+
'when enabling the Admin Adobe IMS Module</error>',
176+
true
172177
],
178+
[
179+
true,
180+
$this->never(),
181+
$this->never(),
182+
'<error>The Client ID, Client Secret, Organization ID and 2FA Auth are required ' .
183+
'when enabling the Admin Adobe IMS Module</error>',
184+
false
185+
],
186+
[
187+
false,
188+
$this->never(),
189+
$this->never(),
190+
'<error>The Client ID, Client Secret, Organization ID and 2FA Auth are required ' .
191+
'when enabling the Admin Adobe IMS Module</error>',
192+
false
193+
]
173194
];
174195
}
175196

app/code/Magento/Catalog/Block/Product/View.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\Catalog\Block\Product;
77

88
use Magento\Catalog\Api\ProductRepositoryInterface;
9-
use Magento\Catalog\Model\Category;
109

1110
/**
1211
* Product View block
@@ -183,7 +182,8 @@ public function getJsonConfig()
183182
foreach ($tierPricesList as $tierPrice) {
184183
$tierPriceData = [
185184
'qty' => $tierPrice['price_qty'],
186-
'price' => $tierPrice['website_price'],
185+
'price' => $tierPrice['price']->getValue(),
186+
'basePrice' => $tierPrice['price']->getBaseAmount()
187187
];
188188
$tierPrices[] = $tierPriceData;
189189
}

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Catalog\Model;
88

99
use Magento\Catalog\Api\CategoryLinkManagementInterface;
10+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
1011
use Magento\Catalog\Api\Data\ProductExtension;
1112
use Magento\Catalog\Api\Data\ProductInterface;
1213
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
@@ -617,7 +618,10 @@ public function save(ProductInterface $product, $saveOptions = false)
617618
$product->getStoreId()
618619
)
619620
) {
620-
$product->setData($attributeCode);
621+
$product->setData(
622+
$attributeCode,
623+
$attributeCode === ProductAttributeInterface::CODE_SEO_FIELD_URL_KEY ? false : null
624+
);
621625
$hasDataChanged = true;
622626
}
623627
}

app/code/Magento/Catalog/Pricing/Price/TierPrice.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Magento\Framework\Pricing\PriceCurrencyInterface;
1919
use Magento\Framework\Pricing\PriceInfoInterface;
2020
use Magento\Customer\Model\Group\RetrieverInterface as CustomerGroupRetrieverInterface;
21-
use Magento\Tax\Model\Config;
2221

2322
/**
2423
* @api
@@ -176,13 +175,6 @@ public function getTierPriceList()
176175
function (&$priceData) {
177176
/* convert string value to float */
178177
$priceData['price_qty'] *= 1;
179-
$exclTaxPrice = $this->calculator->getAmount($priceData['price'], $this->product);
180-
if ($this->getConfigTaxDisplayType() === Config::DISPLAY_TYPE_EXCLUDING_TAX) {
181-
$priceData['excl_tax_price'] = $exclTaxPrice;
182-
}
183-
if ($this->getConfigTaxDisplayType() === Config::DISPLAY_TYPE_BOTH) {
184-
$priceData['incl_excl_tax_price'] = $exclTaxPrice;
185-
}
186178
$priceData['price'] = $this->applyAdjustment($priceData['price']);
187179
}
188180
);
@@ -191,16 +183,6 @@ function (&$priceData) {
191183
return $this->priceList;
192184
}
193185

194-
/**
195-
* Returns config tax display type
196-
*
197-
* @return int
198-
*/
199-
private function getConfigTaxDisplayType(): int
200-
{
201-
return (int) $this->scopeConfig->getValue(self::XML_PATH_TAX_DISPLAY_TYPE);
202-
}
203-
204186
/**
205187
* Filters tier prices
206188
*
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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\Setup\Patch\Data;
9+
10+
use Magento\Eav\Setup\EavSetup;
11+
use Magento\Eav\Setup\EavSetupFactory;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
use Magento\Framework\Setup\Patch\PatchVersionInterface;
15+
16+
/**
17+
* Class UpdateProductUrlKey for updating description and validation class
18+
*/
19+
class UpdateProductUrlKey implements DataPatchInterface, PatchVersionInterface
20+
{
21+
/**
22+
* @var ModuleDataSetupInterface
23+
*/
24+
private $moduleDataSetup;
25+
26+
/**
27+
* @var EavSetupFactory
28+
*/
29+
private $eavSetupFactory;
30+
31+
/**
32+
* PatchInitial constructor.
33+
* @param ModuleDataSetupInterface $moduleDataSetup
34+
* @param EavSetupFactory $eavSetupFactory
35+
*/
36+
public function __construct(
37+
ModuleDataSetupInterface $moduleDataSetup,
38+
EavSetupFactory $eavSetupFactory
39+
) {
40+
$this->moduleDataSetup = $moduleDataSetup;
41+
$this->eavSetupFactory = $eavSetupFactory;
42+
}
43+
44+
/**
45+
* @inheritdoc
46+
*/
47+
public function apply()
48+
{
49+
/** @var EavSetup $eavSetup */
50+
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
51+
52+
$eavSetup->updateAttribute(
53+
\Magento\Catalog\Model\Product::ENTITY,
54+
'url_key',
55+
[
56+
'frontend_class' => 'validate-trailing-hyphen'
57+
]
58+
);
59+
return $this;
60+
}
61+
62+
/**
63+
* @inheritdoc
64+
*/
65+
public static function getDependencies()
66+
{
67+
return [
68+
UpdateProductAttributes::class,
69+
\Magento\CatalogUrlRewrite\Setup\Patch\Data\CreateUrlAttributes::class
70+
];
71+
}
72+
73+
/**
74+
* @inheritdoc
75+
*/
76+
public static function getVersion()
77+
{
78+
return '2.4.5';
79+
}
80+
81+
/**
82+
* @inheritdoc
83+
*/
84+
public function getAliases()
85+
{
86+
return [];
87+
}
88+
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCrossSellProductBySkuActionGroup.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
<scrollTo selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" x="0" y="-100" stepKey="scrollTo"/>
2121
<conditionalClick selector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDropdown}}" dependentSelector="{{AdminProductFormRelatedUpSellCrossSellSection.relatedDependent}}" visible="false" stepKey="openDropDownIfClosedRelatedUpSellCrossSell"/>
2222
<click selector="{{AdminProductFormRelatedUpSellCrossSellSection.AddCrossSellProductsButton}}" stepKey="clickAddCrossSellButton"/>
23-
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
24-
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
25-
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
26-
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
23+
<conditionalClick selector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
24+
<click selector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
25+
<fillField selector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
26+
<click selector="{{AdminProductCrossSellModalSection.Modal}} {{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
2727
<waitForPageLoad stepKey="waitForPageToLoad"/>
28-
<click selector="{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/>
28+
<click selector="{{AdminProductCrossSellModalSection.Modal}}{{AdminProductModalSlideGridSection.productGridXRowYColumnButton('1', '1')}}" stepKey="selectProduct"/>
2929
<click selector="{{AdminProductCrossSellModalSection.addSelectedProducts}}" stepKey="addRelatedProductSelected"/>
3030
<waitForPageLoad stepKey="waitForModalDisappear"/>
3131
</actionGroup>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductCrossSellModalSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductCrossSellModalSection">
12+
<element name="Modal" type="button" selector=".product_form_product_form_related_crosssell_modal"/>
1213
<element name="addSelectedProducts" type="button" selector=".product_form_product_form_related_crosssell_modal .action-primary"/>
1314
</section>
1415
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductRelatedUpSellCrossSellSection/AdminProductFormRelatedUpSellCrossSellSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@
2020
<element name="selectedRelatedProduct" type="block" selector="//span[@data-index='name']"/>
2121
<element name="removeRelatedProduct" type="button" selector="//span[text()='Related Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
2222
<element name="selectedProductSku" type="text" selector="//div[@data-index='{{section}}']//span[@data-index='sku']" parameterized="true" timeout="30"/>
23+
<element name="removeCrossSellProduct" type="button" selector="//span[text()='Cross-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
24+
<element name="removeUpsellProduct" type="button" selector="//span[text()='Up-Sell Products']//..//..//..//span[text()='{{productName}}']//..//..//..//..//..//button[@class='action-delete']" parameterized="true"/>
2325
</section>
2426
</sections>

0 commit comments

Comments
 (0)