use of org.mifos.accounts.loan.schedule.domain.Installment in project head by mifos.
the class ScheduleCalculatorTest method overdueOnLastInstallmentIsRecoveredInLastInstallment.
@Test
public void overdueOnLastInstallmentIsRecoveredInLastInstallment() {
Installment installment1 = getInstallment(1, getDate(25, 9, 2010), 242.24, 20.40, 0);
Installment installment2 = getInstallment(2, getDate(25, 10, 2010), 247.67, 14.96, 0);
schedule = new Schedule(getDate(25, 8, 2010), 0.000658, BigDecimal.valueOf(1000d), asList(installment1, installment2));
scheduleCalculator.computeExtraInterest(schedule, getDate(20, 11, 2010));
assertThat(installment1.getExtraInterest().doubleValue(), is(0.0));
assertThat(installment2.getExtraInterest().doubleValue(), is(13.17));
}
use of org.mifos.accounts.loan.schedule.domain.Installment in project head by mifos.
the class ScheduleCalculatorTest method withOverDueInterestsAndFeesAndPenalty.
@Test
public void withOverDueInterestsAndFeesAndPenalty() {
Installment installment1 = getInstallment(1, getDate(25, 9, 2010), 242.24, 20.40, 0, 1, 2, 3, 4);
Installment installment2 = getInstallment(2, getDate(25, 10, 2010), 247.67, 14.96, 0, 1, 2, 3, 4);
Installment installment3 = getInstallment(3, getDate(25, 11, 2010), 252.22, 10.40, 0);
Installment installment4 = getInstallment(4, getDate(25, 12, 2010), 257.87, 5.09, 0);
schedule = new Schedule(getDate(25, 8, 2010), 0.000658, BigDecimal.valueOf(1000d), asList(installment1, installment2, installment3, installment4));
scheduleCalculator.applyPayment(schedule, BigDecimal.valueOf(560d), getDate(30, 9, 2010), false);
assertInstallmentPrincipals(installment1, 242.24, 0, 242.24);
assertInstallmentPrincipals(installment2, 247.67, 0, 247.67);
assertInstallmentPrincipals(installment3, 252.22, 215.82, 36.4);
assertInstallmentPrincipals(installment4, 257.87, 257.87, 0);
assertInstallmentInterests(installment1, 20.40, 0, 20.40);
assertInstallmentInterests(installment2, 7.79, 7.79, 2.49);
assertInstallmentInterests(installment3, 9.66, 9.66, 0);
assertInstallmentInterests(installment4, 5.09, 5.09, 0);
}
use of org.mifos.accounts.loan.schedule.domain.Installment in project head by mifos.
the class ScheduleCalculatorTest method shouldComputeExtraFullPayment.
@Test
public void shouldComputeExtraFullPayment() {
Installment installment1 = getInstallment(1, getDate(25, 9, 2010), 242.24, 20.40, 0);
Installment installment2 = getInstallment(2, getDate(25, 10, 2010), 247.67, 14.96, 0);
schedule = new Schedule(getDate(25, 8, 2010), 0.000658, BigDecimal.valueOf(1000d), asList(installment1, installment2));
scheduleCalculator.applyPayment(schedule, new BigDecimal(262.64), getDate(25, 9, 2010), false);
scheduleCalculator.applyPayment(schedule, new BigDecimal(262.63), getDate(25, 10, 2010), false);
scheduleCalculator.computeExtraInterest(schedule, getDate(30, 12, 2010));
assertThat(installment1.getExtraInterest().doubleValue(), is(0.0));
assertThat(installment2.getExtraInterest().doubleValue(), is(0.0));
}
use of org.mifos.accounts.loan.schedule.domain.Installment in project head by mifos.
the class ScheduleCalculatorTest method shouldComputeRepaymentAmountWhenOnDateExcessPaymentMade.
@Test
public void shouldComputeRepaymentAmountWhenOnDateExcessPaymentMade() {
Installment installment1 = getInstallment(1, getDate(25, 9, 2010), 242.24, 20.40, 0);
Installment installment2 = getInstallment(2, getDate(25, 10, 2010), 247.67, 14.96, 0);
Installment installment3 = getInstallment(3, getDate(25, 11, 2010), 252.22, 10.40, 0);
Installment installment4 = getInstallment(4, getDate(25, 12, 2010), 257.87, 5.09, 0);
schedule = new Schedule(getDate(25, 8, 2010), 0.000658, BigDecimal.valueOf(1000d), asList(installment1, installment2, installment3, installment4));
scheduleCalculator.applyPayment(schedule, BigDecimal.valueOf(500d), getDate(30, 10, 2010), false);
RepaymentResultsHolder repaymentResultsHolder = scheduleCalculator.computeRepaymentAmount(schedule, getDate(25, 12, 2010));
assertThat(repaymentResultsHolder.getTotalRepaymentAmount().doubleValue(), is(563.36));
assertThat(repaymentResultsHolder.getWaiverAmount().doubleValue(), is(5.09));
}
use of org.mifos.accounts.loan.schedule.domain.Installment in project head by mifos.
the class ScheduleCalculatorTest method shouldComputeOneDayExtraInterest.
@Test
public void shouldComputeOneDayExtraInterest() {
Installment installment1 = getInstallment(1, getDate(25, 9, 2010), 242.24, 20.40, 0);
Installment installment2 = getInstallment(2, getDate(25, 10, 2010), 247.67, 14.96, 0);
schedule = new Schedule(getDate(25, 8, 2010), 0.000658, BigDecimal.valueOf(1000d), asList(installment1, installment2));
scheduleCalculator.computeExtraInterest(schedule, getDate(26, 9, 2010));
assertThat(installment1.getExtraInterest().doubleValue(), is(0.0));
assertThat(installment2.getExtraInterest().doubleValue(), is(0.16));
}
Aggregations