public void Charge_agio_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); saving.Closure(new DateTime(2009, 1, 12), new User()); //agio for ten days Assert.AreEqual(-111.55, saving.GetBalance().Value); }
public void UpdateAccountsBalanceSaving() { Assert.Ignore(); // Ru55 SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User() { Id = 1 }, new DateTime(2009, 01, 01), _savingsBookProduct, null) { Code = "S/CR/2009/SAVIN-1/BAR-2", Status = OSavingsStatus.Active, InterestRate = 0.01, FlatWithdrawFees = 3, FlatTransferFees = 3, AgioFees = 0.1 }; saving.Events[0].User = new User() { Id = 1 }; saving.Id = _savingManager.Add(saving, new Person { Id = 6 }); saving = (SavingBookContract)_savingManager.Select(saving.Id); saving.Closure(new DateTime(2009, 02, 01), new User { Id = 1 }); saving.Withdraw(50, new DateTime(2009, 02, 01), "testWithdraw", new User { Id = 1 }, false, null); saving.Closure(new DateTime(2010, 01, 01), new User { Id = 1 }); SavingBookContract retrievedSaving = (SavingBookContract)_savingManager.Select(saving.Id); }
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); }
public void CalculateInterest_TwoOperation_In_OneDay() { SavingsBookProduct product = new SavingsBookProduct { Id = 1, InterestBase = OSavingInterestBase.Monthly, InterestFrequency = OSavingInterestFrequency.EndOfYear, CalculAmountBase = OSavingCalculAmountBase.MinimalAmount, WithdrawFeesType = OSavingsFeesType.Flat, FlatWithdrawFees = 0 }; SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1, FlatWithdrawFees = 0 }; saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller); saving.Withdraw(250, new DateTime(2009, 01, 15), "retrait", new User(), false, null); // saving.Deposit(100, new DateTime(2009, 01, 15), "depot", new User(), true, false, OPaymentMethods.Cash, null, null); saving.Deposit(100, new DateTime(2009, 01, 15), "depot", new User(), true, false, OSavingsMethods.Cash, null, null); List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>(); list = saving.CalculateInterest(new DateTime(2009, 02, 01), new User { Id = 1 }); Assert.AreEqual(list.Count, 1); Assert.AreEqual(list[0].Amount, 75); }
public void CalculateInterest_OneWeek_Withdraw_FirstDayOfMonth() { SavingsBookProduct product = new SavingsBookProduct { Id = 1, InterestBase = OSavingInterestBase.Weekly, InterestFrequency = OSavingInterestFrequency.EndOfYear, CalculAmountBase = OSavingCalculAmountBase.MinimalAmount, WithdrawFeesType = OSavingsFeesType.Flat, FlatWithdrawFees = 0 }; SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1, FlatWithdrawFees = 0 }; saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller); saving.Withdraw(100, new DateTime(2009, 01, 01), "retrait", new User(), false, null, new PaymentMethod()); List<SavingInterestsAccrualEvent> list = new List<SavingInterestsAccrualEvent>(); list = saving.CalculateInterest(new DateTime(2009, 01, 08), new User { Id = 1 }); Assert.AreEqual(list.Count, 1); Assert.AreEqual(list[0].Amount, 90); }
public void Get_Balance_At_Date() { SavingsBookProduct product = new SavingsBookProduct() { WithdrawFeesType = OSavingsFeesType.Flat, FlatWithdrawFees = 0 }; SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), product, null) { FlatWithdrawFees = 0, DepositFees = 5, CloseFees = 6, ManagementFees = 7}; saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller); // saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), false, false, OPaymentMethods.Cash, null, null); saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), false, false, OSavingsMethods.Cash, null, null); saving.Withdraw(230, new DateTime(2009, 02, 03), "retrait", new User(), false, null); Assert.AreEqual(saving.GetBalance(new DateTime(2009, 01, 31)), 1000); Assert.AreEqual(saving.GetBalance(new DateTime(2009, 02, 01)), 1100); Assert.AreEqual(saving.GetBalance(new DateTime(2009, 02, 02)), 1100); Assert.AreEqual(saving.GetBalance(new DateTime(2009, 02, 03)), 870); }
public void Cancel_Last_Withdraw_Event_After_Closure() { SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), _product, null) { InterestRate = 0.1, FlatWithdrawFees = 0, AgioFees = 0.1 }; saving.FirstDeposit(100, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller); saving.Closure(new DateTime(2009, 01, 02), new User()); saving.Withdraw(50, new DateTime(2009, 01, 02), "retrait", new User(), false, null); Assert.AreEqual(saving.GetBalance(), 50); saving.Closure(new DateTime(2009, 01, 05), new User()); Assert.AreEqual(saving.GetBalance(), 50); saving.CancelLastEvent(); Assert.AreEqual(saving.GetBalance(), 50); }
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); }