Skip to content

Commit 13118ce

Browse files
committed
Merge remote-tracking branch 'origin/2.3.3-develop' into MC-19089
2 parents 789ed27 + 8bc73be commit 13118ce

File tree

26 files changed

+356
-90
lines changed

26 files changed

+356
-90
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
9+
<default>
10+
<admin>
11+
<usage>
12+
<enabled>
13+
1
14+
</enabled>
15+
</usage>
16+
</admin>
17+
</default>
18+
</config>

app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ $taxDataHelper = $this->helper(Magento\Tax\Helper\Data::class);
2828
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
2929
<dd>
3030
<?php if (isset($_formatedOptionValue['full_view'])) :?>
31-
<?= $block->escapeHtml($_formatedOptionValue['full_view']) ?>
31+
<?= /* @noEscape */ $_formatedOptionValue['full_view'] ?>
3232
<?php else :?>
33-
<?= $block->escapeHtml($_formatedOptionValue['value']) ?>
33+
<?= /* @noEscape */ $_formatedOptionValue['value'] ?>
3434
<?php endif; ?>
3535
</dd>
3636
<?php endforeach; ?>

app/code/Magento/Checkout/view/frontend/web/js/action/select-payment-method.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ define([
1212
'use strict';
1313

1414
return function (paymentMethod) {
15-
paymentMethod.__disableTmpl = {
16-
title: true
17-
};
18-
15+
if (paymentMethod) {
16+
paymentMethod.__disableTmpl = {
17+
title: true
18+
};
19+
}
1920
quote.paymentMethod(paymentMethod);
2021
};
2122
});

