FINERACT-2418: add originator global config
This commit is contained in:
+1
@@ -79,6 +79,7 @@ public final class GlobalConfigurationConstants {
|
||||
public static final String ASSET_OWNER_TRANSFER_OUTSTANDING_INTEREST_CALCULATION_STRATEGY = "outstanding-interest-calculation-strategy-for-external-asset-transfer";
|
||||
public static final String ALLOWED_LOAN_STATUSES_FOR_EXTERNAL_ASSET_TRANSFER = "allowed-loan-statuses-for-external-asset-transfer";
|
||||
public static final String ALLOWED_LOAN_STATUSES_OF_DELAYED_SETTLEMENT_FOR_EXTERNAL_ASSET_TRANSFER = "allowed-loan-statuses-of-delayed-settlement-for-external-asset-transfer";
|
||||
public static final String ENABLE_ORIGINATOR_CREATION_DURING_LOAN_APPLICATION = "enable-originator-creation-during-loan-application";
|
||||
|
||||
private GlobalConfigurationConstants() {}
|
||||
}
|
||||
|
||||
+1
@@ -25,4 +25,5 @@
|
||||
<include relativeToChangelogFile="true" file="parts/0001_initial_schema.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/0002_permissions.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/0003_mapping_permissions.xml"/>
|
||||
<include relativeToChangelogFile="true" file="parts/0004_add_global_config_originator_creation.xml"/>
|
||||
</databaseChangeLog>
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?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="enable-originator-creation-during-loan-application"/>
|
||||
<column name="value"/>
|
||||
<column name="date_value"/>
|
||||
<column name="string_value"/>
|
||||
<column name="enabled" valueBoolean="false"/>
|
||||
<column name="is_trap_door" valueBoolean="false"/>
|
||||
<column name="description"
|
||||
value="When enabled, allows creating new loan originators on-the-fly during loan application if the provided externalId does not exist in the registry"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
+31
@@ -125,4 +125,35 @@ public class GlobalConfigurationTest {
|
||||
assertEquals(403, exception.getResponse().code());
|
||||
assertTrue(exception.getMessage().contains("error.msg.password.reset.days.value.must.be.greater.than.zero"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOriginatorCreationConfigurationExists() {
|
||||
String configName = GlobalConfigurationConstants.ENABLE_ORIGINATOR_CREATION_DURING_LOAN_APPLICATION;
|
||||
GlobalConfigurationPropertyData config = globalConfigurationHelper.getGlobalConfigurationByName(configName);
|
||||
|
||||
Assertions.assertNotNull(config, "Configuration should exist");
|
||||
assertEquals(configName, config.getName(), "Configuration name should match");
|
||||
assertEquals(false, config.getEnabled(), "Configuration should be disabled by default");
|
||||
assertEquals(false, config.getTrapDoor(), "Configuration should not be a trap door");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOriginatorCreationConfigurationCanBeEnabled() {
|
||||
String configName = GlobalConfigurationConstants.ENABLE_ORIGINATOR_CREATION_DURING_LOAN_APPLICATION;
|
||||
GlobalConfigurationPropertyData config = globalConfigurationHelper.getGlobalConfigurationByName(configName);
|
||||
Assertions.assertNotNull(config);
|
||||
|
||||
try {
|
||||
globalConfigurationHelper.updateGlobalConfiguration(configName, new PutGlobalConfigurationsRequest().enabled(true));
|
||||
GlobalConfigurationPropertyData enabledConfig = globalConfigurationHelper.getGlobalConfigurationByName(configName);
|
||||
assertEquals(true, enabledConfig.getEnabled(), "Configuration should be enabled after update");
|
||||
|
||||
globalConfigurationHelper.updateGlobalConfiguration(configName, new PutGlobalConfigurationsRequest().enabled(false));
|
||||
GlobalConfigurationPropertyData disabledConfig = globalConfigurationHelper.getGlobalConfigurationByName(configName);
|
||||
assertEquals(false, disabledConfig.getEnabled(), "Configuration should be disabled after update");
|
||||
} finally {
|
||||
globalConfigurationHelper.updateGlobalConfiguration(configName,
|
||||
new PutGlobalConfigurationsRequest().enabled(config.getEnabled()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -585,6 +585,14 @@ public class GlobalConfigurationHelper {
|
||||
"ACTIVE,TRANSFER_IN_PROGRESS,TRANSFER_ON_HOLD,OVERPAID,CLOSED_OBLIGATIONS_MET");
|
||||
defaults.add(allowedLoanStatusesForDelayedSettlementExternalAssetTransfer);
|
||||
|
||||
HashMap<String, Object> enableOriginatorCreationDuringLoanApplication = new HashMap<>();
|
||||
enableOriginatorCreationDuringLoanApplication.put("name",
|
||||
GlobalConfigurationConstants.ENABLE_ORIGINATOR_CREATION_DURING_LOAN_APPLICATION);
|
||||
enableOriginatorCreationDuringLoanApplication.put("value", 0L);
|
||||
enableOriginatorCreationDuringLoanApplication.put("enabled", false);
|
||||
enableOriginatorCreationDuringLoanApplication.put("trapDoor", false);
|
||||
defaults.add(enableOriginatorCreationDuringLoanApplication);
|
||||
|
||||
return defaults;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user