Search in sources :

Example 1 with CustomerHierarchyParams

use of org.mifos.application.servicefacade.CustomerHierarchyParams in project head by mifos.

the class SavingsDaoHibernateIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    enableCustomWorkingDays();
    weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    weeklyPeriodicFeeForCenterOnly = new FeeBuilder().appliesToCenterOnly().withFeeAmount("100.0").withName("Center Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForCenterOnly);
    center = new CenterBuilder().with(weeklyMeeting).withName("Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
    IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
    weeklyPeriodicFeeForGroupOnly = new FeeBuilder().appliesToGroupsOnly().withFeeAmount("50.0").withName("Group Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForGroupOnly);
    group = new GroupBuilder().withMeeting(weeklyMeeting).withName("Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withFee(weeklyPeriodicFeeForGroupOnly).withParentCustomer(center).build();
    IntegrationTestObjectMother.createGroup(group, weeklyMeeting);
    weeklyPeriodicFeeForClientsOnly = new FeeBuilder().appliesToClientsOnly().withFeeAmount("10.0").withName("Client Weekly Periodic Fee").withSameRecurrenceAs(weeklyMeeting).with(sampleBranchOffice()).build();
    IntegrationTestObjectMother.saveFee(weeklyPeriodicFeeForClientsOnly);
    client = new ClientBuilder().withMeeting(weeklyMeeting).withName("Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
    IntegrationTestObjectMother.createClient(client, weeklyMeeting);
    customerHierarchyParams = new CustomerHierarchyParams(center.getCustomerId(), center.getOffice().getOfficeId(), center.getSearchId() + ".%", new LocalDate());
    baseDao = new GenericDaoHibernate();
    savingsDao = new SavingsDaoHibernate(baseDao);
}
Also used : FeeBuilder(org.mifos.domain.builders.FeeBuilder) GroupBuilder(org.mifos.domain.builders.GroupBuilder) CustomerHierarchyParams(org.mifos.application.servicefacade.CustomerHierarchyParams) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) LocalDate(org.joda.time.LocalDate) ClientBuilder(org.mifos.domain.builders.ClientBuilder) Before(org.junit.Before)

Example 2 with CustomerHierarchyParams

use of org.mifos.application.servicefacade.CustomerHierarchyParams in project head by mifos.

the class CollectionSheetDaoHibernateIntegrationTest method testShouldFindSavingsDepositsforCustomerHierarchy.

@Test
public void testShouldFindSavingsDepositsforCustomerHierarchy() {
    // setup
    savingsProduct = new SavingsProductBuilder().mandatory().appliesToCentersOnly().withShortName("SP1").buildForIntegrationTests();
    savingsAccount = new SavingsAccountBuilder().withSavingsProduct(savingsProduct).withCreatedBy(IntegrationTestObjectMother.testUser()).withCustomer(center).build();
    IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
    savingsProduct2 = new SavingsProductBuilder().withName("product2").withShortName("SP2").mandatory().appliesToCentersOnly().buildForIntegrationTests();
    savingsAccount2 = new SavingsAccountBuilder().withSavingsProduct(savingsProduct2).withCustomer(center).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
    IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct2, savingsAccount2);
    final Integer customerAtTopOfHierarchyId = center.getCustomerId();
    final Short branchId = center.getOffice().getOfficeId();
    final String searchId = center.getSearchId() + ".%";
    final LocalDate transactionDate = new LocalDate();
    final CustomerHierarchyParams customerHierarchyParams = new CustomerHierarchyParams(customerAtTopOfHierarchyId, branchId, searchId, transactionDate);
    // exercise test
    final List<CollectionSheetCustomerSavingsAccountDto> allSavingsDeposits = collectionSheetDao.findAllSavingAccountsForCustomerHierarchy(customerHierarchyParams);
    // verification
    Assert.assertThat(allSavingsDeposits.size(), is(2));
}
Also used : SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) CustomerHierarchyParams(org.mifos.application.servicefacade.CustomerHierarchyParams) CollectionSheetCustomerSavingsAccountDto(org.mifos.application.servicefacade.CollectionSheetCustomerSavingsAccountDto) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Aggregations

LocalDate (org.joda.time.LocalDate)2 CustomerHierarchyParams (org.mifos.application.servicefacade.CustomerHierarchyParams)2 Before (org.junit.Before)1 Test (org.junit.Test)1 CollectionSheetCustomerSavingsAccountDto (org.mifos.application.servicefacade.CollectionSheetCustomerSavingsAccountDto)1 CenterBuilder (org.mifos.domain.builders.CenterBuilder)1 ClientBuilder (org.mifos.domain.builders.ClientBuilder)1 FeeBuilder (org.mifos.domain.builders.FeeBuilder)1 GroupBuilder (org.mifos.domain.builders.GroupBuilder)1 MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)1 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)1 SavingsProductBuilder (org.mifos.domain.builders.SavingsProductBuilder)1