app/code/Magento/Checkout/view/frontend/web/js/action/set-payment-information-extended.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,33 @@ define([
1313
'Magento_Checkout/js/model/error-processor',
1414
'Magento_Customer/js/model/customer',
1515
'Magento_Checkout/js/action/get-totals',
16-
'Magento_Checkout/js/model/full-screen-loader'
17-
], function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader) {
16+
'Magento_Checkout/js/model/full-screen-loader',
17+
'underscore'
18+
], function (quote, urlBuilder, storage, errorProcessor, customer, getTotalsAction, fullScreenLoader, _) {
1819
'use strict';
1920

21+
/**
22+
* Filter template data.
23+
*
24+
* @param {Object|Array} data
25+
*/
26+
var filterTemplateData = function (data) {
27+
return _.each(data, function (value, key, list) {
28+
if (_.isArray(value) || _.isObject(value)) {
29+
list[key] = filterTemplateData(value);
30+
}
31+
32+
if (key === '__disableTmpl') {
33+
delete list[key];
34+
}
35+
});
36+
};
37+
2038
return function (messageContainer, paymentData, skipBilling) {
2139
var serviceUrl,
2240
payload;
2341

42+
paymentData = filterTemplateData(paymentData);
2443
skipBilling = skipBilling || false;
2544
payload = {
2645
cartId: quote.getQuoteId(),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ define([
1313
'jquery-ui-modules/widget',
1414
'mage/decorate',
1515
'mage/collapsible',
16-
'mage/cookies'
16+
'mage/cookies',
17+
'jquery-ui-modules/effect-fade'
1718
], function ($, authenticationPopup, customerData, alert, confirm, _) {
1819
'use strict';
1920

app/code/Magento/MysqlMq/Model/ResourceModel/Queue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function getMessages($queueName, $limit = null)
151151
'queue_message_status.status IN (?)',
152152
[QueueManagement::MESSAGE_STATUS_NEW, QueueManagement::MESSAGE_STATUS_RETRY_REQUIRED]
153153
)->where('queue.name = ?', $queueName)
154-
->order('queue_message_status.updated_at ASC');
154+
->order(['queue_message_status.updated_at ASC', 'queue_message_status.id ASC']);
155155

156156
if ($limit) {
157157
$select->limit($limit);

app/code/Magento/MysqlMq/Test/Unit/Model/ResourceModel/QueueTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ public function testGetMessages()
206206
]
207207
)->willReturnSelf();
208208
$select->expects($this->once())
209-
->method('order')->with('queue_message_status.updated_at ASC')->willReturnSelf();
209+
->method('order')
210+
->with(['queue_message_status.updated_at ASC', 'queue_message_status.id ASC'])
211+
->willReturnSelf();
210212
$select->expects($this->once())->method('limit')->with($limit)->willReturnSelf();
211213
$connection->expects($this->once())->method('fetchAll')->with($select)->willReturn($messages);
212214
$this->assertEquals($messages, $this->queue->getMessages($queueName, $limit));

app/code/Magento/Persistent/Observer/CheckExpirePersistentQuoteObserver.php

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
namespace Magento\Persistent\Observer;
77

88
use Magento\Framework\Event\ObserverInterface;
9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Quote\Api\CartRepositoryInterface;
11+
use Magento\Quote\Api\Data\CartInterface;
912
use Magento\Quote\Model\Quote;
1013

1114
/**
@@ -74,6 +77,11 @@ class CheckExpirePersistentQuoteObserver implements ObserverInterface
7477
*/
7578
private $quote;
7679

80+
/**
81+
* @var CartRepositoryInterface
82+
*/
83+
private $quoteRepository;
84+
7785
/**
7886
* @param \Magento\Persistent\Helper\Session $persistentSession
7987
* @param \Magento\Persistent\Helper\Data $persistentData
@@ -82,6 +90,7 @@ class CheckExpirePersistentQuoteObserver implements ObserverInterface
8290
* @param \Magento\Customer\Model\Session $customerSession
8391
* @param \Magento\Checkout\Model\Session $checkoutSession
8492
* @param \Magento\Framework\App\RequestInterface $request
93+
* @param CartRepositoryInterface $quoteRepository
8594
*/
8695
public function __construct(
8796
\Magento\Persistent\Helper\Session $persistentSession,
@@ -90,7 +99,8 @@ public function __construct(
9099
\Magento\Framework\Event\ManagerInterface $eventManager,
91100
\Magento\Customer\Model\Session $customerSession,
92101
\Magento\Checkout\Model\Session $checkoutSession,
93-
\Magento\Framework\App\RequestInterface $request
102+
\Magento\Framework\App\RequestInterface $request,
103+
CartRepositoryInterface $quoteRepository
94104
) {
95105
$this->_persistentSession = $persistentSession;
96106
$this->quoteManager = $quoteManager;
@@ -99,6 +109,7 @@ public function __construct(
99109
$this->_eventManager = $eventManager;
100110
$this->_persistentData = $persistentData;
101111
$this->request = $request;
112+
$this->quoteRepository = $quoteRepository;
102113
}
103114

104115
/**
@@ -146,9 +157,11 @@ public function execute(\Magento\Framework\Event\Observer $observer)
146157
*/
147158
private function isPersistentQuoteOutdated(): bool
148159
{
149-
if ((!$this->_persistentData->isEnabled() || !$this->_persistentData->isShoppingCartPersist())
160+
if (!($this->_persistentData->isEnabled() && $this->_persistentData->isShoppingCartPersist())
150161
&& !$this->_customerSession->isLoggedIn()
151-
&& $this->_checkoutSession->getQuoteId()) {
162+
&& $this->_checkoutSession->getQuoteId()
163+
&& $this->isActiveQuote()
164+
) {
152165
return (bool)$this->getQuote()->getIsPersistent();
153166
}
154167
return false;
@@ -181,6 +194,21 @@ private function getQuote(): Quote
181194
return $this->quote;
182195
}
183196

197+
/**
198+
* Check if quote is active.
199+
*
200+
* @return bool
201+
*/
202+
private function isActiveQuote(): bool
203+
{
204+
try {
205+
$this->quoteRepository->getActive($this->_checkoutSession->getQuoteId());
206+
return true;
207+
} catch (NoSuchEntityException $e) {
208+
return false;
209+
}
210+
}
211+
184212
/**
185213
* Check current request is coming from onepage checkout page.
186214
*

app/code/Magento/Persistent/Test/Unit/Observer/CheckExpirePersistentQuoteObserverTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace Magento\Persistent\Test\Unit\Observer;
88

9+
use Magento\Framework\Exception\NoSuchEntityException;
10+
use Magento\Quote\Api\CartRepositoryInterface;
911
use Magento\Quote\Model\Quote;
1012

1113
/**
@@ -63,6 +65,11 @@ class CheckExpirePersistentQuoteObserverTest extends \PHPUnit\Framework\TestCase
6365
*/
6466
private $quoteMock;
6567

68+
/**
69+
* @var \PHPUnit_Framework_MockObject_MockObject|CartRepositoryInterface
70+
*/
71+
private $quoteRepositoryMock;
72+
6673
/**
6774
* @inheritdoc
6875
*/
@@ -82,6 +89,7 @@ protected function setUp()
8289
->disableOriginalConstructor()
8390
->setMethods(['getRequestUri', 'getServer'])
8491
->getMockForAbstractClass();
92+
$this->quoteRepositoryMock = $this->createMock(CartRepositoryInterface::class);
8593

8694
$this->model = new \Magento\Persistent\Observer\CheckExpirePersistentQuoteObserver(
8795
$this->sessionMock,
@@ -90,7 +98,8 @@ protected function setUp()
9098
$this->eventManagerMock,
9199
$this->customerSessionMock,
92100
$this->checkoutSessionMock,
93-
$this->requestMock
101+
$this->requestMock,
102+
$this->quoteRepositoryMock
94103
);
95104
$this->quoteMock = $this->getMockBuilder(Quote::class)
96105
->setMethods(['getCustomerIsGuest', 'getIsPersistent'])
@@ -111,12 +120,19 @@ public function testExecuteWhenCanNotApplyPersistentData()
111120

112121
public function testExecuteWhenPersistentIsNotEnabled()
113122
{
123+
$quoteId = 'quote_id_1';
124+
114125
$this->persistentHelperMock
115126
->expects($this->once())
116127
->method('canProcess')
117128
->with($this->observerMock)
118129
->willReturn(true);
119130
$this->persistentHelperMock->expects($this->exactly(2))->method('isEnabled')->willReturn(false);
131+
$this->checkoutSessionMock->expects($this->exactly(2))->method('getQuoteId')->willReturn($quoteId);
132+
$this->quoteRepositoryMock->expects($this->once())
133+
->method('getActive')
134+
->with($quoteId)
135+
->willThrowException(new NoSuchEntityException());
120136
$this->eventManagerMock->expects($this->never())->method('dispatch');
121137
$this->model->execute($this->observerMock);
122138
}

app/code/Magento/QuoteGraphQl/Model/Cart/UpdateCartItem.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ public function execute(Quote $cart, int $cartItemId, float $quantity, array $cu
9393
)
9494
);
9595
}
96-
97-
$this->quoteRepository->save($cart);
9896
}
9997

10098
/**
@@ -105,7 +103,7 @@ public function execute(Quote $cart, int $cartItemId, float $quantity, array $cu
105103
* @param float $quantity
106104
* @throws GraphQlNoSuchEntityException
107105
* @throws NoSuchEntityException
108-
* @throws GraphQlNoSuchEntityException
106+
* @throws GraphQlInputException
109107
*/
110108
private function updateItemQuantity(int $itemId, Quote $cart, float $quantity)
111109
{

0 commit comments

Comments
 (0)