public void Test_ProvisionRescheduledLoanProcessing() { Loan myContract = _SetContract(1000, 0.03m, OLoanTypes.Flat, new NonRepaymentPenalties(0, 0, 0.003, 0), false, 1, new DateTime(2010, 6, 6), 6); OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments rLI = _SetRepaymentOptions(myContract, false); ProvisionTable provisionTable = ProvisionTable.GetInstance(new User()); provisionTable.ProvisioningRates = new List <ProvisioningRate>(); provisionTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, Rate = 0.5 }); provisionTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, Rate = 1 }); provisionTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, Rate = 1.5 }); provisionTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 60, NbOfDaysMax = 999, Rate = 2 }); provisionTable.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = -1, NbOfDaysMax = -1, Rate = 1 }); Assert.AreEqual(new DateTime(2010, 7, 6), myContract.GetInstallment(0).ExpectedDate); Assert.AreEqual(new DateTime(2010, 8, 6), myContract.GetInstallment(1).ExpectedDate); myContract.Repay(1, new DateTime(2010, 8, 6), 100, false, false); ReschedulingOptions ro = new ReschedulingOptions { InterestRate = 0.04m, NewInstallments = 2, RepaymentDateOffset = 0, ChargeInterestDuringShift = true, ReschedulingDate = new DateTime(2010, 12, 1) }; myContract.Reschedule(ro); myContract.Rescheduled = true; rLI.CalculateNewInstallmentsWithLateFees(new DateTime(2010, 10, 1)); ProvisionEvent e = myContract.GetProvisionEvent(new DateTime(2010, 10, 1), provisionTable); Assert.AreEqual(e.Code, "LLPE"); Assert.AreEqual(e.Amount, 1000); myContract.Events.Add(e); }
public void TestFixtureSetUp() { provisionTable = ProvisionTable.GetInstance(new User()); provisionTable.ProvisioningRates = new List <ProvisioningRate>(); provisionTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, Rate = 2 }); provisionTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, Rate = 10 }); provisionTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, Rate = 25 }); }
public void TestFixtureSetUp() { _user = new User(); _provisions = ProvisionTable.GetInstance(_user); _provisions.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 30, Rate = 10 }); _provisions.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 31, NbOfDaysMax = 60, Rate = 25 }); _provisions.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 61, NbOfDaysMax = 90, Rate = 50 }); _provisions.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = 91, NbOfDaysMax = 180, Rate = 75 }); _provisions.Add(new ProvisioningRate { Number = 5, NbOfDaysMin = 181, NbOfDaysMax = 365, Rate = 100 }); _provisions.Add(new ProvisioningRate { Number = 6, NbOfDaysMin = 366, NbOfDaysMax = 99999, Rate = 100 }); _daysOff = NonWorkingDateSingleton.GetInstance(""); _daysOff.WeekEndDay1 = 6; _daysOff.WeekEndDay2 = 0; ApplicationSettings settings = ApplicationSettings.GetInstance(""); settings.DeleteAllParameters(); settings.AddParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash); settings.AddParameter(OGeneralSettings.PAYFIRSTINSTALLMENTREALVALUE, false); settings.AddParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true); settings.AddParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, false); settings.AddParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, true); }
public void TestFixtureSetUp() { ProvisionTable provisionTable = ProvisionTable.GetInstance(new User()); provisionTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 30, ProvisioningValue = 10, ProvisioningInterest = 10, ProvisioningPenalty = 10 }); provisionTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 25, ProvisioningInterest = 25, ProvisioningPenalty = 25 }); provisionTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 61, NbOfDaysMax = 90, ProvisioningValue = 50, ProvisioningInterest = 50, ProvisioningPenalty = 50 }); provisionTable.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = 91, NbOfDaysMax = 180, ProvisioningValue = 75, ProvisioningInterest = 75, ProvisioningPenalty = 75 }); provisionTable.Add(new ProvisioningRate { Number = 5, NbOfDaysMin = 181, NbOfDaysMax = 365, ProvisioningValue = 100, ProvisioningInterest = 100, ProvisioningPenalty = 100 }); provisionTable.Add(new ProvisioningRate { Number = 6, NbOfDaysMin = 366, NbOfDaysMax = 99999, ProvisioningValue = 100, ProvisioningInterest = 100, ProvisioningPenalty = 100 }); nonWorkingDateHelper = NonWorkingDateSingleton.GetInstance(""); nonWorkingDateHelper.WeekEndDay1 = 6; nonWorkingDateHelper.WeekEndDay2 = 0; nonWorkingDateHelper.PublicHolidays = new Dictionary <DateTime, string>(); nonWorkingDateHelper.PublicHolidays.Add(new DateTime(2006, 1, 1), "New Year Eve"); nonWorkingDateHelper.PublicHolidays.Add(new DateTime(2006, 12, 25), "Christmas"); dataParam = ApplicationSettings.GetInstance(""); dataParam.DeleteAllParameters(); dataParam.AddParameter(OGeneralSettings.PAYFIRSTINSTALLMENTREALVALUE, true); dataParam.AddParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, false); dataParam.AddParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, true); }
public void Test_ProvisionLoanProcessing() { Loan myContract = _SetContract(1000, 0.03m, OLoanTypes.Flat, new NonRepaymentPenalties(0, 0, 0.003, 0), false, 1, new DateTime(2010, 6, 6), 6); OpenCBS.CoreDomain.Contracts.Loans.LoanRepayment.Repayment.RepayLateInstallments.CalculateInstallments rLI = _SetRepaymentOptions(myContract, false); ProvisionTable provisionTable = ProvisionTable.GetInstance(new User()); provisionTable.ProvisioningRates = new List <ProvisioningRate>(); provisionTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, ProvisioningValue = 0.5, ProvisioningInterest = 0.5, ProvisioningPenalty = 0.5 }); provisionTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty = 1 }); provisionTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 1.5, ProvisioningInterest = 1.5, ProvisioningPenalty = 1.5 }); provisionTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 60, NbOfDaysMax = 999, ProvisioningValue = 2, ProvisioningInterest = 2, ProvisioningPenalty = 2 }); Assert.AreEqual(new DateTime(2010, 7, 6), myContract.GetInstallment(0).ExpectedDate); Assert.AreEqual(new DateTime(2010, 8, 6), myContract.GetInstallment(1).ExpectedDate); rLI.CalculateNewInstallmentsWithLateFees(new DateTime(2010, 10, 1)); ProvisionEvent e = myContract.GetProvisionEvent(new DateTime(2010, 10, 1), provisionTable); Assert.AreEqual(e.Code, "LLPE"); Assert.AreEqual(e.Amount, 2000); myContract.Events.Add(e); myContract.Repay(1, new DateTime(2010, 10, 20), 500, false, true); }
public void AddProvisioningRate(ProvisioningRate pR) { ProvisionTable pT = ProvisionTable.GetInstance(_user); pR.Number = pT.ProvisioningRates.Count + 1; pT.Add(pR); using (SqlConnection conn = _provisionningRuleManager.GetConnection()) using (SqlTransaction sqlTransac = conn.BeginTransaction()) { try { _provisionningRuleManager.AddProvisioningRate(pR, sqlTransac); sqlTransac.Commit(); } catch (Exception ex) { sqlTransac.Rollback(); throw ex; } } }
public void TestFixtureSetUp() { _generalSettings = ApplicationSettings.GetInstance(""); _generalSettings.DeleteAllParameters(); _generalSettings.AddParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true); _generalSettings.AddParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, false); _generalSettings.AddParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, true); _generalSettings.AddParameter(OGeneralSettings.PAYFIRSTINSTALLMENTREALVALUE, true); _generalSettings.AddParameter(OGeneralSettings.BAD_LOAN_DAYS, "180"); _generalSettings.AddParameter(OGeneralSettings.STOP_WRITEOFF_PENALTY, true); _generalSettings.AddParameter(OGeneralSettings.USE_DAILY_ACCRUAL_OF_PENALTY, false); _provisionningTable = ProvisionTable.GetInstance(new User()); _provisionningTable.ProvisioningRates = new List <ProvisioningRate>(); _provisionningTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 30, ProvisioningValue = 10 }); _provisionningTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 25 }); _provisionningTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 61, NbOfDaysMax = 90, ProvisioningValue = 50 }); _provisionningTable.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = 91, NbOfDaysMax = 180, ProvisioningValue = 75 }); _provisionningTable.Add(new ProvisioningRate { Number = 5, NbOfDaysMin = 181, NbOfDaysMax = 365, ProvisioningValue = 100 }); _provisionningTable.Add(new ProvisioningRate { Number = 6, NbOfDaysMin = 366, NbOfDaysMax = 99999, ProvisioningValue = 100 }); _nonWorkingDate = NonWorkingDateSingleton.GetInstance(""); _nonWorkingDate.PublicHolidays = new Dictionary <DateTime, string>(); _nonWorkingDate.WeekEndDay1 = 0; _nonWorkingDate.WeekEndDay2 = 1; }