示例#1
0
        public void Charge_overdaft_fees()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User(), new DateTime(2009, 01, 01), null)
            {
                Product           = _bookProduct,
                AgioFees          = 0.01,
                ChequeDepositFees = 100,
                DepositFees       = 50,
                CloseFees         = 100,
                ReopenFees        = 100,
                OverdraftFees     = 100
            };

            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            Currency currency = new Currency()
            {
                UseCents = true, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM"
            };

            Assert.AreEqual(1000, saving.GetBalance().Value);

            //Below, we explicitly implement withdraw method from <Saving services>.<Withdraw>, since withdraw method of 'saving' object doesn't implement
            // overdraft fee by default

            List <SavingEvent> withdrawEvents = saving.Withdraw(1100, new DateTime(2009, 1, 2), "withdraw", new User(), false, null);

            if (saving.GetBalance() < 0 && !saving.InOverdraft)
            {
                saving.ChargeOverdraftFee(new DateTime(2009, 1, 2), new User());
            }

            Assert.AreEqual(-200, saving.GetBalance().Value);
        }
示例#2
0
        public void SeveralMgmtFeeEvents()
        {
            _saving                = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), new DateTime(2007, 08, 11), _bookProduct, null);
            _saving.AgioFees       = 0.1;
            _saving.ManagementFees = 50;
            _saving.FirstDeposit(10000, new DateTime(2007, 08, 01), null, new User(), Teller.CurrentTeller);
            _saving.Closure(new DateTime(2007, 12, 31), new User());
            List <SavingEvent> events = _saving.Events.FindAll(item => item is SavingManagementFeeEvent);

            Assert.AreEqual(events.Count, 4);
            Assert.AreEqual(9800, _saving.GetBalance().Value);
        }
示例#3
0
        public void CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek_Agio()
        {
            Assert.Ignore();
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
            _bookProduct.InterestFrequency = OSavingInterestFrequency.EndOfYear;
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                                               new DateTime(2009, 01, 01), null)
            {
                Product = _bookProduct, InterestRate = 0.1, AgioFees = 0.1
            };

            saving.Closure(new DateTime(2009, 01, 08), new User()
            {
                Id = 1
            });

            int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count;
            int postingEvents = saving.Events.FindAll(items => items is SavingInterestsPostingEvent).Count;

            List <SavingEvent> agioEvents = saving.Events.FindAll(items => items is SavingAgioEvent);

            Assert.AreEqual(agioEvents.Count, 7);
            Assert.AreEqual(agioEvents[0].Fee, 10);
            Assert.AreEqual(saving.GetBalance(), -170);

//            saving.Deposit(200, new DateTime(2009, 01, 08), "depot", new User(), false, false, OPaymentMethods.Cash, null, null);
            saving.Deposit(200, new DateTime(2009, 01, 08), "depot", new User(), false, false, OSavingsMethods.Cash, null, null);
            //saving.Withdraw(230, new DateTime(2009, 02, 03), "retrait", new User(), false);

            saving.Closure(new DateTime(2009, 01, 15), new User()
            {
                Id = 1
            });
            List <SavingEvent> agioEvents2 = saving.Events.FindAll(items => items is SavingAgioEvent);

            Assert.AreEqual(agioEvents2.Count, 13);
            Assert.AreEqual(agioEvents2[9].Fee, 13);
            Assert.AreEqual(saving.GetBalance(), -51);
        }
示例#4
0
        public void RateWithdrawFees()
        {
            SavingsBookProduct product = new SavingsBookProduct()
            {
                WithdrawFeesType    = OSavingsFeesType.Rate,
                RateWithdrawFeesMin = 0.01,
                RateWithdrawFeesMax = 0.05
            };

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), product, null)
            {
                RateWithdrawFees = 0.03
            };

            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);
            List <SavingEvent> withdrawEvents = saving.Withdraw(10, new DateTime(2009, 01, 02), "withdraw", new User(), false, null);

            Assert.AreEqual(1, withdrawEvents.Count);
            Assert.AreEqual(10, withdrawEvents[0].Amount.Value);
            Assert.AreEqual(0.3, ((ISavingsFees)withdrawEvents[0]).Fee.Value);
            Assert.AreEqual(989.7, saving.GetBalance().Value);
        }
示例#5
0
        public void Create_Saving_Book_Account_With_EntryFees()
        {
            SavingsBookProduct product = new SavingsBookProduct()
            {
                Name              = "NewSavingProduct",
                InitialAmountMin  = 1000,
                InitialAmountMax  = 2000,
                DepositMin        = 100,
                DepositMax        = 200,
                WithdrawingMin    = 100,
                WithdrawingMax    = 200,
                InterestRate      = 0.2,
                BalanceMin        = 1000,
                BalanceMax        = 2000,
                InterestBase      = OSavingInterestBase.Monthly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase  = OSavingCalculAmountBase.MinimalAmount,
                ClientType        = OClientTypes.All,
                EntryFeesMin      = 5,
                EntryFeesMax      = 15,
                Currency          = new Currency {
                    Id = 1
                }
            };

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                                               new DateTime(2009, 01, 01), product, null);

            saving.InitialAmount = 1000;
            saving.EntryFees     = 10;
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), 10, new User(), Teller.CurrentTeller);

            Assert.AreEqual(saving.GetBalance(), 1000);
            Assert.AreEqual(saving.Events.Count, 1);
            Assert.AreEqual(saving.InitialAmount, 1000);
            Assert.AreEqual(saving.EntryFees, 10);
        }
示例#6
0
        public void FlatWithdrawFees()
        {
            SavingsBookProduct product = new SavingsBookProduct()
            {
                WithdrawFeesType    = OSavingsFeesType.Flat,
                FlatWithdrawFeesMin = 1,
                FlatWithdrawFeesMax = 5
            };

            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User(), new DateTime(2009, 01, 01), product, null)
            {
                FlatWithdrawFees = 2,
            };

            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            List <SavingEvent> withdrawEvents = saving.Withdraw(10, new DateTime(2009, 01, 02), "withdraw", new User(), false, null, new PaymentMethod());

            Assert.AreEqual(1, withdrawEvents.Count);
            Assert.AreEqual(10, withdrawEvents[0].Amount.Value);
            Assert.AreEqual(2, ((ISavingsFees)withdrawEvents[0]).Fee.Value);
            Assert.AreEqual(988, saving.GetBalance().Value);
        }