quoteManagement = $quoteManagement; $this->quoteIdMaskFactory = $quoteIdMaskFactory; $this->cartRepository = $cartRepository; } /** * {@inheritdoc} */ public function createEmptyCart() { /** @var $quoteIdMask \Magento\Quote\Model\QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create(); $cartId = $this->quoteManagement->createEmptyCart(); $quoteIdMask->setQuoteId($cartId)->save(); return $quoteIdMask->getMaskedId(); } /** * {@inheritdoc} */ public function assignCustomer($cartId, $customerId, $storeId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); return $this->quoteManagement->assignCustomer($quoteIdMask->getQuoteId(), $customerId, $storeId); } /** * {@inheritdoc} */ public function placeOrder($cartId, PaymentInterface $paymentMethod = null) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); $this->cartRepository->get($quoteIdMask->getQuoteId()) ->setCheckoutMethod(CartManagementInterface::METHOD_GUEST); return $this->quoteManagement->placeOrder($quoteIdMask->getQuoteId(), $paymentMethod); } }