use of org.mifos.domain.builders.SavingsProductBuilder in project head by mifos.
the class SavingsScheduleIntegrationTest method createClientSavingsAccount.
public void createClientSavingsAccount() throws Exception {
meeting = new MeetingBuilder().customerMeeting().weekly().every(1).withStartDate(expectedFirstDepositDate).build();
IntegrationTestObjectMother.saveMeeting(meeting);
center = new CenterBuilder().with(meeting).withName("Center").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
IntegrationTestObjectMother.createCenter(center, meeting);
group = new GroupBuilder().withMeeting(meeting).withName("Group").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(center).build();
IntegrationTestObjectMother.createGroup(group, meeting);
client = new ClientBuilder().withMeeting(meeting).withName("Client 1").withOffice(sampleBranchOffice()).withLoanOfficer(testUser()).withParentCustomer(group).buildForIntegrationTests();
IntegrationTestObjectMother.createClient(client, meeting);
savingsProduct = new SavingsProductBuilder().mandatory().appliesToClientsOnly().buildForIntegrationTests();
HolidayDao holidayDao = ApplicationContextProvider.getBean(HolidayDao.class);
List<Holiday> holidays = holidayDao.findAllHolidaysThisYearAndNext(client.getOfficeId());
savingsAccount = new SavingsAccountBuilder().withSavingsProduct(savingsProduct).withCustomer(client).with(holidays).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
}
use of org.mifos.domain.builders.SavingsProductBuilder in project head by mifos.
the class SavingsAdjustmentTest method canAdjustLastTransactionThatIsAWithdrawal.
@Test
public void canAdjustLastTransactionThatIsAWithdrawal() {
savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").withMaxWithdrawalAmount(TestUtils.createMoney("50")).appliesToClientsOnly().buildForUnitTests();
savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withBalanceOf(TestUtils.createMoney("100")).withWithdrawalOf("15").build();
Money withdrawalAdjustment = TestUtils.createMoney("20");
// exercise test
boolean result = savingsAccount.isAdjustPossibleOnTrxn(withdrawalAdjustment, savingsAccount.getLastPmnt());
// verification
assertTrue(result);
}
use of org.mifos.domain.builders.SavingsProductBuilder in project head by mifos.
the class SavingsAccountSchedulesIntegrationTest method shouldNotGenerateSavingsAccountSchedulesForGroupWithoutActiveClients.
@Test
public void shouldNotGenerateSavingsAccountSchedulesForGroupWithoutActiveClients() throws Exception {
createCenterAndGroupHierarchyWithNoClients(aWeeklyMeeting);
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToGroupsOnly().trackedPerIndividual().buildForIntegrationTests();
SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(group).withCreatedBy(IntegrationTestObjectMother.testUser()).buildJointSavingsAccount();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
List<AccountActionDateEntity> savingSchedules = savingsAccount.getAccountActionDatesSortedByInstallmentId();
assertTrue(savingSchedules.isEmpty());
}
use of org.mifos.domain.builders.SavingsProductBuilder in project head by mifos.
the class SavingsDaoHibernateIntegrationTest method testShouldFindOnlyVoluntarySavingsAccountsForIndividualClientsOfTheVoluntaryCentersOrVoluntaryGroupsWithPerIndividualStatus.
@Test
public void testShouldFindOnlyVoluntarySavingsAccountsForIndividualClientsOfTheVoluntaryCentersOrVoluntaryGroupsWithPerIndividualStatus() {
// setup
savingsProduct = new SavingsProductBuilder().voluntary().withShortName("SP1").appliesToGroupsOnly().buildForIntegrationTests();
savingsAccount = new SavingsAccountBuilder().completeGroup().perIndividual().withSavingsProduct(savingsProduct).withCustomer(group).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
secondSavingsProduct = new SavingsProductBuilder().mandatory().withShortName("SP2").appliesToCentersOnly().withName("testSavingPrd2").buildForIntegrationTests();
secondSavingsAccount = new SavingsAccountBuilder().withSavingsProduct(secondSavingsProduct).withCustomer(center).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(secondSavingsProduct, secondSavingsAccount);
// exercise test
List<CollectionSheetCustomerSavingDto> voluntarySavingAccountsForPaymentByIndividuals = savingsDao.findAllVoluntarySavingAccountsForIndividualChildrenOfCentersOrGroupsWithPerIndividualStatusForCustomerHierarchy(customerHierarchyParams);
// verification
assertThat(voluntarySavingAccountsForPaymentByIndividuals.size(), is(1));
}
use of org.mifos.domain.builders.SavingsProductBuilder in project head by mifos.
the class SavingsDaoHibernateIntegrationTest method testShouldFindExistingMandatorySavingsAccountsForGroupsWithCompleteGroupStatusWhenCenterIsTopOfCustomerHierarchy.
@Test
public void testShouldFindExistingMandatorySavingsAccountsForGroupsWithCompleteGroupStatusWhenCenterIsTopOfCustomerHierarchy() {
// setup
savingsProduct = new SavingsProductBuilder().mandatory().appliesToGroupsOnly().buildForIntegrationTests();
savingsAccount = new SavingsAccountBuilder().withSavingsProduct(savingsProduct).withCustomer(group).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
// exercise test
List<CollectionSheetCustomerSavingDto> mandatorySavingAccounts = savingsDao.findAllMandatorySavingAccountsForClientsOrGroupsWithCompleteGroupStatusForCustomerHierarchy(customerHierarchyParams);
// verification
assertThat(mandatorySavingAccounts.size(), is(1));
}
Aggregations