adamsaghy commented on code in PR #5937:
URL: https://github.com/apache/fineract/pull/5937#discussion_r3389769339
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/service/WorkingCapitalLoanAmortizationScheduleWriteServiceImpl.java:
##########
@@ -183,6 +183,23 @@ public void applyRepayment(final WorkingCapitalLoan loan,
final LocalDate transa
scheduleRepositoryWrapper.writeModel(loan, model);
}
+ @Override
+ public void applyRepaymentUndo(final WorkingCapitalLoan loan, final
LocalDate transactionDate, final BigDecimal repaymentAmount) {
+ Validate.notNull(loan, "loan must not be null");
+ Validate.notNull(transactionDate, "transactionDate must not be null");
+ Validate.notNull(repaymentAmount, "repaymentAmount must not be null");
+
+ final MathContext mc = MoneyHelper.getMathContext();
+ final ProjectedAmortizationScheduleModel model =
scheduleRepositoryWrapper
+ .readModel(loan.getId(), mc,
WorkingCapitalLoanCurrencyResolver.resolveCurrency(loan))
+ .orElseThrow(() -> new IllegalStateException("Projected
amortization schedule is not found for loan " + loan.getId()));
+
+ model.undoPayment(transactionDate, repaymentAmount);
+
model.recalculateNetAmortizationAndDeferredBalanceFrom(transactionDate);
Review Comment:
This should not be standalone operation but as side-effect of
`model.undoPayment`
--
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]