Examples of LoanRepaymentScheduleInstallment


Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

        for (Integer frequency : frequencyNumbers) {
            scheduleDates.remove(frequency);
        }

        LoanRepaymentScheduleInstallment installment = null;
        if (!scheduleDates.isEmpty()) {
            if (loan == null) {
                loan = this.loanAssembler.assembleFrom(loanId);
                checkClientOrGroupActive(loan);
                existingTransactionIds.addAll(loan.findExistingTransactionIds());
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

    private List<LoanRepaymentScheduleInstallment> retrieveRepaymentScheduleFromModel(LoanScheduleModel model) {
        final List<LoanRepaymentScheduleInstallment> installments = new ArrayList<>();
        for (final LoanScheduleModelPeriod scheduledLoanInstallment : model.getPeriods()) {
            if (scheduledLoanInstallment.isRepaymentPeriod()) {
                final LoanRepaymentScheduleInstallment installment = new LoanRepaymentScheduleInstallment(null,
                        scheduledLoanInstallment.periodNumber(), scheduledLoanInstallment.periodFromDate(),
                        scheduledLoanInstallment.periodDueDate(), scheduledLoanInstallment.principalDue(),
                        scheduledLoanInstallment.interestDue(), scheduledLoanInstallment.feeChargesDue(),
                        scheduledLoanInstallment.penaltyChargesDue(), scheduledLoanInstallment.isRecalculatedInterestComponent());
                installments.add(installment);
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

                && !this.fromJsonHelper.parameterExists(RescheduleLoansApiConstants.adjustedDueDateParamName, jsonElement)) {
            dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.graceOnPrincipalParamName).notNull();
        }

        if (rescheduleFromDate != null) {
            LoanRepaymentScheduleInstallment installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate);

            if (installment == null) {
                dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName)
                        .failWithCode("repayment.schedule.installment.does.not.exist", "Repayment schedule installment does not exist");
            }

            if (installment != null && installment.isObligationsMet()) {
                dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName)
                        .failWithCode("repayment.schedule.installment.obligation.met", "Repayment schedule installment obligation met");
            }

            if (installment != null && installment.isPartlyPaid()) {
                dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.rescheduleFromDateParamName)
                        .failWithCode("repayment.schedule.installment.partly.paid", "Repayment schedule installment is partly paid");
            }

            if (installment != null) {

                if (installment.getPenaltyChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) {
                    dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                            "repayment.schedule.installment.has.an.outstanding.penalty.charge",
                            "Repayment schedule installment has an outsatnding penalty charge.");
                }

                if (installment.getFeeChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) {
                    dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                            "repayment.schedule.installment.has.an.outstanding.fee.charge",
                            "Repayment schedule installment has an outsatnding fee charge.");
                }
            }
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

        if (rescheduleFromInstallmentNo > 0) {
            // this will hold the loan repayment installment that is before the
            // reschedule start installment
            // (rescheduleFrominstallment)
            LoanRepaymentScheduleInstallment previousInstallment = null;

            // get the install number of the previous installment
            int previousInstallmentNo = rescheduleFromInstallmentNo - 1;

            // only fetch the installment if the number is greater than 0
            if (previousInstallmentNo > 0) {
                previousInstallment = loan.fetchRepaymentScheduleInstallment(previousInstallmentNo);
            }

            LoanRepaymentScheduleInstallment firstInstallment = loan.fetchRepaymentScheduleInstallment(1);

            // the "installment from date" is equal to the due date of the
            // previous installment, if it exists
            if (previousInstallment != null) {
                installmentFromDate = previousInstallment.getDueDate();
            }

            else {
                installmentFromDate = firstInstallment.getFromDate();
            }

            installmentDueDate = installmentFromDate;
            LocalDate periodStartDateApplicableForInterest = installmentFromDate;
            Integer periodNumber = 1;
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

            if (!loan.status().isActive()) {
                dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("loan.is.not.active", "Loan is not active");
            }

            if (rescheduleFromDate != null) {
                LoanRepaymentScheduleInstallment installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate);

                if (installment == null) {
                    dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                            "loan.repayment.schedule.installment.does.not.exist", "Repayment schedule installment does not exist");
                }

                if (installment != null && installment.isObligationsMet()) {
                    dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                            "loan.repayment.schedule.installment." + "obligation.met", "Repayment schedule installment obligation met");
                }

                if (installment != null) {

                    if (installment.getPenaltyChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) {
                        dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                                "repayment.schedule.installment.has.an.outstanding.penalty.charge",
                                "Repayment schedule installment has an outsatnding penalty charge.");
                    }

                    if (installment.getFeeChargesOutstanding(loan.getCurrency()).isGreaterThanZero()) {
                        dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                                "repayment.schedule.installment.has.an.outstanding.fee.charge",
                                "Repayment schedule installment has an outsatnding fee charge.");
                    }
                }
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

            Money principalUnprocessed = Money.zero(currency);
            Money interestUnprocessed = Money.zero(currency);
            Money feeUnprocessed = Money.zero(currency);
            boolean isBeforeFirstInstallment = false;
            if (scheduleInstallments.size() == 1) {
                LoanRepaymentScheduleInstallment installment = scheduleInstallments.get(0);
                if (installment.getInstallmentNumber() == 1
                        && (installment.getDueDate().isAfter(processTransactionsForInterestCompound) || (installment
                                .isRecalculatedInterestComponent() && installment.getDueDate().isEqual(
                                processTransactionsForInterestCompound)))) {
                    isBeforeFirstInstallment = true;
                }
            }
            if (!isBeforeFirstInstallment) {
                for (LoanRepaymentScheduleInstallment installment : scheduleInstallments) {
                    principalUnprocessed = principalUnprocessed.plus(installment.getPrincipalOutstanding(currency));
                    interestUnprocessed = interestUnprocessed.plus(installment.getInterestOutstanding(currency));
                    feeUnprocessed = feeUnprocessed.plus(installment.getFeeChargesOutstanding(currency));
                    feeUnprocessed = feeUnprocessed.plus(installment.getPenaltyChargesOutstanding(currency));
                }
            }
            if (interestUnprocessed.isLessThan(loanTransaction.getAmount(currency))) {
                LoanRepaymentScheduleInstallment lastProcessedInstallment = scheduleInstallments.get(scheduleInstallments.size() - 1);
                LocalDate startDate = lastProcessedInstallment.getDueDate();
                if (isBeforeFirstInstallment) {
                    startDate = loanApplicationTerms.getExpectedDisbursementDate();
                }
                RecalculationDetail recalculationDetail = new RecalculationDetail(false, startDate, processTransactionsForInterestCompound,
                        null, true);
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

                    installments, loanCharges, lastTransactionDate);
            Map<Integer, LoanRepaymentScheduleInstallment> installmentMap = getRepaymentsAsMap(installments);

            for (LoanScheduleModelPeriod loanScheduleModelPeriod : periods) {
                if (loanScheduleModelPeriod.isRepaymentPeriod()) {
                    LoanRepaymentScheduleInstallment installment = installmentMap.get(loanScheduleModelPeriod.periodNumber());
                    Money overdueChargeForInstallment = Money.zero(currency);
                    overdueChargeForInstallment = cumulativeOverDuePenaltyChargesDueWithin(loanScheduleModelPeriod.periodFromDate(),
                            loanScheduleModelPeriod.periodDueDate(), loanCharges, currency, installment.getPrincipalOutstanding(currency)
                                    .getAmount(), installment.getInterestOutstanding(currency).getAmount(), graceDate.isAfter(installment
                                    .getDueDate()));
                    totalPenaltyChargesCharged = totalPenaltyChargesCharged.add(overdueChargeForInstallment.getAmount());
                    BigDecimal feeChargesForInstallment = BigDecimal.ZERO;
                    loanScheduleModelPeriod.addLoanCharges(feeChargesForInstallment, overdueChargeForInstallment.getAmount());
                }
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

    private List<LoanRepaymentScheduleInstallment> retrieveRepaymentSchedule(LoanScheduleModel model) {
        final List<LoanRepaymentScheduleInstallment> installments = new ArrayList<>();
        for (final LoanScheduleModelPeriod scheduledLoanInstallment : model.getPeriods()) {
            if (scheduledLoanInstallment.isRepaymentPeriod()) {
                final LoanRepaymentScheduleInstallment installment = new LoanRepaymentScheduleInstallment(null,
                        scheduledLoanInstallment.periodNumber(), scheduledLoanInstallment.periodFromDate(),
                        scheduledLoanInstallment.periodDueDate(), scheduledLoanInstallment.principalDue(),
                        scheduledLoanInstallment.interestDue(), scheduledLoanInstallment.feeChargesDue(),
                        scheduledLoanInstallment.penaltyChargesDue(), scheduledLoanInstallment.isRecalculatedInterestComponent());
                installments.add(installment);
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

                    penaltyCharges = penaltyCharges.plus(loanCharge.amountOutstanding());
                }
            }
        }

        return new LoanRepaymentScheduleInstallment(null, 0, onDate, onDate, totalPrincipal.getAmount(), totalInterest.getAmount(),
                feeCharges.getAmount(), penaltyCharges.getAmount(), false);
    }
View Full Code Here

Examples of org.mifosplatform.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment

                precloseTransaction = loanTransaction;
            }
            collectedPrincipal = collectedPrincipal.plus(loanTransaction.getPrincipalPortion());
        }
        if (precloseTransaction != null) {
            LoanRepaymentScheduleInstallment loanRepaymentScheduleInstallment = calculatePrepaymentAmount(installments, currency,
                    precloseTransaction.getTransactionDate(), applicationTerms.getInterestChargedFromLocalDate(), applicationTerms, mc,
                    loanCharges);
            Money pendingPrinciapl = applicationTerms.getPrincipal().minus(collectedPrincipal)
                    .plus(precloseTransaction.getPrincipalPortion());
            if (pendingPrinciapl.isGreaterThan(loanRepaymentScheduleInstallment.getPrincipal(currency))
                    || precloseTransaction.getAmount(currency).isLessThan(loanRepaymentScheduleInstallment.getTotalOutstanding(currency))) {
                precloseTransaction = null;
            }
        }

        return precloseTransaction;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.