/** * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer * * @return void */ protected function hydrateCustomerTransfer(QuoteTransfer $quoteTransfer, CustomerTransfer $customerTransfer) { $customerTransfer->setFirstName($quoteTransfer->getBillingAddress()->getFirstName()); $customerTransfer->setLastName($quoteTransfer->getBillingAddress()->getLastName()); if ($customerTransfer->getEmail() === null) { $customerTransfer->setEmail($quoteTransfer->getBillingAddress()->getEmail()); } }
/** * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer * * @return bool */ public function tryAuthorizeCustomerByEmailAndPassword(CustomerTransfer $customerTransfer) { $result = false; $customerEntity = $this->queryContainer->queryCustomerByEmail($customerTransfer->getEmail())->findOne(); if ($customerEntity !== null) { $result = $this->isValidPassword($customerEntity->getPassword(), $customerTransfer->getPassword()); } return $result; }
/** * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer * * @throws \Spryker\Zed\Customer\Business\Exception\CustomerNotFoundException * * @return \Orm\Zed\Customer\Persistence\SpyCustomer */ protected function getCustomerFromCustomerTransfer(CustomerTransfer $customerTransfer) { $customer = null; if ($customerTransfer->getEmail()) { $customer = $this->queryContainer->queryCustomerByEmail($customerTransfer->getEmail())->findOne(); } elseif ($customerTransfer->getIdCustomer()) { $customer = $this->queryContainer->queryCustomerById($customerTransfer->getIdCustomer())->findOne(); } if ($customer === null) { throw new CustomerNotFoundException(sprintf('Customer not found for email `%s` or ID `%s`.', $customerTransfer->getEmail(), $customerTransfer->getIdCustomer())); } return $customer; }