use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class ClientIntegrationTest method testGenerateScheduleForClient_OnClientCreate.
@Test
public void testGenerateScheduleForClient_OnClientCreate() throws Exception {
SavingsOfferingBO savingsOffering = TestObjectFactory.createSavingsProduct("Offering1", "s1", SavingsType.MANDATORY, ApplicableTo.GROUPS, new Date(System.currentTimeMillis()));
createParentObjects(CustomerStatus.GROUP_ACTIVE);
accountBO = TestObjectFactory.createSavingsAccount("globalNum", center, AccountState.SAVINGS_ACTIVE, new java.util.Date(), savingsOffering, TestObjectFactory.getContext());
Assert.assertEquals(0, accountBO.getAccountActionDates().size());
client = createClient(CustomerStatus.CLIENT_ACTIVE);
StaticHibernateUtil.flushSession();
accountBO = TestObjectFactory.getObject(AccountBO.class, accountBO.getAccountId());
Assert.assertEquals(1, accountBO.getAccountCustomFields().size());
Assert.assertEquals(10, accountBO.getAccountActionDates().size());
for (AccountActionDateEntity actionDate : accountBO.getAccountActionDates()) {
Assert.assertEquals(client.getCustomerId(), actionDate.getCustomer().getCustomerId());
Assert.assertTrue(true);
}
client = TestObjectFactory.getClient(client.getCustomerId());
group = TestObjectFactory.getGroup(group.getCustomerId());
center = TestObjectFactory.getCenter(center.getCustomerId());
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsAccountBuilder method buildForUnitTests.
public SavingsBO buildForUnitTests() {
List<AccountActionDateEntity> listOfScheduledPayments = new ArrayList<AccountActionDateEntity>();
if (scheduledPayments != null) {
listOfScheduledPayments = new ArrayList<AccountActionDateEntity>(scheduledPayments);
}
activationDetails = new SavingsAccountActivationDetail(new LocalDate(activationDate), nextInterestPostingDate, listOfScheduledPayments);
return buildAccount(activationDetails);
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class SavingsAccountBuilder method buildAccount.
private SavingsBO buildAccount(SavingsAccountActivationDetail derivedActivationDetails) {
List<AccountActionDateEntity> listOfScheduledPayments = new ArrayList<AccountActionDateEntity>();
if (scheduledPayments == null) {
listOfScheduledPayments = derivedActivationDetails.getScheduledPayments();
} else {
listOfScheduledPayments = new ArrayList<AccountActionDateEntity>(scheduledPayments);
}
activationDetails = new SavingsAccountActivationDetail(new LocalDate(activationDate), nextInterestPostingDate, listOfScheduledPayments);
CreationDetail creationDetail = new CreationDetail(new DateTime(createdDate), createdByUserId.intValue());
SavingsBO savingsAccount = new SavingsBO(accountState, customer, activationDetails, creationDetail, savingsProduct, recommendedAmountUnit, recommendedAmount, createdBy, savingsBalanceAmount);
savingsAccount.setCustomerPersistence(customerDao);
savingsAccount.setSavingsPaymentStrategy(savingsPaymentStrategy);
savingsAccount.setSavingsTransactionActivityHelper(savingsTransactionActivityHelper);
savingsAccount.updateDetails(TestUtils.makeUserWithLocales());
for (AccountPaymentEntity depositPayment : deposits) {
try {
depositPayment.setAccount(savingsAccount);
savingsAccount.deposit(depositPayment, customer);
} catch (AccountException e) {
throw new MifosRuntimeException("builder failed to apply deposits.", e);
}
}
for (AccountPaymentEntity withdrawal : withdrawals) {
try {
withdrawal.setAccount(savingsAccount);
savingsAccount.withdraw(withdrawal, customer);
} catch (AccountException e) {
throw new MifosRuntimeException("builder failed to apply withdrawals.", e);
}
}
return savingsAccount;
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanArrearsHelperIntegrationTest method setDisbursementDateAsOldDate.
private void setDisbursementDateAsOldDate(AccountBO account) {
Date startDate = offSetCurrentDate(15);
LoanBO loan = (LoanBO) account;
LoanBOTestUtils.modifyDisbursementDate(loan, startDate);
for (AccountActionDateEntity actionDate : loan.getAccountActionDates()) {
LoanBOTestUtils.setActionDate(actionDate, offSetGivenDate(actionDate.getActionDate(), 18));
}
}
use of org.mifos.accounts.business.AccountActionDateEntity in project head by mifos.
the class LoanArrearsTaskIntegrationTest method setDisbursementDateAsOldDate.
private void setDisbursementDateAsOldDate(AccountBO account) {
Date startDate = offSetCurrentDate(15);
LoanBO loan = (LoanBO) account;
LoanBOTestUtils.modifyDisbursementDate(loan, startDate);
for (AccountActionDateEntity actionDate : loan.getAccountActionDates()) {
LoanBOTestUtils.setActionDate(actionDate, offSetGivenDate(actionDate.getActionDate(), 18));
}
}
Aggregations