Skip to content

Commit

Permalink
Create an order as a guest
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrzyzewski authored and cieslix committed Jun 10, 2020
1 parent 525b742 commit a2d7fa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 72 deletions.
18 changes: 4 additions & 14 deletions Model/OrderImporter/Creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ class Creator
/** @var StoreManagerInterface */
private $storeManager;

/** @var Customer */
private $customer;

/** @var ScopeConfigInterface */
private $scopeConfig;

Expand All @@ -85,7 +82,6 @@ class Creator
* @param CartExtensionFactory $cartExtensionFactory
* @param ProductRepositoryInterface $productRepository
* @param StoreManagerInterface $storeManager
* @param Customer $customer
* @param ScopeConfigInterface $scopeConfig
* @param QuoteManagement $quoteManagement
* @param Registry $registry
Expand All @@ -101,7 +97,6 @@ public function __construct(
CartExtensionFactory $cartExtensionFactory,
ProductRepositoryInterface $productRepository,
StoreManagerInterface $storeManager,
Customer $customer,
ScopeConfigInterface $scopeConfig,
QuoteManagement $quoteManagement,
Registry $registry
Expand All @@ -116,7 +111,6 @@ public function __construct(
$this->cartExtensionFactory = $cartExtensionFactory;
$this->productRepository = $productRepository;
$this->storeManager = $storeManager;
$this->customer = $customer;
$this->scopeConfig = $scopeConfig;
$this->quoteManagement = $quoteManagement;
$this->registry = $registry;
Expand Down Expand Up @@ -177,8 +171,6 @@ public function execute(CheckoutFormInterface $checkoutForm)
/**
* @param Quote $quote
* @param CheckoutFormInterface $checkoutForm
* @throws NoSuchEntityException
* @throws LocalizedException
*/
private function processCustomer(Quote $quote, CheckoutFormInterface $checkoutForm)
{
Expand All @@ -193,12 +185,10 @@ private function processCustomer(Quote $quote, CheckoutFormInterface $checkoutFo
);
}

$customer = $this->customer->get(
$checkoutForm->getBuyer(),
$store = $this->getStore(),
$checkoutForm->getInvoice()->getAddress()->getCompany()->getVatId()
);
$quote->assignCustomer($customer);
$quote->setCustomerFirstname($checkoutForm->getBuyer()->getFirstName());
$quote->setCustomerLastname($checkoutForm->getBuyer()->getLastName());
$quote->setCustomerEmail($checkoutForm->getBuyer()->getEmail());
$quote->setCustomerIsGuest(true);
}

/**
Expand Down
58 changes: 0 additions & 58 deletions Model/OrderImporter/Customer.php

This file was deleted.

0 comments on commit a2d7fa0

Please sign in to comment.