Search in sources :

Example 1 with RepaymentScheduleInstallmentDto

use of org.mifos.dto.domain.RepaymentScheduleInstallmentDto in project head by mifos.

the class LoanAccountServiceFacadeWebTier method retrieveOriginalLoanSchedule.

@Override
public OriginalScheduleInfoDto retrieveOriginalLoanSchedule(String globalAccountNum) {
    LoanBO loanBO = this.loanDao.findByGlobalAccountNum(globalAccountNum);
    Integer accountId = loanBO.getAccountId();
    try {
        List<OriginalLoanScheduleEntity> loanScheduleEntities = loanBusinessService.retrieveOriginalLoanSchedule(accountId);
        ArrayList<RepaymentScheduleInstallmentDto> repaymentScheduleInstallments = new ArrayList<RepaymentScheduleInstallmentDto>();
        for (OriginalLoanScheduleEntity loanScheduleEntity : loanScheduleEntities) {
            RepaymentScheduleInstallment repaymentScheduleInstallment = loanScheduleEntity.toDto();
            RepaymentScheduleInstallmentDto installmentDto = new RepaymentScheduleInstallmentDto(repaymentScheduleInstallment.getInstallment(), repaymentScheduleInstallment.getPrincipal().toString(), repaymentScheduleInstallment.getInterest().toString(), repaymentScheduleInstallment.getFees().toString(), repaymentScheduleInstallment.getMiscFees().toString(), repaymentScheduleInstallment.getFeesWithMiscFee().toString(), repaymentScheduleInstallment.getMiscPenalty().toString(), repaymentScheduleInstallment.getTotal(), repaymentScheduleInstallment.getDueDate());
            repaymentScheduleInstallments.add(installmentDto);
        }
        return new OriginalScheduleInfoDto(loanBO.getLoanAmount().toString(), loanBO.getDisbursementDate(), repaymentScheduleInstallments);
    } catch (PersistenceException e) {
        throw new MifosRuntimeException(e);
    }
}
Also used : RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment) OriginalScheduleInfoDto(org.mifos.dto.domain.OriginalScheduleInfoDto) LoanBO(org.mifos.accounts.loan.business.LoanBO) OriginalLoanScheduleEntity(org.mifos.accounts.loan.business.OriginalLoanScheduleEntity) RepaymentScheduleInstallmentDto(org.mifos.dto.domain.RepaymentScheduleInstallmentDto) ArrayList(java.util.ArrayList) PersistenceException(org.mifos.framework.exceptions.PersistenceException) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

ArrayList (java.util.ArrayList)1 LoanBO (org.mifos.accounts.loan.business.LoanBO)1 OriginalLoanScheduleEntity (org.mifos.accounts.loan.business.OriginalLoanScheduleEntity)1 RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 OriginalScheduleInfoDto (org.mifos.dto.domain.OriginalScheduleInfoDto)1 RepaymentScheduleInstallmentDto (org.mifos.dto.domain.RepaymentScheduleInstallmentDto)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1