mariiaKraievska commented on code in PR #5861:
URL: https://github.com/apache/fineract/pull/5861#discussion_r3322438474
##########
fineract-e2e-tests-runner/src/test/resources/features/WorkingCapitalLoanCreditBalanceRefund.feature:
##########
@@ -483,5 +483,5 @@ Feature: Working Capital Loan Credit Balance Refund
| field | value |
| principalOutstanding | 0.00 |
| overpaymentAmount | 100.00 |
- | totalPaidPrincipal | 9000.00 |
+ | totalPaidPrincipal | 9100.00 |
Review Comment:
Done
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanDiscountFeeAmortizationServiceImpl.java:
##########
@@ -84,4 +90,18 @@ private BigDecimal calculateAlreadyPostedAmount(final
WorkingCapitalLoan loan) {
.filter(txn -> txn.getTypeOf() ==
LoanTransactionType.DISCOUNT_FEE_AMORTIZATION && !txn.isReversed())
.map(WorkingCapitalLoanTransaction::getTransactionAmount).reduce(BigDecimal.ZERO,
BigDecimal::add);
}
+
+ private void syncIncomeBalances(final WorkingCapitalLoan loan, final
BigDecimal scheduleAmortization) {
+ final BigDecimal discount = loan.getLoanProductRelatedDetails() !=
null && loan.getLoanProductRelatedDetails().getDiscount() != null
+ ? loan.getLoanProductRelatedDetails().getDiscount()
+ : BigDecimal.ZERO;
+ final BigDecimal realizedIncome =
scheduleAmortization.max(BigDecimal.ZERO).min(discount);
+ final BigDecimal unrealizedIncome =
discount.subtract(realizedIncome).max(BigDecimal.ZERO);
+
+ final WorkingCapitalLoanBalance balance =
balanceRepository.findByWcLoan_Id(loan.getId())
+ .orElseGet(() -> WorkingCapitalLoanBalance.createFor(loan));
+ balance.setRealizedIncome(realizedIncome);
+ balance.setUnrealizedIncome(unrealizedIncome);
+ balanceRepository.saveAndFlush(balance);
Review Comment:
Done
--
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]