From a6fb496f8bd66e1818f3c72f9607d62162a7a5fe Mon Sep 17 00:00:00 2001 From: GreRut Date: Mon, 11 Nov 2024 14:26:54 +0100 Subject: [PATCH] Fix: account closure --- EventSourcing/AccountAggregate.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/EventSourcing/AccountAggregate.cs b/EventSourcing/AccountAggregate.cs index 7068892..fbe7333 100644 --- a/EventSourcing/AccountAggregate.cs +++ b/EventSourcing/AccountAggregate.cs @@ -51,6 +51,9 @@ private void Apply(Event accountEvent) case ActivationEvent activation: Apply(activation); break; + case ClosureEvent closure: + Apply(closure); + break; default: throw new EventTypeNotSupportedException("162 ERROR_EVENT_NOT_SUPPORTED"); } @@ -117,6 +120,10 @@ private void Apply(CurrencyChangeEvent currencyChange) private void Apply(ClosureEvent closure) { - throw new NotImplementedException(); + if (AccountLog == null) + AccountLog = new List(); + var logMessage = new LogMessage("CLOSURE", closure.Reason.ToString(), closure.Timestamp); + AccountLog.Add(logMessage); + Status = AccountStatus.Closed; } }