magyari-adam commented on code in PR #4706:
URL: https://github.com/apache/fineract/pull/4706#discussion_r2111849280


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java:
##########
@@ -96,4 +100,76 @@ public void testLoanCapitalizedIncomeAmortization() {
             );
         });
     }
+
+    @Test
+    public void 
testOverpaymentAmountWhenCapitalizedIncomeTransactionsAreReversed() {
+        final AtomicReference<Long> loanIdRef = new AtomicReference<>();
+        final PostClientsResponse client = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest());
+        runAt("01 March 2023", () -> {
+            final PostLoanProductsResponse loanProductsResponse = 
loanProductHelper
+                    
.createLoanProduct(create4IProgressiveWithCapitalizedIncome());
+            PostLoansResponse postLoansResponse = 
loanTransactionHelper.applyLoan(applyLP2ProgressiveLoanRequest(client.getClientId(),
+                    loanProductsResponse.getResourceId(), "01 March 2023", 
10000.00, 12.00, 4, null));
+            Long loanId = postLoansResponse.getLoanId();
+            loanIdRef.set(loanId);
+
+            loanTransactionHelper.approveLoan(loanId, 
approveLoanRequest(10000.00, "01 March 2023"));
+            disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 March 2023");
+
+            loanTransactionHelper.addCapitalizedIncome(loanId, "01 March 
2023", 500.00);
+            loanTransactionHelper.addCapitalizedIncome(loanId, "01 March 
2023", 500.00);
+            Long capitalizedIncomeId = 
loanTransactionHelper.getLoanDetails(loanId).getTransactions().get(2).getId();

Review Comment:
   loanTransactionHelper.addCapitalizedIncome() returns the created 
transactions id in resourceId field



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

Reply via email to