adamsaghy commented on code in PR #3591:
URL: https://github.com/apache/fineract/pull/3591#discussion_r1398825464


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java:
##########
@@ -811,108 +815,102 @@ public List<PostingPeriod> calculateInterestUsing(final 
MathContext mc, final Lo
             boolean isInterestTransfer, final boolean 
isSavingsInterestPostingAtCurrentPeriodEnd, final Integer 
financialYearBeginningMonth,
             final LocalDate postInterestOnDate, final boolean 
backdatedTxnsAllowedTill, final boolean postReversals) {
 
-        // no openingBalance concept supported yet but probably will to allow
-        // for migrations.
-        Money openingAccountBalance = null;
-
+        // no openingBalance concept supported yet but probably will to allow 
for migrations.
         // Check global configurations and 'pivot' date is null
-        if (backdatedTxnsAllowedTill) {
-            openingAccountBalance = Money.of(this.currency, 
this.summary.getRunningBalanceOnPivotDate());
-        } else {
-            openingAccountBalance = Money.zero(this.currency);
-        }
-
-        // update existing transactions so derived balance fields are
-        // correct.
+        Money openingAccountBalance = backdatedTxnsAllowedTill ? 
Money.of(this.currency, this.summary.getRunningBalanceOnPivotDate())
+                : Money.zero(this.currency);
 
+        // update existing transactions so derived balance fields are correct.
         recalculateDailyBalances(openingAccountBalance, 
upToInterestCalculationDate, backdatedTxnsAllowedTill, postReversals);
 
-        // 1. default to calculate interest based on entire history OR
-        // 2. determine latest 'posting period' and find interest credited to
-        // that period
-
-        // A generate list of EndOfDayBalances (not including interest 
postings)
-        final SavingsPostingInterestPeriodType postingPeriodType = 
SavingsPostingInterestPeriodType.fromInt(this.interestPostingPeriodType);
-
-        final SavingsCompoundingInterestPeriodType compoundingPeriodType = 
SavingsCompoundingInterestPeriodType
-                .fromInt(this.interestCompoundingPeriodType);
+        final List<PostingPeriod> allPostingPeriods = new ArrayList<>();
+        if (hasInterestCalculation() || hasOverdraftInterestCalculation()) {

Review Comment:
   "hasOverDraftInterestCalculation" method is kind of unnecessary hence, if 
the "hasInterestCalculation()" is false, the "hasOverDraftInteretCalculation" 
method is false too (see last condition).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to