use of org.mifos.accounts.savings.business.SavingsScheduleEntity in project head by mifos.
the class TestObjectFactory method createSavingsAccount.
public static SavingsBO createSavingsAccount(final String globalNum, final CustomerBO customer, final Short accountStateId, final Date startDate, final SavingsOfferingBO savingsOffering) throws Exception {
UserContext userContext = TestUtils.makeUserWithLocales();
MifosCurrency currency = testObjectPersistence.getCurrency();
MeetingBO meeting = createLoanMeeting(customer.getCustomerMeeting().getMeeting());
SavingsBO savings = new SavingsBO(userContext, savingsOffering, customer, AccountState.SAVINGS_PARTIAL_APPLICATION, new Money(currency, "300.0"), null);
savings.save();
savings.setUserContext(TestObjectFactory.getContext());
PersonnelBO loggedInUser = IntegrationTestObjectMother.testUser();
savings.changeStatus(AccountState.fromShort(accountStateId), null, "", loggedInUser);
SavingBOTestUtils.setActivationDate(savings, new Date(System.currentTimeMillis()));
List<Date> meetingDates = getMeetingDates(customer.getOfficeId(), meeting, 3);
short installment = 0;
for (Date date : meetingDates) {
SavingsScheduleEntity actionDate = new SavingsScheduleEntity(savings, customer, ++installment, new java.sql.Date(date.getTime()), PaymentStatus.UNPAID, new Money(currency, "200.0"));
AccountTestUtils.addAccountActionDate(actionDate, savings);
}
StaticHibernateUtil.flushSession();
return getObject(SavingsBO.class, savings.getAccountId());
}
Aggregations