public Transfer MakeTransfer(string counterAccount, Money amount) { // 1. Check withdrawal limit: if (amount.GreaterThan(this.transferLimit)) { throw new BusinessException("Limit exceeded!"); } if (Accounts.IsValid(counterAccount)) // <1> // 2. Look up counter account and make transfer object: { CheckingAccount acct = Accounts.FindAcctByNumber(counterAccount); Transfer result = new Transfer(this, acct, amount); // <2> return(result); } else { throw new BusinessException("Invalid account number!"); } }
public Transfer MakeTransfer(string counterAccount, Money amount) { // 1. Assuming result is 9-digit bank account number, validate with 11-test: if (Accounts.IsValid(counterAccount)) // <1> // 2. Look up counter account and make transfer object: { CheckingAccount acct = Accounts.FindAcctByNumber(counterAccount); Transfer result = new Transfer(this, acct, amount); // <2> if (result.CounterAccount.Equals(this.RegisteredCounterAccount)) { return(result); } else { throw new BusinessException("Counter-account not registered!"); } } else { throw new BusinessException("Invalid account number!!"); } }
public Transfer(CheckingAccount acct1, CheckingAccount acct2, Money m) { }