JohnAlva commented on code in PR #4886:
URL: https://github.com/apache/fineract/pull/4886#discussion_r2279999960


##########
fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularInterestPoster.java:
##########
@@ -157,6 +162,44 @@ private List<SavingsAccountTransactionData> 
fetchTransactionsFromIds(final List<
         return 
this.savingsAccountReadPlatformService.retrieveAllTransactionData(refNo);
     }
 
+    private Long validateAccountForCreditAllowOverdraft(Boolean 
allowOverdraft, Boolean isOverdraftDown,
+            SavingsAccountData savingsAccountData, 
SavingsAccountTransactionData savingsAccountTransactionData) {
+        Long accountId = null;
+        if (allowOverdraft) {
+            if 
(!MathUtil.isZero(savingsAccountData.getGlAccountIdForInterestReceivable())) {
+                accountId = isOverdraftDown
+                        ? 
MathUtil.isLessThanZero(savingsAccountTransactionData.getRunningBalance())
+                                ? 
savingsAccountData.getGlAccountIdForInterestReceivable()
+                                : 
savingsAccountData.getGlAccountIdForInterestReceivable()
+                        : savingsAccountData.getGlAccountIdForSavingsControl();
+            } else {
+                accountId = 
savingsAccountData.getGlAccountIdForSavingsControl();

Review Comment:
   I simplified the method by removing redundant else branches, using early 
returns, and reducing nesting. The logic and outcomes remain the same, but the 
structure is now cleaner and easier to follow.



-- 
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