use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.
the class SavingsAccountAdjustmentAndInterestCalculationServiceFacadeIntegrationTest method shouldHaveCorrectBalanceAfterDepositAndAdjustment.
@Test
public void shouldHaveCorrectBalanceAfterDepositAndAdjustment() throws Exception {
createCenterGroupClientHierarchy(aWeeklyMeeting);
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToClientsOnly().buildForIntegrationTests();
SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(client).withCreatedBy(IntegrationTestObjectMother.testUser()).withBalanceOf(TestUtils.createMoney("0")).withDepositOn("20", new DateTime()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
Long savingsId = Long.valueOf(savingsAccount.getAccountId());
Double adjustedAmount = Double.valueOf("35");
String note = "I entered 20 but it should of being 35 which is an overpayment of the mandatory sum.";
SavingsAdjustmentDto savingsAdjustment = new SavingsAdjustmentDto(savingsId, adjustedAmount, note, savingsAccount.getLastPmnt().getPaymentId(), new LocalDate(savingsAccount.getLastPmnt().getPaymentDate()));
// exercise test
this.savingsServiceFacade.adjustTransaction(savingsAdjustment);
// verification
savingsAccount = IntegrationTestObjectMother.findSavingsAccountById(savingsId);
assertThat(savingsAccount.getSavingsBalance(), is(TestUtils.createMoney("35")));
}
use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO 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()));
}
}
use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO 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());
}
use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.
the class SavingsAccountSchedulesIntegrationTest method shouldGenerateSavingsAccountSchedulesForGroupOnlyWhenUsingCompleteGroupSetting.
@Test
public void shouldGenerateSavingsAccountSchedulesForGroupOnlyWhenUsingCompleteGroupSetting() throws Exception {
createCenterGroupClientHierarchy(aWeeklyMeeting);
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToGroupsOnly().trackedOnCompleteGroup().buildForIntegrationTests();
SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(group).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
List<AccountActionDateEntity> savingSchedules = savingsAccount.getAccountActionDatesSortedByInstallmentId();
for (AccountActionDateEntity savingSchedule : savingSchedules) {
assertThat("saving schedule should be generated for group only and not any of its clients", savingSchedule.getCustomer().getCustomerId(), is(group.getCustomerId()));
}
}
use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.
the class SavingsAccountSchedulesIntegrationTest method shouldGenerateSavingsAccountSchedulesForClient.
@Test
public void shouldGenerateSavingsAccountSchedulesForClient() throws Exception {
createCenterGroupClientHierarchy(aWeeklyMeeting);
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToClientsOnly().buildForIntegrationTests();
SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(client).withCreatedBy(IntegrationTestObjectMother.testUser()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
List<AccountActionDateEntity> savingSchedules = savingsAccount.getAccountActionDatesSortedByInstallmentId();
for (AccountActionDateEntity savingSchedule : savingSchedules) {
assertThat("saving schedule should be generated for individual client savings account", savingSchedule.getCustomer().getCustomerId(), is(client.getCustomerId()));
}
}
Aggregations