diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java index 334f075a8..3d5b0e520 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/interestpauses/service/InterestPauseWritePlatformServiceImpl.java @@ -114,14 +114,13 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite LocalDate endDate = parseDate(endDateString, dateFormat, locale); validateActiveLoan(loan); - validateInterestPauseDates(loan, startDate, endDate, dateFormat, locale); LoanTermVariations variation = loanTermVariationsRepository .findByIdAndLoanIdAndTermType(variationId, loan.getId(), INTEREST_PAUSE.getValue()) .orElseThrow(() -> new GeneralPlatformDomainRuleException("error.msg.variation.not.found", "Variation not found for the given loan ID")); - validateVariations(loan, variation); + validateInterestPauseDates(loan, startDate, endDate, dateFormat, locale, variation.getId()); variation.setTermApplicableFrom(startDate); variation.setDateValue(endDate); @@ -135,7 +134,7 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite private CommandProcessingResult processInterestPause(Loan loan, LocalDate startDate, LocalDate endDate, String dateFormat, String locale) { validateActiveLoan(loan); - validateInterestPauseDates(loan, startDate, endDate, dateFormat, locale); + validateInterestPauseDates(loan, startDate, endDate, dateFormat, locale, null); LoanTermVariations variation = new LoanTermVariations(INTEREST_PAUSE.getValue(), startDate, null, endDate, false, loan); @@ -144,7 +143,8 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite return new CommandProcessingResultBuilder().withEntityId(savedVariation.getId()).build(); } - private void validateInterestPauseDates(Loan loan, LocalDate startDate, LocalDate endDate, String dateFormat, String locale) { + private void validateInterestPauseDates(Loan loan, LocalDate startDate, LocalDate endDate, String dateFormat, String locale, + Long currentVariationId) { validateOrThrow(baseDataValidator -> { baseDataValidator.reset().parameter("startDate").value(startDate).notBlank(); @@ -182,11 +182,15 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite "Interest pause is only supported for loans with recalculate interest enabled."); } - for (LoanTermVariations existingVariation : loan.getLoanTermVariations()) { - if (Objects.equals(existingVariation.getTermType().getValue(), INTEREST_PAUSE.getValue())) { - if (!(endDate.isBefore(existingVariation.getTermApplicableFrom()) || startDate.isAfter(existingVariation.getDateValue()))) { - throw new GeneralPlatformDomainRuleException("interest.pause.overlapping", - "Overlapping interest pauses are not allowed."); + List existingVariations = loan.getLoanTermVariations(); + for (LoanTermVariations existingVariation : existingVariations) { + if (currentVariationId == null || !existingVariation.getId().equals(currentVariationId)) { + if (Objects.equals(existingVariation.getTermType().getValue(), INTEREST_PAUSE.getValue())) { + if (!(endDate.isBefore(existingVariation.getTermApplicableFrom()) + || startDate.isAfter(existingVariation.getDateValue()))) { + throw new GeneralPlatformDomainRuleException("interest.pause.overlapping", + "Overlapping interest pauses are not allowed."); + } } } } @@ -199,25 +203,6 @@ public class InterestPauseWritePlatformServiceImpl implements InterestPauseWrite } } - private void validateVariations(Loan loan, LoanTermVariations variation) { - if (variation == null) { - throw new GeneralPlatformDomainRuleException("interest.pause.not.found", - "The specified interest pause does not exist for the given loan."); - } - - List existingVariations = loan.getLoanTermVariations(); - for (LoanTermVariations existingVariation : existingVariations) { - if (!existingVariation.equals(variation) - && Objects.equals(existingVariation.getTermType().getValue(), INTEREST_PAUSE.getValue())) { - if (!(variation.getDateValue().isBefore(existingVariation.getTermApplicableFrom()) - || variation.getTermApplicableFrom().isAfter(existingVariation.getDateValue()))) { - throw new GeneralPlatformDomainRuleException("interest.pause.overlapping", - "Overlapping interest pauses are not allowed."); - } - } - } - } - private LocalDate parseDate(String date, String dateFormat, String locale) { try { DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat, Locale.forLanguageTag(locale)); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestPauseApiTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestPauseApiTest.java index 6af4626b6..c85926ca3 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestPauseApiTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestPauseApiTest.java @@ -57,7 +57,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { private static ResponseSpecification RESPONSE_SPEC_403; private static ResponseSpecification RESPONSE_SPEC_404; private static ResponseSpecification RESPONSE_SPEC_204; - private static LoanTransactionHelper LOAN_TRANSACTIONAL_HELPER; + private static LoanTransactionHelper LOAN_TRANSACTION_HELPER; private static LoanTransactionHelper LOAN_TRANSACTIONAL_HELPER_204; private static LoanTransactionHelper LOAN_TRANSACTION_HELPER_403; private static LoanTransactionHelper LOAN_TRANSACTION_HELPER_404; @@ -82,7 +82,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { RESPONSE_SPEC_403 = new ResponseSpecBuilder().expectStatusCode(403).build(); RESPONSE_SPEC_404 = new ResponseSpecBuilder().expectStatusCode(404).build(); RESPONSE_SPEC_204 = new ResponseSpecBuilder().expectStatusCode(204).build(); - LOAN_TRANSACTIONAL_HELPER = new LoanTransactionHelper(REQUEST_SPEC, RESPONSE_SPEC); + LOAN_TRANSACTION_HELPER = new LoanTransactionHelper(REQUEST_SPEC, RESPONSE_SPEC); LOAN_TRANSACTION_HELPER_403 = new LoanTransactionHelper(REQUEST_SPEC, RESPONSE_SPEC_403); LOAN_TRANSACTION_HELPER_404 = new LoanTransactionHelper(REQUEST_SPEC, RESPONSE_SPEC_404); LOAN_TRANSACTIONAL_HELPER_204 = new LoanTransactionHelper(REQUEST_SPEC, RESPONSE_SPEC_204); @@ -108,7 +108,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testCreateInterestPauseByLoanId_validRequest_shouldSucceed() { - PostLoansLoanIdTransactionsResponse response = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-12", + PostLoansLoanIdTransactionsResponse response = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(response); @@ -153,7 +153,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testRetrieveInterestPausesByLoanId_noPauses_shouldReturnEmpty() { - String response = LOAN_TRANSACTIONAL_HELPER.retrieveInterestPauseByLoanId(nonExistLoanId); + String response = LOAN_TRANSACTION_HELPER.retrieveInterestPauseByLoanId(nonExistLoanId); Assertions.assertNotNull(response, "Response should not be null"); Assertions.assertFalse(response.contains("id")); @@ -163,9 +163,9 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testRetrieveInterestPausesByLoanId_shouldReturnData() { - LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", loanId); + LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", loanId); - String response = LOAN_TRANSACTIONAL_HELPER.retrieveInterestPauseByLoanId(loanId); + String response = LOAN_TRANSACTION_HELPER.retrieveInterestPauseByLoanId(loanId); Assertions.assertNotNull(response, "Response should not be null"); Assertions.assertTrue(response.contains("2023-01-01")); @@ -174,7 +174,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testCreateInterestPauseByExternalLoanId_validRequest_shouldSucceed() { - PostLoansLoanIdTransactionsResponse response = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-12", + PostLoansLoanIdTransactionsResponse response = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(response); @@ -219,7 +219,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testRetrieveInterestPausesByExternalLoanId_noPauses_shouldReturnEmpty() { - String response = LOAN_TRANSACTIONAL_HELPER.retrieveInterestPauseByExternalId(nonExistExternalId); + String response = LOAN_TRANSACTION_HELPER.retrieveInterestPauseByExternalId(nonExistExternalId); Assertions.assertNotNull(response, "Response should not be null"); Assertions.assertFalse(response.contains("id")); @@ -229,9 +229,9 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testRetrieveInterestPausesByExternalLoanId_shouldReturnData() { - LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", externalId); + LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", externalId); - String response = LOAN_TRANSACTIONAL_HELPER.retrieveInterestPauseByExternalId(externalId); + String response = LOAN_TRANSACTION_HELPER.retrieveInterestPauseByExternalId(externalId); Assertions.assertNotNull(response, "Response should not be null"); Assertions.assertTrue(response.contains("2023-01-01")); @@ -240,8 +240,10 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByLoanId_overlapping_shouldFail() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", - "2023-01-12", "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-03", + "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse2 = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-08", + "2023-01-10", "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(createResponse); Assertions.assertNotNull(createResponse.getResourceId()); @@ -258,9 +260,33 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { } } + @Test + public void testUpdateInterestPauseByLoanId_overlapping_shouldNotFail() { + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-03", + "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse2 = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-08", + "2023-01-10", "yyyy-MM-dd", "en", loanId); + + Assertions.assertNotNull(createResponse); + Assertions.assertNotNull(createResponse.getResourceId()); + + Long variationId = createResponse.getResourceId(); + + try { + LOAN_TRANSACTION_HELPER.updateInterestPauseByLoanId(variationId, "2023-01-01", "2023-01-07", "yyyy-MM-dd", "en", loanId); + } catch (Exception e) { + String responseBody = e.getMessage(); + Assertions.assertNotNull(responseBody, "Response body should not be null"); + Assertions.assertTrue(responseBody.contains("interest.pause.overlapping"), + "Response should contain the validation error message for end date after loan maturity date"); + } + } + @Test public void testUpdateInterestPauseByLoanId_overlapping_shouldFail2() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-06", + "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse2 = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-07", "2023-01-12", "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(createResponse); @@ -280,7 +306,9 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByLoanId_overlapping_shouldFail3() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-02", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-02", "2023-01-06", + "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse2 = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-07", "2023-01-12", "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(createResponse); @@ -300,16 +328,16 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByLoanId_validRequest_shouldSucceed() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", - "2023-01-02", "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-02", + "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(createResponse); Assertions.assertNotNull(createResponse.getResourceId()); Long variationId = createResponse.getResourceId(); - PostLoansLoanIdTransactionsResponse updateResponse = LOAN_TRANSACTIONAL_HELPER.updateInterestPauseByLoanId(variationId, - "2023-01-03", "2023-01-04", "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse updateResponse = LOAN_TRANSACTION_HELPER.updateInterestPauseByLoanId(variationId, "2023-01-03", + "2023-01-04", "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(updateResponse); Assertions.assertNotNull(updateResponse.getResourceId()); @@ -318,8 +346,8 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByLoanId_endDateBeforeStartDate_shouldFail() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", - "2023-01-12", "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-12", + "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(createResponse); Assertions.assertNotNull(createResponse.getResourceId()); @@ -338,8 +366,8 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByLoanId_startDateBeforeLoanStart_shouldFail() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", - "2023-01-12", "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-12", + "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(createResponse); Assertions.assertNotNull(createResponse.getResourceId()); @@ -358,8 +386,8 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testDeleteInterestPauseByLoanId_validRequest_shouldSucceed() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", - "2023-01-12", "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-12", + "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(createResponse, "Create response should not be null"); Assertions.assertNotNull(createResponse.getResourceId(), "Resource ID should not be null"); @@ -372,7 +400,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { Assertions.fail("Delete operation failed: " + e.getMessage()); } - String response = LOAN_TRANSACTIONAL_HELPER.retrieveInterestPauseByLoanId(loanId); + String response = LOAN_TRANSACTION_HELPER.retrieveInterestPauseByLoanId(loanId); Assertions.assertFalse(response.contains(String.valueOf(variationId)), "Response should not contain the deleted variation ID"); } @@ -390,8 +418,8 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testDeleteInterestPauseByLoanId_invalidLoanId_shouldFail() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByLoanId("2023-01-01", - "2023-01-12", "yyyy-MM-dd", "en", loanId); + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByLoanId("2023-01-01", "2023-01-12", + "yyyy-MM-dd", "en", loanId); Assertions.assertNotNull(createResponse); Assertions.assertNotNull(createResponse.getResourceId()); @@ -410,7 +438,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByExternalId_validRequest_shouldSucceed() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-02", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(createResponse); @@ -418,7 +446,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { Long variationId = createResponse.getResourceId(); - PostLoansLoanIdTransactionsResponse updateResponse = LOAN_TRANSACTIONAL_HELPER.updateInterestPauseByExternalId(variationId, + PostLoansLoanIdTransactionsResponse updateResponse = LOAN_TRANSACTION_HELPER.updateInterestPauseByExternalId(variationId, "2023-01-03", "2023-01-04", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(updateResponse); @@ -428,7 +456,9 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByExternalId_overlapping_shouldFail() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", + "2023-01-06", "yyyy-MM-dd", "en", externalId); + PostLoansLoanIdTransactionsResponse createResponse2 = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-07", "2023-01-12", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(createResponse); @@ -448,7 +478,9 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByExternalId_overlapping_shouldFail2() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", + "2023-01-06", "yyyy-MM-dd", "en", externalId); + PostLoansLoanIdTransactionsResponse createResponse2 = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-07", "2023-01-12", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(createResponse); @@ -468,7 +500,9 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByExternalId_overlapping_shouldFail3() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-02", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-02", + "2023-01-06", "yyyy-MM-dd", "en", externalId); + PostLoansLoanIdTransactionsResponse createResponse2 = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-07", "2023-01-12", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(createResponse); @@ -488,7 +522,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByExternalId_endDateBeforeStartDate_shouldFail() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(createResponse); @@ -509,7 +543,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testUpdateInterestPauseByExternalId_startDateBeforeLoanStart_shouldFail() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(createResponse); @@ -530,7 +564,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testDeleteInterestPauseByExternalId_validRequest_shouldSucceed() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(createResponse, "Create response should not be null"); @@ -544,7 +578,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { Assertions.fail("Delete operation failed: " + e.getMessage()); } - String response = LOAN_TRANSACTIONAL_HELPER.retrieveInterestPauseByExternalId(externalId); + String response = LOAN_TRANSACTION_HELPER.retrieveInterestPauseByExternalId(externalId); Assertions.assertFalse(response.contains(String.valueOf(variationId)), "Response should not contain the deleted variation ID"); } @@ -562,7 +596,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { @Test public void testDeleteInterestPauseByExternalId_invalidExternalId_shouldFail() { - PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTIONAL_HELPER.createInterestPauseByExternalId("2023-01-01", + PostLoansLoanIdTransactionsResponse createResponse = LOAN_TRANSACTION_HELPER.createInterestPauseByExternalId("2023-01-01", "2023-01-12", "yyyy-MM-dd", "en", externalId); Assertions.assertNotNull(createResponse); @@ -616,7 +650,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { interestRecalculationCompoundingMethod, rescheduleStrategyMethod, preCloseInterestCalculationStrategy) .build(); - loanProductId = LOAN_TRANSACTIONAL_HELPER.getLoanProductId(loanProductJSON); + loanProductId = LOAN_TRANSACTION_HELPER.getLoanProductId(loanProductJSON); LOG.info("Successfully created loan product (ID:{}) ", loanProductId); } @@ -634,7 +668,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { .withSubmittedOnDate(dateString).withLoanType("individual").withExternalId(externalId) .withRepaymentStrategy("advanced-payment-allocation-strategy").build(clientId.toString(), loanProductId.toString(), null); - loanId = LOAN_TRANSACTIONAL_HELPER.getLoanId(loanApplicationJSON); + loanId = LOAN_TRANSACTION_HELPER.getLoanId(loanApplicationJSON); LOG.info("Sucessfully created loan (ID: {} )", loanId); @@ -648,7 +682,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { private void approveLoanApplication() { if (loanId != null) { - LOAN_TRANSACTIONAL_HELPER.approveLoan(dateString, loanId); + LOAN_TRANSACTION_HELPER.approveLoan(dateString, loanId); LOG.info("Successfully approved loan (ID: {} )", loanId); } } @@ -659,7 +693,7 @@ public class LoanInterestPauseApiTest extends BaseLoanIntegrationTest { private void disburseLoan() { if (loanId != null) { - LOAN_TRANSACTIONAL_HELPER.disburseLoan(externalId, new PostLoansLoanIdRequest().actualDisbursementDate(dateString) + LOAN_TRANSACTION_HELPER.disburseLoan(externalId, new PostLoansLoanIdRequest().actualDisbursementDate(dateString) .transactionAmount(new BigDecimal(loanPrincipalAmount)).locale("en").dateFormat("dd MMMM yyyy")); LOG.info("Successfully disbursed loan (ID: {} )", loanId); }