FINERACT-2398: Re-amortization Interest Handling configuration

This commit is contained in:
Jose Alberto Hernandez
2025-10-29 12:13:05 +01:00
committed by Adam Saghy
parent 8a86759773
commit a849e9bae3
22 changed files with 294 additions and 35 deletions
@@ -1027,8 +1027,9 @@ public abstract class BaseLoanIntegrationTest extends IntegrationTest {
loanTransactionHelper.reAge(loanId, request);
}
protected void reAmortizeLoan(Long loanId) {
protected void reAmortizeLoan(Long loanId, String reAmortizationInterestHandling) {
PostLoansLoanIdTransactionsRequest request = new PostLoansLoanIdTransactionsRequest();
request.setReAmortizationInterestHandling(reAmortizationInterestHandling);
request.setDateFormat(DATETIME_PATTERN);
request.setLocale("en");
loanTransactionHelper.reAmortize(loanId, request);
@@ -30,6 +30,7 @@ import org.apache.fineract.client.models.PostLoansResponse;
import org.apache.fineract.integrationtests.BaseLoanIntegrationTest;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.loans.LoanProductTestBuilder;
import org.apache.fineract.portfolio.loanaccount.domain.reamortization.LoanReAmortizationInterestHandlingType;
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
import org.junit.jupiter.api.Test;
@@ -90,7 +91,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
runAt("02 February 2023", () -> {
// create re-amortize transaction
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
// verify transactions
verifyTransactions(loanId.get(), //
@@ -157,7 +158,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
runAt("02 February 2023", () -> {
// create re-amortize transaction
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
// verify transactions
verifyTransactions(loanId.get(), //
@@ -220,7 +221,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
);
});
runAt("25 January 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -265,7 +266,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
});
runAt("01 February 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -319,7 +320,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
);
});
runAt("30 January 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -375,7 +376,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
);
});
runAt("31 January 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -421,7 +422,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
runAt("01 February 2023", () -> {
addCharge(loanId.get(), false, 10.0, "27 February 2023");
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -466,7 +467,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
);
});
runAt("01 February 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -549,7 +550,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
);
});
runAt("01 February 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -613,7 +614,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
});
runAt("01 February 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -677,7 +678,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
);
});
runAt("17 January 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -726,7 +727,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
});
runAt("25 January 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //
@@ -821,7 +822,7 @@ public class LoanReAmortizationIntegrationTest extends BaseLoanIntegrationTest {
});
runAt("25 January 2023", () -> {
reAmortizeLoan(loanId.get());
reAmortizeLoan(loanId.get(), LoanReAmortizationInterestHandlingType.DEFAULT.name());
verifyRepaymentSchedule(loanId.get(), //
installment(500, null, "01 January 2023"), //