use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LoanArrearsAgingHelperIntegrationTest method testLoanWithTwoOverduePayments.
@Test
public void testLoanWithTwoOverduePayments() throws Exception {
LoanBO loan = setUpLoan(dateTime, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING);
int daysOverdue = 10;
LoanArrearsAgingEntity loanArrearsAgingEntity = ageLoanAndGetLoanArrearsAgingEntity(loan, repaymentInterval + daysOverdue);
Assert.assertEquals(new Money(getCurrency(), "" + loanAmount), loanArrearsAgingEntity.getUnpaidPrincipal());
Assert.assertEquals(new Money(getCurrency(), "" + totalInterest), loanArrearsAgingEntity.getUnpaidInterest());
Assert.assertEquals(new Money(getCurrency(), "" + 2 * principalForOneInstallment), loanArrearsAgingEntity.getOverduePrincipal());
Assert.assertEquals(new Money(getCurrency(), "" + 2 * interestForOneInstallment), loanArrearsAgingEntity.getOverdueInterest());
Assert.assertEquals(new Money(getCurrency(), "" + (2 * (principalForOneInstallment + interestForOneInstallment))), loanArrearsAgingEntity.getOverdueBalance());
Assert.assertEquals(daysOverdue, loanArrearsAgingEntity.getDaysInArrears().intValue());
}
use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LoanAccountBuilder method build.
public LoanBO build() {
BigDecimal amount = BigDecimal.valueOf(orgininalLoanAmount);
Money loanAmount = new Money(Money.getDefaultCurrency(), amount);
BigDecimal balance = BigDecimal.valueOf(remainingLoanBalance);
Money loanBalance = new Money(Money.getDefaultCurrency(), balance);
final LoanBO loanAccount = new LoanBO(loanProduct, numOfInstallments, gracePeriodType, accountType, accountState, customer, offsettingAllowable, loanAmount, loanBalance);
loanAccount.setUserContext(TestUtils.makeUser());
loanAccount.setCreateDetails();
return loanAccount;
}
use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LoanArrearsAgingHelperIntegrationTest method setUpLoan.
private LoanBO setUpLoan(DateTime dateTime, AccountState accountState) {
Date startDate = dateTime.toDate();
meeting = getNewMeeting(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING, WeekDay.MONDAY, startDate);
center = TestObjectFactory.createWeeklyFeeCenter(this.getClass().getSimpleName() + " Center", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter(this.getClass().getSimpleName() + " Group", CustomerStatus.GROUP_ACTIVE, center);
LoanOfferingBO product = TestObjectFactory.createLoanOffering("LoanProduct", "LP", startDate, meeting);
LoanBO loan = createBasicLoanAccount(group, accountState, product, "" + loanAmount, numInstallments, interestRate);
return loan;
}
use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LoanArrearsAgingHelperIntegrationTest method testThatLoanInActiveInBadStandingStateDoesGenerateArrearsData.
@Test
public void testThatLoanInActiveInBadStandingStateDoesGenerateArrearsData() throws Exception {
LoanBO loan = setUpLoan(dateTime, AccountState.LOAN_ACTIVE_IN_BAD_STANDING);
Assert.assertNotNull(ageLoanTenDaysAndGetLoanArrearsAgingEntity(loan));
}
use of org.mifos.accounts.loan.business.LoanBO in project head by mifos.
the class LoanArrearsAgingHelperIntegrationTest method ageLoanAndGetLoanArrearsAgingEntity.
private LoanArrearsAgingEntity ageLoanAndGetLoanArrearsAgingEntity(LoanBO loan, int daysToAgeLoan) throws BatchJobException, PersistenceException {
Assert.assertNull(loan.getLoanArrearsAgingEntity());
new DateTimeService().setCurrentDateTimeFixed(dateTime.plusDays(daysToAgeLoan));
runLoanArrearsThenLoanArrearsAging();
StaticHibernateUtil.flushAndClearSession();
LoanBO reloadedLoan = legacyLoanDao.getAccount(loan.getAccountId());
return reloadedLoan.getLoanArrearsAgingEntity();
}
Aggregations