FINERACT-2401: Add business events for interest pause actions
This commit is contained in:
committed by
Adam Saghy
parent
5ea7c36804
commit
1b4abd18a9
+27
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.test.messaging.event.loan;
|
||||
|
||||
public class LoanScheduleVariationsAddedEvent extends AbstractLoanEvent {
|
||||
|
||||
@Override
|
||||
public String getEventName() {
|
||||
return "LoanScheduleVariationsAddedBusinessEvent";
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.test.messaging.event.loan;
|
||||
|
||||
public class LoanScheduleVariationsDeletedEvent extends AbstractLoanEvent {
|
||||
|
||||
@Override
|
||||
public String getEventName() {
|
||||
return "LoanScheduleVariationsDeletedBusinessEvent";
|
||||
}
|
||||
}
|
||||
+174
-10
@@ -22,6 +22,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.cucumber.java.en.Then;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.client.models.CommandProcessingResult;
|
||||
import org.apache.fineract.client.models.InterestPauseRequestDto;
|
||||
import org.apache.fineract.client.models.PostLoansResponse;
|
||||
@@ -30,32 +33,76 @@ import org.apache.fineract.test.factory.LoanRequestFactory;
|
||||
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.messaging.EventAssertion;
|
||||
import org.apache.fineract.test.messaging.event.loan.LoanBalanceChangedEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.LoanScheduleVariationsAddedEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.LoanScheduleVariationsDeletedEvent;
|
||||
import org.apache.fineract.test.stepdef.AbstractStepDef;
|
||||
import org.apache.fineract.test.support.TestContextKey;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import retrofit2.Response;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class LoanInterestPauseStepDef extends AbstractStepDef {
|
||||
|
||||
@Autowired
|
||||
private LoanInterestPauseApi loanInterestPauseApi;
|
||||
private static final String DATE_FORMAT = "dd MMMM yyyy";
|
||||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT);
|
||||
private static final int INTEREST_PAUSE_TERM_TYPE_ID = 11;
|
||||
|
||||
private final LoanInterestPauseApi loanInterestPauseApi;
|
||||
private final EventAssertion eventAssertion;
|
||||
|
||||
@Then("Create an interest pause period with start date {string} and end date {string}")
|
||||
public void interestPauseCreate(final String startDate, final String endDate) throws IOException {
|
||||
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
long loanId = loanResponse.body().getLoanId();
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final InterestPauseRequestDto interestPauseRequest = LoanRequestFactory.defaultInterestPauseRequest().startDate(startDate)
|
||||
.endDate(endDate);
|
||||
final Response<CommandProcessingResult> interestPauseResponse = loanInterestPauseApi
|
||||
.createInterestPause(loanId, interestPauseRequest).execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(interestPauseResponse);
|
||||
|
||||
Assertions.assertNotNull(interestPauseResponse.body());
|
||||
final Long variationId = interestPauseResponse.body().getResourceId();
|
||||
testContext().set(TestContextKey.INTEREST_PAUSE_VARIATION_ID, variationId);
|
||||
}
|
||||
|
||||
@Then("Delete the interest pause period")
|
||||
public void interestPauseDelete() throws IOException {
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final Long variationId = testContext().get(TestContextKey.INTEREST_PAUSE_VARIATION_ID);
|
||||
Assertions.assertNotNull(variationId, "Interest pause variation ID must be set before deletion");
|
||||
|
||||
final Response<Void> deleteResponse = loanInterestPauseApi.deleteInterestPause(loanId, variationId).execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(deleteResponse);
|
||||
}
|
||||
|
||||
@Then("Update the interest pause period with start date {string} and end date {string}")
|
||||
public void interestPauseUpdate(final String startDate, final String endDate) throws IOException {
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final Long variationId = testContext().get(TestContextKey.INTEREST_PAUSE_VARIATION_ID);
|
||||
Assertions.assertNotNull(variationId, "Interest pause variation ID must be set before update");
|
||||
|
||||
final InterestPauseRequestDto interestPauseRequest = LoanRequestFactory.defaultInterestPauseRequest().startDate(startDate)
|
||||
.endDate(endDate);
|
||||
final Response<CommandProcessingResult> updateResponse = loanInterestPauseApi
|
||||
.updateInterestPause(loanId, variationId, interestPauseRequest).execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(updateResponse);
|
||||
}
|
||||
|
||||
@Then("Admin is not able to add an interest pause period with start date {string} and end date {string}")
|
||||
public void createInterestPauseFailure(final String startDate, final String endDate) throws IOException {
|
||||
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
long loanId = loanResponse.body().getLoanId();
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final InterestPauseRequestDto interestPauseRequest = LoanRequestFactory.defaultInterestPauseRequest().startDate(startDate)
|
||||
.endDate(endDate);
|
||||
@@ -71,17 +118,134 @@ public class LoanInterestPauseStepDef extends AbstractStepDef {
|
||||
|
||||
@Then("Admin is not able to add an interest pause period with start date {string} and end date {string} due to inactive loan status")
|
||||
public void createInterestPauseForInactiveLoanFailure(final String startDate, final String endDate) throws IOException {
|
||||
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
long loanId = loanResponse.body().getLoanId();
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final InterestPauseRequestDto interestPauseRequest = LoanRequestFactory.defaultInterestPauseRequest().startDate(startDate)
|
||||
.endDate(endDate);
|
||||
final Response<CommandProcessingResult> interestPauseResponse = loanInterestPauseApi
|
||||
.createInterestPause(loanId, interestPauseRequest).execute();
|
||||
|
||||
ErrorResponse errorDetails = ErrorResponse.from(interestPauseResponse);
|
||||
final ErrorResponse errorDetails = ErrorResponse.from(interestPauseResponse);
|
||||
assertThat(errorDetails.getHttpStatusCode()).as(ErrorMessageHelper.addInterestPauseForNotInactiveLoanFailure()).isEqualTo(403);
|
||||
assertThat(errorDetails.getSingleError().getDeveloperMessage())
|
||||
.isEqualTo(ErrorMessageHelper.addInterestPauseForNotInactiveLoanFailure());
|
||||
}
|
||||
|
||||
@Then("LoanScheduleVariationsAddedBusinessEvent is created for interest pause from {string} to {string}")
|
||||
public void checkLoanScheduleVariationsAddedBusinessEvent(final String start, final String end) {
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final LocalDate startDateParsed = LocalDate.parse(start, FORMATTER);
|
||||
final LocalDate endDateParsed = LocalDate.parse(end, FORMATTER);
|
||||
|
||||
eventAssertion.assertEvent(LoanScheduleVariationsAddedEvent.class, loanId).extractingData(loanAccountData -> {
|
||||
assertThat(loanAccountData.getLoanTermVariations()).isNotNull();
|
||||
assertThat(loanAccountData.getLoanTermVariations()).isNotEmpty();
|
||||
|
||||
boolean foundInterestPause = loanAccountData.getLoanTermVariations().stream()
|
||||
.anyMatch(variation -> isInterestPauseWithDates(variation, startDateParsed, endDateParsed));
|
||||
|
||||
assertThat(foundInterestPause)
|
||||
.as("LoanTermVariations should contain an INTEREST_PAUSE with start date '%s' and end date '%s'", start, end).isTrue();
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Then("LoanScheduleVariationsDeletedBusinessEvent is created for interest pause from {string} to {string}")
|
||||
public void checkLoanScheduleVariationsDeletedBusinessEvent(final String start, final String end) {
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final LocalDate startDateParsed = LocalDate.parse(start, FORMATTER);
|
||||
final LocalDate endDateParsed = LocalDate.parse(end, FORMATTER);
|
||||
|
||||
eventAssertion.assertEvent(LoanScheduleVariationsDeletedEvent.class, loanId).extractingData(loanAccountData -> {
|
||||
boolean foundInterestPause = false;
|
||||
|
||||
if (loanAccountData.getLoanTermVariations() != null && !loanAccountData.getLoanTermVariations().isEmpty()) {
|
||||
foundInterestPause = loanAccountData.getLoanTermVariations().stream()
|
||||
.anyMatch(variation -> isInterestPauseWithDates(variation, startDateParsed, endDateParsed));
|
||||
}
|
||||
|
||||
assertThat(foundInterestPause)
|
||||
.as("LoanTermVariations should NOT contain an INTEREST_PAUSE with start date '%s' and end date '%s' after deletion",
|
||||
start, end)
|
||||
.isFalse();
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Then("LoanScheduleVariationsAddedBusinessEvent is created for interest pause update from {string} and {string} to {string} and {string}")
|
||||
public void checkLoanScheduleVariationsAddedBusinessEventForUpdate(final String oldStart, final String oldEnd, final String newStart,
|
||||
final String newEnd) {
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final LocalDate oldStartDateParsed = LocalDate.parse(oldStart, FORMATTER);
|
||||
final LocalDate oldEndDateParsed = LocalDate.parse(oldEnd, FORMATTER);
|
||||
final LocalDate newStartDateParsed = LocalDate.parse(newStart, FORMATTER);
|
||||
final LocalDate newEndDateParsed = LocalDate.parse(newEnd, FORMATTER);
|
||||
|
||||
eventAssertion.assertEvent(LoanScheduleVariationsAddedEvent.class, loanId).extractingData(loanAccountData -> {
|
||||
assertThat(loanAccountData.getLoanTermVariations()).isNotNull();
|
||||
assertThat(loanAccountData.getLoanTermVariations()).isNotEmpty();
|
||||
|
||||
boolean foundOldInterestPause = loanAccountData.getLoanTermVariations().stream()
|
||||
.anyMatch(variation -> isInterestPauseWithDates(variation, oldStartDateParsed, oldEndDateParsed));
|
||||
|
||||
assertThat(foundOldInterestPause)
|
||||
.as("LoanTermVariations should NOT contain old INTEREST_PAUSE with start date '%s' and end date '%s' after update",
|
||||
oldStart, oldEnd)
|
||||
.isFalse();
|
||||
|
||||
boolean foundUpdatedInterestPause = loanAccountData.getLoanTermVariations().stream()
|
||||
.anyMatch(variation -> isInterestPauseWithDates(variation, newStartDateParsed, newEndDateParsed));
|
||||
|
||||
assertThat(foundUpdatedInterestPause)
|
||||
.as("LoanTermVariations should contain updated INTEREST_PAUSE with new start date '%s' and new end date '%s'", newStart,
|
||||
newEnd)
|
||||
.isTrue();
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Then("LoanBalanceChangedBusinessEvent is created on {string}")
|
||||
public void checkLoanBalanceChangedBusinessEvent(final String date) {
|
||||
final Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
Assertions.assertNotNull(loanResponse.body());
|
||||
final Long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
final LocalDate expectedBusinessDateParsed = LocalDate.parse(date, FORMATTER);
|
||||
eventAssertion.assertEvent(LoanBalanceChangedEvent.class, loanId).isRaisedOnBusinessDate(expectedBusinessDateParsed);
|
||||
}
|
||||
|
||||
private boolean isInterestPauseWithDates(final org.apache.fineract.avro.loan.v1.LoanTermVariationsDataV1 variation,
|
||||
final LocalDate startDate, final LocalDate endDate) {
|
||||
if (variation.getTermType() == null) {
|
||||
return false;
|
||||
}
|
||||
if (!Integer.valueOf(INTEREST_PAUSE_TERM_TYPE_ID).equals(variation.getTermType().getId())) {
|
||||
return false;
|
||||
}
|
||||
if (variation.getTermVariationApplicableFrom() == null || variation.getDateValue() == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
final LocalDate variationStartDate = LocalDate.parse(variation.getTermVariationApplicableFrom());
|
||||
final LocalDate variationEndDate = LocalDate.parse(variation.getDateValue());
|
||||
return variationStartDate.equals(startDate) && variationEndDate.equals(endDate);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
@@ -256,6 +256,7 @@ public abstract class TestContextKey {
|
||||
public static final String LOAN_CAPITALIZED_INCOME_AMORTIZATION_ID = "loanCapitalizedIncomeAmortizationId";
|
||||
public static final String LOAN_CAPITALIZED_INCOME_ADJUSTMENT_RESPONSE = "loanCapitalizedIncomeAdjustmentResponse";
|
||||
public static final String LOAN_INTEREST_REFUND_RESPONSE = "loanInterestRefundResponse";
|
||||
public static final String INTEREST_PAUSE_VARIATION_ID = "interestPauseVariationId";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_INTEREST_RECALCULATION_CONTRACT_TERMINATION = "loanProductCreateResponseLP2AdvancedPaymentInterestDailyInterestRecalculationContractTermination";
|
||||
public static final String LOAN_CONTRACT_TERMINATION_RESPONSE = "loanContractTerminationResponse";
|
||||
public static final String LOAN_UNDO_CONTRACT_TERMINATION_RESPONSE = "loanUndoContractTerminationResponse";
|
||||
|
||||
@@ -25,6 +25,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin sets the business date to "1 February 2024"
|
||||
And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 February 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -62,6 +64,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin sets the business date to "1 February 2024"
|
||||
And Customer makes "AUTOPAY" repayment on "01 February 2024" with 17.01 EUR transaction amount
|
||||
And Create an interest pause period with start date "10 February 2024" and end date "10 March 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "10 February 2024" to "10 March 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 February 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -117,6 +121,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
|
||||
| 01 March 2024 | Repayment | 17.01 | 16.52 | 0.49 | 0.0 | 0.0 | 67.05 | false | false |
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 March 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -177,6 +183,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
|
||||
| 01 March 2024 | Repayment | 17.01 | 16.52 | 0.49 | 0.0 | 0.0 | 67.05 | false | false |
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 March 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -195,6 +203,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
|
||||
| 01 March 2024 | Repayment | 17.01 | 16.62 | 0.39 | 0.0 | 0.0 | 66.95 | false | true |
|
||||
And Create an interest pause period with start date "10 March 2024" and end date "20 March 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "10 March 2024" to "20 March 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 March 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -236,6 +246,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount
|
||||
When Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "10 February 2024" and end date "10 March 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "10 February 2024" to "10 March 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "02 January 2024"
|
||||
Then Loan term variations has 1 variation, with the following data:
|
||||
| Term Type Id | Term Type Code | Term Type Value | Applicable From | Decimal Value | Date Value | Is Specific To Installment | Is Processed |
|
||||
| 11 | loanTermType.interestPause | interestPause | 10 February 2024 | 0.0 | 10 March 2024 | false | |
|
||||
@@ -367,6 +379,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
|
||||
| 14 January 2024 | Repayment | 17.01 | 16.77 | 0.24 | 0.0 | 0.0 | 83.23 | false | false |
|
||||
And Create an interest pause period with start date "15 January 2024" and end date "25 January 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 January 2024" to "25 January 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "14 January 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -395,6 +409,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin successfully disburse the loan on "01 April 2025" with "1000" EUR transaction amount
|
||||
And Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "15 April 2025" and end date "25 April 2025"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 April 2025" to "25 April 2025"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 April 2025"
|
||||
When Admin sets the business date to "20 April 2025"
|
||||
And Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 18 periods, with the following data for periods:
|
||||
@@ -498,6 +514,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin successfully disburse the loan on "01 April 2025" with "1000" EUR transaction amount
|
||||
And Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "15 April 2025" and end date "05 May 2025"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 April 2025" to "05 May 2025"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 April 2025"
|
||||
When Admin sets the business date to "20 April 2025"
|
||||
And Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 16 periods, with the following data for periods:
|
||||
@@ -600,6 +618,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin successfully disburse the loan on "01 April 2025" with "1000" EUR transaction amount
|
||||
And Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "15 April 2025" and end date "25 April 2025"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 April 2025" to "25 April 2025"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 April 2025"
|
||||
When Admin sets the business date to "20 April 2025"
|
||||
And Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 6 periods, with the following data for periods:
|
||||
@@ -688,6 +708,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin successfully disburse the loan on "01 April 2025" with "1000" EUR transaction amount
|
||||
And Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "15 April 2025" and end date "25 April 2025"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 April 2025" to "25 April 2025"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 April 2025"
|
||||
When Admin sets the business date to "20 April 2025"
|
||||
And Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 6 periods, with the following data for periods:
|
||||
@@ -775,6 +797,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin successfully disburse the loan on "01 April 2025" with "1000" EUR transaction amount
|
||||
And Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "15 April 2025" and end date "25 April 2025"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 April 2025" to "25 April 2025"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 April 2025"
|
||||
When Admin sets the business date to "20 April 2025"
|
||||
And Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 4 periods, with the following data for periods:
|
||||
@@ -856,6 +880,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
And Admin successfully disburse the loan on "01 April 2025" with "700" EUR transaction amount
|
||||
And Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "10 April 2025" and end date "05 May 2025"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "10 April 2025" to "05 May 2025"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 April 2025"
|
||||
When Admin sets the business date to "12 April 2025"
|
||||
And Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 11 periods, with the following data for periods:
|
||||
@@ -940,6 +966,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin successfully disburse the loan on "01 April 2025" with "700" EUR transaction amount
|
||||
And Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "15 April 2025" and end date "25 April 2025"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 April 2025" to "25 April 2025"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 April 2025"
|
||||
When Admin sets the business date to "20 April 2025"
|
||||
And Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 6 periods, with the following data for periods:
|
||||
@@ -1024,6 +1052,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin successfully disburse the loan on "01 April 2025" with "1000" EUR transaction amount
|
||||
And Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "15 April 2025" and end date "25 April 2025"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 April 2025" to "25 April 2025"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 April 2025"
|
||||
When Admin sets the business date to "20 April 2025"
|
||||
And Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 6 periods, with the following data for periods:
|
||||
@@ -1125,6 +1155,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin runs inline COB job for Loan
|
||||
# --- set and check interest pause period --- #
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "02 January 2024"
|
||||
Then Loan term variations has 1 variation, with the following data:
|
||||
| Term Type Id | Term Type Code | Term Type Value | Applicable From | Decimal Value | Date Value | Is Specific To Installment | Is Processed |
|
||||
| 11 | loanTermType.interestPause | interestPause | 05 February 2024 | 0.0 | 10 February 2024 | false | |
|
||||
@@ -1208,6 +1240,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin runs inline COB job for Loan
|
||||
# --- set and check interest pause period --- #
|
||||
And Create an interest pause period with start date "10 February 2024" and end date "10 March 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "10 February 2024" to "10 March 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "02 January 2024"
|
||||
Then Loan term variations has 1 variation, with the following data:
|
||||
| Term Type Id | Term Type Code | Term Type Value | Applicable From | Decimal Value | Date Value | Is Specific To Installment | Is Processed |
|
||||
| 11 | loanTermType.interestPause | interestPause | 10 February 2024 | 0.0 | 10 March 2024 | false | |
|
||||
@@ -1337,6 +1371,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 01 March 2024 | Repayment | 17.01 | 16.52 | 0.49 | 0.0 | 0.0 | 67.05 | false | false |
|
||||
# --- set and check interest pause period --- #
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 March 2024"
|
||||
When Admin sets the business date to "5 March 2024"
|
||||
When Admin runs inline COB job for Loan
|
||||
Then Loan term variations has 1 variation, with the following data:
|
||||
@@ -1461,6 +1497,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 01 March 2024 | Repayment | 17.01 | 16.52 | 0.49 | 0.0 | 0.0 | 67.05 | false | false |
|
||||
# --- set and check interest pause period --- #
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 March 2024"
|
||||
Then Loan term variations has 1 variation, with the following data:
|
||||
| Term Type Id | Term Type Code | Term Type Value | Applicable From | Decimal Value | Date Value | Is Specific To Installment | Is Processed |
|
||||
| 11 | loanTermType.interestPause | interestPause | 05 February 2024 | 0.0 | 10 February 2024 | false | |
|
||||
@@ -1483,6 +1521,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 01 March 2024 | Repayment | 17.01 | 16.62 | 0.39 | 0.0 | 0.0 | 66.95 | false | true |
|
||||
# --- set and check 2nd interest pause period --- #
|
||||
And Create an interest pause period with start date "10 March 2024" and end date "20 March 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "10 March 2024" to "20 March 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 March 2024"
|
||||
Then Loan term variations has 2 variation, with the following data:
|
||||
| Term Type Id | Term Type Code | Term Type Value | Applicable From | Decimal Value | Date Value | Is Specific To Installment | Is Processed |
|
||||
| 11 | loanTermType.interestPause | interestPause | 05 February 2024 | 0.0 | 10 February 2024 | false | |
|
||||
@@ -1610,6 +1650,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
When Admin runs inline COB job for Loan
|
||||
# --- set and check interest pause period --- #
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "15 February 2024"
|
||||
Then Loan term variations has 1 variation, with the following data:
|
||||
| Term Type Id | Term Type Code | Term Type Value | Applicable From | Decimal Value | Date Value | Is Specific To Installment | Is Processed |
|
||||
| 11 | loanTermType.interestPause | interestPause | 05 February 2024 | 0.0 | 10 February 2024 | false | |
|
||||
@@ -1779,6 +1821,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 15 January 2024 | Repayment | 15.0 | 15.0 | 0.0 | 0.0 | 0.0 | 85.0 | false | false |
|
||||
# --- set and check interest pause period --- #
|
||||
And Create an interest pause period with start date "14 January 2024" and end date "20 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "14 January 2024" to "20 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "15 January 2024"
|
||||
When Admin sets the business date to "5 March 2024"
|
||||
When Admin runs inline COB job for Loan
|
||||
Then Loan Repayment schedule has 6 periods, with the following data for periods:
|
||||
@@ -1867,6 +1911,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
|
||||
| 14 January 2024 | Repayment | 17.01 | 16.77 | 0.24 | 0.0 | 0.0 | 83.23 | false | false |
|
||||
And Create an interest pause period with start date "15 January 2024" and end date "25 January 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "15 January 2024" to "25 January 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "14 January 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -1907,6 +1953,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount
|
||||
When Admin runs inline COB job for Loan
|
||||
And Create an interest pause period with start date "01 February 2024" and end date "01 March 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "01 February 2024" to "01 March 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "02 January 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -2303,6 +2351,8 @@ Feature: Loan interest pause on repayment schedule
|
||||
And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount
|
||||
When Admin sets the business date to "02 January 2024"
|
||||
And Create an interest pause period with start date "02 January 2024" and end date "10 January 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "02 January 2024" to "10 January 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "02 January 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
@@ -2315,3 +2365,105 @@ Feature: Loan interest pause on repayment schedule
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 100 | 1.9 | 0 | 0 | 101.9 | 0 | 0 | 0 | 101.9 |
|
||||
|
||||
Scenario: Verify interest pause deletion
|
||||
When Admin sets the business date to "1 January 2024"
|
||||
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_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | | | | 0.0 |
|
||||
| 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | 17.0 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 100 | 2.05 | 0 | 0 | 102.05 | 0 | 0 | 0 | 102.05 |
|
||||
And Admin successfully approves the loan on "1 January 2024" with "100" amount and expected disbursement date on "1 January 2024"
|
||||
And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 January 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 2 | 29 | 01 March 2024 | | 66.95 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 3 | 31 | 01 April 2024 | | 50.33 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 4 | 30 | 01 May 2024 | | 33.61 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 5 | 31 | 01 June 2024 | | 16.8 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.8 | 0.1 | 0.0 | 0.0 | 16.9 | 0.0 | 0.0 | 0.0 | 16.9 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 100 | 1.95 | 0 | 0 | 101.95 | 0 | 0 | 0 | 101.95 |
|
||||
When Delete the interest pause period
|
||||
Then LoanScheduleVariationsDeletedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 January 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | 17.0 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 100 | 2.05 | 0 | 0 | 102.05 | 0 | 0 | 0 | 102.05 |
|
||||
|
||||
Scenario: Verify interest pause update
|
||||
When Admin sets the business date to "1 January 2024"
|
||||
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_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 100 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | | | | 0.0 |
|
||||
| 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 2 | 29 | 01 March 2024 | | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 3 | 31 | 01 April 2024 | | 50.43 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 4 | 30 | 01 May 2024 | | 33.71 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 5 | 31 | 01 June 2024 | | 16.9 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.9 | 0.1 | 0.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | 17.0 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 100 | 2.05 | 0 | 0 | 102.05 | 0 | 0 | 0 | 102.05 |
|
||||
And Admin successfully approves the loan on "1 January 2024" with "100" amount and expected disbursement date on "1 January 2024"
|
||||
And Admin successfully disburse the loan on "1 January 2024" with "100" EUR transaction amount
|
||||
And Create an interest pause period with start date "05 February 2024" and end date "10 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause from "05 February 2024" to "10 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 January 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 2 | 29 | 01 March 2024 | | 66.95 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 3 | 31 | 01 April 2024 | | 50.33 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 4 | 30 | 01 May 2024 | | 33.61 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 5 | 31 | 01 June 2024 | | 16.8 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.8 | 0.1 | 0.0 | 0.0 | 16.9 | 0.0 | 0.0 | 0.0 | 16.9 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 100 | 1.95 | 0 | 0 | 101.95 | 0 | 0 | 0 | 101.95 |
|
||||
When Update the interest pause period with start date "10 February 2024" and end date "25 February 2024"
|
||||
Then LoanScheduleVariationsAddedBusinessEvent is created for interest pause update from "05 February 2024" and "10 February 2024" to "10 February 2024" and "25 February 2024"
|
||||
Then LoanBalanceChangedBusinessEvent is created on "01 January 2024"
|
||||
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 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 31 | 01 February 2024 | | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 2 | 29 | 01 March 2024 | | 66.78 | 16.79 | 0.22 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 3 | 31 | 01 April 2024 | | 50.16 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 4 | 30 | 01 May 2024 | | 33.44 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 5 | 31 | 01 June 2024 | | 16.63 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
|
||||
| 6 | 30 | 01 July 2024 | | 0.0 | 16.63 | 0.1 | 0.0 | 0.0 | 16.73 | 0.0 | 0.0 | 0.0 | 16.73 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 100 | 1.78 | 0 | 0 | 101.78 | 0 | 0 | 0 | 101.78 |
|
||||
+19
@@ -36,6 +36,10 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
|
||||
import org.apache.fineract.infrastructure.core.domain.ExternalId;
|
||||
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanBalanceChangedBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanScheduleVariationsAddedBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.LoanScheduleVariationsDeletedBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.common.service.Validator;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper;
|
||||
@@ -53,6 +57,7 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite
|
||||
private final LoanRepositoryWrapper loanRepositoryWrapper;
|
||||
private final LoanAssembler loanAssembler;
|
||||
private final ReprocessLoanTransactionsService reprocessLoanTransactionsService;
|
||||
private final BusinessEventNotifierService businessEventNotifierService;
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult createInterestPause(final ExternalId loanExternalId, final String startDateString,
|
||||
@@ -107,6 +112,12 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite
|
||||
"Variation not found for the given loan ID"));
|
||||
|
||||
loanTermVariationsRepository.delete(variation);
|
||||
loan.getLoanTermVariations().remove(variation);
|
||||
|
||||
reprocessLoanTransactionsService.reprocessTransactions(loan);
|
||||
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanScheduleVariationsDeletedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
|
||||
return new CommandProcessingResultBuilder().withEntityId(variationId).build();
|
||||
}
|
||||
@@ -130,6 +141,11 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite
|
||||
|
||||
LoanTermVariations updatedVariation = loanTermVariationsRepository.save(variation);
|
||||
|
||||
reprocessLoanTransactionsService.reprocessTransactions(loan);
|
||||
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanScheduleVariationsAddedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
|
||||
return new CommandProcessingResultBuilder().withEntityId(updatedVariation.getId())
|
||||
.with(Map.of("startDate", startDate.toString(), "endDate", endDate.toString())).build();
|
||||
}
|
||||
@@ -147,6 +163,9 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite
|
||||
|
||||
reprocessLoanTransactionsService.reprocessTransactions(loan);
|
||||
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanScheduleVariationsAddedBusinessEvent(loan));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
|
||||
return new CommandProcessingResultBuilder().withEntityId(savedVariation.getId()).build();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -542,9 +542,9 @@ public class LoanAccountConfiguration {
|
||||
@ConditionalOnMissingBean(InterestPauseWritePlatformService.class)
|
||||
public InterestPauseWritePlatformService interestPauseWritePlatformService(LoanTermVariationsRepository loanTermVariationsRepository,
|
||||
LoanRepositoryWrapper loanRepositoryWrapper, LoanAssembler loanAssembler,
|
||||
ReprocessLoanTransactionsService reprocessLoanTransactionsService) {
|
||||
ReprocessLoanTransactionsService reprocessLoanTransactionsService, BusinessEventNotifierService businessEventNotifierService) {
|
||||
return new InterestPauseWritePlatformServiceImpl(loanTermVariationsRepository, loanRepositoryWrapper, loanAssembler,
|
||||
reprocessLoanTransactionsService);
|
||||
reprocessLoanTransactionsService, businessEventNotifierService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user