Skip to content

Commit f58eb63

Browse files
author
bshevchenko
committed
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-94838
2 parents d2453cb + ca42048 commit f58eb63

File tree

345 files changed

+37751
-16754
lines changed

Some content is hidden

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

345 files changed

+37751
-16754
lines changed

app/code/Magento/Backend/Block/Media/Uploader.php

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

810
use Magento\Framework\App\ObjectManager;
911
use Magento\Framework\Serialize\Serializer\Json;
12+
use Magento\Framework\Image\Adapter\UploadConfigInterface;
1013

1114
/**
1215
* Adminhtml media library uploader
@@ -35,24 +38,35 @@ class Uploader extends \Magento\Backend\Block\Widget
3538
*/
3639
private $jsonEncoder;
3740

41+
/**
42+
* @var UploadConfigInterface
43+
*/
44+
private $imageConfig;
45+
3846
/**
3947
* @param \Magento\Backend\Block\Template\Context $context
4048
* @param \Magento\Framework\File\Size $fileSize
4149
* @param array $data
4250
* @param Json $jsonEncoder
51+
* @param UploadConfigInterface $imageConfig
4352
*/
4453
public function __construct(
4554
\Magento\Backend\Block\Template\Context $context,
4655
\Magento\Framework\File\Size $fileSize,
4756
array $data = [],
48-
Json $jsonEncoder = null
57+
Json $jsonEncoder = null,
58+
UploadConfigInterface $imageConfig = null
4959
) {
5060
$this->_fileSizeService = $fileSize;
5161
$this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class);
62+
$this->imageConfig = $imageConfig ?: ObjectManager::getInstance()->get(UploadConfigInterface::class);
63+
5264
parent::__construct($context, $data);
5365
}
5466

5567
/**
68+
* Initialize block.
69+
*
5670
* @return void
5771
*/
5872
protected function _construct()
@@ -90,6 +104,26 @@ public function getFileSizeService()
90104
return $this->_fileSizeService;
91105
}
92106

107+
/**
108+
* Get Image Upload Maximum Width Config.
109+
*
110+
* @return int
111+
*/
112+
public function getImageUploadMaxWidth()
113+
{
114+
return $this->imageConfig->getMaxWidth();
115+
}
116+
117+
/**
118+
* Get Image Upload Maximum Height Config.
119+
*
120+
* @return int
121+
*/
122+
public function getImageUploadMaxHeight()
123+
{
124+
return $this->imageConfig->getMaxHeight();
125+
}
126+
93127
/**
94128
* Prepares layout and set element renderer
95129
*

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,19 @@
336336
</depends>
337337
</field>
338338
</group>
339+
<group id="upload_configuration" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1" showInStore="1">
340+
<label>Images Upload Configuration</label>
341+
<field id="max_width" translate="label comment" type="text" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
342+
<label>Maximum Width</label>
343+
<validate>validate-greater-than-zero validate-number required-entry</validate>
344+
<comment>Maximum allowed width for uploaded image.</comment>
345+
</field>
346+
<field id="max_height" translate="label comment" type="text" sortOrder="200" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
347+
<label>Maximum Height</label>
348+
<validate>validate-greater-than-zero validate-number required-entry</validate>
349+
<comment>Maximum allowed height for uploaded image.</comment>
350+
</field>
351+
</group>
339352
</section>
340353
<section id="admin" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
341354
<label>Admin</label>

app/code/Magento/Backend/etc/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
<dashboard>
2929
<enable_charts>1</enable_charts>
3030
</dashboard>
31+
<upload_configuration>
32+
<max_width>1920</max_width>
33+
<max_height>1200</max_height>
34+
</upload_configuration>
3135
</system>
3236
<general>
3337
<validator_data>

app/code/Magento/Backend/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Backend" >
9+
<module name="Magento_Backend">
1010
<sequence>
1111
<module name="Magento_Directory"/>
1212
</sequence>

app/code/Magento/Backend/view/adminhtml/templates/media/uploader.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
data-mage-init='{
1414
"Magento_Backend/js/media-uploader" : {
1515
"maxFileSize": <?= /* @escapeNotVerified */ $block->getFileSizeService()->getMaxFileSize() ?>,
16-
"maxWidth":<?= /* @escapeNotVerified */ \Magento\Framework\File\Uploader::MAX_IMAGE_WIDTH ?> ,
17-
"maxHeight": <?= /* @escapeNotVerified */ \Magento\Framework\File\Uploader::MAX_IMAGE_HEIGHT ?>
16+
"maxWidth":<?= /* @escapeNotVerified */ $block->getImageUploadMaxWidth() ?> ,
17+
"maxHeight": <?= /* @escapeNotVerified */ $block->getImageUploadMaxHeight() ?>
1818
}
1919
}'
2020
>

