diff --git a/app/code/Magento/PaypalCaptcha/LICENSE.txt b/app/code/Magento/PaypalCaptcha/LICENSE.txt
new file mode 100644
index 0000000000000..49525fd99da9c
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/LICENSE.txt
@@ -0,0 +1,48 @@
+
+Open Software License ("OSL") v. 3.0
+
+This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Open Software License version 3.0
+
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
+
+ 4. to perform the Original Work publicly; and
+
+ 5. to display the Original Work publicly.
+
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+ 16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under
" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
\ No newline at end of file
diff --git a/app/code/Magento/PaypalCaptcha/LICENSE_AFL.txt b/app/code/Magento/PaypalCaptcha/LICENSE_AFL.txt
new file mode 100644
index 0000000000000..f39d641b18a19
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/LICENSE_AFL.txt
@@ -0,0 +1,48 @@
+
+Academic Free License ("AFL") v. 3.0
+
+This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Academic Free License version 3.0
+
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
+
+ 4. to perform the Original Work publicly; and
+
+ 5. to display the Original Work publicly.
+
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+ 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
diff --git a/app/code/Magento/PaypalCaptcha/Model/Checkout/ConfigProviderPayPal.php b/app/code/Magento/PaypalCaptcha/Model/Checkout/ConfigProviderPayPal.php
new file mode 100644
index 0000000000000..289a1631ed1f6
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/Model/Checkout/ConfigProviderPayPal.php
@@ -0,0 +1,135 @@
+storeManager = $storeManager;
+ $this->captchaData = $captchaData;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getConfig(): array
+ {
+ $config['captchaPayments'][self::$formId] = [
+ 'isCaseSensitive' => $this->isCaseSensitive(self::$formId),
+ 'imageHeight' => $this->getImageHeight(self::$formId),
+ 'imageSrc' => $this->getImageSrc(self::$formId),
+ 'refreshUrl' => $this->getRefreshUrl(),
+ 'isRequired' => $this->isRequired(self::$formId),
+ 'timestamp' => time()
+ ];
+
+ return $config;
+ }
+
+ /**
+ * Returns is captcha case sensitive
+ *
+ * @param string $formId
+ * @return bool
+ */
+ private function isCaseSensitive(string $formId): bool
+ {
+ return (bool)$this->getCaptchaModel($formId)->isCaseSensitive();
+ }
+
+ /**
+ * Returns captcha image height
+ *
+ * @param string $formId
+ * @return int
+ */
+ private function getImageHeight(string $formId): int
+ {
+ return (int)$this->getCaptchaModel($formId)->getHeight();
+ }
+
+ /**
+ * Returns captcha image source path
+ *
+ * @param string $formId
+ * @return string
+ */
+ private function getImageSrc(string $formId): string
+ {
+ if ($this->isRequired($formId)) {
+ $captcha = $this->getCaptchaModel($formId);
+ $captcha->generate();
+ return $captcha->getImgSrc();
+ }
+
+ return '';
+ }
+
+ /**
+ * Returns URL to controller action which returns new captcha image
+ *
+ * @return string
+ */
+ private function getRefreshUrl(): string
+ {
+ $store = $this->storeManager->getStore();
+ return $store->getUrl('captcha/refresh', ['_secure' => $store->isCurrentlySecure()]);
+ }
+
+ /**
+ * Whether captcha is required to be inserted to this form
+ *
+ * @param string $formId
+ * @return bool
+ */
+ private function isRequired(string $formId): bool
+ {
+ return (bool)$this->getCaptchaModel($formId)->isRequired();
+ }
+
+ /**
+ * Return captcha model for specified form
+ *
+ * @param string $formId
+ * @return CaptchaInterface
+ */
+ private function getCaptchaModel(string $formId): CaptchaInterface
+ {
+ return $this->captchaData->getCaptcha($formId);
+ }
+}
diff --git a/app/code/Magento/PaypalCaptcha/Observer/CaptchaRequestToken.php b/app/code/Magento/PaypalCaptcha/Observer/CaptchaRequestToken.php
new file mode 100644
index 0000000000000..e7cb282b1799b
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/Observer/CaptchaRequestToken.php
@@ -0,0 +1,76 @@
+helper = $helper;
+ $this->jsonSerializer = $jsonSerializer;
+ $this->actionFlag = $actionFlag;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(Observer $observer)
+ {
+ $formId = 'co-payment-form';
+ $captcha = $this->helper->getCaptcha($formId);
+
+ if (!$captcha->isRequired()) {
+ return;
+ }
+
+ /** @var Action $controller */
+ $controller = $observer->getControllerAction();
+ $word = $controller->getRequest()->getPost('captcha_string');
+ if ($captcha->isCorrect($word)) {
+ return;
+ }
+
+ $data = $this->jsonSerializer->serialize([
+ 'success' => false,
+ 'error' => true,
+ 'error_messages' => __('Incorrect CAPTCHA.')
+ ]);
+ $this->actionFlag->set('', Action::FLAG_NO_DISPATCH, true);
+ $controller->getResponse()->representJson($data);
+ }
+}
diff --git a/app/code/Magento/PaypalCaptcha/README.md b/app/code/Magento/PaypalCaptcha/README.md
new file mode 100644
index 0000000000000..71588599a5ecd
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/README.md
@@ -0,0 +1 @@
+The PayPal Captcha module provides a possibility to enable Captcha validation on Payflow Pro payment form.
\ No newline at end of file
diff --git a/app/code/Magento/PaypalCaptcha/composer.json b/app/code/Magento/PaypalCaptcha/composer.json
new file mode 100644
index 0000000000000..e71ef8c0ec7de
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/composer.json
@@ -0,0 +1,30 @@
+{
+ "name": "magento/module-paypal-captcha",
+ "description": "Provides CAPTCHA validation for PayPal Payflow Pro",
+ "config": {
+ "sort-packages": true
+ },
+ "require": {
+ "php": "~7.1.3||~7.2.0",
+ "magento/framework": "*",
+ "magento/module-captcha": "*",
+ "magento/module-checkout": "*",
+ "magento/module-store": "*"
+ },
+ "suggest": {
+ "magento/module-paypal": "*"
+ },
+ "type": "magento2-module",
+ "license": [
+ "OSL-3.0",
+ "AFL-3.0"
+ ],
+ "autoload": {
+ "files": [
+ "registration.php"
+ ],
+ "psr-4": {
+ "Magento\\PaypalCaptcha\\": ""
+ }
+ }
+}
diff --git a/app/code/Magento/PaypalCaptcha/etc/adminhtml/system.xml b/app/code/Magento/PaypalCaptcha/etc/adminhtml/system.xml
new file mode 100644
index 0000000000000..12afd8ceda60e
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/etc/adminhtml/system.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+ CAPTCHA for "Create user", "Forgot password", "Payflow Pro" forms is always enabled if chosen.
+
+
+
+
+
diff --git a/app/code/Magento/PaypalCaptcha/etc/config.xml b/app/code/Magento/PaypalCaptcha/etc/config.xml
new file mode 100644
index 0000000000000..133a78a42f7b4
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/etc/config.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+
+ Payflow Pro
+
+
+
+
+
+
diff --git a/app/code/Magento/PaypalCaptcha/etc/frontend/di.xml b/app/code/Magento/PaypalCaptcha/etc/frontend/di.xml
new file mode 100644
index 0000000000000..c236d5ea04ca0
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/etc/frontend/di.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ - Magento\PaypalCaptcha\Model\Checkout\ConfigProviderPayPal
+
+
+
+
diff --git a/app/code/Magento/PaypalCaptcha/etc/frontend/events.xml b/app/code/Magento/PaypalCaptcha/etc/frontend/events.xml
new file mode 100644
index 0000000000000..ae706c4485d61
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/etc/frontend/events.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/app/code/Magento/PaypalCaptcha/etc/module.xml b/app/code/Magento/PaypalCaptcha/etc/module.xml
new file mode 100644
index 0000000000000..425c829a5d391
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/etc/module.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/PaypalCaptcha/registration.php b/app/code/Magento/PaypalCaptcha/registration.php
new file mode 100644
index 0000000000000..4dac0582a6d1b
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/registration.php
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+ -
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
- uiComponent
+ - paypal-captcha
+ - paypal-captcha
+ - checkoutProvider
+ -
+
- Magento_Checkout/payment/before-place-order
+
+ -
+
-
+
- Magento_PaypalCaptcha/js/view/checkout/paymentCaptcha
+ - paypal-captcha
+ - co-payment-form
+ - checkoutConfig
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/PaypalCaptcha/view/frontend/requirejs-config.js b/app/code/Magento/PaypalCaptcha/view/frontend/requirejs-config.js
new file mode 100644
index 0000000000000..78e7add4ec690
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/view/frontend/requirejs-config.js
@@ -0,0 +1,14 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+var config = {
+ config: {
+ mixins: {
+ 'Magento_Checkout/js/view/payment/list': {
+ 'Magento_PaypalCaptcha/js/view/payment/list-mixin': true
+ }
+ }
+ }
+};
diff --git a/app/code/Magento/PaypalCaptcha/view/frontend/web/js/view/checkout/paymentCaptcha.js b/app/code/Magento/PaypalCaptcha/view/frontend/web/js/view/checkout/paymentCaptcha.js
new file mode 100644
index 0000000000000..f8f119e3b3396
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/view/frontend/web/js/view/checkout/paymentCaptcha.js
@@ -0,0 +1,44 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define([
+ 'jquery',
+ 'Magento_Captcha/js/view/checkout/defaultCaptcha',
+ 'Magento_Captcha/js/model/captchaList',
+ 'Magento_Captcha/js/model/captcha'
+],
+function ($, defaultCaptcha, captchaList, Captcha) {
+ 'use strict';
+
+ return defaultCaptcha.extend({
+
+ /** @inheritdoc */
+ initialize: function () {
+ var captchaConfigPayment,
+ currentCaptcha;
+
+ this._super();
+
+ if (window[this.configSource] && window[this.configSource].captchaPayments) {
+ captchaConfigPayment = window[this.configSource].captchaPayments;
+
+ $.each(captchaConfigPayment, function (formId, captchaData) {
+ var captcha;
+
+ captchaData.formId = formId;
+ captcha = Captcha(captchaData);
+ captchaList.add(captcha);
+ });
+ }
+
+ currentCaptcha = captchaList.getCaptchaByFormId(this.formId);
+
+ if (currentCaptcha != null) {
+ currentCaptcha.setIsVisible(true);
+ this.setCurrentCaptcha(currentCaptcha);
+ }
+ }
+ });
+});
diff --git a/app/code/Magento/PaypalCaptcha/view/frontend/web/js/view/payment/list-mixin.js b/app/code/Magento/PaypalCaptcha/view/frontend/web/js/view/payment/list-mixin.js
new file mode 100644
index 0000000000000..60172f696e9ed
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/view/frontend/web/js/view/payment/list-mixin.js
@@ -0,0 +1,54 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define([
+ 'jquery',
+ 'Magento_Captcha/js/model/captchaList'
+], function ($, captchaList) {
+ 'use strict';
+
+ var mixin = {
+
+ formId: 'co-payment-form',
+
+ /**
+ * Sets custom template for Payflow Pro
+ *
+ * @param {Object} payment
+ * @returns {Object}
+ */
+ createComponent: function (payment) {
+
+ var component = this._super(payment);
+
+ if (component.component === 'Magento_Paypal/js/view/payment/method-renderer/payflowpro-method') {
+ component.template = 'Magento_PaypalCaptcha/payment/payflowpro-form';
+ $(window).off('clearTimeout')
+ .on('clearTimeout', this.clearTimeout.bind(this));
+ }
+
+ return component;
+ },
+
+ /**
+ * Overrides default window.clearTimeout() to catch errors from iframe and reload Captcha.
+ */
+ clearTimeout: function () {
+ var captcha = captchaList.getCaptchaByFormId(this.formId);
+
+ if (captcha !== null) {
+ captcha.refresh();
+ }
+ clearTimeout();
+ }
+ };
+
+ /**
+ * Overrides `Magento_Checkout/js/view/payment/list::createComponent`
+ */
+ return function (target) {
+ return target.extend(mixin);
+ };
+});
diff --git a/app/code/Magento/PaypalCaptcha/view/frontend/web/template/payment/payflowpro-form.html b/app/code/Magento/PaypalCaptcha/view/frontend/web/template/payment/payflowpro-form.html
new file mode 100644
index 0000000000000..fec5cf96b0324
--- /dev/null
+++ b/app/code/Magento/PaypalCaptcha/view/frontend/web/template/payment/payflowpro-form.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/ProductVideo/i18n/de_DE.csv b/app/code/Magento/ProductVideo/i18n/de_DE.csv
deleted file mode 100644
index ca24668bb8d16..0000000000000
--- a/app/code/Magento/ProductVideo/i18n/de_DE.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-"Add video","Add video"
-"New Video","New Video"
-"Product Video","Product Video"
-"YouTube API key","YouTube API key"
-"You have not entered youtube API key. No information about youtube video will be retrieved.","You have not entered youtube API key. No information about youtube video will be retrieved."
-"Url","Url"
-"Preview Image","Preview Image"
-"Get Video Information","Get Video Information"
-"Youtube or Vimeo supported","Youtube or Vimeo supported"
-"Delete image in all store views","Delete image in all store views"
diff --git a/app/code/Magento/ProductVideo/i18n/es_ES.csv b/app/code/Magento/ProductVideo/i18n/es_ES.csv
deleted file mode 100644
index ca24668bb8d16..0000000000000
--- a/app/code/Magento/ProductVideo/i18n/es_ES.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-"Add video","Add video"
-"New Video","New Video"
-"Product Video","Product Video"
-"YouTube API key","YouTube API key"
-"You have not entered youtube API key. No information about youtube video will be retrieved.","You have not entered youtube API key. No information about youtube video will be retrieved."
-"Url","Url"
-"Preview Image","Preview Image"
-"Get Video Information","Get Video Information"
-"Youtube or Vimeo supported","Youtube or Vimeo supported"
-"Delete image in all store views","Delete image in all store views"
diff --git a/app/code/Magento/ProductVideo/i18n/fr_FR.csv b/app/code/Magento/ProductVideo/i18n/fr_FR.csv
deleted file mode 100644
index ca24668bb8d16..0000000000000
--- a/app/code/Magento/ProductVideo/i18n/fr_FR.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-"Add video","Add video"
-"New Video","New Video"
-"Product Video","Product Video"
-"YouTube API key","YouTube API key"
-"You have not entered youtube API key. No information about youtube video will be retrieved.","You have not entered youtube API key. No information about youtube video will be retrieved."
-"Url","Url"
-"Preview Image","Preview Image"
-"Get Video Information","Get Video Information"
-"Youtube or Vimeo supported","Youtube or Vimeo supported"
-"Delete image in all store views","Delete image in all store views"
diff --git a/app/code/Magento/ProductVideo/i18n/nl_NL.csv b/app/code/Magento/ProductVideo/i18n/nl_NL.csv
deleted file mode 100644
index 5ad8386573040..0000000000000
--- a/app/code/Magento/ProductVideo/i18n/nl_NL.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-"Add video","Add video"
-"New Video","New Video"
-"Product Video","Product Video"
-"YouTube API key","YouTube API key"
-"You have not entered youtube API key. No information about youtube video will be retrieved.","You have not entered youtube API key. No information about youtube video will be retrieved."
-"Url","Url"
-"Preview Image","Preview Image"
-"Get Video Information","Get Video Information"
-"Youtube or Vimeo supported","Youtube or Vimeo supported"
-"Delete image in all store views","Delete image in all store views"
\ No newline at end of file
diff --git a/app/code/Magento/ProductVideo/i18n/pt_BR.csv b/app/code/Magento/ProductVideo/i18n/pt_BR.csv
deleted file mode 100644
index 5ad8386573040..0000000000000
--- a/app/code/Magento/ProductVideo/i18n/pt_BR.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-"Add video","Add video"
-"New Video","New Video"
-"Product Video","Product Video"
-"YouTube API key","YouTube API key"
-"You have not entered youtube API key. No information about youtube video will be retrieved.","You have not entered youtube API key. No information about youtube video will be retrieved."
-"Url","Url"
-"Preview Image","Preview Image"
-"Get Video Information","Get Video Information"
-"Youtube or Vimeo supported","Youtube or Vimeo supported"
-"Delete image in all store views","Delete image in all store views"
\ No newline at end of file
diff --git a/app/code/Magento/ProductVideo/i18n/zh_Hans_CN.csv b/app/code/Magento/ProductVideo/i18n/zh_Hans_CN.csv
deleted file mode 100644
index 5ad8386573040..0000000000000
--- a/app/code/Magento/ProductVideo/i18n/zh_Hans_CN.csv
+++ /dev/null
@@ -1,10 +0,0 @@
-"Add video","Add video"
-"New Video","New Video"
-"Product Video","Product Video"
-"YouTube API key","YouTube API key"
-"You have not entered youtube API key. No information about youtube video will be retrieved.","You have not entered youtube API key. No information about youtube video will be retrieved."
-"Url","Url"
-"Preview Image","Preview Image"
-"Get Video Information","Get Video Information"
-"Youtube or Vimeo supported","Youtube or Vimeo supported"
-"Delete image in all store views","Delete image in all store views"
\ No newline at end of file
diff --git a/app/code/Magento/Quote/Test/Mftf/Data/CartItemData.xml b/app/code/Magento/Quote/Test/Mftf/Data/CartItemData.xml
index 4cc2c4f392419..a513b6747f612 100644
--- a/app/code/Magento/Quote/Test/Mftf/Data/CartItemData.xml
+++ b/app/code/Magento/Quote/Test/Mftf/Data/CartItemData.xml
@@ -13,4 +13,14 @@
+
+ 2
+
+
+
+
+ abc
+
+
+
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php b/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
index 145e9c01980a5..3506ffc8c8792 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
@@ -13,6 +13,7 @@
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface;
use Magento\Quote\Model\Quote;
+use Magento\Store\Model\StoreManagerInterface;
/**
* Get cart
@@ -29,16 +30,24 @@ class GetCartForUser
*/
private $cartRepository;
+ /**
+ * @var StoreManagerInterface
+ */
+ private $storeManager;
+
/**
* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
* @param CartRepositoryInterface $cartRepository
+ * @param StoreManagerInterface $storeManager
*/
public function __construct(
MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId,
- CartRepositoryInterface $cartRepository
+ CartRepositoryInterface $cartRepository,
+ StoreManagerInterface $storeManager
) {
$this->maskedQuoteIdToQuoteId = $maskedQuoteIdToQuoteId;
$this->cartRepository = $cartRepository;
+ $this->storeManager = $storeManager;
}
/**
@@ -75,6 +84,15 @@ public function execute(string $cartHash, ?int $customerId): Quote
);
}
+ if ((int)$cart->getStoreId() !== (int)$this->storeManager->getStore()->getId()) {
+ throw new GraphQlNoSuchEntityException(
+ __(
+ 'Wrong store code specified for cart "%masked_cart_id"',
+ ['masked_cart_id' => $cartHash]
+ )
+ );
+ }
+
$cartCustomerId = (int)$cart->getCustomerId();
/* Guest cart, allow operations */
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php b/app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php
index 76bdc74611131..13d6a1d3dce70 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php
@@ -7,9 +7,12 @@
namespace Magento\QuoteGraphQl\Model\Cart;
-use Magento\Customer\Api\Data\AddressInterface as CustomerAddress;
+use Magento\Customer\Helper\Address as AddressHelper;
+use Magento\CustomerGraphQl\Model\Customer\Address\GetCustomerAddress;
use Magento\Framework\Exception\LocalizedException;
+use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
+use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
use Magento\Quote\Model\Quote\Address as QuoteAddress;
use Magento\Quote\Model\Quote\AddressFactory as BaseQuoteAddressFactory;
@@ -23,13 +26,29 @@ class QuoteAddressFactory
*/
private $quoteAddressFactory;
+ /**
+ * @var GetCustomerAddress
+ */
+ private $getCustomerAddress;
+
+ /**
+ * @var AddressHelper
+ */
+ private $addressHelper;
+
/**
* @param BaseQuoteAddressFactory $quoteAddressFactory
+ * @param GetCustomerAddress $getCustomerAddress
+ * @param AddressHelper $addressHelper
*/
public function __construct(
- BaseQuoteAddressFactory $quoteAddressFactory
+ BaseQuoteAddressFactory $quoteAddressFactory,
+ GetCustomerAddress $getCustomerAddress,
+ AddressHelper $addressHelper
) {
$this->quoteAddressFactory = $quoteAddressFactory;
+ $this->getCustomerAddress = $getCustomerAddress;
+ $this->addressHelper = $addressHelper;
}
/**
@@ -37,25 +56,38 @@ public function __construct(
*
* @param array $addressInput
* @return QuoteAddress
+ * @throws GraphQlInputException
*/
public function createBasedOnInputData(array $addressInput): QuoteAddress
{
$addressInput['country_id'] = $addressInput['country_code'] ?? '';
+ $maxAllowedLineCount = $this->addressHelper->getStreetLines();
+ if (is_array($addressInput['street']) && count($addressInput['street']) > $maxAllowedLineCount) {
+ throw new GraphQlInputException(
+ __('"Street Address" cannot contain more than %1 lines.', $maxAllowedLineCount)
+ );
+ }
+
$quoteAddress = $this->quoteAddressFactory->create();
$quoteAddress->addData($addressInput);
return $quoteAddress;
}
/**
- * Create QuoteAddress based on CustomerAddress
+ * Create Quote Address based on Customer Address
*
- * @param CustomerAddress $customerAddress
+ * @param int $customerAddressId
+ * @param int $customerId
* @return QuoteAddress
* @throws GraphQlInputException
+ * @throws GraphQlAuthorizationException
+ * @throws GraphQlNoSuchEntityException
*/
- public function createBasedOnCustomerAddress(CustomerAddress $customerAddress): QuoteAddress
+ public function createBasedOnCustomerAddress(int $customerAddressId, int $customerId): QuoteAddress
{
+ $customerAddress = $this->getCustomerAddress->execute((int)$customerAddressId, $customerId);
+
$quoteAddress = $this->quoteAddressFactory->create();
try {
$quoteAddress->importCustomerAddressData($customerAddress);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php
index 31524ea023222..c2bac13c07067 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/SetBillingAddressOnCart.php
@@ -7,8 +7,9 @@
namespace Magento\QuoteGraphQl\Model\Cart;
-use Magento\CustomerGraphQl\Model\Customer\Address\GetCustomerAddress;
use Magento\CustomerGraphQl\Model\Customer\GetCustomer;
+use Magento\Framework\GraphQl\Exception\GraphQlAuthenticationException;
+use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
@@ -29,11 +30,6 @@ class SetBillingAddressOnCart
*/
private $getCustomer;
- /**
- * @var GetCustomerAddress
- */
- private $getCustomerAddress;
-
/**
* @var AssignBillingAddressToCart
*/
@@ -42,18 +38,15 @@ class SetBillingAddressOnCart
/**
* @param QuoteAddressFactory $quoteAddressFactory
* @param GetCustomer $getCustomer
- * @param GetCustomerAddress $getCustomerAddress
* @param AssignBillingAddressToCart $assignBillingAddressToCart
*/
public function __construct(
QuoteAddressFactory $quoteAddressFactory,
GetCustomer $getCustomer,
- GetCustomerAddress $getCustomerAddress,
AssignBillingAddressToCart $assignBillingAddressToCart
) {
$this->quoteAddressFactory = $quoteAddressFactory;
$this->getCustomer = $getCustomer;
- $this->getCustomerAddress = $getCustomerAddress;
$this->assignBillingAddressToCart = $assignBillingAddressToCart;
}
@@ -65,6 +58,8 @@ public function __construct(
* @param array $billingAddressInput
* @return void
* @throws GraphQlInputException
+ * @throws GraphQlAuthenticationException
+ * @throws GraphQlAuthorizationException
* @throws GraphQlNoSuchEntityException
*/
public function execute(ContextInterface $context, CartInterface $cart, array $billingAddressInput): void
@@ -97,8 +92,10 @@ public function execute(ContextInterface $context, CartInterface $cart, array $b
$billingAddress = $this->quoteAddressFactory->createBasedOnInputData($addressInput);
} else {
$customer = $this->getCustomer->execute($context);
- $customerAddress = $this->getCustomerAddress->execute((int)$customerAddressId, (int)$customer->getId());
- $billingAddress = $this->quoteAddressFactory->createBasedOnCustomerAddress($customerAddress);
+ $billingAddress = $this->quoteAddressFactory->createBasedOnCustomerAddress(
+ (int)$customerAddressId,
+ (int)$customer->getId()
+ );
}
$this->assignBillingAddressToCart->execute($cart, $billingAddress, $useForShipping);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/SetShippingAddressesOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/SetShippingAddressesOnCart.php
index bbca7721754cb..6b0e2a311bf44 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/SetShippingAddressesOnCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/SetShippingAddressesOnCart.php
@@ -7,7 +7,6 @@
namespace Magento\QuoteGraphQl\Model\Cart;
-use Magento\CustomerGraphQl\Model\Customer\Address\GetCustomerAddress;
use Magento\CustomerGraphQl\Model\Customer\GetCustomer;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
@@ -28,11 +27,6 @@ class SetShippingAddressesOnCart implements SetShippingAddressesOnCartInterface
*/
private $getCustomer;
- /**
- * @var GetCustomerAddress
- */
- private $getCustomerAddress;
-
/**
* @var AssignShippingAddressToCart
*/
@@ -41,18 +35,15 @@ class SetShippingAddressesOnCart implements SetShippingAddressesOnCartInterface
/**
* @param QuoteAddressFactory $quoteAddressFactory
* @param GetCustomer $getCustomer
- * @param GetCustomerAddress $getCustomerAddress
* @param AssignShippingAddressToCart $assignShippingAddressToCart
*/
public function __construct(
QuoteAddressFactory $quoteAddressFactory,
GetCustomer $getCustomer,
- GetCustomerAddress $getCustomerAddress,
AssignShippingAddressToCart $assignShippingAddressToCart
) {
$this->quoteAddressFactory = $quoteAddressFactory;
$this->getCustomer = $getCustomer;
- $this->getCustomerAddress = $getCustomerAddress;
$this->assignShippingAddressToCart = $assignShippingAddressToCart;
}
@@ -86,8 +77,10 @@ public function execute(ContextInterface $context, CartInterface $cart, array $s
$shippingAddress = $this->quoteAddressFactory->createBasedOnInputData($addressInput);
} else {
$customer = $this->getCustomer->execute($context);
- $customerAddress = $this->getCustomerAddress->execute((int)$customerAddressId, (int)$customer->getId());
- $shippingAddress = $this->quoteAddressFactory->createBasedOnCustomerAddress($customerAddress);
+ $shippingAddress = $this->quoteAddressFactory->createBasedOnCustomerAddress(
+ (int)$customerAddressId,
+ (int)$customer->getId()
+ );
}
$this->assignShippingAddressToCart->execute($cart, $shippingAddress);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/AppliedCoupon.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/AppliedCoupon.php
index ca69b763929be..8251089abcd60 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/AppliedCoupon.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/AppliedCoupon.php
@@ -11,12 +11,27 @@
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
+use Magento\Quote\Api\CouponManagementInterface;
/**
* @inheritdoc
*/
class AppliedCoupon implements ResolverInterface
{
+ /**
+ * @var CouponManagementInterface
+ */
+ private $couponManagement;
+
+ /**
+ * @param CouponManagementInterface $couponManagement
+ */
+ public function __construct(
+ CouponManagementInterface $couponManagement
+ ) {
+ $this->couponManagement = $couponManagement;
+ }
+
/**
* @inheritdoc
*/
@@ -26,9 +41,9 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
throw new LocalizedException(__('"model" value should be specified'));
}
$cart = $value['model'];
+ $cartId = $cart->getId();
- $appliedCoupon = $cart->getCouponCode();
-
+ $appliedCoupon = $this->couponManagement->get($cartId);
return $appliedCoupon ? ['code' => $appliedCoupon] : null;
}
}
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php
new file mode 100644
index 0000000000000..3bd46a664f2ab
--- /dev/null
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php
@@ -0,0 +1,83 @@
+getCartForUser = $getCartForUser;
+ $this->cartManagement = $cartManagement;
+ $this->orderRepository = $orderRepository;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
+ {
+ if (!isset($args['input']['cart_id']) || empty($args['input']['cart_id'])) {
+ throw new GraphQlInputException(__('Required parameter "cart_id" is missing'));
+ }
+ $maskedCartId = $args['input']['cart_id'];
+
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+
+ try {
+ $orderId = $this->cartManagement->placeOrder($cart->getId());
+ $order = $this->orderRepository->get($orderId);
+
+ return [
+ 'order' => [
+ 'order_id' => $order->getIncrementId(),
+ ],
+ ];
+ } catch (NoSuchEntityException $e) {
+ throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
+ } catch (LocalizedException $e) {
+ throw new GraphQlInputException(__('Unable to place order: %message', ['message' => $e->getMessage()]), $e);
+ }
+ }
+}
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveCouponFromCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveCouponFromCart.php
index 5a708ceaedc28..f81ea3020d3d0 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveCouponFromCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveCouponFromCart.php
@@ -62,7 +62,11 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
try {
$this->couponManagement->remove($cartId);
} catch (NoSuchEntityException $e) {
- throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
+ $message = $e->getMessage();
+ if (preg_match('/The "\d+" Cart doesn\'t contain products/', $message)) {
+ $message = 'Cart does not contain products';
+ }
+ throw new GraphQlNoSuchEntityException(__($message), $e);
} catch (CouldNotDeleteException $e) {
throw new LocalizedException(__($e->getMessage()), $e);
}
diff --git a/app/code/Magento/QuoteGraphQl/composer.json b/app/code/Magento/QuoteGraphQl/composer.json
index 1bf4d581a5fe3..22ca9cfdfae9a 100644
--- a/app/code/Magento/QuoteGraphQl/composer.json
+++ b/app/code/Magento/QuoteGraphQl/composer.json
@@ -10,7 +10,8 @@
"magento/module-catalog": "*",
"magento/module-store": "*",
"magento/module-customer": "*",
- "magento/module-customer-graph-ql": "*"
+ "magento/module-customer-graph-ql": "*",
+ "magento/module-sales": "*"
},
"suggest": {
"magento/module-graph-ql": "*"
diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
index 79cea3855f6f3..9ec3492f64531 100644
--- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
@@ -17,6 +17,7 @@ type Mutation {
setBillingAddressOnCart(input: SetBillingAddressOnCartInput): SetBillingAddressOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetBillingAddressOnCart")
setShippingMethodsOnCart(input: SetShippingMethodsOnCartInput): SetShippingMethodsOnCartOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SetShippingMethodsOnCart")
setPaymentMethodOnCart(input: SetPaymentMethodOnCartInput): SetPaymentMethodOnCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\SetPaymentMethodOnCart")
+ placeOrder(input: PlaceOrderInput): PlaceOrderOutput @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\PlaceOrder")
}
input AddSimpleProductsToCartInput {
@@ -114,6 +115,10 @@ input ShippingMethodInput {
method_code: String!
}
+input PlaceOrderInput {
+ cart_id: String!
+}
+
input SetPaymentMethodOnCartInput {
cart_id: String!
payment_method: PaymentMethodInput!
@@ -144,6 +149,10 @@ type ApplyCouponToCartOutput {
cart: Cart!
}
+type PlaceOrderOutput {
+ order: Order!
+}
+
type Cart {
items: [CartItemInterface] @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartItems")
applied_coupon: AppliedCoupon @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\AppliedCoupon")
@@ -285,3 +294,7 @@ type CartItemSelectedOptionValuePrice {
units: String!
type: PriceTypeEnum!
}
+
+type Order {
+ order_id: String
+}
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Totals.php
index 83b155293c2b9..8172a3c0db4ad 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Totals.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Totals.php
@@ -5,6 +5,11 @@
*/
namespace Magento\Sales\Block\Adminhtml;
+use Magento\Sales\Model\Order;
+
+/**
+ * Adminhtml sales totals block
+ */
class Totals extends \Magento\Sales\Block\Order\Totals
{
/**
@@ -67,12 +72,16 @@ protected function _initTotals()
if (!$this->getSource()->getIsVirtual() && ((double)$this->getSource()->getShippingAmount() ||
$this->getSource()->getShippingDescription())
) {
+ $shippingLabel = __('Shipping & Handling');
+ if ($this->isFreeShipping($this->getOrder()) && $this->getSource()->getDiscountDescription()) {
+ $shippingLabel .= sprintf(' (%s)', $this->getSource()->getDiscountDescription());
+ }
$this->_totals['shipping'] = new \Magento\Framework\DataObject(
[
'code' => 'shipping',
'value' => $this->getSource()->getShippingAmount(),
'base_value' => $this->getSource()->getBaseShippingAmount(),
- 'label' => __('Shipping & Handling'),
+ 'label' => $shippingLabel,
]
);
}
@@ -109,4 +118,23 @@ protected function _initTotals()
return $this;
}
+
+ /**
+ * Availability of free shipping in at least one order item
+ *
+ * @param Order $order
+ * @return bool
+ */
+ private function isFreeShipping(Order $order): bool
+ {
+ $isFreeShipping = false;
+ foreach ($order->getItems() as $orderItem) {
+ if ($orderItem->getFreeShipping() == '1') {
+ $isFreeShipping = true;
+ break;
+ }
+ }
+
+ return $isFreeShipping;
+ }
}
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php
index 11908864236f6..48934e24a3795 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php
@@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Sales\Model\Order\Pdf\Items\Creditmemo;
/**
@@ -66,11 +68,18 @@ public function draw()
$lines = [];
// draw Product name
- $lines[0] = [['text' => $this->string->split($item->getName(), 35, true, true), 'feed' => 35]];
+ $lines[0] = [
+ [
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
+ 'text' => $this->string->split(html_entity_decode($item->getName()), 35, true, true),
+ 'feed' => 35
+ ]
+ ];
// draw SKU
$lines[0][] = [
- 'text' => $this->string->split($this->getSku($item), 17),
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
+ 'text' => $this->string->split(html_entity_decode($this->getSku($item)), 17),
'feed' => 255,
'align' => 'right',
];
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
index 8562328025540..23c2c00daadc3 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php
@@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Sales\Model\Order\Pdf\Items\Invoice;
/**
@@ -66,11 +68,18 @@ public function draw()
$lines = [];
// draw Product name
- $lines[0] = [['text' => $this->string->split($item->getName(), 35, true, true), 'feed' => 35]];
+ $lines[0] = [
+ [
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
+ 'text' => $this->string->split(html_entity_decode($item->getName()), 35, true, true),
+ 'feed' => 35
+ ]
+ ];
// draw SKU
$lines[0][] = [
- 'text' => $this->string->split($this->getSku($item), 17),
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
+ 'text' => $this->string->split(html_entity_decode($this->getSku($item)), 17),
'feed' => 290,
'align' => 'right',
];
diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php
index 6007e1dcf2b47..a88b508ba0789 100644
--- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php
+++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php
@@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Sales\Model\Order\Pdf\Items\Shipment;
/**
@@ -65,14 +67,21 @@ public function draw()
$lines = [];
// draw Product name
- $lines[0] = [['text' => $this->string->split($item->getName(), 60, true, true), 'feed' => 100]];
+ $lines[0] = [
+ [
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
+ 'text' => $this->string->split(html_entity_decode($item->getName()), 60, true, true),
+ 'feed' => 100
+ ]
+ ];
// draw QTY
$lines[0][] = ['text' => $item->getQty() * 1, 'feed' => 35];
// draw SKU
$lines[0][] = [
- 'text' => $this->string->split($this->getSku($item), 25),
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
+ 'text' => $this->string->split(html_entity_decode($this->getSku($item)), 25),
'feed' => 565,
'align' => 'right',
];
diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml
index 0061411d576e2..b90bac7e0881b 100644
--- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml
+++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminInvoiceActionGroup.xml
@@ -19,18 +19,15 @@
-
-
-
@@ -38,7 +35,6 @@
-
@@ -50,19 +46,22 @@
-
+
+
+
+
+
+
-
-
@@ -70,4 +69,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml
index b690d0190bdd1..d77e30cda24eb 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml
@@ -96,4 +96,8 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml
new file mode 100644
index 0000000000000..66f89bfc37365
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionsSectionActionGroup.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleConditionsSectionActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleConditionsSectionActionGroup.xml
new file mode 100644
index 0000000000000..ab45aae46db1d
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleConditionsSectionActionGroup.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleLabelsSectionActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleLabelsSectionActionGroup.xml
new file mode 100644
index 0000000000000..4133cc44ebc15
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleLabelsSectionActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleRuleInfoSectionActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleRuleInfoSectionActionGroup.xml
new file mode 100644
index 0000000000000..27b9634cbe28c
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleRuleInfoSectionActionGroup.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml
index 35e1bee0952cf..7a3a20e603255 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminFilterCartPriceRuleActionGroup.xml
@@ -18,4 +18,9 @@
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertCartPriceRuleSuccessSaveMessageActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertCartPriceRuleSuccessSaveMessageActionGroup.xml
new file mode 100644
index 0000000000000..8fe0250307c6a
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertCartPriceRuleSuccessSaveMessageActionGroup.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml
new file mode 100644
index 0000000000000..f9c9a9fd357ee
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AssertStorefrontMiniCartItemsActionGroup.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml
new file mode 100644
index 0000000000000..fa474194635e6
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontAddToTheCartActionGroup.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontClickOnMiniCartActionGroup.xml b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontClickOnMiniCartActionGroup.xml
new file mode 100644
index 0000000000000..59028ee1a17b5
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/ActionGroup/StorefrontClickOnMiniCartActionGroup.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
index aa0220ea523f4..3e1a247c7a1e2 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
@@ -193,6 +193,54 @@
by_fixed
+
+ Cart Price Rule with Specific Coupon
+ Description for Cart Price Rule
+ Yes
+ Main Website
+ 'NOT LOGGED IN'
+ Specific Coupon
+ 123-abc-ABC-987
+ Percent of product price discount
+ 50
+ Cart Price Rule with Specific Coupon
+ Cart Price Rule with Specific Coupon
+
+
+ Cart Price Rule with complex conditions
+ Cart Price Rule with complex conditions
+ Yes
+ Main Website
+ 'NOT LOGGED IN', 'General', 'Wholesale', 'Retailer'
+ Specific Coupon
+ 123-abc-ABC-987
+ 13
+ 63
+ 1
+ Yes
+ 300
+ US
+ 123456789a
+ Percent of product price discount
+ 50
+ 0
+ 0
+ Yes
+ Yes
+ For matching items only
+ Cart Price Rule with complex conditions
+ Cart Price Rule with complex conditions
+
+
+ Inactive Cart Price Rule
+ Inactive Cart Price Rule
+ 0
+ Main Website
+ 'NOT LOGGED IN'
+ No Coupon
+ Percent of product price discount
+ 50
+
Cart Price Rule
@@ -209,4 +257,4 @@
Percent of product price discount
50
-
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml
index 48d2a2685fcbe..e5e21df91930a 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml
@@ -16,6 +16,8 @@
+
+
@@ -26,6 +28,7 @@
+
@@ -39,6 +42,11 @@
+
+
+
+
+
@@ -65,12 +73,19 @@
-
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesSection.xml b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesSection.xml
index 14d3a734408db..60bf3d63e7e54 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesSection.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesSection.xml
@@ -18,5 +18,6 @@
+
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml
new file mode 100644
index 0000000000000..4403010e1ffc9
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml
new file mode 100644
index 0000000000000..41e4221a2c37f
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml
new file mode 100644
index 0000000000000..1570bfbdb7a23
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminEditSearchTermActionGroup.xml b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminEditSearchTermActionGroup.xml
new file mode 100644
index 0000000000000..de330bb24a2e6
--- /dev/null
+++ b/app/code/Magento/Search/Test/Mftf/ActionGroup/AdminEditSearchTermActionGroup.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Search/Test/Mftf/Data/SearchTermData.xml b/app/code/Magento/Search/Test/Mftf/Data/SearchTermData.xml
index 1518adad01347..8263ff996318e 100644
--- a/app/code/Magento/Search/Test/Mftf/Data/SearchTermData.xml
+++ b/app/code/Magento/Search/Test/Mftf/Data/SearchTermData.xml
@@ -14,4 +14,12 @@
http://example.com/
0
+
+ UpdatedSearchTerm
+ Default Store View
+ 1
+ 20
+ http://example.com
+ No
+
diff --git a/app/code/Magento/Search/i18n/de_DE.csv b/app/code/Magento/Search/i18n/de_DE.csv
deleted file mode 100644
index 8b4b04aa3b9ec..0000000000000
--- a/app/code/Magento/Search/i18n/de_DE.csv
+++ /dev/null
@@ -1 +0,0 @@
-"Search Engine","Search Engine"
diff --git a/app/code/Magento/Search/i18n/es_ES.csv b/app/code/Magento/Search/i18n/es_ES.csv
deleted file mode 100644
index 8b4b04aa3b9ec..0000000000000
--- a/app/code/Magento/Search/i18n/es_ES.csv
+++ /dev/null
@@ -1 +0,0 @@
-"Search Engine","Search Engine"
diff --git a/app/code/Magento/Search/i18n/fr_FR.csv b/app/code/Magento/Search/i18n/fr_FR.csv
deleted file mode 100644
index 8b4b04aa3b9ec..0000000000000
--- a/app/code/Magento/Search/i18n/fr_FR.csv
+++ /dev/null
@@ -1 +0,0 @@
-"Search Engine","Search Engine"
diff --git a/app/code/Magento/Search/i18n/nl_NL.csv b/app/code/Magento/Search/i18n/nl_NL.csv
deleted file mode 100644
index 8b4b04aa3b9ec..0000000000000
--- a/app/code/Magento/Search/i18n/nl_NL.csv
+++ /dev/null
@@ -1 +0,0 @@
-"Search Engine","Search Engine"
diff --git a/app/code/Magento/Search/i18n/pt_BR.csv b/app/code/Magento/Search/i18n/pt_BR.csv
deleted file mode 100644
index c10566a7c9800..0000000000000
--- a/app/code/Magento/Search/i18n/pt_BR.csv
+++ /dev/null
@@ -1 +0,0 @@
-"Search Engine","Mecanismo de Busca"
diff --git a/app/code/Magento/Search/i18n/zh_Hans_CN.csv b/app/code/Magento/Search/i18n/zh_Hans_CN.csv
deleted file mode 100644
index 8b4b04aa3b9ec..0000000000000
--- a/app/code/Magento/Search/i18n/zh_Hans_CN.csv
+++ /dev/null
@@ -1 +0,0 @@
-"Search Engine","Search Engine"
diff --git a/app/code/Magento/Swatches/i18n/de_DE.csv b/app/code/Magento/Swatches/i18n/de_DE.csv
deleted file mode 100644
index f0aa34bbef26e..0000000000000
--- a/app/code/Magento/Swatches/i18n/de_DE.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"Swatch","Swatch"
-"Swatches per Product","Swatches per Product"
diff --git a/app/code/Magento/Swatches/i18n/es_ES.csv b/app/code/Magento/Swatches/i18n/es_ES.csv
deleted file mode 100644
index f0aa34bbef26e..0000000000000
--- a/app/code/Magento/Swatches/i18n/es_ES.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"Swatch","Swatch"
-"Swatches per Product","Swatches per Product"
diff --git a/app/code/Magento/Swatches/i18n/fr_FR.csv b/app/code/Magento/Swatches/i18n/fr_FR.csv
deleted file mode 100644
index f0aa34bbef26e..0000000000000
--- a/app/code/Magento/Swatches/i18n/fr_FR.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"Swatch","Swatch"
-"Swatches per Product","Swatches per Product"
diff --git a/app/code/Magento/Swatches/i18n/nl_NL.csv b/app/code/Magento/Swatches/i18n/nl_NL.csv
deleted file mode 100644
index f0aa34bbef26e..0000000000000
--- a/app/code/Magento/Swatches/i18n/nl_NL.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"Swatch","Swatch"
-"Swatches per Product","Swatches per Product"
diff --git a/app/code/Magento/Swatches/i18n/pt_BR.csv b/app/code/Magento/Swatches/i18n/pt_BR.csv
deleted file mode 100644
index f0aa34bbef26e..0000000000000
--- a/app/code/Magento/Swatches/i18n/pt_BR.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"Swatch","Swatch"
-"Swatches per Product","Swatches per Product"
diff --git a/app/code/Magento/Swatches/i18n/zh_Hans_CN.csv b/app/code/Magento/Swatches/i18n/zh_Hans_CN.csv
deleted file mode 100644
index f0aa34bbef26e..0000000000000
--- a/app/code/Magento/Swatches/i18n/zh_Hans_CN.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"Swatch","Swatch"
-"Swatches per Product","Swatches per Product"
diff --git a/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php
new file mode 100644
index 0000000000000..a81f29280af96
--- /dev/null
+++ b/app/code/Magento/Theme/Controller/Result/JsFooterPlugin.php
@@ -0,0 +1,38 @@
+getContent();
+ $script = [];
+ if (strpos($content, '