Ejemplo n.º 1
0
        public static AccountTransaction TransferTransaction(IAccountable fromAccount, IAccountable toAccount, decimal amount, string description)
        {
            if (fromAccount.Currency != toAccount.Currency)
            {
                throw new InvalidOperationException("Accounts should have same currency.");
            }

            return(new AccountTransaction(Guid.NewGuid(), amount, DateTimeOffset.UtcNow, fromAccount.Debit(amount), toAccount.Credit(amount), description));
        }