Search in sources :

Example 26 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class LoanScheduleEntityIntegrationTest method testIsPricipalZero.

@Test
public void testIsPricipalZero() {
    for (AccountActionDateEntity accountAction : groupLoan.getAccountActionDates()) {
        LoanScheduleEntity accountActionDateEntity = (LoanScheduleEntity) accountAction;
        if (accountActionDateEntity.getInstallmentId() == 1) {
            accountActionDateEntity.setPrincipal(new Money(getCurrency()));
            Assert.assertTrue(accountActionDateEntity.isPrincipalZero());
        } else {
            Assert.assertFalse(accountActionDateEntity.isPrincipalZero());
        }
    }
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) Money(org.mifos.framework.util.helpers.Money) Test(org.junit.Test)

Example 27 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class SavingsBOIntegrationTest method testGetTotalAmountInArrearsForSingleInstallmentDue.

@Test
public void testGetTotalAmountInArrearsForSingleInstallmentDue() throws Exception {
    savings = getSavingsAccount();
    AccountActionDateEntity accountActionDateEntity = savings.getAccountActionDate((short) 1);
    ((SavingsScheduleEntity) accountActionDateEntity).setActionDate(offSetCurrentDate(1));
    savings = (SavingsBO) saveAndFetch(savings);
    Assert.assertEquals(TestUtils.createMoney(200.0), savings.getTotalAmountInArrears());
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) SavingsScheduleEntity(org.mifos.accounts.savings.business.SavingsScheduleEntity) Test(org.junit.Test)

Example 28 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class SavingsBOIntegrationTest method testGetDetailsOfInstallmentsInArrearsForTwoInstallmentsDue.

@Test
public void testGetDetailsOfInstallmentsInArrearsForTwoInstallmentsDue() throws Exception {
    savings = getSavingsAccount();
    AccountActionDateEntity accountActionDateEntity = savings.getAccountActionDate((short) 1);
    ((SavingsScheduleEntity) accountActionDateEntity).setActionDate(offSetCurrentDate(2));
    AccountActionDateEntity accountActionDateEntity2 = savings.getAccountActionDate((short) 2);
    ((SavingsScheduleEntity) accountActionDateEntity2).setActionDate(offSetCurrentDate(1));
    savings = (SavingsBO) saveAndFetch(savings);
    Assert.assertEquals(savings.getDetailsOfInstallmentsInArrears().size(), 2);
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) SavingsScheduleEntity(org.mifos.accounts.savings.business.SavingsScheduleEntity) Test(org.junit.Test)

Example 29 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class SavingsAccountSchedulesIntegrationTest method shouldGenerateSavingsAccountSchedulesForActiveClientsOfGroupWhenUsingPerIndividualSetting.

@Test
public void shouldGenerateSavingsAccountSchedulesForActiveClientsOfGroupWhenUsingPerIndividualSetting() throws Exception {
    createCenterGroupClientHierarchy(aWeeklyMeeting);
    SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToGroupsOnly().trackedPerIndividual().buildForIntegrationTests();
    SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(group).withMember(client).withCreatedBy(IntegrationTestObjectMother.testUser()).buildJointSavingsAccount();
    IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
    List<AccountActionDateEntity> savingSchedules = savingsAccount.getAccountActionDatesSortedByInstallmentId();
    for (AccountActionDateEntity savingSchedule : savingSchedules) {
        assertThat("saving schedule should be generated for active client belong to group savings account", savingSchedule.getCustomer().getCustomerId(), is(client.getCustomerId()));
    }
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) Test(org.junit.Test)

Example 30 with AccountActionDateEntity

use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.

the class SavingsAccountSchedulesIntegrationTest method shouldNotGenerateSavingsAccountSchedulesForCenterWithoutActiveClients.

@Test
public void shouldNotGenerateSavingsAccountSchedulesForCenterWithoutActiveClients() throws Exception {
    createCenterAndGroupHierarchyWithNoClients(aWeeklyMeeting);
    SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToCentersOnly().buildForIntegrationTests();
    SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(center).withCreatedBy(IntegrationTestObjectMother.testUser()).buildJointSavingsAccount();
    IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
    List<AccountActionDateEntity> savingSchedules = savingsAccount.getAccountActionDatesSortedByInstallmentId();
    assertTrue(savingSchedules.isEmpty());
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) Test(org.junit.Test)

Aggregations

AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)211 Money (org.mifos.framework.util.helpers.Money)80 Test (org.junit.Test)69 ArrayList (java.util.ArrayList)58 LocalDate (org.joda.time.LocalDate)42 Date (java.util.Date)39 DateTime (org.joda.time.DateTime)33 MeetingBO (org.mifos.application.meeting.business.MeetingBO)33 AccountException (org.mifos.accounts.exceptions.AccountException)24 PaymentData (org.mifos.accounts.util.helpers.PaymentData)24 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)21 Date (java.sql.Date)19 SavingsScheduleEntity (org.mifos.accounts.savings.business.SavingsScheduleEntity)19 LoanBO (org.mifos.accounts.loan.business.LoanBO)17 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)15 LoanScheduleEntity (org.mifos.accounts.loan.business.LoanScheduleEntity)14 UserContext (org.mifos.security.util.UserContext)14 Calendar (java.util.Calendar)13 GregorianCalendar (java.util.GregorianCalendar)13 CenterBuilder (org.mifos.domain.builders.CenterBuilder)13