FINERACT-1971: Fix next payment due date loan delinquent detail

This commit is contained in:
Ruchi Dhamankar
2024-01-12 15:57:06 +01:00
committed by Adam Saghy
parent e3a771aa71
commit 0672996678
9 changed files with 425 additions and 6 deletions
@@ -141,4 +141,6 @@ public interface ConfigurationDomainService {
String getAccrualDateConfigForCharge();
String getNextPaymentDateConfigForLoan();
}
@@ -190,6 +190,8 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom {
public static final String WRITTEN_OFF_ON_DATE = "writtenOffOnDate";
public static final String FEE = "fee";
public static final String PENALTIES = "penalties";
public static final String EARLIEST_UNPAID_DATE = "earliest-unpaid-date";
public static final String NEXT_UNPAID_DUE_DATE = "next-unpaid-due-date";
/** Disable optimistic locking till batch jobs failures can be fixed **/
@Version
int version;
@@ -3624,7 +3626,40 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom {
return isChronologicallyLatestRepaymentOrWaiver;
}
public LocalDate possibleNextRepaymentDate() {
public LocalDate possibleNextRepaymentDate(final String nextPaymentDueDateConfig) {
LocalDate nextPossibleRepaymentDate = null;
if (EARLIEST_UNPAID_DATE.equalsIgnoreCase(nextPaymentDueDateConfig)) {
nextPossibleRepaymentDate = getEarliestUnpaidInstallmentDate();
} else if (NEXT_UNPAID_DUE_DATE.equalsIgnoreCase(nextPaymentDueDateConfig)) {
nextPossibleRepaymentDate = getNextUnpaidInstallmentDueDate();
}
return nextPossibleRepaymentDate;
}
private LocalDate getNextUnpaidInstallmentDueDate() {
LocalDate nextUnpaidInstallmentDate = null;
List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
LocalDate currentBusinessDate = DateUtils.getBusinessLocalDate();
LocalDate expectedMaturityDate = determineExpectedMaturityDate();
for (final LoanRepaymentScheduleInstallment installment : installments) {
boolean isCurrentDateBeforeInstallmentAndLoanPeriod = DateUtils.isBefore(currentBusinessDate, installment.getDueDate())
&& DateUtils.isBefore(currentBusinessDate, expectedMaturityDate);
if (installment.isDownPayment()) {
isCurrentDateBeforeInstallmentAndLoanPeriod = DateUtils.isEqual(currentBusinessDate, installment.getDueDate())
&& DateUtils.isBefore(currentBusinessDate, expectedMaturityDate);
}
if (isCurrentDateBeforeInstallmentAndLoanPeriod) {
if (installment.isNotFullyPaidOff()) {
nextUnpaidInstallmentDate = installment.getDueDate();
break;
}
}
}
return nextUnpaidInstallmentDate;
}
private LocalDate getEarliestUnpaidInstallmentDate() {
LocalDate earliestUnpaidInstallmentDate = DateUtils.getBusinessLocalDate();
List<LoanRepaymentScheduleInstallment> installments = getRepaymentScheduleInstallments();
for (final LoanRepaymentScheduleInstallment installment : installments) {
@@ -53,6 +53,8 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
private static final String REPORT_EXPORT_S3_FOLDER_NAME = "report-export-s3-folder-name";
public static final String CHARGE_ACCRUAL_DATE_CRITERIA = "charge-accrual-date";
public static final String NEXT_PAYMENT_DUE_DATE = "next-payment-due-date";
private final PermissionRepository permissionRepository;
private final GlobalConfigurationRepositoryWrapper globalConfigurationRepository;
private final PlatformCacheRepository cacheTypeRepository;
@@ -516,4 +518,15 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
return value;
}
@Override
public String getNextPaymentDateConfigForLoan() {
String defaultValue = "earliest-unpaid-date";
final GlobalConfigurationPropertyData property = getGlobalConfigurationPropertyData(NEXT_PAYMENT_DUE_DATE);
String value = property.getStringValue();
if (StringUtils.isBlank(value)) {
return defaultValue;
}
return value;
}
}
@@ -26,6 +26,7 @@ import java.util.Optional;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
import org.apache.fineract.infrastructure.core.service.MathUtil;
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
import org.apache.fineract.portfolio.delinquency.data.DelinquencyBucketData;
@@ -70,6 +71,7 @@ public class DelinquencyReadPlatformServiceImpl implements DelinquencyReadPlatfo
private final LoanInstallmentDelinquencyTagRepository repositoryLoanInstallmentDelinquencyTag;
private final LoanDelinquencyActionRepository loanDelinquencyActionRepository;
private final DelinquencyEffectivePauseHelper delinquencyEffectivePauseHelper;
private final ConfigurationDomainService configurationDomainService;
@Override
public Collection<DelinquencyRangeData> retrieveAllDelinquencyRanges() {
@@ -128,9 +130,11 @@ public class DelinquencyReadPlatformServiceImpl implements DelinquencyReadPlatfo
List<LoanDelinquencyActionData> effectiveDelinquencyList = delinquencyEffectivePauseHelper
.calculateEffectiveDelinquencyList(savedDelinquencyList);
final String nextPaymentDueDateConfig = configurationDomainService.getNextPaymentDateConfigForLoan();
collectionData = loanDelinquencyDomainService.getOverdueCollectionData(loan, effectiveDelinquencyList);
collectionData.setAvailableDisbursementAmount(loan.getApprovedPrincipal().subtract(loan.getDisbursedAmount()));
collectionData.setNextPaymentDueDate(loan.possibleNextRepaymentDate());
collectionData.setNextPaymentDueDate(loan.possibleNextRepaymentDate(nextPaymentDueDateConfig));
final LoanTransaction lastPayment = loan.getLastPaymentTransaction();
if (lastPayment != null) {
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.portfolio.delinquency.starter;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
import org.apache.fineract.portfolio.delinquency.domain.DelinquencyBucketMappingsRepository;
import org.apache.fineract.portfolio.delinquency.domain.DelinquencyBucketRepository;
@@ -57,10 +58,11 @@ public class DelinquencyConfiguration {
LoanDelinquencyDomainService loanDelinquencyDomainService,
LoanInstallmentDelinquencyTagRepository repositoryLoanInstallmentDelinquencyTag,
LoanDelinquencyActionRepository loanDelinquencyActionRepository,
DelinquencyEffectivePauseHelper delinquencyEffectivePauseHelper) {
DelinquencyEffectivePauseHelper delinquencyEffectivePauseHelper, ConfigurationDomainService configurationDomainService) {
return new DelinquencyReadPlatformServiceImpl(repositoryRange, repositoryBucket, repositoryLoanDelinquencyTagHistory, mapperRange,
mapperBucket, mapperLoanDelinquencyTagHistory, loanRepository, loanDelinquencyDomainService,
repositoryLoanInstallmentDelinquencyTag, loanDelinquencyActionRepository, delinquencyEffectivePauseHelper);
repositoryLoanInstallmentDelinquencyTag, loanDelinquencyActionRepository, delinquencyEffectivePauseHelper,
configurationDomainService);
}
@Bean
@@ -151,4 +151,5 @@
<include file="parts/0129_transaction_summary_with_asset_owner_report_overpaid_amount.xml" relativeToChangelogFile="true" />
<include file="parts/0130_add_create_delinquency_action_permission.xml" relativeToChangelogFile="true" />
<include file="parts/0131_add_configuration_maker_checker.xml" relativeToChangelogFile="true" />
<include file="parts/0132_add_configuration_loan_next_repayment_date_calculation.xml" relativeToChangelogFile="true" />
</databaseChangeLog>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<changeSet author="fineract" id="1" context="postgresql">
<sql>
SELECT SETVAL('c_configuration_id_seq', COALESCE(MAX(id), 0)+1, false ) FROM c_configuration;
</sql>
</changeSet>
<changeSet author="fineract" id="2">
<insert tableName="c_configuration">
<column name="name" value="next-payment-due-date"/>
<column name="value"/>
<column name="date_value"/>
<column name="string_value" value="earliest-unpaid-date"/>
<column name="enabled" valueBoolean="true"/>
<column name="is_trap_door" valueBoolean="false"/>
<column name="description" value="earliest-unpaid-date: default for next-payment-due-date, Use earliest-unpaid-date or next-unpaid-due-date"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,299 @@
/**
* 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.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.fineract.client.models.BusinessDateRequest;
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.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
import org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class LoanDelinquencyDetailsNextPaymentDateConfigurationTest extends BaseLoanIntegrationTest {
public static final BigDecimal DOWN_PAYMENT_PERCENTAGE = new BigDecimal(25);
@Test
public void testNextPaymentDateForUnpaidInstallmentsWithNPlusOneTest() {
runAt("01 November 2023", () -> {
try {
// update Global configuration for next payment date
GlobalConfigurationHelper.updateLoanNextPaymentDateConfiguration(this.requestSpec, this.responseSpec,
"next-unpaid-due-date");
// Create Client
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
// Create Loan Product
Long loanProductId = createLoanProductWith25PctDownPaymentAndDelinquencyBucket(false, true, false, 0);
// Apply and Approve Loan
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 November 2023", 1000.0, 3, req -> {
req.submittedOnDate("01 November 2023");
req.setLoanTermFrequency(45);
req.setRepaymentEvery(15);
req.setGraceOnArrearsAgeing(0);
});
// Loan amount Disbursement
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 November 2023");
// verify repayment schedule
verifyRepaymentSchedule(loanId, //
installment(0, null, "01 November 2023"), //
installment(250.0, false, "01 November 2023"), //
installment(250.0, false, "16 November 2023"), //
installment(250.0, false, "01 December 2023"), //
installment(250.0, false, "16 December 2023") //
);
// delinquency next payment date for 01 Nov Business date
verifyLoanDelinquencyNextPaymentDate(loanId, "01 November 2023", false);
// Update business date
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("13 November 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency next payment date for 13 Nov Business date
verifyLoanDelinquencyNextPaymentDate(loanId, "16 November 2023", false);
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("16 November 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency next payment date for 16 Nov Business date
verifyLoanDelinquencyNextPaymentDate(loanId, "01 December 2023", false);
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("01 December 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency next payment date for 01 Dec Business date
verifyLoanDelinquencyNextPaymentDate(loanId, "16 December 2023", false);
// add charge with due date after loan maturity date (N + 1)
Long loanChargeId = addCharge(loanId, false, 50, "23 December 2023");
// verify repayment schedule
verifyRepaymentSchedule(loanId, //
installment(0, null, "01 November 2023"), //
installment(250.0, false, "01 November 2023"), //
installment(250.0, false, "16 November 2023"), //
installment(250.0, false, "01 December 2023"), //
installment(250.0, false, "16 December 2023"), //
installment(0.0, 0.0, 50.0, 50.0, false, "23 December 2023") //
);
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("17 December 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency next payment date for 17 Dec Business date N + 1
verifyLoanDelinquencyNextPaymentDate(loanId, "23 December 2023", false);
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("25 December 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency null next payment date for date after maturity date
verifyLoanDelinquencyNextPaymentDate(loanId, "", true);
} finally {
// reset global config
GlobalConfigurationHelper.updateLoanNextPaymentDateConfiguration(this.requestSpec, this.responseSpec,
"earliest-unpaid-date");
}
});
}
@Test
public void testNextPaymentDateFor2Paid1PartiallyPaidInstallmentsWithNPlusOneTest() {
runAt("01 November 2023", () -> {
try {
// update Global configuration for next payment date
GlobalConfigurationHelper.updateLoanNextPaymentDateConfiguration(this.requestSpec, this.responseSpec,
"next-unpaid-due-date");
// Create Client
Long clientId = clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
// Create Loan Product with auto downpayment enabled
Long loanProductId = createLoanProductWith25PctDownPaymentAndDelinquencyBucket(true, true, false, 0);
// Apply and Approve Loan
Long loanId = applyAndApproveLoan(clientId, loanProductId, "01 November 2023", 1000.0, 3, req -> {
req.submittedOnDate("01 November 2023");
req.setLoanTermFrequency(45);
req.setRepaymentEvery(15);
req.setGraceOnArrearsAgeing(0);
});
// Loan amount Disbursement
disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 November 2023");
// verify repayment schedule
verifyRepaymentSchedule(loanId, //
installment(0, null, "01 November 2023"), //
installment(250.0, true, "01 November 2023"), //
installment(250.0, false, "16 November 2023"), //
installment(250.0, false, "01 December 2023"), //
installment(250.0, false, "16 December 2023") //
);
// delinquency next payment date for 01 Nov Business date with auto paid downpayment installment
verifyLoanDelinquencyNextPaymentDate(loanId, "16 November 2023", false);
// Update business date
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("13 November 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency next payment date for 13 Nov Business date
verifyLoanDelinquencyNextPaymentDate(loanId, "16 November 2023", false);
// pay 16 Nov Installment
addRepaymentForLoan(loanId, 250.0, "13 November 2023");
// verify repayment schedule
verifyRepaymentSchedule(loanId, //
installment(0, null, "01 November 2023"), //
installment(250.0, true, "01 November 2023"), //
installment(250.0, true, "16 November 2023"), //
installment(250.0, false, "01 December 2023"), //
installment(250.0, false, "16 December 2023")//
);
// delinquency next payment date for 13 Nov Business date after paying 16 November Installment
verifyLoanDelinquencyNextPaymentDate(loanId, "01 December 2023", false);
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("16 November 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency next payment date for 16 Nov Business date
verifyLoanDelinquencyNextPaymentDate(loanId, "01 December 2023", false);
// partially pay 01 December installment
addRepaymentForLoan(loanId, 100.0, "16 November 2023");
// verify repayment schedule
verifyRepaymentSchedule(loanId, //
installment(0, null, "01 November 2023"), //
installment(250.0, true, "01 November 2023"), //
installment(250.0, true, "16 November 2023"), //
installment(250.0, 0.0, 150.0, false, "01 December 2023"), //
installment(250.0, false, "16 December 2023")//
);
// delinquency next payment date for 16 Nov Business date after partial payment of 01 Dec installment
verifyLoanDelinquencyNextPaymentDate(loanId, "01 December 2023", false);
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("01 December 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency next payment date for 01 December Business date
verifyLoanDelinquencyNextPaymentDate(loanId, "16 December 2023", false);
// add charge with due date after loan maturity date (N + 1)
Long loanChargeId = addCharge(loanId, false, 50, "23 December 2023");
// verify repayment schedule
verifyRepaymentSchedule(loanId, //
installment(0, null, "01 November 2023"), //
installment(250.0, true, "01 November 2023"), //
installment(250.0, true, "16 November 2023"), //
installment(250.0, 0.0, 150.0, false, "01 December 2023"), //
installment(250.0, false, "16 December 2023"), //
installment(0.0, 0.0, 50.0, 50.0, false, "23 December 2023") //
);
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("17 December 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency next payment date for 17 Dec Business date N + 1
verifyLoanDelinquencyNextPaymentDate(loanId, "23 December 2023", false);
businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BUSINESS_DATE.getName()).date("25 December 2023")
.dateFormat(DATETIME_PATTERN).locale("en"));
// delinquency null next payment date for date after maturity date
verifyLoanDelinquencyNextPaymentDate(loanId, "", true);
} finally {
// reset global config
GlobalConfigurationHelper.updateLoanNextPaymentDateConfiguration(this.requestSpec, this.responseSpec,
"earliest-unpaid-date");
}
});
}
private void verifyLoanDelinquencyNextPaymentDate(Long loanId, String nextPaymentDate, boolean verifyNull) {
GetLoansLoanIdResponse loan = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId.intValue());
Assertions.assertNotNull(loan.getDelinquent());
if (!verifyNull) {
Assertions.assertNotNull(loan.getDelinquent().getNextPaymentDueDate());
assertThat(loan.getDelinquent().getNextPaymentDueDate().isEqual(LocalDate.parse(nextPaymentDate, dateTimeFormatter)));
} else {
Assertions.assertNull(loan.getDelinquent().getNextPaymentDueDate());
}
}
private Long createLoanProductWith25PctDownPaymentAndDelinquencyBucket(boolean autoDownPaymentEnabled, boolean multiDisburseEnabled,
boolean installmentLevelDelinquencyEnabled, Integer graceOnArrearsAging) {
// Create DelinquencyBuckets
Integer delinquencyBucketId = DelinquencyBucketsHelper.createDelinquencyBucket(requestSpec, responseSpec, List.of(//
Pair.of(1, 3), //
Pair.of(4, 10), //
Pair.of(11, 60), //
Pair.of(61, null)//
));
PostLoanProductsRequest product = createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct();
product.setDelinquencyBucketId(delinquencyBucketId.longValue());
product.setMultiDisburseLoan(multiDisburseEnabled);
product.setEnableDownPayment(true);
product.setGraceOnArrearsAgeing(graceOnArrearsAging);
product.setDisbursedAmountPercentageForDownPayment(DOWN_PAYMENT_PERCENTAGE);
product.setEnableAutoRepaymentForDownPayment(autoDownPaymentEnabled);
product.setEnableInstallmentLevelDelinquency(installmentLevelDelinquencyEnabled);
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;
}
}
@@ -119,8 +119,8 @@ public class GlobalConfigurationHelper {
ArrayList<HashMap> expectedGlobalConfigurations = getAllDefaultGlobalConfigurations();
ArrayList<HashMap> actualGlobalConfigurations = getAllGlobalConfigurations(requestSpec, responseSpec);
Assertions.assertEquals(53, expectedGlobalConfigurations.size());
Assertions.assertEquals(53, actualGlobalConfigurations.size());
Assertions.assertEquals(54, expectedGlobalConfigurations.size());
Assertions.assertEquals(54, actualGlobalConfigurations.size());
for (int i = 0; i < expectedGlobalConfigurations.size(); i++) {
@@ -581,6 +581,15 @@ public class GlobalConfigurationHelper {
enableSameMakerChecker.put("trapDoor", false);
defaults.add(enableSameMakerChecker);
HashMap<String, Object> nextPaymentDateConfigForLoan = new HashMap<>();
nextPaymentDateConfigForLoan.put("id", 59);
nextPaymentDateConfigForLoan.put("name", "next-payment-due-date");
nextPaymentDateConfigForLoan.put("value", 0);
nextPaymentDateConfigForLoan.put("enabled", true);
nextPaymentDateConfigForLoan.put("trapDoor", false);
nextPaymentDateConfigForLoan.put("string_value", "earliest-unpaid-date");
defaults.add(nextPaymentDateConfigForLoan);
return defaults;
}
@@ -705,4 +714,17 @@ public class GlobalConfigurationHelper {
}
public static Integer updateLoanNextPaymentDateConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final String stringValue) {
long configId = 59;
final HashMap<String, String> map = new HashMap<>();
map.put("stringValue", stringValue);
log.info("map : {}", map);
final String configValue = GSON.toJson(map);
final String GLOBAL_CONFIG_UPDATE_URL = "/fineract-provider/api/v1/configurations/" + configId + "?" + Utils.TENANT_IDENTIFIER;
log.info("---------------------------------UPDATE VALUE FOR GLOBAL CONFIG---------------------------------------------");
return Utils.performServerPut(requestSpec, responseSpec, GLOBAL_CONFIG_UPDATE_URL, configValue, "resourceId");
}
}