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