Skip to content

Commit eb028fa

Browse files
committed
B2B-1552: PayPal express compatibility fix
1 parent eaa1cdc commit eb028fa

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

app/code/Magento/Paypal/Controller/Express/GetTokenData.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,24 @@ public function execute(): ResultInterface
168168
return $controllerResult->setData($responseContent);
169169
}
170170

171+
/**
172+
* Prepare quote specified for checkout.
173+
*
174+
* @return \Magento\Quote\Api\Data\CartInterface
175+
* @throws LocalizedException
176+
*/
177+
private function prepareQuote()
178+
{
179+
$quoteId = $this->getRequest()->getParam('quote_id');
180+
if ($quoteId) {
181+
$quote = $this->userContext->getUserId()
182+
? $this->cartRepository->get($quoteId)
183+
: $this->guestCartRepository->get($quoteId);
184+
} else {
185+
$quote = $this->_getQuote();
186+
}
187+
return $quote;
188+
}
171189
/**
172190
* Get paypal token
173191
*
@@ -176,7 +194,7 @@ public function execute(): ResultInterface
176194
*/
177195
private function getToken(): ?string
178196
{
179-
$quote = $this->_getQuote();
197+
$quote = $this->prepareQuote();
180198
$this->_initCheckout($quote);
181199

182200
if ($quote->getIsMultiShipping()) {

0 commit comments

Comments
 (0)