public new Transfer makeTransfer(string counterAccount, Money amount) { if (amount.greaterThan(this.transferLimit)) { throw new BusinessException("Limit exceeded!"); } return base.makeTransfer(counterAccount, amount); }
public Transfer MakeTransfer(string counterAccount, Money amount) { if (IsValid(counterAccount)) { CheckingAccount acct = Accounts.FindAcctByNumber(counterAccount); return new Transfer(this, acct, amount); } else { throw new BusinessException("Invalid account number!"); } }
public override Transfer MakeTransfer(string counterAccount, Money amount) { Transfer result = base.MakeTransfer(counterAccount, amount); if (result.CounterAccount.Equals(this.RegisteredCounterAccount)) { return result; } else { throw new BusinessException("Counter-account not registered!"); } }
public Transfer makeTransfer(string counterAccount, Money amount) { if (isValid(counterAccount)) { CheckingAccount acct = eu.sig.training.ch04.v3.Accounts.findAcctByNumber(counterAccount); return new Transfer(this, acct, amount); } else { throw new BusinessException("Invalid account number!"); } }
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 virtual Transfer MakeTransfer(string counterAccount, Money amount) { // 1. Assuming result is 9-digit bank account number, validate 11-test: int sum = 0; // <1> for (int i = 0; i < counterAccount.Length; i++) { sum = sum + (9 - i) * (int)Char. GetNumericValue(counterAccount[i]); } if (sum % 11 == 0) { // 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. Check withdrawal limit: if (amount.GreaterThan(this.transferLimit)) { throw new BusinessException("Limit exceeded!"); } // 2. Assuming result is 9-digit bank account number, validate 11-test: int sum = 0; for (int i = 0; i < counterAccount.Length; i++) { sum = sum + (9 - i) * (int)Char.GetNumericValue( counterAccount[i]); } if (sum % 11 == 0) { // 3. Look up counter account and make transfer object: CheckingAccount acct = Accounts.FindAcctByNumber(counterAccount); Transfer result = new Transfer(this, acct, amount); 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 11-test: int sum = 0; // <1> for (int i = 0; i < counterAccount.Length; i++) { sum = sum + (9 - i) * (int)Char.GetNumericValue( counterAccount[i]); } if (sum % 11 == 0) { // 2. Look up counter account and make transfer object: CheckingAccount acct = Accounts.FindAcctByNumber(counterAccount); Transfer result = new Transfer(this, acct, amount); // <2> // 3. Check whether withdrawal is to registered counter account: 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(Account acct1, CheckingAccount acct2, Money m) { CounterAccount = acct2; }
public Transfer(SavingsAccount acct1, CheckingAccount acct2, Money m) { }