You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2022/09/20 04:41:38 UTC

[GitHub] [fineract] josehernandezfintecheandomx opened a new pull request, #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

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

   ## Description
   
   Remove the Loan Disbursement Details when the Loan Product has the flag `isDisallowExpectedDisbursements` in true as part of the Undo Loan Disbursal command
   
   [FINERACT-1724](https://issues.apache.org/jira/browse/FINERACT-1724).
   
   ## 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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980174059


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -869,6 +873,20 @@ public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCo
             final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(currency.getCode(), existingTransactionIds,
                     existingReversedTransactionIds, isAccountTransfer);
             journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
+
+            // Remove All the Disbursement Details If the Loan Product is disabled and exists one
+            if (loan.loanProduct().isDisallowExpectedDisbursements()) {

Review Comment:
   If we have multiple disbursement details and the loan is not getting back to approved (by undoing the latest disbursement) i dont think it is a good idea to remove all of the 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


[GitHub] [fineract] josehernandezfintecheandomx commented on pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
josehernandezfintecheandomx commented on PR #2609:
URL: https://github.com/apache/fineract/pull/2609#issuecomment-1253271776

   > Tests pls.
   
   Once time the PR https://github.com/apache/fineract/pull/2519 is merged I can do more quickly this Integration Test


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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980178386


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -869,6 +873,20 @@ public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCo
             final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(currency.getCode(), existingTransactionIds,
                     existingReversedTransactionIds, isAccountTransfer);
             journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
+
+            // Remove All the Disbursement Details If the Loan Product is disabled and exists one
+            if (loan.loanProduct().isDisallowExpectedDisbursements()) {
+                if (!loan.getDisbursementDetails().isEmpty()) {
+                    this.loanDisbursementDetailsRepository.deleteAll(loan.getDisbursementDetails());
+                }
+            }
+
+            // Remove All the Loan Delinquency Tags If exist one
+            List<LoanDelinquencyTagHistory> loanDelinquencyTagsHistory = this.loanDelinquencyTagHistoryRepository.findByLoan(loan);

Review Comment:
   Same here... if the loan is not getting back to approved state (there was multiple disbursement) we shall not remove the whole history...



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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980184459


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java:
##########
@@ -347,6 +350,83 @@ public void createApproveAndValidateMultiDisburseLoan() throws ParseException {
         this.editLoanDisbursementDetails();
     }
 
+    @Test

Review Comment:
   Missing test case:
   1. There are multiple disbursement
   1.1 Undo the 2nd one, check whether it is remains active, the principal amount is correct, the scheduling is correct



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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980184459


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java:
##########
@@ -347,6 +350,83 @@ public void createApproveAndValidateMultiDisburseLoan() throws ParseException {
         this.editLoanDisbursementDetails();
     }
 
+    @Test

Review Comment:
   Missing test case:
   1. There are multiple disbursement
   1.1 Undo the 2nd one, check whether it is remains active, the principal amount is correct, the scheduling is correct



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


[GitHub] [fineract] josehernandezfintecheandomx commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
josehernandezfintecheandomx commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980523563


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -869,6 +873,20 @@ public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCo
             final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(currency.getCode(), existingTransactionIds,
                     existingReversedTransactionIds, isAccountTransfer);
             journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
+
+            // Remove All the Disbursement Details If the Loan Product is disabled and exists one
+            if (loan.loanProduct().isDisallowExpectedDisbursements()) {

Review Comment:
   Those now are marked as reversed and not more removed physically



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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980178386


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -869,6 +873,20 @@ public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCo
             final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(currency.getCode(), existingTransactionIds,
                     existingReversedTransactionIds, isAccountTransfer);
             journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
+
+            // Remove All the Disbursement Details If the Loan Product is disabled and exists one
+            if (loan.loanProduct().isDisallowExpectedDisbursements()) {
+                if (!loan.getDisbursementDetails().isEmpty()) {
+                    this.loanDisbursementDetailsRepository.deleteAll(loan.getDisbursementDetails());
+                }
+            }
+
+            // Remove All the Loan Delinquency Tags If exist one
+            List<LoanDelinquencyTagHistory> loanDelinquencyTagsHistory = this.loanDelinquencyTagHistoryRepository.findByLoan(loan);

Review Comment:
   Same here... if the loan is not getting back to approved state (there was multiple disbursement) we shall not remove the whole history...



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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980178386


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -869,6 +873,20 @@ public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCo
             final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(currency.getCode(), existingTransactionIds,
                     existingReversedTransactionIds, isAccountTransfer);
             journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
+
+            // Remove All the Disbursement Details If the Loan Product is disabled and exists one
+            if (loan.loanProduct().isDisallowExpectedDisbursements()) {
+                if (!loan.getDisbursementDetails().isEmpty()) {
+                    this.loanDisbursementDetailsRepository.deleteAll(loan.getDisbursementDetails());
+                }
+            }
+
+            // Remove All the Loan Delinquency Tags If exist one
+            List<LoanDelinquencyTagHistory> loanDelinquencyTagsHistory = this.loanDelinquencyTagHistoryRepository.findByLoan(loan);

Review Comment:
   Same here... if the loan is not getting back to approved state (there was multiple disbursement) we shall not remove the delinquency state



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


[GitHub] [fineract] josehernandezfintecheandomx commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
josehernandezfintecheandomx commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980523721


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -869,6 +873,20 @@ public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCo
             final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(currency.getCode(), existingTransactionIds,
                     existingReversedTransactionIds, isAccountTransfer);
             journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
+
+            // Remove All the Disbursement Details If the Loan Product is disabled and exists one
+            if (loan.loanProduct().isDisallowExpectedDisbursements()) {
+                if (!loan.getDisbursementDetails().isEmpty()) {
+                    this.loanDisbursementDetailsRepository.deleteAll(loan.getDisbursementDetails());
+                }
+            }
+
+            // Remove All the Loan Delinquency Tags If exist one
+            List<LoanDelinquencyTagHistory> loanDelinquencyTagsHistory = this.loanDelinquencyTagHistoryRepository.findByLoan(loan);

Review Comment:
   Done



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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980233303


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -869,6 +873,20 @@ public CommandProcessingResult undoLoanDisbursal(final Long loanId, final JsonCo
             final Map<String, Object> accountingBridgeData = loan.deriveAccountingBridgeData(currency.getCode(), existingTransactionIds,
                     existingReversedTransactionIds, isAccountTransfer);
             journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData);
+
+            // Remove All the Disbursement Details If the Loan Product is disabled and exists one
+            if (loan.loanProduct().isDisallowExpectedDisbursements()) {
+                if (!loan.getDisbursementDetails().isEmpty()) {
+                    this.loanDisbursementDetailsRepository.deleteAll(loan.getDisbursementDetails());
+                }
+            }
+
+            // Remove All the Loan Delinquency Tags If exist one
+            List<LoanDelinquencyTagHistory> loanDelinquencyTagsHistory = this.loanDelinquencyTagHistoryRepository.findByLoan(loan);

Review Comment:
   I dont think we should remove the history entries. 
   If there was any entry, it should be lifted and thats 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


[GitHub] [fineract] IOhacker commented on pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
IOhacker commented on PR #2609:
URL: https://github.com/apache/fineract/pull/2609#issuecomment-1259880873

   LGTM


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


[GitHub] [fineract] IOhacker merged pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
IOhacker merged PR #2609:
URL: https://github.com/apache/fineract/pull/2609


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


[GitHub] [fineract] josehernandezfintecheandomx commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
josehernandezfintecheandomx commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980718183


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java:
##########
@@ -347,6 +350,83 @@ public void createApproveAndValidateMultiDisburseLoan() throws ParseException {
         this.editLoanDisbursementDetails();
     }
 
+    @Test

Review Comment:
   Done



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


[GitHub] [fineract] adamsaghy commented on a diff in pull request #2609: FINERACT-1724: Remove disbursement details in undo loan disbursal command

Posted by GitBox <gi...@apache.org>.
adamsaghy commented on code in PR #2609:
URL: https://github.com/apache/fineract/pull/2609#discussion_r980253352


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java:
##########
@@ -347,6 +350,83 @@ public void createApproveAndValidateMultiDisburseLoan() throws ParseException {
         this.editLoanDisbursementDetails();
     }
 
+    @Test

Review Comment:
   Missing test case:
   1. Create and disburse loan product with "disallowExpectedDisbursements=true"
   2. Undo the disbursement
   3. Disburse again



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