public void FlateBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithInterestAndKeepExpectedInstallment() { LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.Flat, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1, UseCents = true } }; package.KeepExpectedInstallment = true; package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB; Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); myContract.BadLoan = true; myContract.NonRepaymentPenalties.OverDuePrincipal = 0.003; myContract.NonRepaymentPenalties.OverDueInterest = 0.003; myContract.AnticipatedTotalRepaymentPenalties = 0.01; ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", true); CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase); repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance("")); //30 + 230 + 30 * 0.003 * 42 + 230 * 0.003 *14 Assert.AreEqual(273.44m, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2)); //NOT CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", false); //30 + 230 + 30 * 0.003 * 36 + 230 * 0.003 *12 Assert.AreEqual(270.74m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value); }
public void TestCalculateMaximumAmountWithDecliningBadLoanWith42dayslateWhenNonRepaymentFeesBaseOnOverDueWithInterestAndKeepNotExpectedInstallment() { LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.DecliningFixedInstallments, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1 }, RoundingType = ORoundingType.Approximate }; package.KeepExpectedInstallment = false; package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB; Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); myContract.BadLoan = true; myContract.NonRepaymentPenalties.OverDueInterest = 0.003; myContract.NonRepaymentPenalties.OverDuePrincipal = 0.003; myContract.AnticipatedTotalRepaymentPenalties = 0.01; CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase); repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance("")); //30 + 218.35 + 30 * 0.003 * 42 + 218.35 * 0.003 * 14 = 30 + 218 + 4 + 9 = 261 Assert.AreEqual(261, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2)); }
public void Flate_BadLoan_42DaysLate_BasedOnInitialAmount_KeepExpectedInstallment_Fees() { LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.Flat, ChargeInterestWithinGracePeriod = true, KeepExpectedInstallment = true, AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB, Currency = new Currency { Id = 1 } }; Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); myContract.BadLoan = true; myContract.NonRepaymentPenalties.InitialAmount = 0.003; myContract.AnticipatedTotalRepaymentPenalties = 0.01; //42 days late CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase); repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance("")); //30 + 230 + 1000 * 0.003 * 42 = 386 Assert.AreEqual(386, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2)); }
public void Declining_BadLoanWith42dayslateWhenNonRepaymentFeesBaseOnInitialAmountAndKeepExpectedInstallment() { ApplicationSettings.GetInstance("").UpdateParameter("CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS", true); LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.DecliningFixedInstallments, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1, UseCents = true }, RoundingType = ORoundingType.Approximate }; package.KeepExpectedInstallment = true; package.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB; Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())); myContract.BadLoan = true; myContract.NonRepaymentPenalties.InitialAmount = 0.003; myContract.AnticipatedTotalRepaymentPenalties = 0.01; CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase); repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance("")); //30 + 218.35 + 1000 * 0.003 * 42 Assert.AreEqual(374.35m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value); }
public void _Flate_BadLoan_42dayslate_BasedOnOverDueWithoutInterest_KeepExpectedInstallment() { ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true); LoanProduct package = new LoanProduct { InstallmentType = new InstallmentType(1, "Monthly", 0, 1), LoanType = OLoanTypes.Flat, ChargeInterestWithinGracePeriod = true, Currency = new Currency { Id = 1, UseCents = true }, KeepExpectedInstallment = true, AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingOLB }; Loan myContract = new Loan(package, 1000, 0.03m, 6, 1, new DateTime(2006, 1, 1), new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())) { BadLoan = true, NonRepaymentPenalties = { OverDuePrincipal = 0.003 }, AnticipatedTotalRepaymentPenalties = 0.01 }; CreditContractOptions cCO = new CreditContractOptions(package.LoanType, package.KeepExpectedInstallment, false, 0, 0, false, 0, package.AnticipatedTotalRepaymentPenaltiesBase); repayStrategy = new CalculateMaximumAmountToRegradingLoanStrategy(cCO, myContract, new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance("")); //30 + 230 + 200 * 0.003 * 14 Assert.AreEqual(268.4m, Math.Round(repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value, 2)); //NOT CALCULATION_LATE_FEES_DURING_PUBLIC_HOLIDAYS ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, false); //30 + 230 + 200 * 0.003 * 12 Assert.AreEqual(266.60m, repayStrategy.CalculateMaximumAmountToRegradingLoan(new DateTime(2006, 3, 15)).Value); }
private void CalculateAmountToRegradingLoan() { _maximumAmountToRegradingLoan = _amountToRegradingLoan.CalculateMaximumAmountToRegradingLoan(_date); }