Example #1
0
        private Customer(
            CustomerId id,
            string email,
            string password,
            string firstName,
            string lastName,
            DateTime registrationDate,
            ICustomerChecker customerChecker
            )
        {
            CheckRule(new CustomerEmailMustBeUniqueRule(email, customerChecker));

            Id                = id;
            _email            = email;
            _password         = password;
            _firstName        = firstName;
            _lastName         = lastName;
            _registrationDate = registrationDate;

            AddDomainEvent(new CustomerCreatedDomainEvent(
                               id,
                               email,
                               password,
                               firstName,
                               lastName,
                               registrationDate
                               ));
        }
Example #2
0
        private CustomerRegistration(
            CustomerRegistrationId id,
            string email,
            string password,
            string firstName,
            string lastName,
            ICustomerChecker customerChecker
            )
        {
            CheckRule(new CustomerEmailMustBeUniqueRule(email, customerChecker));

            Id                = id;
            _email            = email;
            _password         = password;
            _firstName        = firstName;
            _lastName         = lastName;
            _status           = CustomerRegistrationStatus.WaitingForConfirmation;
            _registrationDate = SystemClock.Now;

            AddDomainEvent(new NewCustomerRegisteredDomainEvent(
                               Id,
                               _email,
                               _password,
                               _firstName,
                               _lastName,
                               _registrationDate
                               ));
        }
 public CustomerRegistrationConfirmedHandler(
     ICustomerRegistrationRepository customerRegistrationRepository,
     ICustomerRepository customerRepository,
     ICustomerChecker customerChecker
     )
 {
     _customerRegistrationRepository = customerRegistrationRepository;
     _customerRepository             = customerRepository;
     _customerChecker = customerChecker;
 }
 public RegisterNewCustomerCommandHandler(
     ICustomerRegistrationRepository customerRegistrationRepository,
     ICustomerChecker customerChecker,
     IPasswordHasher passwordHasher
     )
 {
     _customerRegistrationRepository = customerRegistrationRepository;
     _customerChecker = customerChecker;
     _passwordHasher  = passwordHasher;
 }
Example #5
0
 public CreateCustomerCommandHandler(
     ICustomerRepository customerRepository,
     ICustomerChecker customerChecker,
     IPasswordHasher passwordHasher
     )
 {
     _customerRepository = customerRepository;
     _customerChecker    = customerChecker;
     _passwordHasher     = passwordHasher;
 }
Example #6
0
 public static CustomerRegistration RegisterNewCustomer(
     CustomerRegistrationId id,
     string email,
     string password,
     string firstName,
     string lastName,
     ICustomerChecker customerChecker
     )
 {
     return(new CustomerRegistration(id, email, password, firstName, lastName, customerChecker));
 }
Example #7
0
 public static Customer CreateNew(
     CustomerId id,
     string email,
     string password,
     string firstName,
     string lastName,
     DateTime registrationDate,
     ICustomerChecker customerChecker
     )
 {
     return(new Customer(id, email, password, firstName, lastName, registrationDate, customerChecker));
 }
Example #8
0
 public Customer CreateCustomer(ICustomerChecker customerChecker)
 {
     return(Customer.CreateNew(
                new CustomerId(Id.Value),
                _email,
                _password,
                _firstName,
                _lastName,
                _registrationDate,
                customerChecker
                ));
 }
 public CustomerEmailMustBeUniqueRule(string email, ICustomerChecker customerChecker)
 {
     _email = email;
     _customerChecker = customerChecker;
 }