adamsaghy commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2081227850
##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanDownPaymentHandlerServiceImpl.java:
##########
@@ -127,22 +127,22 @@ public void
handleRepaymentOrRecoveryOrWaiverTransaction(final Loan loan, final
final LoanRepaymentScheduleInstallment currentInstallment = loan
.fetchLoanRepaymentScheduleInstallmentByDueDate(loanTransaction.getTransactionDate());
- boolean reprocess = loan.isForeclosure() ||
!isTransactionChronologicallyLatest || adjustedTransaction != null
- ||
!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate()) ||
currentInstallment == null
- ||
!currentInstallment.getTotalOutstanding(loan.getCurrency()).isEqualTo(loanTransaction.getAmount(loan.getCurrency()));
-
- // TODO FINERACT-2220 fix processLatestTransaction to save model.
- if (loan.isProgressiveSchedule() && loan.isInterestBearing()) {
- reprocess = true;
- }
+ boolean reprocess = loan.isProgressiveSchedule()
+ ? (loan.isForeclosure() || !isTransactionChronologicallyLatest
|| adjustedTransaction != null
+ || loanTransaction.isReversed() ||
!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate())
+ ||
!loanTransactionProcessingService.canProcessLatestTransactionOnly(loan,
loanTransaction))
+ : loan.isForeclosure() || !isTransactionChronologicallyLatest
|| adjustedTransaction != null
+ ||
!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate()) ||
currentInstallment == null
+ ||
!currentInstallment.getTotalOutstanding(loan.getCurrency())
+
.isEqualTo(loanTransaction.getAmount(loan.getCurrency()));
if (isTransactionChronologicallyLatest && adjustedTransaction == null
Review Comment:
I am not a big fan of these complex, repetitive conditions reevaluate
"reprocess" flag over and over again.
Is there a way to simplify this logic and make sure, it is either process
latest or reprocess all...
##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanDownPaymentHandlerServiceImpl.java:
##########
@@ -127,22 +127,22 @@ public void
handleRepaymentOrRecoveryOrWaiverTransaction(final Loan loan, final
final LoanRepaymentScheduleInstallment currentInstallment = loan
.fetchLoanRepaymentScheduleInstallmentByDueDate(loanTransaction.getTransactionDate());
- boolean reprocess = loan.isForeclosure() ||
!isTransactionChronologicallyLatest || adjustedTransaction != null
- ||
!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate()) ||
currentInstallment == null
- ||
!currentInstallment.getTotalOutstanding(loan.getCurrency()).isEqualTo(loanTransaction.getAmount(loan.getCurrency()));
-
- // TODO FINERACT-2220 fix processLatestTransaction to save model.
- if (loan.isProgressiveSchedule() && loan.isInterestBearing()) {
- reprocess = true;
- }
+ boolean reprocess = loan.isProgressiveSchedule()
+ ? (loan.isForeclosure() || !isTransactionChronologicallyLatest
|| adjustedTransaction != null
+ || loanTransaction.isReversed() ||
!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate())
+ ||
!loanTransactionProcessingService.canProcessLatestTransactionOnly(loan,
loanTransaction))
+ : loan.isForeclosure() || !isTransactionChronologicallyLatest
|| adjustedTransaction != null
+ ||
!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate()) ||
currentInstallment == null
+ ||
!currentInstallment.getTotalOutstanding(loan.getCurrency())
+
.isEqualTo(loanTransaction.getAmount(loan.getCurrency()));
if (isTransactionChronologicallyLatest && adjustedTransaction == null
Review Comment:
I am not a big fan of these complex, repetitive conditions reevaluate
"reprocess" flag over and over again.
Is there a way to simplify this logic and make sure, it is either process
latest or reprocess all...?
--
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]