private Transfer TransferMoney(string counterAccount, Money amount)
        {
            // 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!");
            }
        }
        private Transfer MakeTransferWithAmountWithinLimit(string counterAccount, Money amount)
        {
            int sum = Accounts.CalculateSum(counterAccount);

            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. Check withdrawal limit:
            AssertAmount(amount);
            AssertCounterAccount(counterAccount);

            // 2. Assuming result is 9-digit bank account number, validate 11-test:
            int sum = Do11Test(counterAccount);

            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!");
            }
        }
Exemple #4
0
        public static Transfer GenerateTransferObject(Accounts from, string counterAccount, Money amount)
        {
            CheckingAccount acct = FindAcctByNumber(counterAccount);

            return(new Transfer(from, acct, amount));
        }
 public Transfer(CheckingAccount acct1, CheckingAccount acct2, Money m)
 {
 }
 public Transfer(SavingsAccount acct1, CheckingAccount acct2, Money m)
 {
 }