diff --git a/src/MPWAR/Module/Economy/Application/DomainEventSubscriber/GiveWelcomeBonusOnAccountOpened.php b/src/MPWAR/Module/Economy/Application/DomainEventSubscriber/GiveWelcomeBonusOnAccountOpened.php new file mode 100644 index 0000000..e2da8ce --- /dev/null +++ b/src/MPWAR/Module/Economy/Application/DomainEventSubscriber/GiveWelcomeBonusOnAccountOpened.php @@ -0,0 +1,36 @@ +processor = $processor; + } + + /** + * @param AccountOpened|Message $message + * + * @throws AccountOwnerNotValidException + * + * @return void + */ + public function notify(Message $message) + { + $owner = new AccountOwner($message->aggregateId()); + $coins = AccountWelcomeBonus::coins(); + + $this->processor->__invoke($owner, $coins); + } +} diff --git a/src/MPWAR/Module/Economy/Domain/AccountWelcomeBonus.php b/src/MPWAR/Module/Economy/Domain/AccountWelcomeBonus.php new file mode 100644 index 0000000..70f04b0 --- /dev/null +++ b/src/MPWAR/Module/Economy/Domain/AccountWelcomeBonus.php @@ -0,0 +1,11 @@ +