Search in sources :

Example 1 with RepaymentScheduleInstallment

use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.

the class InstallmentsValidatorImpl method validateInstallmentFormat.

private void validateInstallmentFormat(List<RepaymentScheduleInstallment> installments, Errors errors) {
    for (RepaymentScheduleInstallment installment : installments) {
        errors.addErrors(installmentFormatValidator.validateTotalAmountFormat(installment));
        errors.addErrors(installmentFormatValidator.validateDueDateFormat(installment));
    }
}
Also used : RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)

Example 2 with RepaymentScheduleInstallment

use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.

the class ListOfInstallmentsValidatorImpl method getDueDateInstallmentsLookup.

private Map<Date, List<String>> getDueDateInstallmentsLookup(List<RepaymentScheduleInstallment> installments) {
    Map<Date, List<String>> dateInstallmentsLookup = new LinkedHashMap<Date, List<String>>();
    for (RepaymentScheduleInstallment installment : installments) {
        Date key = installment.getDueDateValue();
        String value = installment.getInstallmentNumberAsString();
        CollectionUtils.addKeyValue(dateInstallmentsLookup, key, value);
    }
    return dateInstallmentsLookup;
}
Also used : RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment) List(java.util.List) ArrayList(java.util.ArrayList) Date(java.util.Date) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with RepaymentScheduleInstallment

use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.

the class LoanBO method updateInstallmentSchedule.

public void updateInstallmentSchedule(List<RepaymentScheduleInstallment> installments) {
    Map<Integer, LoanScheduleEntity> loanScheduleEntityLookUp = getLoanScheduleEntityMap();
    for (RepaymentScheduleInstallment installment : installments) {
        LoanScheduleEntity loanScheduleEntity = loanScheduleEntityLookUp.get(installment.getInstallment());
        loanScheduleEntity.setPrincipal(installment.getPrincipal());
        loanScheduleEntity.setInterest(installment.getInterest());
        loanScheduleEntity.setActionDate(new java.sql.Date(installment.getDueDateValue().getTime()));
    }
    updateLoanSummary();
}
Also used : RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)

Example 4 with RepaymentScheduleInstallment

use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.

the class LoanBO method toRepaymentScheduleDto.

public List<RepaymentScheduleInstallment> toRepaymentScheduleDto(Locale userLocale) {
    List<RepaymentScheduleInstallment> installments = new ArrayList<RepaymentScheduleInstallment>();
    for (AccountActionDateEntity actionDate : this.getAccountActionDates()) {
        LoanScheduleEntity loanSchedule = (LoanScheduleEntity) actionDate;
        installments.add(loanSchedule.toDto());
    }
    Collections.sort(installments, new Comparator<RepaymentScheduleInstallment>() {

        @Override
        public int compare(final RepaymentScheduleInstallment act1, final RepaymentScheduleInstallment act2) {
            return act1.getInstallment().compareTo(act2.getInstallment());
        }
    });
    return installments;
}
Also used : AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment) ArrayList(java.util.ArrayList)

Example 5 with RepaymentScheduleInstallment

use of org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment in project head by mifos.

the class LoanBusinessService method applyDailyInterestRatesWhereApplicable.

public List<RepaymentScheduleInstallment> applyDailyInterestRatesWhereApplicable(LoanScheduleGenerationDto loanScheduleGenerationDto, Locale locale) {
    LoanBO loanBO = loanScheduleGenerationDto.getLoanBO();
    List<RepaymentScheduleInstallment> installments = loanBO.toRepaymentScheduleDto(locale);
    return applyDailyInterestRatesWhereApplicable(loanScheduleGenerationDto, installments);
}
Also used : RepaymentScheduleInstallment(org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment) LoanBO(org.mifos.accounts.loan.business.LoanBO)

Aggregations

RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)66 Test (org.junit.Test)44 Money (org.mifos.framework.util.helpers.Money)34 Date (java.util.Date)27 ArrayList (java.util.ArrayList)19 ErrorEntry (org.mifos.platform.validations.ErrorEntry)19 LoanBO (org.mifos.accounts.loan.business.LoanBO)7 VariableInstallmentDetailsBO (org.mifos.accounts.productdefinition.business.VariableInstallmentDetailsBO)7 OriginalScheduleInfoDto (org.mifos.accounts.loan.business.service.OriginalScheduleInfoDto)6 LoanAccountActionForm (org.mifos.accounts.loan.struts.actionforms.LoanAccountActionForm)6 Errors (org.mifos.platform.validations.Errors)6 MifosCurrency (org.mifos.application.master.business.MifosCurrency)5 MifosRuntimeException (org.mifos.core.MifosRuntimeException)5 BigDecimal (java.math.BigDecimal)4 ActionErrors (org.apache.struts.action.ActionErrors)4 Ignore (org.junit.Ignore)4 HashSet (java.util.HashSet)3 LocalDate (org.joda.time.LocalDate)3 OriginalLoanScheduleEntity (org.mifos.accounts.loan.business.OriginalLoanScheduleEntity)3 MessageLookup (org.mifos.application.master.MessageLookup)3