diff --git a/vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php b/vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php index 461a12c87aeb3..048d46e7cdbf3 100644 --- a/vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php +++ b/vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php @@ -14,6 +14,7 @@ use Magento\Quote\Api\CartRepositoryInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Quote\Model\Quote; +use Magento\Quote\Model\GuestCart\GetGuestCart; /** * Guest payment information management model. @@ -74,5 +75,10 @@ class GuestPaymentInformationManagement implements \Magento\Checkout\Api\GuestPa private $saveRateLimitDisabled = false; + /** + * @var GetGuestCart|null + */ + private $getGuestCart; + /** * @param \Magento\Quote\Api\GuestBillingAddressManagementInterface $billingAddressManagement * @param \Magento\Quote\Api\GuestPaymentMethodManagementInterface $paymentMethodManagement @@ -82,6 +88,7 @@ class GuestPaymentInformationManagement implements \Magento\Checkout\Api\GuestPa * @param CartRepositoryInterface $cartRepository * @param PaymentProcessingRateLimiterInterface|null $paymentsRateLimiter * @param PaymentSavingRateLimiterInterface|null $savingRateLimiter + * @param GetGuestCart|null $getGuestCart * @codeCoverageIgnore */ public function __construct( @@ -92,7 +99,8 @@ public function __construct( \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory, CartRepositoryInterface $cartRepository, ?PaymentProcessingRateLimiterInterface $paymentsRateLimiter = null, - ?PaymentSavingRateLimiterInterface $savingRateLimiter = null + ?PaymentSavingRateLimiterInterface $savingRateLimiter = null, + ?GetGuestCart $getGuestCart = null ) { $this->billingAddressManagement = $billingAddressManagement; $this->paymentMethodManagement = $paymentMethodManagement; @@ -104,6 +112,7 @@ public function __construct( ?? ObjectManager::getInstance()->get(PaymentProcessingRateLimiterInterface::class); $this->savingRateLimiter = $savingRateLimiter ?? ObjectManager::getInstance()->get(PaymentSavingRateLimiterInterface::class); + $this->getGuestCart = $getGuestCart ?? ObjectManager::getInstance()->get(GetGuestCart::class); } /** @@ -165,6 +174,7 @@ public function savePaymentInformation( $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); /** @var Quote $quote */ $quote = $this->cartRepository->getActive($quoteIdMask->getQuoteId()); + $this->getGuestCart->checkIsGuestCart((int)$quote->getCustomerId(), $cartId); if ($billingAddress) { $billingAddress->setEmail($email); @@ -190,6 +200,7 @@ public function savePaymentInformation( public function getPaymentInformation($cartId) { $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); + $this->getGuestCart->execute($cartId, (int) $quoteIdMask->getQuoteId()); return $this->paymentInformationManagement->getPaymentInformation($quoteIdMask->getQuoteId()); } diff --git a/vendor/magento/module-checkout/Model/GuestShippingInformationManagement.php b/vendor/magento/module-checkout/Model/GuestShippingInformationManagement.php index b1194a25ab548..61a7a6d4063e6 100644 --- a/vendor/magento/module-checkout/Model/GuestShippingInformationManagement.php +++ b/vendor/magento/module-checkout/Model/GuestShippingInformationManagement.php @@ -6,5 +6,8 @@ namespace Magento\Checkout\Model; +use Magento\Framework\App\ObjectManager; +use Magento\Quote\Model\GuestCart\GetGuestCart; + class GuestShippingInformationManagement implements \Magento\Checkout\Api\GuestShippingInformationManagementInterface { /** @@ -18,20 +21,28 @@ class GuestShippingInformationManagement implements \Magento\Checkout\Api\GuestS protected $shippingInformationManagement; + /** + * @var GetGuestCart|null + */ + private $getGuestCart; + /** * @param \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory * @param \Magento\Checkout\Api\ShippingInformationManagementInterface $shippingInformationManagement + * @param GetGuestCart|null $getGuestCart * @codeCoverageIgnore */ public function __construct( \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory, - \Magento\Checkout\Api\ShippingInformationManagementInterface $shippingInformationManagement + \Magento\Checkout\Api\ShippingInformationManagementInterface $shippingInformationManagement, + ?GetGuestCart $getGuestCart = null ) { $this->quoteIdMaskFactory = $quoteIdMaskFactory; $this->shippingInformationManagement = $shippingInformationManagement; + $this->getGuestCart = $getGuestCart ?? ObjectManager::getInstance()->get(GetGuestCart::class); } /** - * {@inheritDoc} + * @inheritDoc */ public function saveAddressInformation( $cartId, @@ -39,6 +50,7 @@ public function saveAddressInformation( ) { /** @var $quoteIdMask \Magento\Quote\Model\QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); + $this->getGuestCart->execute($cartId, (int) $quoteIdMask->getQuoteId()); return $this->shippingInformationManagement->saveAddressInformation( $quoteIdMask->getQuoteId(), $addressInformation diff --git a/vendor/magento/module-checkout/Model/GuestTotalsInformationManagement.php b/vendor/magento/module-checkout/Model/GuestTotalsInformationManagement.php index 3551f3dca4a3a..59f50be59d5e6 100644 --- a/vendor/magento/module-checkout/Model/GuestTotalsInformationManagement.php +++ b/vendor/magento/module-checkout/Model/GuestTotalsInformationManagement.php @@ -6,5 +6,9 @@ + namespace Magento\Checkout\Model; +use Magento\Framework\App\ObjectManager; +use Magento\Quote\Model\GuestCart\GetGuestCart; + class GuestTotalsInformationManagement implements \Magento\Checkout\Api\GuestTotalsInformationManagementInterface { /** @@ -18,20 +23,28 @@ class GuestTotalsInformationManagement implements \Magento\Checkout\Api\GuestTot protected $totalsInformationManagement; + /** + * @var GetGuestCart|null + */ + private $getGuestCart; + /** * @param \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory * @param \Magento\Checkout\Api\TotalsInformationManagementInterface $totalsInformationManagement + * @param GetGuestCart|null $getGuestCart * @codeCoverageIgnore */ public function __construct( \Magento\Quote\Model\QuoteIdMaskFactory $quoteIdMaskFactory, - \Magento\Checkout\Api\TotalsInformationManagementInterface $totalsInformationManagement + \Magento\Checkout\Api\TotalsInformationManagementInterface $totalsInformationManagement, + ?GetGuestCart $getGuestCart = null ) { $this->quoteIdMaskFactory = $quoteIdMaskFactory; $this->totalsInformationManagement = $totalsInformationManagement; + $this->getGuestCart = $getGuestCart ?? ObjectManager::getInstance()->get(GetGuestCart::class); } /** - * {@inheritDoc} + * @inheritDoc */ public function calculate( $cartId, @@ -39,6 +52,7 @@ public function calculate( ) { /** @var $quoteIdMask \Magento\Quote\Model\QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); + $this->getGuestCart->execute($cartId, (int) $quoteIdMask->getQuoteId()); return $this->totalsInformationManagement->calculate( $quoteIdMask->getQuoteId(), $addressInformation