/** * @return void */ public function testUpdatePasswordException() { $customerTransfer = new CustomerTransfer(); $this->expectException(CustomerNotFoundException::class); $this->expectExceptionMessage('Customer not found by either ID ``, email `` or restore password key ``.'); $this->customer->updatePassword($customerTransfer); }
/** * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponseTransfer * * @return void */ public function checkPreConditions(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponseTransfer) { if ($quoteTransfer->getCustomer() !== null && $quoteTransfer->getCustomer()->getIdCustomer() !== null) { return; } if ($quoteTransfer->getCustomer()->getIsGuest() === true) { return; } if ($this->customer->hasEmail($quoteTransfer->getCustomer()->getEmail())) { $checkoutErrorTransfer = $this->createCheckoutErrorTransfer(); $checkoutErrorTransfer->setErrorCode(CheckoutConstants::ERROR_CODE_CUSTOMER_ALREADY_REGISTERED)->setMessage('Email already taken'); $checkoutResponseTransfer->setIsSuccess(false)->addError($checkoutErrorTransfer); } }
/** * @return \Spryker\Zed\Customer\Business\Customer\Customer */ public function createCustomer() { $config = $this->getConfig(); $senderPlugins = $this->getProvidedDependency(CustomerDependencyProvider::SENDER_PLUGINS); $customer = new Customer($this->getQueryContainer(), $this->createCustomerReferenceGenerator(), $config); foreach ($senderPlugins[CustomerDependencyProvider::REGISTRATION_TOKEN_SENDERS] as $sender) { $customer->addRegistrationTokenSender($sender); } foreach ($senderPlugins[CustomerDependencyProvider::PASSWORD_RESTORE_TOKEN_SENDERS] as $sender) { $customer->addPasswordRestoreTokenSender($sender); } foreach ($senderPlugins[CustomerDependencyProvider::PASSWORD_RESTORED_CONFIRMATION_SENDERS] as $sender) { $customer->addPasswordRestoredConfirmationSender($sender); } return $customer; }
/** * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer * * @return void */ protected function createNewCustomer(QuoteTransfer $quoteTransfer, CustomerTransfer $customerTransfer) { $this->hydrateCustomerTransfer($quoteTransfer, $customerTransfer); $customerResponseTransfer = $this->customer->register($customerTransfer); $quoteTransfer->setCustomer($customerResponseTransfer->getCustomerTransfer()); }