Suteki.TardisBank.Domain.Child.WithdrawInternal C# (CSharp) Method

WithdrawInternal() public method

public WithdrawInternal ( Parent parent, decimal amount, string description, string insufficientFundsMessage ) : void
parent Parent
amount decimal
description string
insufficientFundsMessage string
return void
        void WithdrawInternal(Parent parent, decimal amount, string description, string insufficientFundsMessage)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }

            if (!parent.HasChild(this))
            {
                throw new CashWithdrawException("Not Your Parent");
            }

            if (amount > Account.Balance)
            {
                throw new CashWithdrawException(insufficientFundsMessage);
            }

            Account.AddTransaction(description, -amount);
        }