FINERACT-1992 Delinquency Pause API Changes
This commit is contained in:
+8
-3
@@ -79,6 +79,7 @@ public abstract class BaseLoanIntegrationTest {
|
||||
protected final LoanProductHelper loanProductHelper = new LoanProductHelper();
|
||||
protected JournalEntryHelper journalEntryHelper = new JournalEntryHelper(requestSpec, responseSpec);
|
||||
protected BusinessDateHelper businessDateHelper = new BusinessDateHelper();
|
||||
protected DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DATETIME_PATTERN);
|
||||
|
||||
// asset
|
||||
protected final Account loansReceivableAccount = accountHelper.createAssetAccount();
|
||||
@@ -229,7 +230,6 @@ public abstract class BaseLoanIntegrationTest {
|
||||
assertNull(loanDetails.getTransactions(), "No transaction is expected");
|
||||
} else {
|
||||
Assertions.assertEquals(transactions.length, loanDetails.getTransactions().size());
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DATETIME_PATTERN);
|
||||
Arrays.stream(transactions).forEach(tr -> {
|
||||
boolean found = loanDetails.getTransactions().stream()
|
||||
.anyMatch(item -> Objects.equals(item.getAmount(), tr.amount) && Objects.equals(item.getType().getValue(), tr.type)
|
||||
@@ -329,8 +329,13 @@ public abstract class BaseLoanIntegrationTest {
|
||||
|
||||
protected Long applyAndApproveLoan(Long clientId, Long loanProductId, String loanDisbursementDate, Double amount,
|
||||
int numberOfRepayments) {
|
||||
PostLoansResponse postLoansResponse = loanTransactionHelper
|
||||
.applyLoan(applyLoanRequest(clientId, loanProductId, loanDisbursementDate, amount, numberOfRepayments));
|
||||
return applyAndApproveLoan(clientId, loanProductId, loanDisbursementDate, amount, numberOfRepayments, null);
|
||||
}
|
||||
|
||||
protected Long applyAndApproveLoan(Long clientId, Long loanProductId, String loanDisbursementDate, Double amount,
|
||||
int numberOfRepayments, String externalId) {
|
||||
PostLoansResponse postLoansResponse = loanTransactionHelper.applyLoan(
|
||||
applyLoanRequest(clientId, loanProductId, loanDisbursementDate, amount, numberOfRepayments).externalId(externalId));
|
||||
|
||||
PostLoansLoanIdResponse approvedLoanResult = loanTransactionHelper.approveLoan(postLoansResponse.getResourceId(),
|
||||
approveLoanRequest(amount));
|
||||
|
||||
+259
@@ -0,0 +1,259 @@
|
||||
/**
|
||||
* 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.integrationtests;
|
||||
|
||||
import static java.lang.Boolean.TRUE;
|
||||
import static org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType.BUSINESS_DATE;
|
||||
import static org.apache.fineract.portfolio.delinquency.domain.DelinquencyAction.PAUSE;
|
||||
import static org.apache.fineract.portfolio.delinquency.domain.DelinquencyAction.RESUME;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.client.models.BusinessDateRequest;
|
||||
import org.apache.fineract.client.models.GetDelinquencyActionsResponse;
|
||||
import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
|
||||
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.PostLoansDelinquencyActionResponse;
|
||||
import org.apache.fineract.client.util.CallFailedRuntimeException;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
@Slf4j
|
||||
@ExtendWith(LoanTestLifecycleExtension.class)
|
||||
public class DelinquencyActionIntegrationTests extends BaseLoanIntegrationTest {
|
||||
|
||||
public static final BigDecimal DOWN_PAYMENT_PERCENTAGE = new BigDecimal(25);
|
||||
private final ClientHelper clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
@Test
|
||||
public void testCreateAndReadPauseDelinquencyAction() {
|
||||
runAt("01 January 2023", () -> {
|
||||
// Create Client
|
||||
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||
|
||||
// Create Loan Product
|
||||
Long loanProductId = createLoanProductWith25PctDownPayment(true, true);
|
||||
|
||||
// Apply and Approve Loan
|
||||
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1500.0, 2);
|
||||
|
||||
// Disburse Loan
|
||||
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
||||
|
||||
// Create Delinquency Pause for the Loan
|
||||
PostLoansDelinquencyActionResponse response = loanTransactionHelper.createLoanDelinquencyAction(loanId, PAUSE,
|
||||
"10 January 2023", "15 January 2023");
|
||||
|
||||
List<GetDelinquencyActionsResponse> loanDelinquencyActions = loanTransactionHelper.getLoanDelinquencyActions(loanId);
|
||||
Assertions.assertNotNull(loanDelinquencyActions);
|
||||
Assertions.assertEquals(1, loanDelinquencyActions.size());
|
||||
Assertions.assertEquals("PAUSE", loanDelinquencyActions.get(0).getAction());
|
||||
Assertions.assertEquals(LocalDate.parse("10 January 2023", dateTimeFormatter), loanDelinquencyActions.get(0).getStartDate());
|
||||
Assertions.assertEquals(LocalDate.parse("15 January 2023", dateTimeFormatter), loanDelinquencyActions.get(0).getEndDate());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndReadPauseDelinquencyActionUsingExternalId() {
|
||||
runAt("01 January 2023", () -> {
|
||||
// Create Client
|
||||
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||
|
||||
// Create Loan Product
|
||||
Long loanProductId = createLoanProductWith25PctDownPayment(true, true);
|
||||
|
||||
// Create external ID
|
||||
String externalId = UUID.randomUUID().toString();
|
||||
|
||||
// Apply and Approve Loan
|
||||
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1500.0, 2, externalId);
|
||||
|
||||
// Disburse Loan
|
||||
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
||||
|
||||
// Create Delinquency Pause for the Loan
|
||||
PostLoansDelinquencyActionResponse response = loanTransactionHelper.createLoanDelinquencyAction(externalId, PAUSE,
|
||||
"10 January 2023", "15 January 2023");
|
||||
|
||||
List<GetDelinquencyActionsResponse> loanDelinquencyActions = loanTransactionHelper.getLoanDelinquencyActions(externalId);
|
||||
Assertions.assertNotNull(loanDelinquencyActions);
|
||||
Assertions.assertEquals(1, loanDelinquencyActions.size());
|
||||
Assertions.assertEquals("PAUSE", loanDelinquencyActions.get(0).getAction());
|
||||
Assertions.assertEquals(LocalDate.parse("10 January 2023", dateTimeFormatter), loanDelinquencyActions.get(0).getStartDate());
|
||||
Assertions.assertEquals(LocalDate.parse("15 January 2023", dateTimeFormatter), loanDelinquencyActions.get(0).getEndDate());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreatePauseAndResumeDelinquencyAction() {
|
||||
runAt("01 January 2023", () -> {
|
||||
// Create Client
|
||||
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||
|
||||
// Create Loan Product
|
||||
Long loanProductId = createLoanProductWith25PctDownPayment(true, true);
|
||||
|
||||
// Apply and Approve Loan
|
||||
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1500.0, 2);
|
||||
|
||||
// Disburse Loan
|
||||
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
||||
|
||||
// Create Delinquency Pause for the Loan
|
||||
loanTransactionHelper.createLoanDelinquencyAction(loanId, PAUSE, "10 January 2023", "15 January 2023");
|
||||
|
||||
// Update business date
|
||||
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("14 January 2023")
|
||||
.dateFormat(DATETIME_PATTERN).locale("en"));
|
||||
|
||||
// Create 2nd Delinquency Resume for the Loan
|
||||
loanTransactionHelper.createLoanDelinquencyAction(loanId, RESUME, "14 January 2023");
|
||||
|
||||
List<GetDelinquencyActionsResponse> loanDelinquencyActions = loanTransactionHelper.getLoanDelinquencyActions(loanId);
|
||||
Assertions.assertNotNull(loanDelinquencyActions);
|
||||
Assertions.assertEquals(2, loanDelinquencyActions.size());
|
||||
|
||||
Assertions.assertEquals("PAUSE", loanDelinquencyActions.get(0).getAction());
|
||||
Assertions.assertEquals(LocalDate.parse("10 January 2023", dateTimeFormatter), loanDelinquencyActions.get(0).getStartDate());
|
||||
Assertions.assertEquals(LocalDate.parse("15 January 2023", dateTimeFormatter), loanDelinquencyActions.get(0).getEndDate());
|
||||
|
||||
Assertions.assertEquals("RESUME", loanDelinquencyActions.get(1).getAction());
|
||||
Assertions.assertEquals(LocalDate.parse("14 January 2023", dateTimeFormatter), loanDelinquencyActions.get(1).getStartDate());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreatePauseAndResumeDelinquencyActionWithStatusFlag() {
|
||||
runAt("01 January 2023", () -> {
|
||||
// Create Client
|
||||
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||
|
||||
// Create Loan Product
|
||||
Long loanProductId = createLoanProductWith25PctDownPayment(true, true);
|
||||
|
||||
// Apply and Approve Loan
|
||||
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1500.0, 2);
|
||||
|
||||
// Disburse Loan
|
||||
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
||||
|
||||
// Create Delinquency Pause for the Loan
|
||||
loanTransactionHelper.createLoanDelinquencyAction(loanId, PAUSE, "10 January 2023", "15 January 2023");
|
||||
|
||||
// Update business date
|
||||
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("14 January 2023")
|
||||
.dateFormat(DATETIME_PATTERN).locale("en"));
|
||||
|
||||
// Validate Loan Delinquency Pause Period on Loan
|
||||
validateLoanDelinquencyPausePerios(loanId, "10 January 2023", "15 January 2023", true);
|
||||
|
||||
// Create a Resume for the Loan for the current business date, it is still expected to be in pause
|
||||
loanTransactionHelper.createLoanDelinquencyAction(loanId, RESUME, "14 January 2023");
|
||||
|
||||
// Validate Loan Delinquency Pause Period on Loan
|
||||
validateLoanDelinquencyPausePerios(loanId, "10 January 2023", "14 January 2023", true);
|
||||
|
||||
// Update business date to 15 January 2023
|
||||
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("15 January 2023")
|
||||
.dateFormat(DATETIME_PATTERN).locale("en"));
|
||||
|
||||
// Validate Loan Delinquency Pause Period on Loan
|
||||
validateLoanDelinquencyPausePerios(loanId, "10 January 2023", "14 January 2023", false);
|
||||
|
||||
// Create a new pause action for the future
|
||||
loanTransactionHelper.createLoanDelinquencyAction(loanId, PAUSE, "20 January 2023", "25 January 2023");
|
||||
|
||||
// Validate Loan Delinquency Pause Period on Loan
|
||||
validateLoanDelinquencyPausePerios(loanId, "10 January 2023", "14 January 2023", false);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidationErrorIsThrownWhenCreatingActionInThePast() {
|
||||
runAt("01 January 2023", () -> {
|
||||
// Create Client
|
||||
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
|
||||
|
||||
// Create Loan Product
|
||||
Long loanProductId = createLoanProductWith25PctDownPayment(true, true);
|
||||
|
||||
// Apply and Approve Loan
|
||||
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 January 2023", 1500.0, 2);
|
||||
|
||||
// Disburse Loan
|
||||
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 January 2023");
|
||||
|
||||
// Create Delinquency Pause for the Loan in the past
|
||||
CallFailedRuntimeException exception = assertThrows(CallFailedRuntimeException.class,
|
||||
() -> loanTransactionHelper.createLoanDelinquencyAction(loanId, PAUSE, "05 December 2022", "15 January 2023"));
|
||||
assertTrue(exception.getMessage().contains("Start date of pause period must be in the future"));
|
||||
});
|
||||
}
|
||||
|
||||
private void validateLoanDelinquencyPausePerios(Long loanId, String expectedStart, String expectedEnd, Boolean expectedPauseState) {
|
||||
GetLoansLoanIdResponse loan = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId.intValue());
|
||||
Assertions.assertNotNull(loan.getDelinquent());
|
||||
Assertions.assertEquals(expectedPauseState, loan.getDelinquent().getDelinquencyCalculationPaused());
|
||||
Assertions.assertEquals(LocalDate.parse(expectedStart, dateTimeFormatter),
|
||||
loan.getDelinquent().getDelinquencyPausePeriodStartDate());
|
||||
Assertions.assertEquals(LocalDate.parse(expectedEnd, dateTimeFormatter), loan.getDelinquent().getDelinquencyPausePeriodEndDate());
|
||||
}
|
||||
|
||||
private Long createLoanProductWith25PctDownPayment(boolean autoDownPaymentEnabled, boolean multiDisburseEnabled) {
|
||||
PostLoanProductsRequest product = createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct();
|
||||
product.setMultiDisburseLoan(multiDisburseEnabled);
|
||||
|
||||
if (!multiDisburseEnabled) {
|
||||
product.disallowExpectedDisbursements(null);
|
||||
product.setAllowApprovedDisbursedAmountsOverApplied(null);
|
||||
product.overAppliedCalculationType(null);
|
||||
product.overAppliedNumber(null);
|
||||
}
|
||||
|
||||
product.setEnableDownPayment(true);
|
||||
product.setDisbursedAmountPercentageForDownPayment(DOWN_PAYMENT_PERCENTAGE);
|
||||
product.setEnableAutoRepaymentForDownPayment(autoDownPaymentEnabled);
|
||||
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(product);
|
||||
GetLoanProductsProductIdResponse getLoanProductsProductIdResponse = loanProductHelper
|
||||
.retrieveLoanProductById(loanProductResponse.getResourceId());
|
||||
|
||||
Long loanProductId = loanProductResponse.getResourceId();
|
||||
|
||||
assertEquals(TRUE, getLoanProductsProductIdResponse.getEnableDownPayment());
|
||||
assertNotNull(getLoanProductsProductIdResponse.getDisbursedAmountPercentageForDownPayment());
|
||||
assertEquals(0, getLoanProductsProductIdResponse.getDisbursedAmountPercentageForDownPayment().compareTo(DOWN_PAYMENT_PERCENTAGE));
|
||||
assertEquals(autoDownPaymentEnabled, getLoanProductsProductIdResponse.getEnableAutoRepaymentForDownPayment());
|
||||
assertEquals(multiDisburseEnabled, getLoanProductsProductIdResponse.getMultiDisburseLoan());
|
||||
return loanProductId;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -41,7 +41,7 @@ import org.apache.fineract.client.models.GetDelinquencyBucketsResponse;
|
||||
import org.apache.fineract.client.models.GetDelinquencyRangesResponse;
|
||||
import org.apache.fineract.client.models.GetDelinquencyTagHistoryResponse;
|
||||
import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdCollectionData;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdDelinquencySummary;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdRepaymentPeriod;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdRepaymentSchedule;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
|
||||
@@ -903,7 +903,7 @@ public class DelinquencyBucketsIntegrationTest {
|
||||
getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId);
|
||||
loanTransactionHelper.printDelinquencyData(getLoansLoanIdResponse);
|
||||
|
||||
GetLoansLoanIdCollectionData getLoansLoanIdCollectionData = getLoansLoanIdResponse.getDelinquent();
|
||||
GetLoansLoanIdDelinquencySummary getLoansLoanIdCollectionData = getLoansLoanIdResponse.getDelinquent();
|
||||
assertNotNull(getLoansLoanIdCollectionData);
|
||||
assertEquals(0, getLoansLoanIdCollectionData.getDelinquentDays());
|
||||
assertEquals(0, getLoansLoanIdCollectionData.getPastDueDays());
|
||||
@@ -992,7 +992,7 @@ public class DelinquencyBucketsIntegrationTest {
|
||||
getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId);
|
||||
loanTransactionHelper.printDelinquencyData(getLoansLoanIdResponse);
|
||||
|
||||
GetLoansLoanIdCollectionData getLoansLoanIdCollectionData = getLoansLoanIdResponse.getDelinquent();
|
||||
GetLoansLoanIdDelinquencySummary getLoansLoanIdCollectionData = getLoansLoanIdResponse.getDelinquent();
|
||||
assertNotNull(getLoansLoanIdCollectionData);
|
||||
assertEquals(0, getLoansLoanIdCollectionData.getDelinquentDays());
|
||||
assertEquals(0, getLoansLoanIdCollectionData.getPastDueDays());
|
||||
|
||||
+32
-2
@@ -45,13 +45,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.client.models.AdvancedPaymentData;
|
||||
import org.apache.fineract.client.models.DeleteLoansLoanIdChargesChargeIdResponse;
|
||||
import org.apache.fineract.client.models.DeleteLoansLoanIdResponse;
|
||||
import org.apache.fineract.client.models.GetDelinquencyActionsResponse;
|
||||
import org.apache.fineract.client.models.GetDelinquencyTagHistoryResponse;
|
||||
import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
|
||||
import org.apache.fineract.client.models.GetLoanProductsResponse;
|
||||
import org.apache.fineract.client.models.GetLoansApprovalTemplateResponse;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdChargesChargeIdResponse;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdChargesTemplateResponse;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdCollectionData;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdDelinquencySummary;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdDisbursementDetails;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdRepaymentPeriod;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdRepaymentSchedule;
|
||||
@@ -63,6 +64,8 @@ import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionId
|
||||
import org.apache.fineract.client.models.GetPaymentTypesResponse;
|
||||
import org.apache.fineract.client.models.PostLoanProductsRequest;
|
||||
import org.apache.fineract.client.models.PostLoanProductsResponse;
|
||||
import org.apache.fineract.client.models.PostLoansDelinquencyActionRequest;
|
||||
import org.apache.fineract.client.models.PostLoansDelinquencyActionResponse;
|
||||
import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdRequest;
|
||||
import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdResponse;
|
||||
import org.apache.fineract.client.models.PostLoansLoanIdChargesRequest;
|
||||
@@ -88,6 +91,7 @@ import org.apache.fineract.integrationtests.client.IntegrationTest;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.portfolio.delinquency.domain.DelinquencyAction;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
|
||||
@@ -279,6 +283,32 @@ public class LoanTransactionHelper extends IntegrationTest {
|
||||
return GSON.fromJson(response, delinquencyTagsListType);
|
||||
}
|
||||
|
||||
public List<GetDelinquencyActionsResponse> getLoanDelinquencyActions(final Long loanID) {
|
||||
return ok(fineract().loans.getLoanDelinquencyActions(loanID));
|
||||
}
|
||||
|
||||
public List<GetDelinquencyActionsResponse> getLoanDelinquencyActions(String externalId) {
|
||||
return ok(fineract().loans.getLoanDelinquencyActions1(externalId));
|
||||
}
|
||||
|
||||
public PostLoansDelinquencyActionResponse createLoanDelinquencyAction(final Long loanid, DelinquencyAction action, String startDate,
|
||||
String endDate) {
|
||||
PostLoansDelinquencyActionRequest postLoansDelinquencyAction = new PostLoansDelinquencyActionRequest().action(action.name())
|
||||
.startDate(startDate).endDate(endDate).locale("en").dateFormat("dd MMMM yyyy");
|
||||
return ok(fineract().loans.createLoanDelinquencyAction(loanid, postLoansDelinquencyAction));
|
||||
}
|
||||
|
||||
public PostLoansDelinquencyActionResponse createLoanDelinquencyAction(String externalId, DelinquencyAction action, String startDate,
|
||||
String endDate) {
|
||||
PostLoansDelinquencyActionRequest postLoansDelinquencyAction = new PostLoansDelinquencyActionRequest().action(action.name())
|
||||
.startDate(startDate).endDate(endDate).locale("en").dateFormat("dd MMMM yyyy");
|
||||
return ok(fineract().loans.createLoanDelinquencyAction1(externalId, postLoansDelinquencyAction));
|
||||
}
|
||||
|
||||
public PostLoansDelinquencyActionResponse createLoanDelinquencyAction(final Long loanid, DelinquencyAction action, String startDate) {
|
||||
return createLoanDelinquencyAction(loanid, action, startDate, null);
|
||||
}
|
||||
|
||||
public Object getLoanProductDetail(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final Integer loanProductId, final String jsonAttributeToGetBack) {
|
||||
final String URL = "/fineract-provider/api/v1/loanproducts/" + loanProductId + "?associations=all&" + Utils.TENANT_IDENTIFIER;
|
||||
@@ -1638,7 +1668,7 @@ public class LoanTransactionHelper extends IntegrationTest {
|
||||
}
|
||||
|
||||
public void printDelinquencyData(GetLoansLoanIdResponse getLoansLoanIdResponse) {
|
||||
GetLoansLoanIdCollectionData getLoansLoanIdCollectionData = getLoansLoanIdResponse.getDelinquent();
|
||||
GetLoansLoanIdDelinquencySummary getLoansLoanIdCollectionData = getLoansLoanIdResponse.getDelinquent();
|
||||
if (getLoansLoanIdCollectionData != null) {
|
||||
log.info("Loan Delinquency {}", getLoansLoanIdCollectionData.toString());
|
||||
}
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.client.models.DeleteDelinquencyBucketResponse;
|
||||
import org.apache.fineract.client.models.GetDelinquencyBucketsResponse;
|
||||
import org.apache.fineract.client.models.GetDelinquencyRangesResponse;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdCollectionData;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdDelinquencySummary;
|
||||
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
|
||||
import org.apache.fineract.client.models.PostDelinquencyBucketResponse;
|
||||
import org.apache.fineract.client.models.PostDelinquencyRangeResponse;
|
||||
@@ -121,7 +121,7 @@ public class DelinquencyBucketsHelper {
|
||||
|
||||
public static void evaluateLoanCollectionData(GetLoansLoanIdResponse getLoansLoanIdResponse, Integer pastDueDays,
|
||||
Double amountExpected) {
|
||||
GetLoansLoanIdCollectionData getCollectionData = getLoansLoanIdResponse.getDelinquent();
|
||||
GetLoansLoanIdDelinquencySummary getCollectionData = getLoansLoanIdResponse.getDelinquent();
|
||||
if (getCollectionData != null) {
|
||||
log.info("Loan Delinquency Data in Days {} and Amount {}", getCollectionData.getPastDueDays(),
|
||||
getCollectionData.getDelinquentAmount());
|
||||
|
||||
Reference in New Issue
Block a user