app/code/Magento/Backend/view/adminhtml/web/js/media-uploader.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,10 @@ define([
123123
this.element.find('input[type=file]').fileupload('option', {
124124
process: [{
125125
action: 'load',
126-
fileTypes: /^image\/(gif|jpeg|png)$/
126+
fileTypes: /^image\/(gif|jpeg|png)$/,
127+
maxFileSize: this.options.maxFileSize
127128
}, {
128-
action: 'resize',
129-
maxWidth: this.options.maxWidth,
130-
maxHeight: this.options.maxHeight
129+
action: 'resize'
131130
}, {
132131
action: 'save'
133132
}]

app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public function __construct(Config $config, ResolverInterface $resolver)
4747
*/
4848
public function getConfig()
4949
{
50+
$requireBillingAddressAll = \Magento\Paypal\Model\Config::REQUIRE_BILLING_ADDRESS_ALL;
51+
5052
return [
5153
'payment' => [
5254
self::PAYPAL_CODE => [
@@ -60,6 +62,8 @@ public function getConfig()
6062
'vaultCode' => self::PAYPAL_VAULT_CODE,
6163
'skipOrderReview' => $this->config->isSkipOrderReview(),
6264
'paymentIcon' => $this->config->getPayPalIcon(),
65+
'isRequiredBillingAddress' =>
66+
(int)$this->config->isRequiredBillingAddress() === $requireBillingAddressAll
6367
]
6468
]
6569
];
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<actionGroup name="StorefrontFillCartDataActionGroup">
11+
<arguments>
12+
<argument name="cartData" defaultValue="PaymentAndShippingInfo"/>
13+
</arguments>
14+
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.cartFrame}}" stepKey="switchToIframe"/>
15+
<fillField selector="{{BraintreeConfigurationPaymentSection.cartCode}}" userInput="{{cartData.cardNumber}}" stepKey="setCartCode"/>
16+
<switchToIFrame stepKey="switchBack"/>
17+
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.monthFrame}}" stepKey="switchToIframe1"/>
18+
<fillField selector="{{BraintreeConfigurationPaymentSection.month}}" userInput="{{cartData.month}}" stepKey="setMonth"/>
19+
<switchToIFrame stepKey="switchBack1"/>
20+
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.yearFrame}}" stepKey="switchToIframe2"/>
21+
<fillField selector="{{BraintreeConfigurationPaymentSection.year}}" userInput="{{cartData.year}}" stepKey="setYear"/>
22+
<switchToIFrame stepKey="switchBack2"/>
23+
<switchToIFrame selector="{{BraintreeConfigurationPaymentSection.codeFrame}}" stepKey="switchToIframe3"/>
24+
<fillField selector="{{BraintreeConfigurationPaymentSection.verificationNumber}}" userInput="{{cartData.cvv}}" stepKey="setVerificationNumber"/>
25+
<switchToIFrame stepKey="SwitchBackToWindow"/>
26+
27+
</actionGroup>
28+
29+
</actionGroups>

app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,33 @@
3535
<data key="value">somePrivateKey</data>
3636
</entity>
3737

