adamsaghy commented on code in PR #3427:
URL: https://github.com/apache/fineract/pull/3427#discussion_r1315715514
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java:
##########
@@ -74,20 +92,285 @@ protected Money
handleRefundTransactionPaymentOfInstallment(LoanRepaymentSchedul
}
@Override
- public ChangedTransactionDetail reprocessLoanTranactions(LocalDate
disbursementDate, List<LoanTransaction> transactionsPostDisbursement,
- MonetaryCurrency currency, List<LoanRepaymentScheduleInstallment>
installments, Set<LoanCharge> charges) {
- throw new NotImplementedException();
+ public ChangedTransactionDetail reprocessLoanTransactions(LocalDate
disbursementDate,
+ List<LoanTransaction> transactionsPostDisbursement,
MonetaryCurrency currency,
+ List<LoanRepaymentScheduleInstallment> installments,
Set<LoanCharge> charges) {
+
+ // TODO: rewrite this whole logic step by step
+ if (charges != null) {
+ for (final LoanCharge loanCharge : charges) {
+ if (!loanCharge.isDueAtDisbursement()) {
+ loanCharge.resetPaidAmount(currency);
+ }
+ }
+ }
+
+ for (final LoanRepaymentScheduleInstallment currentInstallment :
installments) {
+ currentInstallment.resetDerivedComponents();
+ currentInstallment.updateDerivedFields(currency, disbursementDate);
+ }
+
+ // TODO: Remove this reprocess and add the charges to the installment
in chronological order
+ final LoanRepaymentScheduleProcessingWrapper wrapper = new
LoanRepaymentScheduleProcessingWrapper();
Review Comment:
The legacy behaviour was to add all the available charges to the repayment
schedules based on the due date. The problem with this, if the charge was added
later than a repayment, during the reprocessing the repayment might was paying
off that charge. Chronologically when we are processing the repayment and
allocating it we should not consider the charges that were added just later.
In TLDR: when we are reprocessing the transactions, we should reprocessing
the charges as well and add them to the installments one by one based on
whether it was added before or after than the processed transaction.
I hope it helps to understand. A follow up story should cover this
capability.
--
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]