use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsBOIntegrationTest method testGetDetailsOfInstallmentsInArrearsWithPaymentDone.
@Test
public void testGetDetailsOfInstallmentsInArrearsWithPaymentDone() throws Exception {
savings = getSavingsAccount();
AccountActionDateEntity accountActionDateEntity = savings.getAccountActionDate(Short.valueOf("1"));
((SavingsScheduleEntity) accountActionDateEntity).setActionDate(offSetCurrentDate(1));
accountActionDateEntity.setPaymentStatus(PaymentStatus.PAID);
savings = (SavingsBO) saveAndFetch(savings);
Assert.assertEquals(savings.getDetailsOfInstallmentsInArrears().size(), 0);
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsBOIntegrationTest method testIsTrxnDateValid_AfterFirstMeeting.
@Test
public void testIsTrxnDateValid_AfterFirstMeeting() throws Exception {
createInitialObjects();
savingsOffering = TestObjectFactory.createSavingsProduct("dfasdasd1", "sad1", RecommendedAmountUnit.COMPLETE_GROUP);
savings = helper.createSavingsAccount(savingsOffering, group, AccountState.SAVINGS_ACTIVE, userContext);
savings = TestObjectFactory.getObject(SavingsBO.class, savings.getAccountId());
int i = -5;
for (AccountActionDateEntity actionDate : savings.getAccountActionDates()) {
((SavingsScheduleEntity) actionDate).setActionDate(offSetCurrentDate(i--));
}
savings.update();
savings = TestObjectFactory.getObject(SavingsBO.class, savings.getAccountId());
java.util.Date trxnDate = offSetCurrentDate(-5);
Date meetingDate = new CustomerPersistence().getLastMeetingDateForCustomer(savings.getCustomer().getCustomerId());
boolean repaymentIndependentOfMeetingEnabled = new ConfigurationPersistence().isRepaymentIndepOfMeetingEnabled();
if (AccountingRules.isBackDatedTxnAllowed()) {
Assert.assertTrue(savings.isTrxnDateValid(trxnDate, meetingDate, repaymentIndependentOfMeetingEnabled));
} else {
Assert.assertFalse(savings.isTrxnDateValid(trxnDate, meetingDate, repaymentIndependentOfMeetingEnabled));
}
group = TestObjectFactory.getGroup(group.getCustomerId());
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsScheduleIntegrationTest method createWeeklySavingScheduleSecondInstallmentFallsInNextMeetingHoliday.
@Ignore
@Test
public void createWeeklySavingScheduleSecondInstallmentFallsInNextMeetingHoliday() throws Exception {
buildAndPersistHoliday(expectedFirstDepositDate.plusWeeks(1), expectedFirstDepositDate.plusWeeks(1), RepaymentRuleTypes.NEXT_MEETING_OR_REPAYMENT);
createClientSavingsAccount();
short installmentId = 1;
DateTime installmentDate = expectedFirstDepositDate;
for (AccountActionDateEntity accountActionDate : getActionDatesSortedByDate(savingsAccount)) {
SavingsScheduleEntity scheduleEntity = (SavingsScheduleEntity) accountActionDate;
assertThat(scheduleEntity.getInstallmentId(), is(installmentId));
if (installmentId == 2) {
// only second installment pushed out one week.
assertThat(new LocalDate(scheduleEntity.getActionDate()), is(new LocalDate(installmentDate.plusWeeks(1).toDate())));
} else {
assertThat(new LocalDate(scheduleEntity.getActionDate()), is(new LocalDate(installmentDate.toDate())));
}
assertThat(scheduleEntity.getDeposit().getAmountDoubleValue(), is(13.0));
installmentId++;
installmentDate = installmentDate.plusWeeks(1);
}
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsScheduleIntegrationTest method createWeeklySavingScheduleSecondInstallmentFallsInNextWorkingDayHoliday.
@Ignore
@Test
public void createWeeklySavingScheduleSecondInstallmentFallsInNextWorkingDayHoliday() throws Exception {
// One-day holiday on the second deposit date, Monday
buildAndPersistHoliday(expectedFirstDepositDate.plusWeeks(1), expectedFirstDepositDate.plusWeeks(1), RepaymentRuleTypes.NEXT_WORKING_DAY);
createClientSavingsAccount();
short installmentId = 1;
DateTime installmentDate = expectedFirstDepositDate;
for (AccountActionDateEntity accountActionDate : getActionDatesSortedByDate(savingsAccount)) {
SavingsScheduleEntity scheduleEntity = (SavingsScheduleEntity) accountActionDate;
assertThat(scheduleEntity.getInstallmentId(), is(installmentId));
if (installmentId == 2) {
assertThat(new LocalDate(scheduleEntity.getActionDate()), //Tuesday after holiday
is(new LocalDate(installmentDate.plusDays(1).toDate())));
} else {
assertThat(new LocalDate(scheduleEntity.getActionDate()), is(new LocalDate(installmentDate.toDate())));
}
assertThat(scheduleEntity.getDeposit().getAmountDoubleValue(), is(13.0));
installmentId++;
installmentDate = installmentDate.plusWeeks(1);
}
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsScheduleIntegrationTest method createWeeklySavingScheduleSecondInstallmentFallsInMoratorium.
@Ignore
@Test
public void createWeeklySavingScheduleSecondInstallmentFallsInMoratorium() throws Exception {
buildAndPersistHoliday(expectedFirstDepositDate.plusWeeks(1), expectedFirstDepositDate.plusWeeks(1), RepaymentRuleTypes.REPAYMENT_MORATORIUM);
createClientSavingsAccount();
short installmentId = 1;
DateTime installmentDate = expectedFirstDepositDate;
for (AccountActionDateEntity accountActionDate : getActionDatesSortedByDate(savingsAccount)) {
SavingsScheduleEntity scheduleEntity = (SavingsScheduleEntity) accountActionDate;
assertThat(scheduleEntity.getInstallmentId(), is(installmentId));
if (installmentId < 2) {
assertThat(new LocalDate(scheduleEntity.getActionDate()), is(new LocalDate(installmentDate.toDate())));
} else {
// second and following dates pushed out one week.
assertThat(new LocalDate(scheduleEntity.getActionDate()), is(new LocalDate(installmentDate.plusWeeks(1).toDate())));
}
assertThat(scheduleEntity.getDeposit().getAmountDoubleValue(), is(13.0));
installmentId++;
installmentDate = installmentDate.plusWeeks(1);
}
}
Aggregations