/** * {@inheritdoc} */ public function placeOrder($cartId, $agreements = null, 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(), $agreements, $paymentMethod); }
/** * {@inheritDoc} */ public function savePaymentInformationAndPlaceOrder($cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, \Magento\Quote\Api\Data\AddressInterface $billingAddress = null) { $this->savePaymentInformation($cartId, $paymentMethod, $billingAddress); try { $orderId = $this->cartManagement->placeOrder($cartId); } catch (\Exception $e) { throw new CouldNotSaveException(__('Unable to place order. Please try again later.'), $e); } return $orderId; }
/** * Execute operation * * @param Quote $quote * @param array $agreement * @return void * @throws LocalizedException */ public function execute(Quote $quote, array $agreement) { if (!$this->agreementsValidator->isValid($agreement)) { throw new LocalizedException(__('Please agree to all the terms and conditions before placing the order.')); } if ($this->getCheckoutMethod($quote) === Onepage::METHOD_GUEST) { $this->prepareGuestQuote($quote); } $this->disabledQuoteAddressValidation($quote); $quote->collectTotals(); $this->cartManagement->placeOrder($quote->getId()); }
/** * Place order for checkout flow * * @return string */ protected function placeCheckoutOrder() { $result = new DataObject(); $response = $this->getResponse(); try { $this->cartManagement->placeOrder($this->_getCheckout()->getQuote()->getId()); $result->setData('success', true); $this->eventManager->dispatch('checkout_directpost_placeOrder', ['result' => $result, 'action' => $this]); } catch (\Exception $exception) { $result->setData('error', true); $result->setData('error_messages', __('An error occurred on the server. Please try to place the order again.')); } if ($response instanceof Http) { $response->representJson($this->jsonHelper->jsonEncode($result)); } }
/** * {@inheritDoc} */ public function savePaymentInformationAndPlaceOrder($cartId, \Magento\Quote\Api\Data\PaymentInterface $paymentMethod, \Magento\Quote\Api\Data\AddressInterface $billingAddress) { $this->savePaymentInformation($cartId, $paymentMethod, $billingAddress); return $this->cartManagement->placeOrder($cartId); }
/** * {@inheritdoc} */ public function placeOrder($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); return $this->quoteManagement->placeOrder($quoteIdMask->getId()); }