FINERACT-1971: Enhance validation for installment level delinquency for loan product
This commit is contained in:
committed by
Adam Saghy
parent
bcf04b7e6f
commit
b108ca92a6
-5
@@ -64,7 +64,6 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Create Loan Product
|
||||
PostLoanProductsRequest loanProductsRequest = create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
|
||||
InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
|
||||
loanProductsRequest.setEnableInstallmentLevelDelinquency(true);
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(loanProductsRequest);
|
||||
|
||||
// Apply and Approve Loan
|
||||
@@ -112,7 +111,6 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Create Loan Product
|
||||
PostLoanProductsRequest loanProductsRequest = create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
|
||||
InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
|
||||
loanProductsRequest.setEnableInstallmentLevelDelinquency(true);
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(loanProductsRequest);
|
||||
|
||||
// Apply and Approve Loan
|
||||
@@ -169,7 +167,6 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Create Loan Product
|
||||
PostLoanProductsRequest loanProductsRequest = create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
|
||||
InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
|
||||
loanProductsRequest.setEnableInstallmentLevelDelinquency(true);
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(loanProductsRequest);
|
||||
|
||||
// Apply and Approve Loan
|
||||
@@ -215,7 +212,6 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Create Loan Product
|
||||
PostLoanProductsRequest loanProductsRequest = create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
|
||||
InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
|
||||
loanProductsRequest.setEnableInstallmentLevelDelinquency(true);
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(loanProductsRequest);
|
||||
|
||||
// Apply and Approve Loan
|
||||
@@ -259,7 +255,6 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Create Loan Product
|
||||
PostLoanProductsRequest loanProductsRequest = create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
|
||||
InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
|
||||
loanProductsRequest.setEnableInstallmentLevelDelinquency(true);
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(loanProductsRequest);
|
||||
|
||||
// Apply and Approve Loan
|
||||
|
||||
+50
@@ -31,6 +31,7 @@ import org.apache.fineract.client.models.GetLoansLoanIdLoanInstallmentLevelDelin
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
|
||||
import org.apache.fineract.client.models.PostLoanProductsRequest;
|
||||
import org.apache.fineract.client.models.PostLoanProductsResponse;
|
||||
import org.apache.fineract.client.models.PutLoanProductsProductIdRequest;
|
||||
import org.apache.fineract.client.util.CallFailedRuntimeException;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.SchedulerJobHelper;
|
||||
@@ -410,6 +411,55 @@ public class InstallmentLevelDelinquencyAPIIntegrationTests extends BaseLoanInte
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tesInstallmentLevelSettingForLoanProductWithoutDelinquencyBucketValidation() {
|
||||
|
||||
runAt("31 May 2023", () -> {
|
||||
// Create Client
|
||||
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||
|
||||
// Create Loan Product without delinquency bucket
|
||||
PostLoanProductsRequest loanProductsRequest = create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
|
||||
InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
|
||||
// set installment level delinquency as true
|
||||
loanProductsRequest.setEnableInstallmentLevelDelinquency(true);
|
||||
|
||||
// Create loan product with installment level delinquency setting
|
||||
CallFailedRuntimeException callFailedRuntimeException = Assertions.assertThrows(CallFailedRuntimeException.class,
|
||||
() -> loanProductHelper.createLoanProduct(loanProductsRequest));
|
||||
|
||||
Assertions.assertTrue(callFailedRuntimeException.getMessage()
|
||||
.contains("Installment level delinquency cannot be enabled if Delinquency bucket is not configured for loan product"));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tesUpdateInstallmentLevelSettingForLoanProductWithoutDelinquencyBucketValidation() {
|
||||
|
||||
runAt("31 May 2023", () -> {
|
||||
// Create Client
|
||||
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||
|
||||
// Create Loan Product without delinquency bucket
|
||||
PostLoanProductsRequest loanProductsRequest = create1InstallmentAmountInMultiplesOf4Period1MonthLongWithInterestAndAmortizationProduct(
|
||||
InterestType.FLAT, AmortizationType.EQUAL_INSTALLMENTS);
|
||||
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(loanProductsRequest);
|
||||
|
||||
// Update loan product with installment level delinquency setting
|
||||
CallFailedRuntimeException callFailedRuntimeException = Assertions.assertThrows(CallFailedRuntimeException.class,
|
||||
() -> loanProductHelper.updateLoanProductById(loanProductResponse.getResourceId(),
|
||||
new PutLoanProductsProductIdRequest().enableInstallmentLevelDelinquency(true).locale("en")));
|
||||
|
||||
Assertions.assertTrue(callFailedRuntimeException.getMessage()
|
||||
.contains("Installment level delinquency cannot be enabled if Delinquency bucket is not configured for loan product"));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void updateBusinessDateAndExecuteCOBJob(String date) {
|
||||
businessDateHelper.updateBusinessDate(
|
||||
new BusinessDateRequest().type(BUSINESS_DATE.getName()).date(date).dateFormat(DATETIME_PATTERN).locale("en"));
|
||||
|
||||
Reference in New Issue
Block a user