public void Call(RegisterCustomerAccountCommand c) { var accountName = new AccountName(c.AccountName); var customer = _customerLoader(accountName); if (customer != Customer.None) { throw new CannotRegisterCustomerAlreadyExistsException(c); } Customer.RegisterAccount(accountName, c.Name, new Email(c.Email), c.Password, _passwordHasher, _dateTimeSource(), _eventWriter); }
public CannotRegisterCustomerAlreadyExistsException( RegisterCustomerAccountCommand registerCustomerAccountCommand) : base($"Cannot register customer as account name exists: {registerCustomerAccountCommand.AccountName}") { }