diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java index 9f7c98478..745ff7b13 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/helper/ErrorMessageHelper.java @@ -470,6 +470,18 @@ public final class ErrorMessageHelper { + "%nNumber of transaction tab lines: %s %nNumber of expected datatable lines: %s%n", resourceId, actual, expected); } + public static String wrongValueInLineInRescheduleTab(String resourceId, int line, List> actualList, + List expected) { + String actual = actualList.stream().map(Object::toString).collect(Collectors.joining(System.lineSeparator())); + return String.format("%nWrong value in Reschedule tab of resource %s line %s." // + + "%nActual values in line are: %n%s %nExpected values in line: %n%s", resourceId, line, actual, expected); + } + + public static String nrOfLinesWrongInRescheduleTab(String resourceId, int actual, int expected) { + return String.format("%nNumber of lines does not match in Reschedule tab and expected datatable of resource %s." // + + "%nNumber of reschedule tab lines: %s %nNumber of expected datatable lines: %s%n", resourceId, actual, expected); + } + public static String wrongValueInLineInChargesTab(String resourceId, int line, List> actualList, List expected) { String actual = actualList.stream().map(Object::toString).collect(Collectors.joining(System.lineSeparator())); return String.format("%nWrong value in Charges tab of resource %s line %s." // diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRescheduleStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRescheduleStepDef.java index bcef52de9..e20d0bf3c 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRescheduleStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanRescheduleStepDef.java @@ -29,11 +29,13 @@ import java.io.IOException; import java.math.BigDecimal; import java.time.LocalDate; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.List; import java.util.Map; import lombok.extern.slf4j.Slf4j; import org.apache.fineract.client.feign.FineractFeignClient; import org.apache.fineract.client.feign.util.CallFailedRuntimeException; +import org.apache.fineract.client.models.GetLoanRescheduleRequestResponse; import org.apache.fineract.client.models.PostCreateRescheduleLoansRequest; import org.apache.fineract.client.models.PostCreateRescheduleLoansResponse; import org.apache.fineract.client.models.PostLoansResponse; @@ -159,4 +161,51 @@ public class LoanRescheduleStepDef extends AbstractStepDef { log.debug("ERROR CODE: {}", exception.getStatus()); log.debug("ERROR MESSAGE: {}", exception.getDeveloperMessage()); } + + @Then("Loan Reschedule tab has the following data:") + public void loanRescheduleTabCheck(DataTable table) { + PostLoansResponse loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE); + long loanId = loanCreateResponse.getLoanId(); + String resourceId = String.valueOf(loanId); + + List loanRescheduleRequestResponses = ok( + () -> fineractClient.rescheduleLoans().retrieveAllRescheduleRequest("", loanId)); + List> data = table.asLists(); + List header = table.row(0); + checkLoanRescheduleTab(data, loanRescheduleRequestResponses, header, resourceId); + } + + public void checkLoanRescheduleTab(List> data, List reschedules, List header, + String resourceId) { + assertThat(reschedules.size()).as(ErrorMessageHelper.nrOfLinesWrongInRescheduleTab(resourceId, reschedules.size(), data.size() - 1)) + .isEqualTo(data.size() - 1); + checkLoanRescheduleTabRows(data, reschedules, header, resourceId); + } + + public void checkLoanRescheduleTabRows(List> data, List reschedules, List header, + String resourceId) { + for (int i = 1; i < data.size(); i++) { + List expectedValues = data.get(i); + GetLoanRescheduleRequestResponse reschedule = reschedules.get(i - 1); + List actualValues = fetchValuesOfReschedule(header, reschedule); + assertThat(actualValues) + .as(ErrorMessageHelper.wrongValueInLineInRescheduleTab(resourceId, i, List.of(actualValues), expectedValues)) + .isEqualTo(expectedValues); + } + } + + private List fetchValuesOfReschedule(List header, GetLoanRescheduleRequestResponse r) { + List actualValues = new ArrayList<>(); + for (String headerName : header) { + switch (headerName) { + case "From Date" -> + actualValues.add(r.getRescheduleFromDate() == null ? null : FORMATTER_EN.format(r.getRescheduleFromDate())); + case "Reason" -> + actualValues.add(r.getRescheduleReasonCodeValue() == null ? null : r.getRescheduleReasonCodeValue().getName()); + case "Status" -> actualValues.add(r.getStatusEnum() == null ? null : r.getStatusEnum().getValue()); + default -> throw new IllegalStateException(String.format("Header name %s cannot be found", headerName)); + } + } + return actualValues; + } } diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature index 242857964..98a914f94 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature @@ -1459,4 +1459,316 @@ Feature: LoanReschedule When Admin sets the business date to "02 April 2024" Then Loan reschedule with the following data results a 400 error and "LOAN_RESCHEDULE_FROM_DATE_INSTALLMENT_NOT_FOUND" error message | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | - | 01 August 2024 | 02 April 2024 | | | | 2 | | \ No newline at end of file + | 01 August 2024 | 02 April 2024 | | | | 2 | | + + @TestRailId:C4574 + Scenario: Verify multiple interest rate changes on same day, UC1: on due date + When Admin sets the business date to "1 January 2025" + And Admin creates a client with random data + And Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 1 January 2025 | 100 | 10 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2025" with "100" amount and expected disbursement date on "1 January 2025" + And Admin successfully disburse the loan on "1 January 2025" with "100" EUR transaction amount + And Admin sets the business date to "1 February 2025" + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 83.67 | 16.33 | 0.83 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.46 | 0.7 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 3 | 31 | 01 April 2025 | | 50.61 | 16.6 | 0.56 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 4 | 30 | 01 May 2025 | | 33.87 | 16.74 | 0.42 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 5 | 31 | 01 June 2025 | | 16.99 | 16.88 | 0.28 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.99 | 0.14 | 0.0 | 0.0 | 17.13 | 0.0 | 0.0 | 0.0 | 17.13 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 0.0 | 0.0 | 0.0 | 102.93 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | +# --- first interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2025 | 01 February 2025 | | | | | 5 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 83.84 | 16.16 | 0.82 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.63 | 0.35 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 3 | 31 | 01 April 2025 | | 50.51 | 16.7 | 0.28 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 4 | 30 | 01 May 2025 | | 33.74 | 16.77 | 0.21 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 5 | 31 | 01 June 2025 | | 16.9 | 16.84 | 0.14 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.9 | 0.07 | 0.0 | 0.0 | 16.97 | 0.0 | 0.0 | 0.0 | 16.97 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 1.87 | 0.0 | 0.0 | 101.87 | 0.0 | 0.0 | 0.0 | 101.87 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 01 February 2025 | None | Approved | + # --- second interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2025 | 01 February 2025 | | | | | 0 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 84.01 | 15.99 | 0.81 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 3 | 31 | 01 April 2025 | | 50.41 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 4 | 30 | 01 May 2025 | | 33.61 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 5 | 31 | 01 June 2025 | | 16.81 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.81 | 0.0 | 0.0 | 0.0 | 16.81 | 0.0 | 0.0 | 0.0 | 16.81 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 0.81 | 0.0 | 0.0 | 100.81 | 0.0 | 0.0 | 0.0 | 100.81 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 01 February 2025 | None | Approved | + | 01 February 2025 | None | Approved | + + @TestRailId:C4575 + Scenario: Verify multiple interest rate changes on same day, UC2: on due date after repayment + When Admin sets the business date to "1 January 2025" + And Admin creates a client with random data + And Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 1 January 2025 | 100 | 10 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2025" with "100" amount and expected disbursement date on "1 January 2025" + And Admin successfully disburse the loan on "1 January 2025" with "100" EUR transaction amount + And Admin sets the business date to "1 February 2025" + And Customer makes "AUTOPAY" repayment on "01 February 2025" with 17.16 EUR transaction amount + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | 01 February 2025 | 83.67 | 16.33 | 0.83 | 0.0 | 0.0 | 17.16 | 17.16 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.46 | 0.7 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 3 | 31 | 01 April 2025 | | 50.61 | 16.6 | 0.56 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 4 | 30 | 01 May 2025 | | 33.87 | 16.74 | 0.42 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 5 | 31 | 01 June 2025 | | 16.99 | 16.88 | 0.28 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.99 | 0.14 | 0.0 | 0.0 | 17.13 | 0.0 | 0.0 | 0.0 | 17.13 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 17.16 | 0.0 | 0.0 | 85.77 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 01 February 2025 | Repayment | 17.16 | 16.33 | 0.83 | 0.0 | 0.0 | 83.67 | false | false | +# --- first interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2025 | 01 February 2025 | | | | | 5 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | 01 February 2025 | 83.84 | 16.16 | 0.82 | 0.0 | 0.0 | 16.98 | 16.98 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.63 | 0.35 | 0.0 | 0.0 | 16.98 | 0.18 | 0.18 | 0.0 | 16.8 | + | 3 | 31 | 01 April 2025 | | 50.51 | 16.7 | 0.28 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 4 | 30 | 01 May 2025 | | 33.74 | 16.77 | 0.21 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 5 | 31 | 01 June 2025 | | 16.9 | 16.84 | 0.14 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.9 | 0.07 | 0.0 | 0.0 | 16.97 | 0.0 | 0.0 | 0.0 | 16.97 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 1.87 | 0.0 | 0.0 | 101.87 | 17.16 | 0.18 | 0.0 | 84.71 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 01 February 2025 | Repayment | 17.16 | 16.34 | 0.82 | 0.0 | 0.0 | 83.66 | false | true | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 01 February 2025 | None | Approved | + # --- second interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2025 | 01 February 2025 | | | | | 0 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | 01 February 2025 | 84.01 | 15.99 | 0.81 | 0.0 | 0.0 | 16.8 | 16.8 | 0.0 | 0.0 | 0.0 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.36 | 0.36 | 0.0 | 16.44 | + | 3 | 31 | 01 April 2025 | | 50.41 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 4 | 30 | 01 May 2025 | | 33.61 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 5 | 31 | 01 June 2025 | | 16.81 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.81 | 0.0 | 0.0 | 0.0 | 16.81 | 0.0 | 0.0 | 0.0 | 16.81 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 0.81 | 0.0 | 0.0 | 100.81 | 17.16 | 0.36 | 0.0 | 83.65 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + | 01 February 2025 | Repayment | 17.16 | 16.35 | 0.81 | 0.0 | 0.0 | 83.65 | false | true | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 01 February 2025 | None | Approved | + | 01 February 2025 | None | Approved | + + @TestRailId:C4576 + Scenario: Verify multiple interest rate changes on same day, UC3: on midterm date + When Admin sets the business date to "1 January 2025" + And Admin creates a client with random data + And Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 1 January 2025 | 100 | 10 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2025" with "100" amount and expected disbursement date on "1 January 2025" + And Admin successfully disburse the loan on "1 January 2025" with "100" EUR transaction amount + And Admin sets the business date to "15 January 2025" + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 83.67 | 16.33 | 0.83 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.46 | 0.7 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 3 | 31 | 01 April 2025 | | 50.61 | 16.6 | 0.56 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 4 | 30 | 01 May 2025 | | 33.87 | 16.74 | 0.42 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 5 | 31 | 01 June 2025 | | 16.99 | 16.88 | 0.28 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.99 | 0.14 | 0.0 | 0.0 | 17.13 | 0.0 | 0.0 | 0.0 | 17.13 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 0.0 | 0.0 | 0.0 | 102.93 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | +# --- first interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 15 January 2025 | 15 January 2025 | | | | | 5 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 83.65 | 16.35 | 0.59 | 0.0 | 0.0 | 16.94 | 0.0 | 0.0 | 0.0 | 16.94 | + | 2 | 28 | 01 March 2025 | | 67.06 | 16.59 | 0.35 | 0.0 | 0.0 | 16.94 | 0.0 | 0.0 | 0.0 | 16.94 | + | 3 | 31 | 01 April 2025 | | 50.4 | 16.66 | 0.28 | 0.0 | 0.0 | 16.94 | 0.0 | 0.0 | 0.0 | 16.94 | + | 4 | 30 | 01 May 2025 | | 33.67 | 16.73 | 0.21 | 0.0 | 0.0 | 16.94 | 0.0 | 0.0 | 0.0 | 16.94 | + | 5 | 31 | 01 June 2025 | | 16.87 | 16.8 | 0.14 | 0.0 | 0.0 | 16.94 | 0.0 | 0.0 | 0.0 | 16.94 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.87 | 0.07 | 0.0 | 0.0 | 16.94 | 0.0 | 0.0 | 0.0 | 16.94 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 1.64 | 0.0 | 0.0 | 101.64 | 0.0 | 0.0 | 0.0 | 101.64 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 15 January 2025 | None | Approved | + # --- second interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 15 January 2025 | 15 January 2025 | | | | | 0 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 83.63 | 16.37 | 0.35 | 0.0 | 0.0 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | + | 2 | 28 | 01 March 2025 | | 66.91 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | + | 3 | 31 | 01 April 2025 | | 50.19 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | + | 4 | 30 | 01 May 2025 | | 33.47 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | + | 5 | 31 | 01 June 2025 | | 16.75 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | 0.0 | 0.0 | 0.0 | 16.72 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.75 | 0.0 | 0.0 | 0.0 | 16.75 | 0.0 | 0.0 | 0.0 | 16.75 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 0.35 | 0.0 | 0.0 | 100.35 | 0.0 | 0.0 | 0.0 | 100.35 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 15 January 2025 | None | Approved | + | 15 January 2025 | None | Approved | + + @TestRailId:C4577 + Scenario: Verify multiple interest rate changes on same day, UC4: on due date with third change + When Admin sets the business date to "1 January 2025" + And Admin creates a client with random data + And Admin creates a fully customized loan with the following data: + | LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | + | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30 | 1 January 2025 | 100 | 10 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | + And Admin successfully approves the loan on "1 January 2025" with "100" amount and expected disbursement date on "1 January 2025" + And Admin successfully disburse the loan on "1 January 2025" with "100" EUR transaction amount + And Admin sets the business date to "1 February 2025" + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 83.67 | 16.33 | 0.83 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.46 | 0.7 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 3 | 31 | 01 April 2025 | | 50.61 | 16.6 | 0.56 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 4 | 30 | 01 May 2025 | | 33.87 | 16.74 | 0.42 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 5 | 31 | 01 June 2025 | | 16.99 | 16.88 | 0.28 | 0.0 | 0.0 | 17.16 | 0.0 | 0.0 | 0.0 | 17.16 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.99 | 0.14 | 0.0 | 0.0 | 17.13 | 0.0 | 0.0 | 0.0 | 17.13 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 2.93 | 0.0 | 0.0 | 102.93 | 0.0 | 0.0 | 0.0 | 102.93 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | +# --- first interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2025 | 01 February 2025 | | | | | 5 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 83.84 | 16.16 | 0.82 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.63 | 0.35 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 3 | 31 | 01 April 2025 | | 50.51 | 16.7 | 0.28 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 4 | 30 | 01 May 2025 | | 33.74 | 16.77 | 0.21 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 5 | 31 | 01 June 2025 | | 16.9 | 16.84 | 0.14 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.9 | 0.07 | 0.0 | 0.0 | 16.97 | 0.0 | 0.0 | 0.0 | 16.97 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 1.87 | 0.0 | 0.0 | 101.87 | 0.0 | 0.0 | 0.0 | 101.87 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 01 February 2025 | None | Approved | +# --- second interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2025 | 01 February 2025 | | | | | 0 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 84.01 | 15.99 | 0.81 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 3 | 31 | 01 April 2025 | | 50.41 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 4 | 30 | 01 May 2025 | | 33.61 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 5 | 31 | 01 June 2025 | | 16.81 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | 0.0 | 0.0 | 0.0 | 16.8 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.81 | 0.0 | 0.0 | 0.0 | 16.81 | 0.0 | 0.0 | 0.0 | 16.81 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 0.81 | 0.0 | 0.0 | 100.81 | 0.0 | 0.0 | 0.0 | 100.81 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 01 February 2025 | None | Approved | + | 01 February 2025 | None | Approved | +# --- third interest rate change --- + When Admin creates and approves Loan reschedule with the following data: + | rescheduleFromDate | submittedOnDate | adjustedDueDate | graceOnPrincipal | graceOnInterest | extraTerms | newInterestRate | + | 01 February 2025 | 01 February 2025 | | | | | 5 | + Then Loan Repayment schedule has 6 periods, with the following data for periods: + | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | | | 01 January 2025 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | + | 1 | 31 | 01 February 2025 | | 83.84 | 16.16 | 0.82 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 2 | 28 | 01 March 2025 | | 67.21 | 16.63 | 0.35 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 3 | 31 | 01 April 2025 | | 50.51 | 16.7 | 0.28 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 4 | 30 | 01 May 2025 | | 33.74 | 16.77 | 0.21 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 5 | 31 | 01 June 2025 | | 16.9 | 16.84 | 0.14 | 0.0 | 0.0 | 16.98 | 0.0 | 0.0 | 0.0 | 16.98 | + | 6 | 30 | 01 July 2025 | | 0.0 | 16.9 | 0.07 | 0.0 | 0.0 | 16.97 | 0.0 | 0.0 | 0.0 | 16.97 | + And Loan Repayment schedule has the following data in Total row: + | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | + | 100.0 | 1.87 | 0.0 | 0.0 | 101.87 | 0.0 | 0.0 | 0.0 | 101.87 | + And Loan Transactions tab has the following data: + | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | + | 01 January 2025 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | + And Loan Reschedule tab has the following data: + | From Date | Reason | Status | + | 01 February 2025 | None | Approved | + | 01 February 2025 | None | Approved | + | 01 February 2025 | None | Approved | \ No newline at end of file