Skip to content

Commit 24abff1

Browse files
author
Korshenko, Olexii(okorshenko)
committed
Merge pull request #10 from magento-folks/bugs
[Folks] Bugfix
2 parents 58cb4c7 + 417f123 commit 24abff1

File tree

20 files changed

+83
-25
lines changed

20 files changed

+83
-25
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ $numColumns = sizeof($block->getColumns());
255255

256256
deps.push('mage/adminhtml/grid');
257257

258+
<?php if (is_array($block->getRequireJsDependencies())): ?>
259+
<?php foreach ($block->getRequireJsDependencies() as $dependency): ?>
260+
deps.push('<?php /* @escapeNotVerified */ echo $dependency; ?>');
261+
<?php endforeach; ?>
262+
<?php endif; ?>
263+
258264
require(deps, function(<?php echo ($block->getDependencyJsObject() ? 'registry' : '') ?>){
259265
<?php //TODO: getJsObjectName and getRowClickCallback has unexpected behavior. Should be removed ?>
260266

app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@
334334
<item name="displayArea" xsi:type="string">sidebar</item>
335335
<item name="config" xsi:type="array">
336336
<item name="template" xsi:type="string">Magento_Checkout/sidebar</item>
337+
<item name="deps" xsi:type="array">
338+
<item name="0" xsi:type="string">checkout.steps</item>
339+
</item>
337340
</item>
338341
<item name="children" xsi:type="array">
339342
<item name="summary" xsi:type="array">

app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,26 @@
44
*/
55
define(
66
[
7+
'jquery',
78
'Magento_Checkout/js/model/quote',
89
'Magento_Checkout/js/model/url-builder',
910
'mage/storage',
1011
'Magento_Checkout/js/model/error-processor',
1112
'Magento_Customer/js/model/customer',
1213
'Magento_Checkout/js/action/get-totals',
13-
'Magento_Checkout/js/model/full-screen-loader'
14+
'Magento_Checkout/js/model/full-screen-loader',
15+
'Magento_Checkout/js/action/get-payment-information'
1416
],
15-
function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader) {
17+
function ($,
18+
quote,
19+
urlBuilder,
20+
storage,
21+
errorProcessor,
22+
customer,
23+
getTotalsAction,
24+
fullScreenLoader,
25+
getPaymentInformationAction
26+
) {
1627
'use strict';
1728

1829
return function (messageContainer) {
@@ -44,14 +55,21 @@ define(
4455
serviceUrl, JSON.stringify(payload)
4556
).done(
4657
function () {
47-
getTotalsAction([]);
58+
var deferred = null;
59+
60+
if (!quote.isVirtual()) {
61+
getTotalsAction([]);
62+
} else {
63+
deferred = $.Deferred();
64+
getPaymentInformationAction(deferred);
65+
$.when(deferred).done(function () {
66+
fullScreenLoader.stopLoader();
67+
});
68+
}
4869
}
4970
).fail(
5071
function (response) {
5172
errorProcessor.process(response, messageContainer);
52-
}
53-
).always(
54-
function () {
5573
fullScreenLoader.stopLoader();
5674
}
5775
);

app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ define(
133133
if (this.selectedAddress() && this.selectedAddress() != newAddressOption) {
134134
selectBillingAddress(this.selectedAddress());
135135
checkoutData.setSelectedBillingAddress(this.selectedAddress().getKey());
136+
if (window.checkoutConfig.reloadOnBillingAddress) {
137+
setBillingAddressAction(globalMessageList);
138+
}
136139
} else {
137140
this.source.set('params.invalid', false);
138141
this.source.trigger(this.dataScopePrefix + '.data.validate');

app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ define([
7272
this.isLoading(addToCartCalls > 0);
7373
sidebarInitialized = false;
7474
initSidebar();
75+
76+
/**TODO: Extra options support. Should be refactored after MAGETWO-43159. */
77+
setInterval(function(){
78+
minicart.trigger('contentUpdated');
79+
}, 500);
80+
7581
}, this);
7682
$('[data-block="minicart"]').on('contentLoading', function(event) {
7783
addToCartCalls++;

app/code/Magento/Checkout/view/frontend/web/js/view/payment/list.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,16 @@ define([
3030
paymentMethods.subscribe(
3131
function (changes) {
3232
checkoutDataResolver.resolvePaymentMethod();
33+
//remove renderer for "deleted" payment methods
34+
_.each(changes, function (change) {
35+
if (change.status === 'deleted') {
36+
this.removeRenderer(change.value.method);
37+
}
38+
}, this);
39+
//add renderer for "added" payment methods
3340
_.each(changes, function (change) {
3441
if (change.status === 'added') {
3542
this.createRenderer(change.value);
36-
} else if (change.status === 'deleted') {
37-
this.removeRenderer(change.value.method);
3843
}
3944
}, this);
4045
}, this, 'arrayChange');

app/code/Magento/Cookie/View/frontend/web/js/notices.js renamed to app/code/Magento/Cookie/view/frontend/web/js/notices.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ define([
88
"jquery/ui",
99
"mage/cookies"
1010
], function($){
11+
"use strict";
1112

1213
$.widget('mage.cookieNotices', {
1314
_create: function() {
@@ -18,6 +19,7 @@ define([
1819
}
1920
$(this.options.cookieAllowButtonSelector).on('click', $.proxy(function() {
2021
var cookieExpires = new Date(new Date().getTime() + this.options.cookieLifetime * 1000);
22+
2123
$.mage.cookies.set(this.options.cookieName, this.options.cookieValue, {expires: cookieExpires});
2224
if ($.mage.cookies.get(this.options.cookieName)) {
2325
window.location.reload();
@@ -29,4 +31,4 @@ define([
2931
});
3032

3133
return $.mage.cookieNotices;
32-
});
34+
});

app/code/Magento/Cookie/View/frontend/web/js/require-cookie.js renamed to app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ define([
3030
*/
3131
_bind: function() {
3232
var events = {};
33+
3334
$.each(this.options.triggers, function(index, value) {
3435
events['click ' + value] = '_checkCookie';
3536
});
@@ -50,4 +51,4 @@ define([
5051
});
5152

5253
return $.mage.requireCookie;
53-
});
54+
});

app/code/Magento/Customer/Controller/Account/LoginPost.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,12 @@ public function execute()
9292
);
9393
$this->messageManager->addError($message);
9494
$this->session->setUsername($login['username']);
95-
}
96-
catch (AuthenticationException $e) {
95+
} catch (AuthenticationException $e) {
9796
$message = __('Invalid login or password.');
9897
$this->messageManager->addError($message);
9998
$this->session->setUsername($login['username']);
10099
} catch (\Exception $e) {
101-
$this->messageManager->addError(
102-
__('Something went wrong while validating the login and password.')
103-
);
100+
$this->messageManager->addError(__('Invalid login or password.'));
104101
}
105102
} else {
106103
$this->messageManager->addError(__('A login and a password are required.'));

app/code/Magento/Customer/Controller/Ajax/Login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function execute()
116116
} catch (\Exception $e) {
117117
$response = [
118118
'errors' => true,
119-
'message' => __('Something went wrong while validating the login and password.')
119+
'message' => __('Invalid login or password.')
120120
];
121121
}
122122
/** @var \Magento\Framework\Controller\Result\Json $resultJson */

app/code/Magento/Customer/Test/Unit/Controller/Account/LoginPostTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ protected function mockExceptions($exception, $username)
423423
case '\Exception':
424424
$this->messageManager->expects($this->once())
425425
->method('addError')
426-
->with(__('Something went wrong while validating the login and password.'))
426+
->with(__('Invalid login or password.'))
427427
->willReturnSelf();
428428
break;
429429
}

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ define([
107107
if (_.isEmpty(storage.keys())) {
108108
this.reload([], false);
109109
} else if (this.needReload()) {
110+
_.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {
111+
buffer.notify(sectionName, sectionData);
112+
});
110113
this.reload(this.getExpiredKeys(), false);
111114
} else {
112115
_.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {

app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ public function __construct(DirectoryHelper $directoryHelper)
3131
*/
3232
public function getCountry(Quote $quote)
3333
{
34-
return $quote->isVirtual()
35-
? $this->directoryHelper->getDefaultCountry()
36-
: $quote->getShippingAddress()->getCountry();
34+
$address = $quote->isVirtual() ? $quote->getBillingAddress() : $quote->getShippingAddress();
35+
return $address
36+
? $address->getCountry()
37+
: $this->directoryHelper->getDefaultCountry();
3738
}
3839
}

app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,27 @@ public function testGetCountryForNonVirtualQuote()
3333
$this->assertEquals(1, $this->model->getCountry($quoteMock));
3434
}
3535

36-
public function testGetCountryForVirtualQuote()
36+
public function testGetCountryForVirtualQuoteWhenBillingAddressNotExist()
3737
{
3838
$quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false, false);
3939
$quoteMock->expects($this->once())->method('isVirtual')->willReturn(true);
4040
$addressMock = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false, false);
4141
$addressMock->expects($this->never())->method('getCountry');
4242
$quoteMock->expects($this->never())->method('getShippingAddress');
43+
$quoteMock->expects($this->once())->method('getBillingAddress')->willReturn(null);
4344
$this->directoryMock->expects($this->once())->method('getDefaultCountry')->willReturn(10);
4445
$this->assertEquals(10, $this->model->getCountry($quoteMock));
4546
}
47+
48+
public function testGetCountryForVirtualQuoteWhenBillingAddressExist()
49+
{
50+
$quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false, false);
51+
$quoteMock->expects($this->once())->method('isVirtual')->willReturn(true);
52+
$addressMock = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false, false);
53+
$addressMock->expects($this->once())->method('getCountry')->willReturn(10);
54+
$quoteMock->expects($this->never())->method('getShippingAddress');
55+
$quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($addressMock);
56+
$this->directoryMock->expects($this->never())->method('getDefaultCountry');
57+
$this->assertEquals(10, $this->model->getCountry($quoteMock));
58+
}
4659
}

dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summ
173173
app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js
174174
app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js
175175
app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js
176-
app/code/Magento/Cookie/View/adminhtml/requirejs-config.js
177-
app/code/Magento/Cookie/View/frontend/requirejs-config.js
178-
app/code/Magento/Cookie/View/frontend/web/js/notices.js
179-
app/code/Magento/Cookie/View/frontend/web/js/require-cookie.js
176+
app/code/Magento/Cookie/view/adminhtml/requirejs-config.js
177+
app/code/Magento/Cookie/view/frontend/requirejs-config.js
178+
app/code/Magento/Cookie/view/frontend/web/js/notices.js
179+
app/code/Magento/Cookie/view/frontend/web/js/require-cookie.js
180180
app/code/Magento/Customer/view/adminhtml/requirejs-config.js
181181
app/code/Magento/Customer/view/adminhtml/web/edit/tab/js/addresses.js
182182
app/code/Magento/Customer/view/frontend/requirejs-config.js

0 commit comments

Comments
 (0)