Search in sources :

Example 16 with CustomerScheduleEntity

use of org.mifos.customers.business.CustomerScheduleEntity in project head by mifos.

the class GenerateMeetingsForCustomerAndSavingsBatchJobIntegrationTest method assertThatEachScheduleHasFeesDueOf.

private void assertThatEachScheduleHasFeesDueOf(Set<AccountActionDateEntity> customerSchedules, double feesDue) {
    for (AccountActionDateEntity accountActionDateEntity : customerSchedules) {
        CustomerScheduleEntity customerSchedule = (CustomerScheduleEntity) center.getCustomerAccount().getAccountActionDate(accountActionDateEntity.getInstallmentId());
        assertThat(customerSchedule.getTotalFees().getAmountDoubleValue(), is(feesDue));
    }
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) CustomerScheduleEntity(org.mifos.customers.business.CustomerScheduleEntity)

Example 17 with CustomerScheduleEntity

use of org.mifos.customers.business.CustomerScheduleEntity in project head by mifos.

the class CenterScheduleCreationUsingCustomerServiceIntegrationTest method validateOnePeriodicFeeAndOneOneTimeFee.

private void validateOnePeriodicFeeAndOneOneTimeFee(String centerSystemId, String expectedPeriodicFeeName, String expectedOneTimeFeeName, double expectedOneTimeFee, double... expectedFees) {
    CenterBO retrievedCenter = customerDao.findCenterBySystemId(centerSystemId);
    for (AccountActionDateEntity accountActionDate : getActionDatesSortedByDate(retrievedCenter.getCustomerAccount())) {
        CustomerScheduleEntity scheduleEntity = (CustomerScheduleEntity) accountActionDate;
        if (scheduleEntity.getInstallmentId() == 1) {
            assertThat(scheduleEntity.getAccountFeesActionDetails().size(), is(2));
            assertThat(scheduleEntity.getAccountFeesActionDetailsSortedByFeeId().get(1).getFee().getFeeName(), is(expectedOneTimeFeeName));
            assertThat(scheduleEntity.getAccountFeesActionDetailsSortedByFeeId().get(1).getFeeAmount().getAmountDoubleValue(), is(expectedOneTimeFee));
        } else {
            assertThat(scheduleEntity.getAccountFeesActionDetails().size(), is(1));
        }
        assertThat(scheduleEntity.getAccountFeesActionDetailsSortedByFeeId().get(0).getFee().getFeeName(), is(expectedPeriodicFeeName));
        assertThat(scheduleEntity.getAccountFeesActionDetailsSortedByFeeId().get(0).getFeeAmount().getAmountDoubleValue(), is(expectedFees[scheduleEntity.getInstallmentId() - 1]));
    }
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) CustomerScheduleEntity(org.mifos.customers.business.CustomerScheduleEntity) CenterBO(org.mifos.customers.center.business.CenterBO)

Example 18 with CustomerScheduleEntity

use of org.mifos.customers.business.CustomerScheduleEntity in project head by mifos.

the class TestObjectFactory method getDueActionDatesForAccount.

public static List<AccountActionDateEntity> getDueActionDatesForAccount(final Integer accountId, final java.sql.Date transactionDate) throws Exception {
    List<AccountActionDateEntity> dueActionDates = new CustomerPersistence().retrieveCustomerAccountActionDetails(accountId, transactionDate);
    for (AccountActionDateEntity accountActionDate : dueActionDates) {
        Hibernate.initialize(accountActionDate);
        if (accountActionDate instanceof LoanScheduleEntity) {
            LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDate;
            for (AccountFeesActionDetailEntity accountFeesActionDetail : loanScheduleEntity.getAccountFeesActionDetails()) {
                Hibernate.initialize(accountFeesActionDetail);
            }
        }
        if (accountActionDate instanceof CustomerScheduleEntity) {
            CustomerScheduleEntity customerScheduleEntity = (CustomerScheduleEntity) accountActionDate;
            for (AccountFeesActionDetailEntity accountFeesActionDetail : customerScheduleEntity.getAccountFeesActionDetails()) {
                Hibernate.initialize(accountFeesActionDetail);
            }
        }
    }
    StaticHibernateUtil.flushSession();
    return dueActionDates;
}
Also used : LoanScheduleEntity(org.mifos.accounts.loan.business.LoanScheduleEntity) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) AccountFeesActionDetailEntity(org.mifos.accounts.business.AccountFeesActionDetailEntity) CustomerScheduleEntity(org.mifos.customers.business.CustomerScheduleEntity) CustomerPersistence(org.mifos.customers.persistence.CustomerPersistence)

Aggregations

CustomerScheduleEntity (org.mifos.customers.business.CustomerScheduleEntity)18 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)8 Test (org.junit.Test)5 AccountFeesActionDetailEntity (org.mifos.accounts.business.AccountFeesActionDetailEntity)5 DateTime (org.joda.time.DateTime)4 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)4 Money (org.mifos.framework.util.helpers.Money)4 ArrayList (java.util.ArrayList)3 DateMidnight (org.joda.time.DateMidnight)3 LoanBO (org.mifos.accounts.loan.business.LoanBO)3 LoanScheduleEntity (org.mifos.accounts.loan.business.LoanScheduleEntity)3 Date (java.sql.Date)2 LocalDate (org.joda.time.LocalDate)2 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)2 FeeBO (org.mifos.accounts.fees.business.FeeBO)2 PaymentTypeEntity (org.mifos.application.master.business.PaymentTypeEntity)2 CustomerTrxnDetailEntity (org.mifos.customers.business.CustomerTrxnDetailEntity)2 CenterBO (org.mifos.customers.center.business.CenterBO)2 Date (java.util.Date)1 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)1