use of org.mifos.accounts.loan.business.LoanScheduleEntity in project head by mifos.
the class FirstInstallmentRoudingDifferenceLoanScheduleRounder method roundGracePeriodInstallments.
private void roundGracePeriodInstallments(Integer gracePeriodInstallmentsCount, GraceType graceType, Short gracePeriodDuration, List<LoanScheduleEntity> unroundedLoanSchedules, List<LoanScheduleEntity> roundedLoanSchedules, RepaymentTotals totals) {
int installmentNum = 0;
while (installmentNum < gracePeriodInstallmentsCount) {
LoanScheduleEntity currentInstallment = unroundedLoanSchedules.get(installmentNum);
LoanScheduleEntity roundedInstallment = currentInstallment;
installmentNum++;
roundedInstallment = loanScheduleInstallmentRounder.roundAndAdjustGraceInstallment_v2(roundedInstallment);
loanScheduleInstallmentRounder.updateRunningTotals_v2(totals, roundedInstallment);
roundedLoanSchedules.add(roundedInstallment);
}
}
use of org.mifos.accounts.loan.business.LoanScheduleEntity in project head by mifos.
the class ApplicationInitializer method applyMifos4948Fix.
@SuppressWarnings("unchecked")
private void applyMifos4948Fix() throws AccountException {
Session session = StaticHibernateUtil.getSessionTL();
List<LoanBO> fixLoans;
Query query = session.getNamedQuery("fetchMissingInstalmentsForWriteOffsAndReschedules");
fixLoans = query.list();
if (fixLoans != null && fixLoans.size() > 0) {
for (LoanBO fixLoan : fixLoans) {
Set<AccountActionDateEntity> fixLoanSchedules = fixLoan.getAccountActionDates();
Money totalMissedPayment = new Money(fixLoan.getCurrency());
if (fixLoanSchedules != null && fixLoanSchedules.size() > 0) {
for (AccountActionDateEntity fixLoanSchedule : fixLoanSchedules) {
LoanScheduleEntity loanInstallment = (LoanScheduleEntity) fixLoanSchedule;
totalMissedPayment = totalMissedPayment.add(loanInstallment.getPrincipalDue());
}
}
logger.info("MIFOS-4948 - Loan: " + fixLoan.getGlobalAccountNum() + " - Adding payment: " + totalMissedPayment + " to fix instalments that should have been written-off or rescheduled.");
fixLoan.applyMifos4948FixPayment(totalMissedPayment);
}
logger.info(fixLoans.size() + " Account Payments created to fix data related to MIFOS-4948");
}
}
use of org.mifos.accounts.loan.business.LoanScheduleEntity in project head by mifos.
the class AccountActionDateEntityIntegrationTest method testGetPrincipal.
@Test
public void testGetPrincipal() {
Set<AccountActionDateEntity> accountActionDates = groupLoan.getAccountActionDates();
for (AccountActionDateEntity accountActionDate : accountActionDates) {
Money principal = ((LoanScheduleEntity) accountActionDate).getPrincipal();
Assert.assertEquals(100.0, principal.getAmount().doubleValue(), DELTA);
}
}
use of org.mifos.accounts.loan.business.LoanScheduleEntity in project head by mifos.
the class AccountFeesActionDetailEntityIntegrationTest method testMakeEarlyRepaymentEnteriesForFeePayment.
@Test
public void testMakeEarlyRepaymentEnteriesForFeePayment() {
for (AccountActionDateEntity installment : accountBO.getAccountActionDates()) {
LoanScheduleEntity accountActionDateEntity = (LoanScheduleEntity) installment;
for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : accountActionDateEntity.getAccountFeesActionDetails()) {
accountFeesActionDetailEntity.makeRepaymentEnteries(LoanConstants.PAY_FEES_PENALTY_INTEREST);
Assert.assertEquals(accountFeesActionDetailEntity.getFeeAmount(), accountFeesActionDetailEntity.getFeeAmountPaid());
}
}
}
use of org.mifos.accounts.loan.business.LoanScheduleEntity in project head by mifos.
the class AccountFeesActionDetailEntityIntegrationTest method testMakeEarlyRepaymentEnteriesForFeePaymentWithInterestWaiver.
@Test
public void testMakeEarlyRepaymentEnteriesForFeePaymentWithInterestWaiver() {
for (AccountActionDateEntity installment : accountBO.getAccountActionDates()) {
LoanScheduleEntity accountActionDateEntity = (LoanScheduleEntity) installment;
for (AccountFeesActionDetailEntity accountFeesActionDetailEntity : accountActionDateEntity.getAccountFeesActionDetails()) {
accountFeesActionDetailEntity.makeRepaymentEnteries(LoanConstants.PAY_FEES_PENALTY);
Assert.assertEquals(accountFeesActionDetailEntity.getFeeAmount(), accountFeesActionDetailEntity.getFeeAmountPaid());
}
}
}
Aggregations