-
Notifications
You must be signed in to change notification settings - Fork 0
4. Technical Design
NoorulBhoelai edited this page Feb 16, 2018
·
12 revisions
As a Merchant I want all placed GuestOrders automatically be linked to an existing Customer(/ShadowCustomer) based on the email address of the order.
- Use the
\Magento\Quote\Model\QuoteManagement::submit
functionBefore
plugin and link the GuestOrder to the Customer by first fetching the Quote customer e-mail address and find existing Customers. If RESULT FOUND, invokesetCustomer()
andsetCustomerId()
with found Customer data. - Apply
$quote->setCustomerIsGuest(false)
Use the following Magento Data Fixtures:
- Use the tddwizard quote/customer to order fixture.
As a Merchant I want all placed GuestOrders that can’t be automatically linked to a Customer/ShadowCustomer (because it doesn’t exist) automatically create a ShadowCustomer.
- Use the
\Magento\Quote\Model\QuoteManagement::submit
functionBefore
plugin and link the GuestOrder to the Customer by first fetching the Quote customer e-mail address and find existing Customers. If RESULT NOT FOUND, invokesetCustomer()
andsetCustomerId()
after creating an account for the guest. - Apply
$quote->setCustomerIsGuest(false)
Use the following Magento Data Fixtures:
- Create issue for tddwizard and test manually in the frontend by creating a GuestOrder.
As a Merchant I want all historic GuestOrders to be linked to Customers / Create new ShadowCustomers based on the above criteria.
- Create cronjob with schedule_generate_every 15 minutes, with a limit GuestOrders search of X (configurable setting)
- Lookup all orders in
\Magento\Sales\Api\OrderRepositoryInterface::getList()
wheregetCustomerIsGuest
isfalse
. - Loop through each order and apply the same logic as in Story 1/2 with a BeforeSave plugin for
\Magento\Sales\Api\OrderRepositoryInterface::save
- (Should we create a helper class and function for the try/catch account creation??)
Use the following Magento Data Fixtures:
- create customer fixture (with e-mail address: [email protected])
- Fetch orders: Magento/Sales/_files/order_list.php (set one order with customer e-mail address to [email protected]
As a Visitor I shouldn’t know that a ShadowCustomer is being created: I shouldn’t receive email communication about it.
As a Visitor I shouldn’t know that a GuestOrder is being converted to a ShadowCustomerOrder: Order email communication should be as if I have placed a GuestOrder.
- Set $this->_registry->registry("skip_confirmation_if_email") to false.
- ``/**
-
Check whether confirmation may be skipped when registering using certain email address
-
@return bool */ protected function canSkipConfirmation() { if (!$this->getId()) { return false; }
/* If an email was used to start the registration process and it is the same email as the one used to register, then this can skip confirmation. */ $skipConfirmationIfEmail = $this->_registry->registry("skip_confirmation_if_email"); if (!$skipConfirmationIfEmail) { return false; }
return strtolower($skipConfirmationIfEmail) === strtolower($this->getEmail()); }``
-
- Use the tddwizard quote/customer to order fixture. In the test you should use the
assertFalse
function with$this->_registry->registry("skip_confirmation_if_email")