You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "somasorosdpc (via GitHub)" <gi...@apache.org> on 2025/04/30 13:04:42 UTC

[PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

somasorosdpc opened a new pull request, #4634:
URL: https://github.com/apache/fineract/pull/4634

   ## Description
   
   Use `ProgressiveLoanInterestScheduleModel` to `processLatestTransaction` and save updated model.
   
    [Apache Fineract JIRA ticket](https://issues.apache.org/jira/browse/FINERACT-2220).
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
   - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
   - [ ] Create/update unit or integration tests for verifying the changes made.
   - [ ] Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
   - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
   


-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "somasorosdpc (via GitHub)" <gi...@apache.org>.
somasorosdpc commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2081254417


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransaction.java:
##########
@@ -456,6 +456,7 @@ public void resetDerivedComponents() {
         this.penaltyChargesPortion = null;
         this.overPaymentPortion = null;
         this.outstandingLoanBalance = null;
+        this.loanChargesPaid.clear();

Review Comment:
   It is actually an issue CI found. When repayment is new and processed by processLatestTransaction then we run reprocessAllTransactions (valid post checks caused reprocess all) while transaction is still new , reprocessAllTransactions created duplicated charges paid entries.



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "oleksii-novikov-onix (via GitHub)" <gi...@apache.org>.
oleksii-novikov-onix commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2084999521


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java:
##########
@@ -59,11 +61,52 @@ public class LoanTransactionProcessingServiceImpl implements LoanTransactionProc
     private final LoanTermVariationsMapper loanMapper;
     private final InterestScheduleModelRepositoryWrapper modelRepository;
 
+    @Override
+    public boolean canProcessLatestTransactionOnly(Loan loan, LoanTransaction loanTransaction,
+            LoanRepaymentScheduleInstallment currentInstallment) {
+        if (!loan.isInterestBearingAndInterestRecalculationEnabled()) {
+            return true;
+        }
+        if (!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate())) {
+            return false;
+        }
+        if (loan.isProgressiveSchedule()) {
+            return modelRepository.hasValidModelForDate(loan.getId(), loanTransaction.getTransactionDate());
+        }
+        return currentInstallment != null
+                && currentInstallment.getTotalOutstanding(loan.getCurrency()).isEqualTo(loanTransaction.getAmount(loan.getCurrency()));
+    }
+
+    private ChangedTransactionDetail processLatestTransactionProgressiveInterestRecalculation(
+            AdvancedPaymentScheduleTransactionProcessor advancedProcessor, Loan loan, LoanTransaction loanTransaction) {
+        Optional<ProgressiveLoanInterestScheduleModel> savedModel = modelRepository.getSavedModel(loan,
+                loanTransaction.getTransactionDate());
+
+        if (savedModel.isEmpty()) {
+            throw new IllegalStateException("No saved interest schedule model found for loan #" + loan.getId() + " with transaction date "
+                    + loanTransaction.getTransactionDate());
+        }
+
+        ProgressiveTransactionCtx progressiveContext = new ProgressiveTransactionCtx(loan.getCurrency(),
+                loan.getRepaymentScheduleInstallments(), loan.getActiveCharges(), new MoneyHolder(loan.getTotalOverpaidAsMoney()),
+                new ChangedTransactionDetail(), savedModel.orElse(null));
+        progressiveContext.setChargedOff(loan.isChargedOff());
+        ChangedTransactionDetail result = advancedProcessor.processLatestTransaction(loanTransaction, progressiveContext);
+        if (!TransactionSynchronizationManager.isCurrentTransactionReadOnly()) {
+            modelRepository.writeInterestScheduleModel(loan, savedModel.get());

Review Comment:
   Sorry, I see that this check is already done above. But is it okay to throw an IllegalStateException when savedModel is not found? What about new loans?



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2081210094


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransaction.java:
##########
@@ -456,6 +456,7 @@ public void resetDerivedComponents() {
         this.penaltyChargesPortion = null;
         this.overPaymentPortion = null;
         this.outstandingLoanBalance = null;
+        this.loanChargesPaid.clear();

Review Comment:
   This looks suspicious to me... Why to do so? Are we sure whenever the balances were reset the loan charges paid by mapping was rebuilt?



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2081639822


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransaction.java:
##########
@@ -456,6 +456,7 @@ public void resetDerivedComponents() {
         this.penaltyChargesPortion = null;
         this.overPaymentPortion = null;
         this.outstandingLoanBalance = null;
+        this.loanChargesPaid.clear();

Review Comment:
   We should not run process latest and reprocess all... do only either one of it!



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2087264129


##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransaction.java:
##########
@@ -456,6 +456,7 @@ public void resetDerivedComponents() {
         this.penaltyChargesPortion = null;
         this.overPaymentPortion = null;
         this.outstandingLoanBalance = null;
+        this.loanChargesPaid.clear();

Review Comment:
   I still not find this correct behaviour... I truly believe this breaks existing behaviour which relies on it is updating existing charges paid mappings... The situation you described is incorrect: We should either process latest or reprocess all transactions but not both!



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2081230665


##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/InterestScheduleModelRepositoryWrapperImpl.java:
##########
@@ -87,22 +87,40 @@ public Optional<ProgressiveLoanInterestScheduleModel> extractModel(Optional<Prog
                         progressiveLoanModel.get().getLoan().getLoanProduct().getInstallmentAmountInMultiplesOf()));
     }
 
+    @Override
+    public boolean hasValidModelForDate(Long loanId, LocalDate targetDate) {
+        try {
+            entityManager.setFlushMode(FlushModeType.COMMIT);
+            Optional<ProgressiveLoanModel> progressiveLoanModel = findOneByLoanId(loanId);
+            LocalDate modelUpdatedTilDate = progressiveLoanModel.map(ProgressiveLoanModel::getBusinessDate).orElse(null);
+            return progressiveLoanModel.isPresent() && !targetDate.isBefore(modelUpdatedTilDate);
+        } finally {
+            entityManager.setFlushMode(FlushModeType.AUTO);
+        }
+    }
+
     @Override
     public Optional<ProgressiveLoanInterestScheduleModel> getSavedModel(Loan loan, LocalDate businessDate) {
-        Optional<ProgressiveLoanModel> progressiveLoanModel = findOneByLoanId(loan.getId());
-        Optional<ProgressiveLoanInterestScheduleModel> savedModel;
-        if (progressiveLoanModel.isPresent() && !progressiveLoanModel.get().getBusinessDate().isAfter(businessDate)) {
-            savedModel = extractModel(progressiveLoanModel);
-            if (progressiveLoanModel.get().getBusinessDate().isBefore(businessDate) && savedModel.isPresent()) {
-                ProgressiveTransactionCtx ctx = new ProgressiveTransactionCtx(loan.getCurrency(), loan.getRepaymentScheduleInstallments(),
-                        Set.of(), new MoneyHolder(loan.getTotalOverpaidAsMoney()), new ChangedTransactionDetail(), savedModel.get());
-                ctx.setChargedOff(loan.isChargedOff());
-                advancedPaymentScheduleTransactionProcessor.recalculateInterestForDate(businessDate, ctx);
+        try {
+            entityManager.setFlushMode(FlushModeType.COMMIT);

Review Comment:
   Please leave a comment why we change flush mode for future reference!



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "oleksii-novikov-onix (via GitHub)" <gi...@apache.org>.
oleksii-novikov-onix commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2084952365


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java:
##########
@@ -59,11 +61,52 @@ public class LoanTransactionProcessingServiceImpl implements LoanTransactionProc
     private final LoanTermVariationsMapper loanMapper;
     private final InterestScheduleModelRepositoryWrapper modelRepository;
 
+    @Override
+    public boolean canProcessLatestTransactionOnly(Loan loan, LoanTransaction loanTransaction,
+            LoanRepaymentScheduleInstallment currentInstallment) {
+        if (!loan.isInterestBearingAndInterestRecalculationEnabled()) {
+            return true;
+        }
+        if (!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate())) {
+            return false;
+        }
+        if (loan.isProgressiveSchedule()) {
+            return modelRepository.hasValidModelForDate(loan.getId(), loanTransaction.getTransactionDate());
+        }
+        return currentInstallment != null
+                && currentInstallment.getTotalOutstanding(loan.getCurrency()).isEqualTo(loanTransaction.getAmount(loan.getCurrency()));
+    }
+
+    private ChangedTransactionDetail processLatestTransactionProgressiveInterestRecalculation(
+            AdvancedPaymentScheduleTransactionProcessor advancedProcessor, Loan loan, LoanTransaction loanTransaction) {
+        Optional<ProgressiveLoanInterestScheduleModel> savedModel = modelRepository.getSavedModel(loan,
+                loanTransaction.getTransactionDate());
+
+        if (savedModel.isEmpty()) {
+            throw new IllegalStateException("No saved interest schedule model found for loan #" + loan.getId() + " with transaction date "
+                    + loanTransaction.getTransactionDate());
+        }
+
+        ProgressiveTransactionCtx progressiveContext = new ProgressiveTransactionCtx(loan.getCurrency(),
+                loan.getRepaymentScheduleInstallments(), loan.getActiveCharges(), new MoneyHolder(loan.getTotalOverpaidAsMoney()),
+                new ChangedTransactionDetail(), savedModel.orElse(null));
+        progressiveContext.setChargedOff(loan.isChargedOff());
+        ChangedTransactionDetail result = advancedProcessor.processLatestTransaction(loanTransaction, progressiveContext);
+        if (!TransactionSynchronizationManager.isCurrentTransactionReadOnly()) {
+            modelRepository.writeInterestScheduleModel(loan, savedModel.get());

Review Comment:
   I believe we need to check `savedModel.isEmpty()` before accessing the value with `savedModel.get()`



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2081223947


##########
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())

Review Comment:
   adjustedTransaction is not null it means the loan transaction is reversed, so `loanTransaction.isReversed` is duplicate here.
   
   Also the condition can simplified by moving the "common" conditions prior the 'loan.isProgressiveSchedule` or extract them into methods which sole purpose to check whether transactions shall be reprocessed



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2220: Use stored ProgressiveLoanInterestScheduleModel for processLatestTransaction [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #4634:
URL: https://github.com/apache/fineract/pull/4634#discussion_r2085003138


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanTransactionProcessingServiceImpl.java:
##########
@@ -59,11 +61,52 @@ public class LoanTransactionProcessingServiceImpl implements LoanTransactionProc
     private final LoanTermVariationsMapper loanMapper;
     private final InterestScheduleModelRepositoryWrapper modelRepository;
 
+    @Override
+    public boolean canProcessLatestTransactionOnly(Loan loan, LoanTransaction loanTransaction,
+            LoanRepaymentScheduleInstallment currentInstallment) {
+        if (!loan.isInterestBearingAndInterestRecalculationEnabled()) {
+            return true;
+        }
+        if (!DateUtils.isEqualBusinessDate(loanTransaction.getTransactionDate())) {
+            return false;
+        }
+        if (loan.isProgressiveSchedule()) {
+            return modelRepository.hasValidModelForDate(loan.getId(), loanTransaction.getTransactionDate());
+        }
+        return currentInstallment != null
+                && currentInstallment.getTotalOutstanding(loan.getCurrency()).isEqualTo(loanTransaction.getAmount(loan.getCurrency()));
+    }
+
+    private ChangedTransactionDetail processLatestTransactionProgressiveInterestRecalculation(
+            AdvancedPaymentScheduleTransactionProcessor advancedProcessor, Loan loan, LoanTransaction loanTransaction) {
+        Optional<ProgressiveLoanInterestScheduleModel> savedModel = modelRepository.getSavedModel(loan,
+                loanTransaction.getTransactionDate());
+
+        if (savedModel.isEmpty()) {
+            throw new IllegalStateException("No saved interest schedule model found for loan #" + loan.getId() + " with transaction date "
+                    + loanTransaction.getTransactionDate());
+        }
+
+        ProgressiveTransactionCtx progressiveContext = new ProgressiveTransactionCtx(loan.getCurrency(),
+                loan.getRepaymentScheduleInstallments(), loan.getActiveCharges(), new MoneyHolder(loan.getTotalOverpaidAsMoney()),
+                new ChangedTransactionDetail(), savedModel.orElse(null));
+        progressiveContext.setChargedOff(loan.isChargedOff());
+        ChangedTransactionDetail result = advancedProcessor.processLatestTransaction(loanTransaction, progressiveContext);
+        if (!TransactionSynchronizationManager.isCurrentTransactionReadOnly()) {
+            modelRepository.writeInterestScheduleModel(loan, savedModel.get());

Review Comment:
   yeah... throwing exception looks weird...



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org