38+
<entity name="BraintreeConfig" type="braintree_config_state">
39+
<requiredEntity type="title">BraintreeTitle</requiredEntity>
40+
<requiredEntity type="payment_action">PaymentAction</requiredEntity>
41+
<requiredEntity type="environment">Environment</requiredEntity>
42+
<requiredEntity type="merchant_id">MerchantId</requiredEntity>
43+
<requiredEntity type="public_key">PublicKey</requiredEntity>
44+
<requiredEntity type="private_key">PrivateKey</requiredEntity>
45+
</entity>
46+
<entity name="BraintreeTitle" type="title">
47+
<data key="value">Credit Card (Braintree)</data>
48+
</entity>
49+
<entity name="PaymentAction" type="payment_action">
50+
<data key="value">authorize</data>
51+
</entity>
52+
<entity name="Environment" type="environment">
53+
<data key="value">sandbox</data>
54+
</entity>
55+
<entity name="MerchantId" type="merchant_id">
56+
<data key="value">d4pdjhxgjfrsmzbf</data>
57+
</entity>
58+
<entity name="PublicKey" type="public_key">
59+
<data key="value">m7q4wmh43xrgyrst</data>
60+
</entity>
61+
<entity name="PrivateKey" type="private_key">
62+
<data key="value">67de364080b1b4e2492d7a3de413a572</data>
63+
</entity>
64+
3865
<!-- default configuration used to restore Magento config -->
3966
<entity name="DefaultBraintreeConfig" type="braintree_config_state">
4067
<requiredEntity type="title">DefaultTitle</requiredEntity>
@@ -63,6 +90,28 @@
6390
<data key="value"/>
6491
</entity>
6592

93+
<entity name="CustomBraintreeConfigurationData" type="custom_braintree_config_state">
94+
<requiredEntity type="braintree_cc_vault_active">BraintreeValuteActive</requiredEntity>
95+
<requiredEntity type="active">EnableSolution</requiredEntity>
96+
</entity>
97+
<entity name="BraintreeValuteActive" type="braintree_cc_vault_active">
98+
<data key="value">1</data>
99+
</entity>
100+
<entity name="EnableSolution" type="active">
101+
<data key="value">1</data>
102+
</entity>
103+
104+
<entity name="RollBackCustomBraintreeConfigurationData" type="custom_braintree_config_state">
105+
<requiredEntity type="braintree_cc_vault_active">DefaultBraintreeValuteActive</requiredEntity>
106+
<requiredEntity type="active">DefaultEnableSolution</requiredEntity>
107+
</entity>
108+
<entity name="DefaultBraintreeValuteActive" type="braintree_cc_vault_active">
109+
<data key="value">0</data>
110+
</entity>
111+
<entity name="DefaultEnableSolution" type="active">
112+
<data key="value">0</data>
113+
</entity>
114+
66115
<entity name="testData" type="data">
67116
<data key="websiteName" unique="suffix">Website</data>
68117
<data key="websiteCode" unique="suffix">new_website</data>

app/code/Magento/Braintree/Test/Mftf/Metadata/braintree_config-meta.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,22 @@
4242
</object>
4343
</object>
4444
</operation>
45+
<operation name="CustomBraintreeConfigState" dataType="custom_braintree_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/payment/" method="POST">
46+
<object key="groups" dataType="custom_braintree_config_state">
47+
<object key="braintree_section" dataType="custom_braintree_config_state">
48+
<object key="groups" dataType="custom_braintree_config_state">
49+
<object key="braintree" dataType="custom_braintree_config_state">
50+
<object key="fields" dataType="custom_braintree_config_state">
51+
<object key="braintree_cc_vault_active" dataType="braintree_cc_vault_active">
52+
<field key="value">integer</field>
53+
</object>
54+
<object key="active" dataType="active">
55+
<field key="value">string</field>
56+
</object>
57+
</object>
58+
</object>
59+
</object>
60+
</object>
61+
</object>
62+
</operation>
4563
</operations>

0 commit comments

Comments
 (0)