You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "adamsaghy (via GitHub)" <gi...@apache.org> on 2023/09/14 13:15:31 UTC

[GitHub] [fineract] adamsaghy commented on a diff in pull request #3449: [FINERACT-1958] Business events for down payment installments

adamsaghy commented on code in PR #3449:
URL: https://github.com/apache/fineract/pull/3449#discussion_r1325935247


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java:
##########
@@ -313,7 +311,7 @@ private LoanTransactionBusinessEvent getTransactionRepaymentTypeBusinessEvent(Lo
         } else if (isRecoveryRepayment) {
             repaymentEvent = new LoanTransactionRecoveryPaymentPostBusinessEvent(transaction);
         } else if (repaymentTransactionType.isDownPayment()) {
-            repaymentEvent = new LoanTransactionDownPaymentPostBusinessEvent(transaction);
+            repaymentEvent = new LoanTransactionMakeRepaymentPostBusinessEvent(transaction);

Review Comment:
   Are you sure? we dont wanna trigger downpayment business event for downpayment transaction?



##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java:
##########
@@ -292,7 +290,7 @@ private LoanBusinessEvent getLoanRepaymentTypeBusinessEvent(LoanTransactionType
         } else if (isRecoveryRepayment) {
             repaymentEvent = new LoanTransactionRecoveryPaymentPreBusinessEvent(loan);
         } else if (repaymentTransactionType.isDownPayment()) {
-            repaymentEvent = new LoanTransactionDownPaymentPreBusinessEvent(loan);
+            repaymentEvent = new LoanTransactionMakeRepaymentPreBusinessEvent(loan);

Review Comment:
   Are you sure? we dont wanna trigger downpayment business event for downpayment transaction?



##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -456,7 +458,14 @@ public CommandProcessingResult disburseLoan(final Long loanId, final JsonCommand
                 changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO, null, downPaymentEnabled);
             }
             loan.adjustNetDisbursalAmount(amountToDisburse.getAmount());
-            loan.handleDownPayment(amountToDisburse.getAmount(), command, scheduleGeneratorDTO);
+            if (loan.isAutoRepaymentForDownPaymentEnabled()) {
+                businessEventNotifierService.notifyPreBusinessEvent(new LoanTransactionMakeRepaymentPreBusinessEvent(loan));
+                LoanTransaction downPaymentTransaction = loan.handleDownPayment(amountToDisburse.getAmount(), command,
+                        scheduleGeneratorDTO);
+                businessEventNotifierService
+                        .notifyPostBusinessEvent(new LoanTransactionMakeRepaymentPostBusinessEvent(downPaymentTransaction));

Review Comment:
   Are you sure? we dont wanna trigger downpayment business event for downpayment transaction?



-- 
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