private void LoadNormalTransferFee() { if (!(_saving.Product is SavingsBookProduct)) { return; } SavingsBookProduct p = (SavingsBookProduct)_saving.Product; if (p.FlatTransferFees.HasValue || p.FlatTransferFeesMin.HasValue) { if (p.FlatTransferFees.HasValue) { _feesMin = _feesMax = p.FlatTransferFees; } else { _feesMin = p.FlatTransferFeesMin; _feesMax = p.FlatTransferFeesMax; } } else { if (p.RateTransferFees.HasValue) { _feesMin = _feesMax = (decimal)p.RateTransferFees * 100; } else { _feesMin = (decimal)p.RateTransferFeesMin * 100; _feesMax = (decimal)p.RateTransferFeesMax * 100; } } }
public void CalculateInterest_OneMonth_Withdraw() { 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(100, new DateTime(2009, 01, 15), "depot", new User(), false, 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, 90); }
public void PostingInterests_OnePosting() { SavingsBookProduct product = new SavingsBookProduct { Id = 1, InterestBase = OSavingInterestBase.Daily, InterestFrequency = OSavingInterestFrequency.EndOfYear }; SavingBookContract saving = new SavingBookContract( ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1 }; List <SavingInterestsPostingEvent> list = new List <SavingInterestsPostingEvent>(); list = saving.PostingInterests(new DateTime(2010, 01, 01), new User { Id = 1 }); Assert.AreEqual(list.Count, 1); }
public void CalculateInterest_ThirtyDay() { SavingsBookProduct product = new SavingsBookProduct { Id = 1, InterestBase = OSavingInterestBase.Daily, InterestFrequency = OSavingInterestFrequency.EndOfYear }; SavingBookContract saving = new SavingBookContract( ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1 }; List <SavingInterestsAccrualEvent> list = new List <SavingInterestsAccrualEvent>(); list = saving.CalculateInterest(new DateTime(2009, 01, 31), new User { Id = 1 }); Assert.AreEqual(31, list.Count); }
private void nudAmount_ValueChanged(object sender, EventArgs e) { try { _amount = nudAmount.Value; bool isFlat = false; if (_saving is SavingBookContract) { SavingsBookProduct p = (SavingsBookProduct)_saving.Product; if (IsNormalTransfer()) { isFlat = p.FlatTransferFees.HasValue || p.FlatTransferFeesMin.HasValue; } else { isFlat = p.InterBranchTransferFee.IsFlat; } } if (_bookingDirection == OSavingsOperation.Credit) { isFlat = true; } OCurrency fee = isFlat ? updAmountFees.Value : _amount * updAmountFees.Value / 100; nudTotalAmount.Value = (_amount + fee).Value; } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } }
public void PostingInterests_NoPosting() { SavingsBookProduct product = new SavingsBookProduct { Id = 1, InterestBase = OSavingInterestBase.Daily, InterestFrequency = OSavingInterestFrequency.EndOfMonth, Periodicity = new InstallmentType("Monthly", 0, 1) }; SavingBookContract saving = new SavingBookContract( ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1, NextMaturity = new DateTime(2009, 01, 01) }; List <SavingInterestsPostingEvent> list = new List <SavingInterestsPostingEvent>(); list = saving.PostingInterests(new DateTime(2009, 01, 02), new User { Id = 1 }); Assert.AreEqual(0, list.Count); }
public void PostingInterests_OnePosting() { SavingsBookProduct product = new SavingsBookProduct { Id = 1, InterestBase = OSavingInterestBase.Daily, InterestFrequency = OSavingInterestFrequency.EndOfDay, Periodicity = new InstallmentType("Daily", 1, 0) }; SavingBookContract saving = new SavingBookContract( ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 01), null) { Product = product, InterestRate = 0.1 }; saving.NextMaturity = saving.CreationDate; List <SavingInterestsPostingEvent> list = new List <SavingInterestsPostingEvent>(); list = saving.PostingInterests( saving.NextMaturity.Value, new User { Id = 1 } ); Assert.AreEqual(1, list.Count); }
public void CalculateInterest_OneWeek() { SavingsBookProduct product = new SavingsBookProduct { Id = 1, InterestBase = OSavingInterestBase.Weekly, InterestFrequency = OSavingInterestFrequency.EndOfYear, CalculAmountBase = OSavingCalculAmountBase.MinimalAmount }; SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), new DateTime(2009, 01, 05), null) { Product = product, InterestRate = 0.1 }; saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller); List <SavingInterestsAccrualEvent> list = new List <SavingInterestsAccrualEvent>(); list = saving.CalculateInterest(new DateTime(2009, 01, 12), new User { Id = 1 }); Assert.AreEqual(list.Count, 1); Assert.AreEqual(list[0].Amount, 100); }
public void Test_RetrieveForSavings() { SavingsBookProduct savingsBookProduct = new SavingsBookProduct() { Id = 1 }; Person person = new Person { FirstName = "Michael", LastName = "Krejci", Activity = new EconomicActivity(1, "Agriculture", null, false) }; SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(), savingsBookProduct); person.Savings.Add(saving); Account specficAccount = _rules.GetSpecificAccount(OAccounts.CASH_CREDIT, saving, OBookingDirections.Both); Assert.AreEqual(null, specficAccount); specficAccount = _rules.GetSpecificAccount(OAccounts.CASH, saving, OBookingDirections.Both); Assert.AreEqual("1020", specficAccount.Number); }
public void CalculateInterest_TwoOperation_In_OneDay() { 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(250, new DateTime(2009, 01, 02), "retrait", new User(), false, null); // saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), true, false, OPaymentMethods.Cash, null, null); saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), true, false, OSavingsMethods.Cash, null, null); 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, 75); }
public void TestAddSavingBookProduct() { SavingsBookProduct savingsProduct = new SavingsBookProduct { Name = "Good savings account", Code = "P123", InitialAmountMin = 100, InitialAmountMax = 200, DepositMin = 250, DepositMax = 400, WithdrawingMin = 400, WithdrawingMax = 450, TransferMin = 100, TransferMax = 500, InterestRateMin = 0.12, InterestRateMax = 0.20, BalanceMin = 1000, BalanceMax = 2000, InterestBase = OSavingInterestBase.Daily, InterestFrequency = OSavingInterestFrequency.EndOfYear, EntryFeesMin = 10, EntryFeesMax = 20, WithdrawFeesType = OSavingsFeesType.Flat, FlatWithdrawFeesMin = 1, FlatWithdrawFeesMax = 5, TransferFeesType = OSavingsFeesType.Flat, FlatTransferFeesMin = 1, FlatTransferFeesMax = 5, DepositFeesMin = 1, DepositFeesMax = 5, CloseFeesMin = 2, CloseFeesMax = 7, ManagementFeesMin = 4, ManagementFeesMax = 16, OverdraftFeesMin = 2, OverdraftFeesMax = 6, AgioFeesMin = 1, AgioFeesMax = 4, Currency = new Currency { Id = 1 } }; InstallmentType managementFeeFreq = new InstallmentType { Name = "Weekly", NbOfDays = 7, NbOfMonths = 0 }; savingsProduct.ManagementFeeFreq = managementFeeFreq; InstallmentType agioFeeFreq = new InstallmentType { Name = "Daily", NbOfDays = 1, NbOfMonths = 0 }; savingsProduct.AgioFeesFreq = agioFeeFreq; _savingProductManager = (SavingProductManager)container["SavingProductManager"]; _savingProductManager.Add(savingsProduct); Assert.Greater(savingsProduct.Id, 0); }
public void Get_Set_CalculAmountBase() { SavingsBookProduct product = new SavingsBookProduct { CalculAmountBase = OSavingCalculAmountBase.MinimalAmount }; Assert.AreEqual(OSavingCalculAmountBase.MinimalAmount, product.CalculAmountBase); }
public void Get_Set_InitialAmountMax() { SavingsBookProduct savings = new SavingsBookProduct { InitialAmountMax = 300m }; Assert.AreEqual(300m, savings.InitialAmountMax.Value); }
public void Get_Set_InitialAmountMin() { SavingsBookProduct savings = new SavingsBookProduct { InitialAmountMin = 150m }; Assert.AreEqual(150m, savings.InitialAmountMin.Value); }
public void Get_Set_ClientType() { SavingsBookProduct savings = new SavingsBookProduct { ClientType = OClientTypes.Person }; Assert.AreEqual(OClientTypes.Person, savings.ClientType); }
public void Get_Set_Code() { SavingsBookProduct savings = new SavingsBookProduct { Code = "Saving Product Code" }; Assert.AreEqual("Saving Product Code", savings.Code); }
public void Get_Set_RateWithdrawFeesMin() { SavingsBookProduct product = new SavingsBookProduct { RateWithdrawFeesMin = 0.01d }; Assert.AreEqual(0.01d, product.RateWithdrawFeesMin.Value); }
public void Get_Set_RateTransferFeesMax() { SavingsBookProduct product = new SavingsBookProduct { RateTransferFeesMax = 0.10d }; Assert.AreEqual(0.10d, product.RateTransferFeesMax.Value); }
public void Get_Set_RateTransferFees() { SavingsBookProduct product = new SavingsBookProduct { RateTransferFees = 0.05d }; Assert.AreEqual(0.05d, product.RateTransferFees.Value); }
public void Get_Set_FlatTransferFees() { SavingsBookProduct product = new SavingsBookProduct { FlatTransferFees = 25m }; Assert.AreEqual(25m, product.FlatTransferFees.Value); }
public void Get_Set_Delete() { SavingsBookProduct savings = new SavingsBookProduct { Delete = true }; Assert.IsTrue(savings.Delete); }
public void Get_Set_FlatTransferFeesMax() { SavingsBookProduct product = new SavingsBookProduct { FlatTransferFeesMax = 50m }; Assert.AreEqual(50m, product.FlatTransferFeesMax.Value); }
public void Get_Set_FlatTransferFeesMin() { SavingsBookProduct product = new SavingsBookProduct { FlatTransferFeesMin = 10m }; Assert.AreEqual(10m, product.FlatTransferFeesMin.Value); }
public void Get_Set_TransferFeesType() { SavingsBookProduct product = new SavingsBookProduct { TransferFeesType = OSavingsFeesType.Flat }; Assert.AreEqual(OSavingsFeesType.Flat, product.TransferFeesType); }
public void Get_Set_InterestBase() { SavingsBookProduct product = new SavingsBookProduct { InterestBase = OSavingInterestBase.Monthly }; Assert.AreEqual(OSavingInterestBase.Monthly, product.InterestBase); }
public void Get_Set_WithdrawFeesType() { SavingsBookProduct product = new SavingsBookProduct { WithdrawFeesType = OSavingsFeesType.Flat }; Assert.AreEqual(OSavingsFeesType.Flat, product.WithdrawFeesType); }
public void Get_Set_Name() { SavingsBookProduct savings = new SavingsBookProduct { Name = "Saving Product Name" }; Assert.AreEqual("Saving Product Name", savings.Name); }
public void Get_Set_InterestFrequency() { SavingsBookProduct product = new SavingsBookProduct { InterestFrequency = OSavingInterestFrequency.EndOfWeek }; Assert.AreEqual(OSavingInterestFrequency.EndOfWeek, product.InterestFrequency); }
public void Get_Set_Id() { SavingsBookProduct savings = new SavingsBookProduct { Id = 1 }; Assert.AreEqual(1, savings.Id); }
public void Get_Set_InterestRateMax() { SavingsBookProduct savings = new SavingsBookProduct { InterestRateMax = .55d }; Assert.AreEqual(.55d, savings.InterestRateMax); }