I'm building a ecommerce system by using DDD. In this system I have two bounded contexts: Identity & Access and Sales.
Customers can register themselves by filling in a form with their name, email and password. Then in the Sales context, I register a customer with:
$customer = new Customer($request->name, $request->email);
$this->customers->add($customer);
The Customer aggregate raises an CustomerWasRegistered event.
The Identity & Access context reacts on this event and creates a SystemUser aggregate for that customer:
$user = new SystemUser($email, $password);
$this->users->add($user);
My question: because the Customer aggregate doesn't know about a password (and neither the CustomerWasRegistered event). How can I get this password from the request to the Identity & Access context?
I see two solutions here:
In both cases you avoid sending password to the Sales BC.