use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.
the class SavingsProductDaoHibernateIntegrationTest method testShouldFindSavingsProductById.
@Test
public void testShouldFindSavingsProductById() {
// setup
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().appliesToCentersOnly().mandatory().withName("product1").withShortName("1234").withMandatoryAmount("25").buildForIntegrationTests();
IntegrationTestObjectMother.saveSavingsProducts(savingsProduct);
// exercise test
SavingsOfferingBO result = savingsProductDao.findById(savingsProduct.getPrdOfferingId().intValue());
Money recommendedAmount = TestUtils.createMoney("25");
RecommendedAmntUnitEntity recommendedAmntUnit = null;
Money maxAmntWithdrawl = TestUtils.createMoney("100");
Double interestRate = Double.valueOf("12");
Money minAmountRequiredForInterestToBeCalculated = TestUtils.createMoney("100");
LocalDate updateDate = new LocalDate();
result.updateSavingsDetails(recommendedAmount, recommendedAmntUnit, maxAmntWithdrawl, interestRate, minAmountRequiredForInterestToBeCalculated, updateDate);
IntegrationTestObjectMother.saveSavingsProducts(result);
// assertion
assertNotNull(result);
}
use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.
the class SavingsBOTest method overpayingMandatoryOrVoluntaryDepositAmountCausesAnExcessTransactionToBeCreated.
@Ignore
@Test
public void overpayingMandatoryOrVoluntaryDepositAmountCausesAnExcessTransactionToBeCreated() throws AccountException {
// setup
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().buildForUnitTests();
savingsAccount = savingsAccountBuilder.withSavingsProduct(savingsProduct).build();
final SavingsScheduleEntity unpaidSaving1 = new SavingsScheduleBuilder().withAccount(savingsAccount).withCustomer(payingCustomer).build();
final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList(unpaidSaving1);
final Money zero = new Money(defaultCurrency);
SavingsOfferingBO manSavingsProduct = new SavingsProductBuilder().mandatory().buildForUnitTests();
savingsAccount = savingsAccountBuilder.withSavingsProduct(manSavingsProduct).withBalanceOf(zero).withPayments(unpaidDepositsForPayingCustomer).buildForUnitTests();
final Money amountToDeposit = new Money(TestUtils.RUPEE, "100.0");
final Date dateOfDeposit = new DateTime().toDate();
final Money excessDepositAmount = new Money(TestUtils.RUPEE, "25.0");
final Money expectedTotalBalance = amountToDeposit.add(zero);
// stubbing
when(accountPayment.getAmount()).thenReturn(amountToDeposit);
when(accountPayment.getPaymentDate()).thenReturn(dateOfDeposit);
when(paymentStrategy.makeScheduledPayments(accountPayment, unpaidDepositsForPayingCustomer, payingCustomer, SavingsType.MANDATORY, zero)).thenReturn(excessDepositAmount);
// exercise test
savingsAccount.deposit(accountPayment, payingCustomer);
// verification
verify(this.savingsTransactionActivityHelper).createSavingsTrxnForDeposit(accountPayment, excessDepositAmount, payingCustomer, null, expectedTotalBalance);
}
use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.
the class SavingsBOTest method shouldPayOffAnyPaymentsAssociatedWithPayingCustomerAndMandatorySavingsAccount.
@Ignore
@Test
public void shouldPayOffAnyPaymentsAssociatedWithPayingCustomerAndMandatorySavingsAccount() throws AccountException {
// setup
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().buildForUnitTests();
savingsAccount = savingsAccountBuilder.withSavingsProduct(savingsProduct).buildForUnitTests();
final SavingsScheduleEntity unpaidSaving1 = new SavingsScheduleBuilder().withAccount(savingsAccount).withCustomer(payingCustomer).build();
final List<SavingsScheduleEntity> unpaidDepositsForPayingCustomer = Arrays.asList(unpaidSaving1);
final Money zero = new Money(defaultCurrency);
SavingsOfferingBO manSavingsProduct = new SavingsProductBuilder().mandatory().buildForUnitTests();
savingsAccount = savingsAccountBuilder.withSavingsProduct(manSavingsProduct).withBalanceOf(zero).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.MANDATORY, zero);
}
use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.
the class PrdOfferingPersistenceIntegrationTest method testGetMaxPrdOfferingWithProduct.
@Test
public void testGetMaxPrdOfferingWithProduct() throws PersistenceException {
SavingsOfferingBO savingsOffering = new SavingsTestHelper().createSavingsOffering("fsaf6", "ads6");
Assert.assertNotNull(new PrdOfferingPersistence().getMaxPrdOffering());
savingsOffering = null;
}
use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.
the class PrdOfferingPersistenceIntegrationTest method testGetPrdOfferingNameCountWithSameName.
@Test
public void testGetPrdOfferingNameCountWithSameName() throws PersistenceException {
SavingsOfferingBO savingsOffering = new SavingsTestHelper().createSavingsOffering("Savings product", "ads6");
Assert.assertEquals(Integer.valueOf("1"), new PrdOfferingPersistence().getProductOfferingNameCount("Savings product"));
savingsOffering = null;
}
Aggregations