Skip to content

Commit 3dc815d

Browse files
Roman HaninRoman Hanin
authored andcommitted
Merge branch '2.4-develop' of https://github.com/magento/magento2ce into B2B-1610
2 parents 7490a28 + c46d9bf commit 3dc815d

File tree

87 files changed

+2775
-779
lines changed

Some content is hidden

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

87 files changed

+2775
-779
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@
4343
- [ ] Pull request has a meaningful description of its purpose
4444
- [ ] All commits are accompanied by meaningful commit messages
4545
- [ ] All new or changed code is covered with unit/integration tests (if applicable)
46+
- [ ] README.md files for modified modules are updated and included in the pull request if any [README.md predefined sections](https://github.com/magento/devdocs/wiki/Magento-module-README.md) require an update
4647
- [ ] All automated tests passed successfully (all builds are green)

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Backend\Block\Store;
89

@@ -114,7 +115,8 @@ protected function _construct()
114115
{
115116
parent::_construct();
116117

117-
$this->setUseConfirm(true);
118+
$this->setUseConfirm($this->hasData('use_confirm') ? (bool)$this->getData('use_confirm') : true);
119+
118120
$this->setUseAjax(true);
119121

120122
$this->setShowManageStoresLink(0);

app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml

Lines changed: 117 additions & 207 deletions
Large diffs are not rendered by default.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'jquery'
8+
], function ($) {
9+
'use strict';
10+
11+
/**
12+
* @param {Object} storeSwitchConfig
13+
*/
14+
return function (storeSwitchConfig) {
15+
var scopeSwitcherHandler;
16+
17+
(function () {
18+
var storesList = $('[data-role=stores-list]');
19+
20+
storesList.on('click', '[data-value]', function (event) {
21+
var val = $(event.target).data('value'),
22+
role = $(event.target).data('role'),
23+
switcher = $('[data-role=' + role + ']');
24+
25+
event.preventDefault();
26+
27+
if (!switcher.val() || val !== switcher.val()) {
28+
29+
/* Set the value & trigger event */
30+
switcher.val(val).trigger('change');
31+
}
32+
});
33+
})($);
34+
35+
/**
36+
* Switch store scope
37+
*
38+
* @param {Object} obj
39+
* @return void
40+
*/
41+
function switchScope(obj) {
42+
var switcher = $(obj),
43+
scopeId = switcher.val(),
44+
scopeParams = '',
45+
switcherParams = {};
46+
47+
if (scopeId) {
48+
scopeParams = switcher.data('param') + '/' + scopeId + '/';
49+
}
50+
51+
if (obj.switchParams) {
52+
scopeParams += obj.switchParams;
53+
}
54+
55+
/**
56+
* Reload function for switcher
57+
*/
58+
function reload() {
59+
var url;
60+
61+
if (!storeSwitchConfig.isUsingIframe) {
62+
63+
if (storeSwitchConfig.switchUrl && storeSwitchConfig.switchUrl.length > 0) {
64+
url = storeSwitchConfig.switchUrl + scopeParams;
65+
66+
/* eslint-disable no-undef */
67+
setLocation(url);
68+
}
69+
70+
} else {
71+
$('#preview_selected_store').val(scopeId);
72+
$('#preview_form').submit();
73+
74+
$('.store-switcher .dropdown-menu li a').each(function () {
75+
var $this = $(this);
76+
77+
if ($this.data('role') === 'store-view-id' && $this.data('value') === scopeId) {
78+
$('#store-change-button').html($this.text());
79+
}
80+
});
81+
82+
$('#store-change-button').click();
83+
}
84+
}
85+
86+
if (typeof scopeSwitcherHandler !== 'undefined') {
87+
switcherParams = {
88+
scopeId: scopeId,
89+
scopeParams: scopeParams,
90+
useConfirm: storeSwitchConfig.useConfirm
91+
};
92+
93+
scopeSwitcherHandler(switcherParams);
94+
} else if (storeSwitchConfig.useConfirm) {
95+
require([
96+
'Magento_Ui/js/modal/confirm',
97+
'mage/translate'
98+
], function (confirm, $t) {
99+
confirm({
100+
content: $t('Please confirm scope switching. All data that hasn\'t been saved will be lost.'),
101+
actions: {
102+
103+
/**
104+
* Confirm action
105+
*/
106+
confirm: function () {
107+
reload();
108+
},
109+
110+
/**
111+
* Cancel action
112+
*/
113+
cancel: function () {
114+
obj.value = storeSwitchConfig.storeId ? storeSwitchConfig.storeId : '';
115+
}
116+
}
117+
});
118+
});
119+
} else {
120+
reload();
121+
}
122+
}
123+
124+
window.scopeSwitcherHandler = scopeSwitcherHandler;
125+
window.switchScope = switchScope;
126+
};
127+
});

