Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7B2852004CA for ; Wed, 11 May 2016 09:52:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 78AFC1602BF; Wed, 11 May 2016 07:52:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C1E2E1602BE for ; Wed, 11 May 2016 09:52:28 +0200 (CEST) Received: (qmail 21647 invoked by uid 500); 11 May 2016 07:52:28 -0000 Mailing-List: contact commits-help@fineract.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@fineract.incubator.apache.org Delivered-To: mailing list commits@fineract.incubator.apache.org Received: (qmail 21638 invoked by uid 99); 11 May 2016 07:52:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 May 2016 07:52:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B2E6DC1A82 for ; Wed, 11 May 2016 07:52:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.636 X-Spam-Level: X-Spam-Status: No, score=-4.636 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.416] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Ovosl0DB3VfM for ; Wed, 11 May 2016 07:52:23 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with SMTP id 3C90C5FAD8 for ; Wed, 11 May 2016 07:52:23 +0000 (UTC) Received: (qmail 21461 invoked by uid 99); 11 May 2016 07:52:22 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 May 2016 07:52:22 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 45223DFB14; Wed, 11 May 2016 07:52:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rajuan@apache.org To: commits@fineract.incubator.apache.org Date: Wed, 11 May 2016 07:52:23 -0000 Message-Id: In-Reply-To: <2ac6c8d0a7234d9dbbcbffa82878a15e@git.apache.org> References: <2ac6c8d0a7234d9dbbcbffa82878a15e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/4] incubator-fineract git commit: MIFOSX-2565 : fixed prepay with floating rates archived-at: Wed, 11 May 2016 07:52:29 -0000 MIFOSX-2565 : fixed prepay with floating rates Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/72a1fff6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/72a1fff6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/72a1fff6 Branch: refs/heads/develop Commit: 72a1fff6454b76514da45efb9f0ce7fc1e5d22e1 Parents: d2b8535 Author: pramod Authored: Wed May 11 11:39:15 2016 +0530 Committer: pramod Committed: Wed May 11 11:39:15 2016 +0530 ---------------------------------------------------------------------- .../domain/AbstractLoanScheduleGenerator.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/72a1fff6/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java ---------------------------------------------------------------------- diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java index d06b3f1..474b852 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java @@ -547,12 +547,24 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener updateFixedInstallmentAmount(mc, loanApplicationTerms, scheduleParams.getPeriodNumber(), loanApplicationTerms .getPrincipal().minus(scheduleParams.getTotalCumulativePrincipal())); } + + // this is to make sure we are recalculating using correct interest rate + // once calculation is done system will set the actual interest rate + BigDecimal currentInterestRate = loanApplicationTerms.getAnnualNominalInterestRate(); + for(LoanTermVariationsData interestRate : interestRates){ + if(interestRate.isApplicable(periodStartDateApplicableForInterest)){ + loanApplicationTerms.updateAnnualNominalInterestRate(interestRate.getDecimalValue()); + } + } + PrincipalInterest interestTillDate = calculatePrincipalInterestComponentsForPeriod(this.paymentPeriodsInOneYearCalculator, interestCalculationGraceOnRepaymentPeriodFraction, scheduleParams.getTotalCumulativePrincipal(), scheduleParams.getTotalCumulativeInterest(), totalInterestChargedForFullLoanTerm, lastTotalOutstandingInterestPaymentDueToGrace, scheduleParams.getOutstandingBalanceAsPerRest(), loanApplicationTerms, scheduleParams.getPeriodNumber(), mc, mergeVariationsToMap(scheduleParams), scheduleParams.getCompoundingMap(), periodStartDateApplicableForInterest, calculateTill, interestRates); + loanApplicationTerms.updateAnnualNominalInterestRate(currentInterestRate); + // applies charges for the period final ScheduleCurrentPeriodParams tempPeriod = new ScheduleCurrentPeriodParams( totalInterestChargedForFullLoanTerm.getCurrency(), interestCalculationGraceOnRepaymentPeriodFraction);