49 parent::__construct($context);
65 if ($this->customerSession->isLoggedIn()) {
66 return $resultJson->setData(
69 'message' =>
__(
'Customer is already registered')
73 $orderId = $this->checkoutSession->getLastOrderId();
75 return $resultJson->setData(
78 'message' =>
__(
'Your session has expired')
83 $this->orderCustomerService->create($orderId);
84 return $resultJson->setData(
87 'message' =>
__(
'A letter with further instructions will be sent to your email.')
90 }
catch (\Exception $e) {
91 $this->messageManager->addExceptionMessage($e, $e->getMessage());
__construct(\Magento\Framework\App\Action\Context $context, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Customer\Model\Session $customerSession, \Magento\Sales\Api\OrderCustomerManagementInterface $orderCustomerService)