Beispiel #1
0
 /**
  * @param array $orderData
  * @return void
  */
 public function createOrder($orderData)
 {
     $this->setPhraseRenderer();
     if (!empty($orderData)) {
         $orderCreateModel = $this->processQuote($orderData);
         if (!empty($orderData['payment'])) {
             $orderCreateModel->setPaymentData($orderData['payment']);
             $orderCreateModel->getQuote()->getPayment()->addData($orderData['payment']);
         }
         $customer = $this->customerRepository->get($orderData['order']['account']['email'], $this->storeManager->getWebsite()->getId());
         $orderCreateModel->getQuote()->setCustomer($customer);
         $orderCreateModel->getSession()->setCustomerId($customer->getId());
         $order = $orderCreateModel->importPostData($orderData['order'])->createOrder();
         $orderItem = $this->getOrderItemForTransaction($order);
         $this->invoiceOrder($orderItem);
         $this->shipOrder($orderItem);
         if ($orderData['refund'] === "yes") {
             $this->refundOrder($orderItem);
         }
         $registryItems = ['rule_data', 'currently_saved_addresses', 'current_invoice', 'current_shipment'];
         $this->unsetRegistryData($registryItems);
         $this->currentSession->unsQuoteId();
         $this->currentSession->unsStoreId();
         $this->currentSession->unsCustomerId();
     }
 }