diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml index ddd9fa5f2f18ae565d365c090d2ad2c8dd35f55a..3fbc198921448e9b6994db3d7358bbd185ae1e28 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml @@ -255,6 +255,12 @@ $numColumns = sizeof($block->getColumns()); deps.push('mage/adminhtml/grid'); + <?php if (is_array($block->getRequireJsDependencies())): ?> + <?php foreach ($block->getRequireJsDependencies() as $dependency): ?> + deps.push('<?php /* @escapeNotVerified */ echo $dependency; ?>'); + <?php endforeach; ?> + <?php endif; ?> + require(deps, function(<?php echo ($block->getDependencyJsObject() ? 'registry' : '') ?>){ <?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml index 696a2089c460c0c9924dc8f64008580a8cb82741..d63de55391c74e623a2f9af03e36372e78973069 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml @@ -334,6 +334,9 @@ <item name="displayArea" xsi:type="string">sidebar</item> <item name="config" xsi:type="array"> <item name="template" xsi:type="string">Magento_Checkout/sidebar</item> + <item name="deps" xsi:type="array"> + <item name="0" xsi:type="string">checkout.steps</item> + </item> </item> <item name="children" xsi:type="array"> <item name="summary" xsi:type="array"> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js index 84979c5f0cea808d63768be867b5c0e55a736081..2090bdabfe69b2af20f08e340af079cd76d551bd 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js @@ -4,15 +4,26 @@ */ define( [ + 'jquery', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/url-builder', 'mage/storage', 'Magento_Checkout/js/model/error-processor', 'Magento_Customer/js/model/customer', 'Magento_Checkout/js/action/get-totals', - 'Magento_Checkout/js/model/full-screen-loader' + 'Magento_Checkout/js/model/full-screen-loader', + 'Magento_Checkout/js/action/get-payment-information' ], - function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader) { + function ($, + quote, + urlBuilder, + storage, + errorProcessor, + customer, + getTotalsAction, + fullScreenLoader, + getPaymentInformationAction + ) { 'use strict'; return function (messageContainer) { @@ -44,14 +55,21 @@ define( serviceUrl, JSON.stringify(payload) ).done( function () { - getTotalsAction([]); + var deferred = null; + + if (!quote.isVirtual()) { + getTotalsAction([]); + } else { + deferred = $.Deferred(); + getPaymentInformationAction(deferred); + $.when(deferred).done(function () { + fullScreenLoader.stopLoader(); + }); + } } ).fail( function (response) { errorProcessor.process(response, messageContainer); - } - ).always( - function () { fullScreenLoader.stopLoader(); } ); diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index 6be04c3df05fd02b02b22fc06b586fc98c42082e..80d9a5982a6ab575ab68f6500ec72d0e2117d788 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -133,6 +133,9 @@ define( if (this.selectedAddress() && this.selectedAddress() != newAddressOption) { selectBillingAddress(this.selectedAddress()); checkoutData.setSelectedBillingAddress(this.selectedAddress().getKey()); + if (window.checkoutConfig.reloadOnBillingAddress) { + setBillingAddressAction(globalMessageList); + } } else { this.source.set('params.invalid', false); this.source.trigger(this.dataScopePrefix + '.data.validate'); diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js b/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js index 68f02b5d5722412fa17880c59124cf5ee84cdb03..7c4025a51c2e5a66b37de845cb9f7ccf02273227 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js @@ -72,6 +72,12 @@ define([ this.isLoading(addToCartCalls > 0); sidebarInitialized = false; initSidebar(); + + /**TODO: Extra options support. Should be refactored after MAGETWO-43159. */ + setInterval(function(){ + minicart.trigger('contentUpdated'); + }, 500); + }, this); $('[data-block="minicart"]').on('contentLoading', function(event) { addToCartCalls++; diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js b/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js index 7764f5ec9e0c8ddfe55af4847a6d0110becfe765..a65ec36aea72ea2b59f23585b986b49155e868c3 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js @@ -30,11 +30,16 @@ define([ paymentMethods.subscribe( function (changes) { checkoutDataResolver.resolvePaymentMethod(); + //remove renderer for "deleted" payment methods + _.each(changes, function (change) { + if (change.status === 'deleted') { + this.removeRenderer(change.value.method); + } + }, this); + //add renderer for "added" payment methods _.each(changes, function (change) { if (change.status === 'added') { this.createRenderer(change.value); - } else if (change.status === 'deleted') { - this.removeRenderer(change.value.method); } }, this); }, this, 'arrayChange'); diff --git a/app/code/Magento/Cookie/View/adminhtml/requirejs-config.js b/app/code/Magento/Cookie/view/adminhtml/requirejs-config.js similarity index 100% rename from app/code/Magento/Cookie/View/adminhtml/requirejs-config.js rename to app/code/Magento/Cookie/view/adminhtml/requirejs-config.js diff --git a/app/code/Magento/Cookie/View/frontend/layout/default.xml b/app/code/Magento/Cookie/view/frontend/layout/default.xml similarity index 100% rename from app/code/Magento/Cookie/View/frontend/layout/default.xml rename to app/code/Magento/Cookie/view/frontend/layout/default.xml diff --git a/app/code/Magento/Cookie/View/frontend/requirejs-config.js b/app/code/Magento/Cookie/view/frontend/requirejs-config.js similarity index 100% rename from app/code/Magento/Cookie/View/frontend/requirejs-config.js rename to app/code/Magento/Cookie/view/frontend/requirejs-config.js diff --git a/app/code/Magento/Cookie/View/frontend/templates/html/notices.phtml b/app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml similarity index 100% rename from app/code/Magento/Cookie/View/frontend/templates/html/notices.phtml rename to app/code/Magento/Cookie/view/frontend/templates/html/notices.phtml diff --git a/app/code/Magento/Cookie/View/frontend/templates/require_cookie.phtml b/app/code/Magento/Cookie/view/frontend/templates/require_cookie.phtml similarity index 100% rename from app/code/Magento/Cookie/View/frontend/templates/require_cookie.phtml rename to app/code/Magento/Cookie/view/frontend/templates/require_cookie.phtml diff --git a/app/code/Magento/Cookie/View/frontend/web/js/notices.js b/app/code/Magento/Cookie/view/frontend/web/js/notices.js similarity index 97% rename from app/code/Magento/Cookie/View/frontend/web/js/notices.js rename to app/code/Magento/Cookie/view/frontend/web/js/notices.js index 09094b971a26649ad5215ce28f573579dd15ae93..5c82ce314686ad05421be3b53447b6a4486aafa2 100644 --- a/app/code/Magento/Cookie/View/frontend/web/js/notices.js +++ b/app/code/Magento/Cookie/view/frontend/web/js/notices.js @@ -8,6 +8,7 @@ define([ "jquery/ui", "mage/cookies" ], function($){ + "use strict"; $.widget('mage.cookieNotices', { _create: function() { @@ -18,6 +19,7 @@ define([ } $(this.options.cookieAllowButtonSelector).on('click', $.proxy(function() { var cookieExpires = new Date(new Date().getTime() + this.options.cookieLifetime * 1000); + $.mage.cookies.set(this.options.cookieName, this.options.cookieValue, {expires: cookieExpires}); if ($.mage.cookies.get(this.options.cookieName)) { window.location.reload(); @@ -29,4 +31,4 @@ define([ }); return $.mage.cookieNotices; -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Cookie/View/frontend/web/js/require-cookie.js b/app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js similarity index 99% rename from app/code/Magento/Cookie/View/frontend/web/js/require-cookie.js rename to app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js index 22abfc82d56a686059fad13a7e141d8e9c7a22cc..6aedd8ac9b5b15f12e9e08c25fb05bb02805bbc0 100644 --- a/app/code/Magento/Cookie/View/frontend/web/js/require-cookie.js +++ b/app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js @@ -30,6 +30,7 @@ define([ */ _bind: function() { var events = {}; + $.each(this.options.triggers, function(index, value) { events['click ' + value] = '_checkCookie'; }); @@ -50,4 +51,4 @@ define([ }); return $.mage.requireCookie; -}); \ No newline at end of file +}); diff --git a/app/code/Magento/Customer/Controller/Account/LoginPost.php b/app/code/Magento/Customer/Controller/Account/LoginPost.php index 2faeca50ad9e158b75edac0a55191e5c40b79800..7b6191eb2556b8e4c6eb2325519a96fbc23ee21b 100644 --- a/app/code/Magento/Customer/Controller/Account/LoginPost.php +++ b/app/code/Magento/Customer/Controller/Account/LoginPost.php @@ -92,15 +92,12 @@ class LoginPost extends Action implements AccountInterface ); $this->messageManager->addError($message); $this->session->setUsername($login['username']); - } - catch (AuthenticationException $e) { + } catch (AuthenticationException $e) { $message = __('Invalid login or password.'); $this->messageManager->addError($message); $this->session->setUsername($login['username']); } catch (\Exception $e) { - $this->messageManager->addError( - __('Something went wrong while validating the login and password.') - ); + $this->messageManager->addError(__('Invalid login or password.')); } } else { $this->messageManager->addError(__('A login and a password are required.')); diff --git a/app/code/Magento/Customer/Controller/Ajax/Login.php b/app/code/Magento/Customer/Controller/Ajax/Login.php index 8491d5b08e4092774ed5b441d6d0010c63456c80..4258ebf1ef0e18d1c4042425036a343860e8ab38 100644 --- a/app/code/Magento/Customer/Controller/Ajax/Login.php +++ b/app/code/Magento/Customer/Controller/Ajax/Login.php @@ -116,7 +116,7 @@ class Login extends \Magento\Framework\App\Action\Action } catch (\Exception $e) { $response = [ 'errors' => true, - 'message' => __('Something went wrong while validating the login and password.') + 'message' => __('Invalid login or password.') ]; } /** @var \Magento\Framework\Controller\Result\Json $resultJson */ diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php index 6c2d57a9f95a8f3a098600fb66fb7c442e429625..e71e413d7e11738df8aa86059139958cd34584d8 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php @@ -423,7 +423,7 @@ class LoginPostTest extends \PHPUnit_Framework_TestCase case '\Exception': $this->messageManager->expects($this->once()) ->method('addError') - ->with(__('Something went wrong while validating the login and password.')) + ->with(__('Invalid login or password.')) ->willReturnSelf(); break; } diff --git a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js index f4f79932d397cd5ee11cc9a4ad1435547efcac1c..bfec0bf920246edbbacbeba286727b53d23b0c30 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/customer-data.js +++ b/app/code/Magento/Customer/view/frontend/web/js/customer-data.js @@ -107,6 +107,9 @@ define([ if (_.isEmpty(storage.keys())) { this.reload([], false); } else if (this.needReload()) { + _.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) { + buffer.notify(sectionName, sectionData); + }); this.reload(this.getExpiredKeys(), false); } else { _.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) { diff --git a/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php b/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php index 8bbdbef28307a9d0a8fd6ae8ef5d2f14808ed5a0..efd63ae579a5c9408560825c0118b8525b4d4d82 100644 --- a/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php +++ b/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php @@ -31,8 +31,9 @@ class CountryProvider */ public function getCountry(Quote $quote) { - return $quote->isVirtual() - ? $this->directoryHelper->getDefaultCountry() - : $quote->getShippingAddress()->getCountry(); + $address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress(); + return $address + ? $address->getCountry() + : $this->directoryHelper->getDefaultCountry(); } } diff --git a/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php b/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php index 13f1ad7d41451b30dc1e7c5a5fb8afab37d755e2..89fac656c32c26e2e679b285bbe9111944c9ea9e 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php @@ -33,14 +33,27 @@ class CountryProviderTest extends \PHPUnit_Framework_TestCase $this->assertEquals(1, $this->model->getCountry($quoteMock)); } - public function testGetCountryForVirtualQuote() + public function testGetCountryForVirtualQuoteWhenBillingAddressNotExist() { $quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false, false); $quoteMock->expects($this->once())->method('isVirtual')->willReturn(true); $addressMock = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false, false); $addressMock->expects($this->never())->method('getCountry'); $quoteMock->expects($this->never())->method('getShippingAddress'); + $quoteMock->expects($this->once())->method('getBillingAddress')->willReturn(null); $this->directoryMock->expects($this->once())->method('getDefaultCountry')->willReturn(10); $this->assertEquals(10, $this->model->getCountry($quoteMock)); } + + public function testGetCountryForVirtualQuoteWhenBillingAddressExist() + { + $quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false, false); + $quoteMock->expects($this->once())->method('isVirtual')->willReturn(true); + $addressMock = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false, false); + $addressMock->expects($this->once())->method('getCountry')->willReturn(10); + $quoteMock->expects($this->never())->method('getShippingAddress'); + $quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($addressMock); + $this->directoryMock->expects($this->never())->method('getDefaultCountry'); + $this->assertEquals(10, $this->model->getCountry($quoteMock)); + } } diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt index 02aa8c3d20512a666f0a1d817c1bf30f99e1c0cd..70168b63a4efb5f06f978a00c9896b0c1a6d5f12 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt +++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt @@ -173,10 +173,10 @@ app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summ app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js -app/code/Magento/Cookie/View/adminhtml/requirejs-config.js -app/code/Magento/Cookie/View/frontend/requirejs-config.js -app/code/Magento/Cookie/View/frontend/web/js/notices.js -app/code/Magento/Cookie/View/frontend/web/js/require-cookie.js +app/code/Magento/Cookie/view/adminhtml/requirejs-config.js +app/code/Magento/Cookie/view/frontend/requirejs-config.js +app/code/Magento/Cookie/view/frontend/web/js/notices.js +app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js app/code/Magento/Customer/view/adminhtml/requirejs-config.js app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js app/code/Magento/Customer/view/frontend/requirejs-config.js