adamsaghy commented on code in PR #4961:
URL: https://github.com/apache/fineract/pull/4961#discussion_r2332426199
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanDisbursementService.java:
##########
@@ -377,4 +420,64 @@ private Map<String, Object> parseDisbursementDetails(final
JsonObject jsonObject
return returnObject;
}
+ private boolean hasMultipleOrPreDefinedDisbursementDetails(final Loan loan,
+ final Collection<LoanDisbursementDetails> undisbursedDetails) {
+ Collection<LoanDisbursementDetails> allDisbursementDetails =
loan.getDisbursementDetails();
+
+ if (undisbursedDetails.size() > 1) {
+ return true;
+ }
+
+ if (allDisbursementDetails.size() > 1 &&
!undisbursedDetails.isEmpty()) {
+ return true;
+ }
+
+ if (undisbursedDetails.size() == 1) {
+ LoanDisbursementDetails singleDetail =
undisbursedDetails.iterator().next();
+ BigDecimal loanPrincipal =
loan.getLoanRepaymentScheduleDetail().getPrincipal().getAmount();
+
+ if (singleDetail.principal().compareTo(loanPrincipal) == 0) {
+ return false;
+ }
+ }
+
+ // Default to tranche behavior for safety in ambiguous cases
+ return true;
+ }
Review Comment:
This looks rather complex for a simple check whether there are multiple, not
yet disbursed details or not... Also I am not convinced we need this. We should
simply pick the next in line (ordered by expected disbursement date + created
date / id / amount).
--
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]