| @@ 34-40 (lines=7) @@ | ||
| 31 | * @param MoneyDeposited $event Event Object |
|
| 32 | * @return void |
|
| 33 | */ |
|
| 34 | protected function applyMoneyDeposited(MoneyDeposited $event) |
|
| 35 | { |
|
| 36 | $data = $event->getPayload(); |
|
| 37 | $balance = $this->root->balance->getValue(); |
|
| 38 | $balance += $data->deposit->getValue(); |
|
| 39 | $this->root->balance = new UsDollar($balance); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Money Withdrawn Event Handle |
|
| @@ 48-54 (lines=7) @@ | ||
| 45 | * @param MoneyWithdrawn $event Event Object |
|
| 46 | * @return void |
|
| 47 | */ |
|
| 48 | protected function applyMoneyWithdrawn(MoneyWithdrawn $event) |
|
| 49 | { |
|
| 50 | $data = $event->getPayload(); |
|
| 51 | $balance = $this->root->balance->getValue(); |
|
| 52 | $balance -= $data->withdrawal->getValue(); |
|
| 53 | $this->root->balance = new UsDollar($balance); |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Create Account Command Handle |
|