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);
}
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));
}
Aggregations