use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class TestObjectFactory method getBulkEntryAccountActionView.
public static CollectionSheetEntryInstallmentDto getBulkEntryAccountActionView(final AccountActionDateEntity accountActionDateEntity) {
CollectionSheetEntryInstallmentDto bulkEntryAccountActionView = null;
if (accountActionDateEntity instanceof LoanScheduleEntity) {
LoanScheduleEntity actionDate = (LoanScheduleEntity) accountActionDateEntity;
CollectionSheetEntryLoanInstallmentDto installmentView = new CollectionSheetEntryLoanInstallmentDto(actionDate.getAccount().getAccountId(), actionDate.getCustomer().getCustomerId(), actionDate.getInstallmentId(), actionDate.getActionDateId(), actionDate.getActionDate(), actionDate.getPrincipal(), actionDate.getPrincipalPaid(), actionDate.getInterest(), actionDate.getInterestPaid(), actionDate.getMiscFee(), actionDate.getMiscFeePaid(), actionDate.getPenalty(), actionDate.getPenaltyPaid(), actionDate.getMiscPenalty(), actionDate.getMiscPenaltyPaid(), TestUtils.RUPEE);
installmentView.setCollectionSheetEntryAccountFeeActions(getBulkEntryAccountFeeActionViews(accountActionDateEntity));
bulkEntryAccountActionView = installmentView;
} else if (accountActionDateEntity instanceof SavingsScheduleEntity) {
SavingsScheduleEntity actionDate = (SavingsScheduleEntity) accountActionDateEntity;
CollectionSheetEntrySavingsInstallmentDto installmentView = new CollectionSheetEntrySavingsInstallmentDto(actionDate.getAccount().getAccountId(), actionDate.getCustomer().getCustomerId(), actionDate.getInstallmentId(), actionDate.getActionDateId(), actionDate.getActionDate(), actionDate.getDeposit(), actionDate.getDepositPaid());
bulkEntryAccountActionView = installmentView;
} else if (accountActionDateEntity instanceof CustomerScheduleEntity) {
CustomerScheduleEntity actionDate = (CustomerScheduleEntity) accountActionDateEntity;
CollectionSheetEntryCustomerAccountInstallmentDto installmentView = new CollectionSheetEntryCustomerAccountInstallmentDto(actionDate.getAccount().getAccountId(), actionDate.getCustomer().getCustomerId(), actionDate.getInstallmentId(), actionDate.getActionDateId(), actionDate.getActionDate(), actionDate.getMiscFee(), actionDate.getMiscFeePaid(), actionDate.getMiscPenalty(), actionDate.getMiscPenaltyPaid(), TestUtils.RUPEE);
installmentView.setCollectionSheetEntryAccountFeeActions(getBulkEntryAccountFeeActionViews(accountActionDateEntity));
bulkEntryAccountActionView = installmentView;
}
return bulkEntryAccountActionView;
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsDaoHibernate method updateSavingScheduleEntity.
@Override
public void updateSavingScheduleEntity(List<SavingsScheduleEntity> savingScheduleList) {
for (SavingsScheduleEntity savingsScheduleEntity : savingScheduleList) {
savingsScheduleEntity.setDeposit(Money.zero());
this.baseDao.createOrUpdate(savingsScheduleEntity);
}
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class LegacyAccountDaoIntegrationTest method testGetSavingsSchedulesForAccountThatAreWithinDates.
@Test
public void testGetSavingsSchedulesForAccountThatAreWithinDates() throws Exception {
savingsBO = new TestCollectionSheetRetrieveSavingsAccountsUtils().createSavingsAccount(group, "clm", "3.0", false, false);
DateTime fromDate = new DateMidnight().toDateTime().plusDays(1);
DateTime thruDate = new DateMidnight().toDateTime().plusDays(37);
List<SavingsScheduleEntity> affectedDates = legacyAccountDao.getSavingsSchedulesForAccountThatAreWithinDates(savingsBO.getAccountId(), fromDate, thruDate);
Assert.assertNotNull(affectedDates);
Assert.assertEquals(5, affectedDates.size());
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsBOTest method shouldPayOffAnyPaymentsAssociatedWithPayingCustomerAndVoluntarySavingsAccount.
@Ignore
@Test
public void shouldPayOffAnyPaymentsAssociatedWithPayingCustomerAndVoluntarySavingsAccount() throws AccountException {
// setup
savingsAccount = savingsAccountBuilder.build();
final SavingsScheduleEntity unpaidSaving1 = new SavingsScheduleBuilder().withAccount(savingsAccount).withCustomer(payingCustomer).build();
final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList(unpaidSaving1);
SavingsOfferingBO volSavingsProduct = new SavingsProductBuilder().voluntary().buildForUnitTests();
final Money zero = new Money(defaultCurrency);
savingsAccount = savingsAccountBuilder.withSavingsProduct(volSavingsProduct).withBalanceOf(zero).completeGroup().withPayments(unpaidDepositsForPayingCustomer).buildForUnitTests();
final Money amountToDeposit = new Money(TestUtils.RUPEE, "100.0");
final Date dateOfDeposit = new DateTime().toDate();
// stubbing
when(accountPayment.getAmount()).thenReturn(amountToDeposit);
when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
// exercise test
savingsAccount.deposit(accountPayment, payingCustomer);
// verification
verify(paymentStrategy).makeScheduledPayments(accountPayment, unpaidDepositsForPayingCustomer, payingCustomer, SavingsType.VOLUNTARY, zero);
}
use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class SavingsBOTest method depositScheduleIsGeneratedOnCreationNoHoliday.
@Ignore
@Test
public void depositScheduleIsGeneratedOnCreationNoHoliday() {
// setup
when(savingsAccountCustomer.getCustomerMeeting()).thenReturn(customerMeetingEntity);
when(customerMeetingEntity.getMeeting()).thenReturn(defaultWeeklyCustomerMeeting);
when(savingsAccountCustomer.getCustomerLevel()).thenReturn(customerLevelEntity);
when(customerLevelEntity.getId()).thenReturn(CustomerLevel.CLIENT.getValue());
// exercise test
savingsAccount = savingsAccountBuilder.buildForUnitTests();
// verify
List<SavingsScheduleEntity> sortedSavingsSchedules = getSortedSavingsScheduleEntities();
assertThat(sortedSavingsSchedules.size(), is(10));
DateTime installmentDate = new DateMidnight().toDateTime();
for (SavingsScheduleEntity savingsScheduleEntity : sortedSavingsSchedules) {
assertThat(new LocalDate(savingsScheduleEntity.getActionDate()), is(new LocalDate(installmentDate.toDate())));
assertThat(savingsScheduleEntity.getDeposit(), is(new Money(TestUtils.RUPEE, "13.0")));
assertThat(savingsScheduleEntity.getDepositPaid(), is(new Money(TestUtils.RUPEE, "0.0")));
installmentDate = installmentDate.plusWeeks(1);
}
}
Aggregations