Search in sources :

Example 46 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class SavingsAccountSchedulesIntegrationTest method shouldGenerateSavingsAccountSchedulesForActiveClientsOfCenter.

@Test
public void shouldGenerateSavingsAccountSchedulesForActiveClientsOfCenter() throws Exception {
    createCenterGroupClientHierarchy(aWeeklyMeeting);
    SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToCentersOnly().buildForIntegrationTests();
    SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(center).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 center 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 47 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class SavingsBOTest method shouldPayOffAnyPaymentsAssociatedWithPayingCustomerAndVoluntarySavingsAccount.

@Ignore
@Test
public void shouldPayOffAnyPaymentsAssociatedWithPayingCustomerAndVoluntarySavingsAccount() throws AccountException {
    // setup
    savingsAccount = savingsAccountBuilder.build();
    final SavingsScheduleEntity unpaidSaving1 = new SavingsScheduleBuilder().withAccount(savingsAccount).withCustomer(payingCustomer).build();
    final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList(unpaidSaving1);
    SavingsOfferingBO volSavingsProduct = new SavingsProductBuilder().voluntary().buildForUnitTests();
    final Money zero = new Money(defaultCurrency);
    savingsAccount = savingsAccountBuilder.withSavingsProduct(volSavingsProduct).withBalanceOf(zero).completeGroup().withPayments(unpaidDepositsForPayingCustomer).buildForUnitTests();
    final Money amountToDeposit = new Money(TestUtils.RUPEE, "100.0");
    final Date dateOfDeposit = new DateTime().toDate();
    // stubbing
    when(accountPayment.getAmount()).thenReturn(amountToDeposit);
    when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
    // exercise test
    savingsAccount.deposit(accountPayment, payingCustomer);
    // verification
    verify(paymentStrategy).makeScheduledPayments(accountPayment, unpaidDepositsForPayingCustomer, payingCustomer, SavingsType.VOLUNTARY, zero);
}
Also used : SavingsScheduleBuilder(org.mifos.domain.builders.SavingsScheduleBuilder) Money(org.mifos.framework.util.helpers.Money) SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsScheduleEntity(org.mifos.accounts.savings.business.SavingsScheduleEntity) Date(java.util.Date) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 48 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class PrdOfferingPersistenceIntegrationTest method testGetPrdOfferingShortNameCountWithSameName.

@Test
public void testGetPrdOfferingShortNameCountWithSameName() throws PersistenceException {
    SavingsOfferingBO savingsOffering = new SavingsTestHelper().createSavingsOffering("Savings product", "SAVP");
    Assert.assertEquals(Integer.valueOf("1"), new PrdOfferingPersistence().getProductOfferingShortNameCount("SAVP"));
    savingsOffering = null;
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsTestHelper(org.mifos.accounts.savings.util.helpers.SavingsTestHelper) Test(org.junit.Test)

Example 49 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class PrdOfferingPersistenceIntegrationTest method testGetPrdOfferingNameCountWithDifferentName.

@Test
public void testGetPrdOfferingNameCountWithDifferentName() throws PersistenceException {
    SavingsOfferingBO savingsOffering = new SavingsTestHelper().createSavingsOffering("fsaf6", "ads6");
    Assert.assertEquals(Integer.valueOf("0"), new PrdOfferingPersistence().getProductOfferingNameCount("Savings product"));
    savingsOffering = null;
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsTestHelper(org.mifos.accounts.savings.util.helpers.SavingsTestHelper) Test(org.junit.Test)

Example 50 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class PrdOfferingPersistenceIntegrationTest method testGetPrdOfferingShortNameCountWithDifferentName.

@Test
public void testGetPrdOfferingShortNameCountWithDifferentName() throws PersistenceException {
    SavingsOfferingBO savingsOffering = new SavingsTestHelper().createSavingsOffering("fsaf6", "ads6");
    Assert.assertEquals(Integer.valueOf("0"), new PrdOfferingPersistence().getProductOfferingShortNameCount("SAVP"));
    savingsOffering = null;
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsTestHelper(org.mifos.accounts.savings.util.helpers.SavingsTestHelper) Test(org.junit.Test)

Aggregations

SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)63 Test (org.junit.Test)33 ArrayList (java.util.ArrayList)20 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)17 SavingsProductBuilder (org.mifos.domain.builders.SavingsProductBuilder)14 MeetingBO (org.mifos.application.meeting.business.MeetingBO)11 LocalDate (org.joda.time.LocalDate)10 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)10 Date (java.util.Date)9 UserContext (org.mifos.security.util.UserContext)9 Date (java.sql.Date)8 DateTime (org.joda.time.DateTime)8 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)8 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)8 SavingsTestHelper (org.mifos.accounts.savings.util.helpers.SavingsTestHelper)8 MifosRuntimeException (org.mifos.core.MifosRuntimeException)8 CustomerException (org.mifos.customers.exceptions.CustomerException)7 Money (org.mifos.framework.util.helpers.Money)7 AccountException (org.mifos.accounts.exceptions.AccountException)6 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)5