public void Withdraw(Money amount) { if(_balance - amount < new Money(0)) { throw new CannotOverdrawAccountException("The operation would overdraw the account"); } _balance -= amount; _transactions.Add(new Transaction(new Money(0) - amount, TransactionType.Deposit)); }
public Account(string accountHolder, int uniqueIdentifier, Money startingBalance) { AccountHolderName = accountHolder; UniqueIdentifier = uniqueIdentifier; _balance = startingBalance; }
public void Deposit(Money amount) { _balance += amount; _transactions.Add(new Transaction(amount, TransactionType.Deposit)); }
public Transaction(Money amount, TransactionType type) { Amount = amount; Type = type; Timestamp = SystemTime.GetTime(); }