app/code/Magento/Captcha/Test/Mftf/Data/CaptchaConfigData.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
<data key="label">Change password</data>
4747
<data key="value">user_edit</data>
4848
</entity>
49+
<entity name="StorefrontCaptchaOnOnepageCheckoutConfigData">
50+
<data key="path">customer/captcha/forms</data>
51+
<data key="scope_id">0</data>
52+
<data key="label">Checkout/Placing Order</data>
53+
<data key="value">payment_processing_request</data>
54+
</entity>
4955
<entity name="StorefrontCaptchaOnCustomerForgotPasswordConfigData">
5056
<!-- Magento default value -->
5157
<data key="path">customer/captcha/forms</data>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontCaptchaOnOnepageCheckoutPyamentSection">
12+
<element name="captchaField" type="input" selector="#captcha_payment_processing_request"/>
13+
<element name="captchaImg" type="block" selector=".captcha-img"/>
14+
<element name="captchaReload" type="block" selector=".captcha-reload"/>
15+
</section>
16+
</sections>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="StorefrontCheckoutPaymentMethodsSection">
12+
<element name="purchaseOrder" type="radio" selector="#purchaseorder" timeout="30"/>
13+
<element name="purchaseOrderNumber" type="input" selector="#po_number" timeout="30"/>
14+
<element name="bankTransfer" type="radio" selector="#banktransfer" timeout="30"/>
15+
<element name="cashOnDelivery" type="radio" selector="#cashondelivery" timeout="30"/>
16+
</section>
17+
</sections>
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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="StorefrontCaptchaOnOnepageCheckoutPyamentTest">
12+
<annotations>
13+
<features value="Captcha"/>
14+
<stories value="Place order on checkout page + Captcha"/>
15+
<title value="Captcha on checkout page test"/>
16+
<description value="Test creation of order on storefront checkout page with captcha."/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-41461"/>
19+
<useCaseId value="MC-41281"/>
20+
<group value="captcha"/>
21+
</annotations>
22+
<before>
23+
<!-- Create Simple Product -->
24+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct">
25+
<field key="price">20</field>
26+
</createData>
27+
28+
<!-- Create customer -->
29+
<createData entity="Simple_Customer_Without_Address" stepKey="createCustomer"/>
30+
31+
<!-- Enable payment method -->
32+
<magentoCLI command="config:set {{BankTransferEnableConfigData.path}} {{BankTransferEnableConfigData.value}}" stepKey="enableBankTransfer"/>
33+
34+
<!-- Enable captcha for Checkout/Placing Order -->
35+
<magentoCLI command="config:set {{StorefrontCaptchaOnOnepageCheckoutConfigData.path}} {{StorefrontCaptchaOnOnepageCheckoutConfigData.value}}" stepKey="enableOnOpageCheckoutCaptcha" />
36+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaModeAlwaysConfigData.path}} {{StorefrontCustomerCaptchaModeAlwaysConfigData.value}}" stepKey="alwaysEnableCaptcha" />
37+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaLength3ConfigData.path}} {{StorefrontCustomerCaptchaLength3ConfigData.value}}" stepKey="setCaptchaLength" />
38+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaSymbols1ConfigData.path}} {{StorefrontCustomerCaptchaSymbols1ConfigData.value}}" stepKey="setCaptchaSymbols" />
39+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
40+
<argument name="tags" value="config full_page"/>
41+
</actionGroup>
42+
</before>
43+
<after>
44+
<!-- Disabled payment method -->
45+
<magentoCLI command="config:set {{BankTransferDisabledConfigData.path}} {{BankTransferDisabledConfigData.value}}" stepKey="disabledBankTransfer"/>
46+
47+
<!-- Set default configuration for captcha -->
48+
<magentoCLI command="config:set {{StorefrontCaptchaOnOnepageCheckoutConfigData.path}} {{StorefrontCaptchaOnOnepageCheckoutConfigData.value}},{{StorefrontCaptchaOnCustomerForgotPasswordConfigData.value}}" stepKey="enableCaptchaOnDefaultForms" />
49+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaModeAfterFailConfigData.path}} {{StorefrontCustomerCaptchaModeAfterFailConfigData.value}}" stepKey="defaultCaptchaMode" />
50+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaDefaultLengthConfigData.path}} {{StorefrontCustomerCaptchaDefaultLengthConfigData.value}}" stepKey="setDefaultCaptchaLength" />
51+
<magentoCLI command="config:set {{StorefrontCustomerCaptchaDefaultSymbolsConfigData.path}} {{StorefrontCustomerCaptchaDefaultSymbolsConfigData.value}}" stepKey="setDefaultCaptchaSymbols" />
52+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
53+
<argument name="tags" value="config full_page"/>
54+
</actionGroup>
55+
56+
<!-- Customer logout -->
57+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
58+
59+
<!-- Delete created products -->
60+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
61+
62+
<!-- Delete customer -->
63+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
64+
</after>
65+
66+
<!-- Reindex and flush cache -->
67+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
68+
<argument name="indices" value=""/>
69+
</actionGroup>
70+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
71+
<argument name="tags" value=""/>
72+
</actionGroup>
73+
74+
<!-- Add Simple Product to cart -->
75+
<amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/>
76+
<waitForPageLoad stepKey="waitForSimpleProductPageLoad"/>
77+
<actionGroup ref="AddToCartFromStorefrontProductPageActionGroup" stepKey="addToCartSimpleProductFromStorefrontProductPage">
78+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
79+
</actionGroup>
80+
81+
<!-- Go to shopping cart -->
82+
<actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="goToShoppingCartFromMinicart"/>
83+
<actionGroup ref="FillShippingZipForm" stepKey="fillShippingZipForm">
84+
<argument name="address" value="US_Address_CA"/>
85+
</actionGroup>
86+
<actionGroup ref="StorefrontClickProceedToCheckoutActionGroup" stepKey="goToCheckout"/>
87+
88+
<!-- Login as customer on checkout page -->
89+
<actionGroup ref="LoginAsCustomerOnCheckoutPageActionGroup" stepKey="customerLogin">
90+
<argument name="customer" value="$$createCustomer$$"/>
91+
</actionGroup>
92+
93+
<!-- Fill customer new shipping address -->
94+
<actionGroup ref="CustomerCheckoutFillNewShippingAddressActionGroup" stepKey="fillShippingAddress">
95+
<argument name="address" value="US_Address_TX"/>
96+
</actionGroup>
97+
98+
<!-- Click next button to open payment section -->
99+
<actionGroup ref="StorefrontGuestCheckoutProceedToPaymentStepActionGroup" stepKey="clickNext"/>
100+
101+
<!-- Select payment method -->
102+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/>
103+
<click selector="{{StorefrontCheckoutPaymentMethodsSection.bankTransfer}}" stepKey="selectBankTransferMethod"/>
104+
105+
<!-- Enter captcha value -->
106+
<fillField userInput="{{PreconfiguredCaptcha.value}}" selector="{{StorefrontCaptchaOnOnepageCheckoutPyamentSection.captchaField}}" stepKey="fillCaptchaField" />
107+
108+
<!-- Place Order -->
109+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="customerPlaceOrder">
110+
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/>
111+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/>
112+
</actionGroup>
113+
114+
<!-- Assert order grand total -->
115+
<amOnPage url="{{StorefrontCustomerDashboardPage.url}}" stepKey="navigateToCustomerDashboardPage"/>
116+
<waitForPageLoad stepKey="waitForCustomerDashboardPageLoad"/>
117+
<see selector="{{StorefrontCustomerRecentOrdersSection.orderTotal}}" userInput="$25.00" stepKey="checkOrderTotalInStorefront"/>
118+
</test>
119+
</tests>

app/code/Magento/Captcha/view/frontend/web/js/action/refresh.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@
44
*/
55

66
define([
7-
'mage/storage'
8-
], function (storage) {
7+
'jquery', 'mage/url'
8+
], function ($, urlBuilder) {
99
'use strict';
1010

1111
return function (refreshUrl, formId, imageSource) {
12-
return storage.post(
13-
refreshUrl,
14-
JSON.stringify({
12+
return $.ajax({
13+
url: urlBuilder.build(refreshUrl),
14+
type: 'POST',
15+
async: false,
16+
data: JSON.stringify({
1517
'formId': formId
1618
}),
17-
false
18-
).done(
19+
global: false,
20+
contentType: 'application/json'
21+
}).done(
1922
function (response) {
2023
if (response.imgSrc) {
2124
imageSource(response.imgSrc);

app/code/Magento/Catalog/Model/Product/Configuration/Item/ItemResolverComposite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class ItemResolverComposite implements ItemResolverInterface
1717
{
1818
/** @var string[] */
19-
private $itemResolvers = [];
19+
private $itemResolvers;
2020

2121
/** @var ItemResolverInterface[] */
2222
private $itemResolversInstances = [];

0 commit comments

Comments
 (0)