This is an automated email from the ASF dual-hosted git repository. adamsaghy pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/fineract.git
commit b867de889b13883ea208af4cfe790d67bc26d719 Author: tamasszabo-dpc <[email protected]> AuthorDate: Tue May 27 11:43:27 2025 +0200 FINERACT-2232: Added capitalized income scenarios to cover reverse replay logic --- .../org/apache/fineract/test/stepdef/loan/LoanStepDef.java | 14 ++++++++------ .../integrationtests/LoanCapitalizedIncomeTest.java | 14 +++++++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java index 0b31b93b31..6f469de57b 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java @@ -121,7 +121,12 @@ import org.apache.fineract.test.data.loanproduct.LoanProductResolver; import org.apache.fineract.test.data.paymenttype.DefaultPaymentType; import org.apache.fineract.test.data.paymenttype.PaymentTypeResolver; import org.apache.fineract.test.factory.LoanRequestFactory; -import org.apache.fineract.test.helper.*; +import org.apache.fineract.test.helper.BusinessDateHelper; +import org.apache.fineract.test.helper.CodeHelper; +import org.apache.fineract.test.helper.ErrorHelper; +import org.apache.fineract.test.helper.ErrorMessageHelper; +import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.helper.Utils; import org.apache.fineract.test.initializer.global.LoanProductGlobalInitializerStep; import org.apache.fineract.test.messaging.EventAssertion; import org.apache.fineract.test.messaging.config.EventProperties; @@ -4170,9 +4175,6 @@ public class LoanStepDef extends AbstractStepDef { final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); final long loanId = loanResponse.body().getLoanId(); - final DefaultPaymentType paymentType = DefaultPaymentType.valueOf(transactionPaymentType); - final Long paymentTypeValue = paymentTypeResolver.resolve(paymentType); - // Get current business date to ensure we're not creating backdated transactions String currentBusinessDate = businessDateHelper.getBusinessDate(); log.info("Current business date: {}, Transaction date: {}", currentBusinessDate, transactionDate); @@ -4196,7 +4198,7 @@ public class LoanStepDef extends AbstractStepDef { @And("Admin adds invalid capitalized income adjustment with {string} payment type to the loan on {string} with {string} EUR transaction amount") public void adminAddsArbitraryCapitalizedIncomeAdjustmentToTheLoan(final String transactionPaymentType, final String transactionDate, - final String amount) throws IOException { + final String amount) throws IOException { final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); final long loanId = loanResponse.body().getLoanId(); @@ -4216,6 +4218,6 @@ public class LoanStepDef extends AbstractStepDef { transactionDate, amount, capitalizedIncomeTransaction.getId()); testContext().set(TestContextKey.LOAN_CAPITALIZED_INCOME_ADJUSTMENT_RESPONSE, adjustmentResponse); - ErrorHelper.checkFailedApiCall(adjustmentResponse,400); + ErrorHelper.checkFailedApiCall(adjustmentResponse, 400); } } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java index 7e5ad02f8a..43b9390a98 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java @@ -250,7 +250,8 @@ public class LoanCapitalizedIncomeTest extends BaseLoanIntegrationTest { journalEntry(1.10, feeIncomeAccount, "CREDIT") // ); - loanTransactionHelper.capitalizedIncomeAdjustment(loanId, capitalizedIncomeIdRef.get(), "3 January 2024", 100.0); + Long capitalizedIncomeAdjustmentTransactionId = loanTransactionHelper + .capitalizedIncomeAdjustment(loanId, capitalizedIncomeIdRef.get(), "3 January 2024", 100.0).getResourceId(); verifyTransactions(loanId, // transaction(100.0, "Disbursement", "01 January 2024"), // @@ -292,6 +293,17 @@ public class LoanCapitalizedIncomeTest extends BaseLoanIntegrationTest { journalEntry(2.20, feeIncomeAccount, "DEBIT"), // journalEntry(97.80, deferredIncomeLiabilityAccount, "DEBIT") // ); + + verifyTRJournalEntries(capitalizedIncomeAdjustmentTransactionId, // + journalEntry(99.92, loansReceivableAccount, "CREDIT"), // + journalEntry(0.08, interestReceivableAccount, "CREDIT"), // + journalEntry(2.20, feeIncomeAccount, "DEBIT"), // + journalEntry(97.80, deferredIncomeLiabilityAccount, "DEBIT"), // + journalEntry(99.92, loansReceivableAccount, "DEBIT"), // + journalEntry(0.08, interestReceivableAccount, "DEBIT"), // + journalEntry(2.20, feeIncomeAccount, "CREDIT"), // + journalEntry(97.80, deferredIncomeLiabilityAccount, "CREDIT") // + ); }); } }
