Example #1
0
        public static Account.Account Create(AccountHolder accountHolder, string id, TypeOfBankScore typeOfBankScore, Status status = Status.Open)
        {
            Account.Account account = null;

            switch (typeOfBankScore)
            {
            case TypeOfBankScore.Base:
                accountHolder.AddAccount(id);
                account        = new BaseAccount(id, accountHolder);
                account.Status = status;
                return(account);

            case TypeOfBankScore.Silver:
                accountHolder.AddAccount(id);
                account        = new SilverAccount(id, accountHolder);
                account.Status = status;
                return(account);

            case TypeOfBankScore.Gold:
                accountHolder.AddAccount(id);
                account        = new GoldAccount(id, accountHolder);
                account.Status = status;
                return(account);

            case TypeOfBankScore.Platinum:
                accountHolder.AddAccount(id);
                account         = new PlatinumAccount(id, accountHolder);
                account.Status  = status;
                account.Balance = 20;
                return(account);

            default:
                throw new ArgumentException($"Invalid {nameof(typeOfBankScore)}");
            }
        }
Example #2
0
        public static Account.Account Create(AccountHolder accountHolder, string id, TypeOfBankScore typeOfBankScore,
                                             decimal balance, Status status = Status.Open)
        {
            var account = Create(accountHolder, id, typeOfBankScore, status);

            account.Deposite(balance);
            return(account);
        }
Example #3
0
        /// <summary>
        /// Opens the account.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="accountHolder">The account holder.</param>
        /// <param name="typeOfBankScore">The type of bank score.</param>
        public void OpenAccount(string firstName, string lastName, string email, TypeOfBankScore typeOfBankScore)
        {
            var accountHolder = new AccountHolder(firstName, lastName, email);

            var account = AccountFabric.Create(accountHolder, numberGenerator.GenerateAccountNumbers(), typeOfBankScore);

            repositoryAccountHolders.Create(accountHolder.ToDalAccountHolder());

            repositoryAccounts.Create(account.ToDalAccount());
        }
Example #4
0
        /// <summary>
        /// Creates the specified account holder.
        /// </summary>
        /// <param name="accountHolder">The account holder.</param>
        /// <param name="id">The identifier.</param>
        /// <param name="typeOfBankScore">The type of bank score.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">typeOfBankScore</exception>
        public Account Create(AccountHolder accountHolder, string id, TypeOfBankScore typeOfBankScore)
        {
            switch (typeOfBankScore)
            {
            case TypeOfBankScore.Base:
                accountHolder.ListOfAccounts.Add(id);
                return(new BaseAccount(id, accountHolder));

            case TypeOfBankScore.Silver:
                accountHolder.ListOfAccounts.Add(id);
                return(new SilverAccount(id, accountHolder));

            case TypeOfBankScore.Gold:
                accountHolder.ListOfAccounts.Add(id);
                return(new GoldAccount(id, accountHolder));

            case TypeOfBankScore.Platinum:
                accountHolder.ListOfAccounts.Add(id);
                return(new PlatinumAccount(id, accountHolder));

            default:
                throw new ArgumentException($"Invalid {nameof(typeOfBankScore)}");
            }
        }
Example #5
0
        /// <summary>
        /// Opens the account.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="accountHolder">The account holder.</param>
        /// <param name="typeOfBankScore">The type of bank score.</param>
        public void OpenAccount(IAccountNumberGenerator id, AccountHolder accountHolder, TypeOfBankScore typeOfBankScore)
        {
            var account = fabric.Create(accountHolder, id.GenerateAccountNumbers(), typeOfBankScore);

            account.Status = Status.Open;
            repository.Create(account);
        }