Skip to content

Commit dfc2093

Browse files
authored
Merge pull request #3564 from magento-mpi/port-2612
[MPI]-port-2612
2 parents bdf7c3e + 7d4adf4 commit dfc2093

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

app/code/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ public function beforeSavePaymentInformationAndPlaceOrder(
108108
$this->customerSession->setCustomerId(null);
109109
$this->customerSession->setCustomerGroupId(null);
110110
$this->quoteManager->convertCustomerCartToGuest();
111-
/** @var \Magento\Quote\Api\Data\CartInterface $quote */
112-
$quote = $this->cartRepository->get($this->checkoutSession->getQuote()->getId());
111+
$quoteId = $this->checkoutSession->getQuoteId();
112+
$quote = $this->cartRepository->get($quoteId);
113113
$quote->setCustomerEmail($email);
114114
$quote->getAddressesCollection()->walk('setEmail', ['email' => $email]);
115115
$this->cartRepository->save($quote);

app/code/Magento/Persistent/Model/QuoteManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ public function setGuest($checkQuote = false)
108108
*/
109109
public function convertCustomerCartToGuest()
110110
{
111+
$quoteId = $this->checkoutSession->getQuoteId();
111112
/** @var $quote \Magento\Quote\Model\Quote */
112-
$quote = $this->quoteRepository->get($this->checkoutSession->getQuoteId());
113+
$quote = $this->quoteRepository->get($quoteId);
113114
if ($quote && $quote->getId()) {
114115
$this->_setQuotePersistent = false;
115116
$quote->setIsActive(true)

app/code/Magento/Persistent/Test/Unit/Model/Checkout/GuestPaymentInformationManagementPluginTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrderCartConvertsToGuest
102102
['setCustomerEmail', 'getAddressesCollection'],
103103
false
104104
);
105-
$this->checkoutSessionMock->expects($this->once())->method('getQuote')->willReturn($quoteMock);
106-
$quoteMock->expects($this->once())->method('getId')->willReturn($cartId);
105+
$this->checkoutSessionMock->method('getQuoteId')->willReturn($cartId);
107106
$this->cartRepositoryMock->expects($this->once())->method('get')->with($cartId)->willReturn($quoteMock);
108107
$quoteMock->expects($this->once())->method('setCustomerEmail')->with($email);
109108
/** @var \Magento\Framework\Data\Collection|\PHPUnit_Framework_MockObject_MockObject $collectionMock */

0 commit comments

Comments
 (0)