galovics commented on code in PR #4643:
URL: https://github.com/apache/fineract/pull/4643#discussion_r2074118301
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java:
##########
@@ -1542,4 +1552,34 @@ public Pair<Loan, Map<String, Object>>
assembleLoanApproval(AppUser currentUser,
return Pair.of(loan, actualChanges);
}
+ private Set<LoanCharge> separateTotalCompoundingPercentageCharges(final
Set<LoanCharge> loanCharges) {
+ Set<LoanCharge> interestCharges = new HashSet<>();
+ if (loanCharges != null) {
+ for (final LoanCharge loanCharge : loanCharges) {
+ if ((loanCharge.isSpecifiedDueDate() ||
loanCharge.isDisbursementCharge())
+ &&
(loanCharge.getChargeCalculation().isPercentageOfInterest()
+ ||
loanCharge.getChargeCalculation().isPercentageOfAmountAndInterest())) {
+ interestCharges.add(loanCharge);
+ }
+ }
+ loanCharges.removeAll(interestCharges);
+ }
+ return interestCharges;
+ }
+
+ private void updateDisbursementWithCharges(final
Collection<LoanScheduleModelPeriod> periods,
+ final Set<LoanCharge> nonCompoundingCharges) {
+ final BigDecimal totalInterest = periods.stream().filter(p ->
p.isRepaymentPeriod()).map(LoanScheduleModelPeriod::interestDue)
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
+ for (LoanScheduleModelPeriod loanScheduleModelPeriod : periods) {
+ if (loanScheduleModelPeriod instanceof
LoanScheduleModelDisbursementPeriod) {
+ log.info("Period {}", loanScheduleModelPeriod.periodNumber());
Review Comment:
Way too verbose for sure.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java:
##########
@@ -1542,4 +1552,34 @@ public Pair<Loan, Map<String, Object>>
assembleLoanApproval(AppUser currentUser,
return Pair.of(loan, actualChanges);
}
+ private Set<LoanCharge> separateTotalCompoundingPercentageCharges(final
Set<LoanCharge> loanCharges) {
Review Comment:
I really don't like the fact that this method does not only return a new set
of LoanCharges but it actually has a side-effect as it modifies the parameter
loanCharges Set as well.
Can we transform this into a method withOUT any side effects?
Thanks.
--
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]