fineract-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100126 <...@git.apache.org>
Subject [GitHub] incubator-fineract pull request #130: [FINERACT-167] Loan foreclosure implem...
Date Thu, 09 Jun 2016 09:18:43 GMT
Github user nazeer1100126 commented on a diff in the pull request:

    https://github.com/apache/incubator-fineract/pull/130#discussion_r66407606
  
    --- Diff: fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java
---
    @@ -574,9 +576,118 @@ public LoanTransaction makeRefundForActiveLoan(Long accountId, CommandProcessing
             return newRefundTransaction;
         }
     
    +    @Override
    +    public Map<String, Object> foreCloseLoan(LoanForeClosureDetailDTO foreClosureDetailDTO)
{
    +        Loan loan = foreClosureDetailDTO.getLoan();
    +        MonetaryCurrency currency = loan.getCurrency();
    +        LocalDateTime createdDate = DateUtils.getLocalDateTimeOfTenant();
    +        final Map<String, Object> changes = new LinkedHashMap<>();
    +        List<LoanTransaction> newTransactions = new ArrayList<>();
    +
    +        final List<Long> existingTransactionIds = new ArrayList<>();
    +        final List<Long> existingReversedTransactionIds = new ArrayList<>();
    +        existingTransactionIds.addAll(loan.findExistingTransactionIds());
    +        existingReversedTransactionIds.addAll(loan.findExistingReversedTransactionIds());
    +        final LoanRepaymentScheduleInstallment foreCloseDetail = loan.fetchLoanForeclosureDetail(foreClosureDetailDTO.getTransactionDate());
    +        if (loan.isPeriodicAccrualAccountingEnabledOnLoanProduct()
    +                && (loan.getAccruedTill() == null || !foreClosureDetailDTO.getTransactionDate().isEqual(loan.getAccruedTill())))
{
    +            Money[] accruedReceivables = loan.getReceivableIncome(foreClosureDetailDTO.getTransactionDate());
    +            Money interestPortion = foreCloseDetail.getInterestCharged(currency).minus(accruedReceivables[0]);
    +            Money feePortion = foreCloseDetail.getFeeChargesCharged(currency).minus(accruedReceivables[1]);
    +            Money penaltyPortion = foreCloseDetail.getPenaltyChargesCharged(currency).minus(accruedReceivables[2]);
    +            Money total = interestPortion.plus(feePortion).plus(penaltyPortion);
    +            if (total.isGreaterThanZero()) {
    --- End diff --
    
    You need to update all installments accrual portions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message