customerLinkRepository = $customerLinkRepository; $this->customerLinkFactory = $customerLinkFactory; $this->customerInterface = $customerInterface; $this->customerDataFactory = $customerDataFactory; $this->accountManagement = $accountManagement; $this->random = $random; } /** * {@inheritdoc} */ public function getByCustomerId($customerId) { return $this->customerLinkRepository->get($customerId); } /** * {@inheritdoc} */ public function create(AmazonCustomerInterface $amazonCustomer) { $customerData = $this->customerDataFactory->create(); $customerData->setFirstname($amazonCustomer->getFirstName()); $customerData->setLastname($amazonCustomer->getLastName()); $customerData->setEmail($amazonCustomer->getEmail()); $password = $this->random->getRandomString(64); $customer = $this->accountManagement->createAccount($customerData, $password); return $customer; } /** * {@inheritdoc} */ public function updateLink($customerId, $amazonId) { $customerLink = $this->customerLinkFactory->create(); $customerLink ->load($customerId, 'customer_id') ->setAmazonId($amazonId) ->setCustomerId($customerId); $this->customerLinkRepository->save($customerLink); } }