This is an automated email from the ASF dual-hosted git repository.
taskain pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 5f9845f86 FINERACT-1971: Triggering a loan level event during
reamortization and reaging
5f9845f86 is described below
commit 5f9845f86a4d8cbf3a374c8a525b9856b15bcbf7
Author: Arnold Galovics <[email protected]>
AuthorDate: Sun Mar 3 19:17:16 2024 +0100
FINERACT-1971: Triggering a loan level event during reamortization and
reaging
---
.../loan/reaging/LoanReAgeBusinessEvent.java | 36 ++++++++++++++++
.../loan/reaging/LoanUndoReAgeBusinessEvent.java | 36 ++++++++++++++++
.../LoanReAmortizeBusinessEvent.java | 36 ++++++++++++++++
.../LoanUndoReAmortizeBusinessEvent.java | 36 ++++++++++++++++
.../service/reaging/LoanReAgingServiceImpl.java | 4 ++
.../LoanReAmortizationServiceImpl.java | 4 ++
.../db/changelog/tenant/changelog-tenant.xml | 1 +
...nal_event_for_loan_reaging_reamortization_2.xml | 49 ++++++++++++++++++++++
...nalEventConfigurationValidationServiceTest.java | 6 ++-
.../common/ExternalEventConfigurationHelper.java | 20 +++++++++
10 files changed, 226 insertions(+), 2 deletions(-)
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reaging/LoanReAgeBusinessEvent.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reaging/LoanReAgeBusinessEvent.java
new file mode 100644
index 000000000..1dfea126d
--- /dev/null
+++
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reaging/LoanReAgeBusinessEvent.java
@@ -0,0 +1,36 @@
+/**
+ * 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.infrastructure.event.business.domain.loan.reaging;
+
+import
org.apache.fineract.infrastructure.event.business.domain.loan.LoanBusinessEvent;
+import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+
+public class LoanReAgeBusinessEvent extends LoanBusinessEvent {
+
+ private static final String TYPE = "LoanReAgeBusinessEvent";
+
+ public LoanReAgeBusinessEvent(Loan value) {
+ super(value);
+ }
+
+ @Override
+ public String getType() {
+ return TYPE;
+ }
+}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reaging/LoanUndoReAgeBusinessEvent.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reaging/LoanUndoReAgeBusinessEvent.java
new file mode 100644
index 000000000..12830c2c5
--- /dev/null
+++
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reaging/LoanUndoReAgeBusinessEvent.java
@@ -0,0 +1,36 @@
+/**
+ * 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.infrastructure.event.business.domain.loan.reaging;
+
+import
org.apache.fineract.infrastructure.event.business.domain.loan.LoanBusinessEvent;
+import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+
+public class LoanUndoReAgeBusinessEvent extends LoanBusinessEvent {
+
+ private static final String TYPE = "LoanUndoReAgeBusinessEvent";
+
+ public LoanUndoReAgeBusinessEvent(Loan value) {
+ super(value);
+ }
+
+ @Override
+ public String getType() {
+ return TYPE;
+ }
+}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reamortization/LoanReAmortizeBusinessEvent.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reamortization/LoanReAmortizeBusinessEvent.java
new file mode 100644
index 000000000..ba3dce4a0
--- /dev/null
+++
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reamortization/LoanReAmortizeBusinessEvent.java
@@ -0,0 +1,36 @@
+/**
+ * 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.infrastructure.event.business.domain.loan.reamortization;
+
+import
org.apache.fineract.infrastructure.event.business.domain.loan.LoanBusinessEvent;
+import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+
+public class LoanReAmortizeBusinessEvent extends LoanBusinessEvent {
+
+ private static final String TYPE = "LoanReAmortizeBusinessEvent";
+
+ public LoanReAmortizeBusinessEvent(Loan value) {
+ super(value);
+ }
+
+ @Override
+ public String getType() {
+ return TYPE;
+ }
+}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reamortization/LoanUndoReAmortizeBusinessEvent.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reamortization/LoanUndoReAmortizeBusinessEvent.java
new file mode 100644
index 000000000..58e4b8cf4
--- /dev/null
+++
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/reamortization/LoanUndoReAmortizeBusinessEvent.java
@@ -0,0 +1,36 @@
+/**
+ * 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.infrastructure.event.business.domain.loan.reamortization;
+
+import
org.apache.fineract.infrastructure.event.business.domain.loan.LoanBusinessEvent;
+import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+
+public class LoanUndoReAmortizeBusinessEvent extends LoanBusinessEvent {
+
+ private static final String TYPE = "LoanUndoReAmortizeBusinessEvent";
+
+ public LoanUndoReAmortizeBusinessEvent(Loan value) {
+ super(value);
+ }
+
+ @Override
+ public String getType() {
+ return TYPE;
+ }
+}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reaging/LoanReAgingServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reaging/LoanReAgingServiceImpl.java
index f08350527..39bf599cd 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reaging/LoanReAgingServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reaging/LoanReAgingServiceImpl.java
@@ -32,6 +32,8 @@ import
org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
import org.apache.fineract.infrastructure.core.domain.ExternalId;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
+import
org.apache.fineract.infrastructure.event.business.domain.loan.reaging.LoanReAgeBusinessEvent;
+import
org.apache.fineract.infrastructure.event.business.domain.loan.reaging.LoanUndoReAgeBusinessEvent;
import
org.apache.fineract.infrastructure.event.business.domain.loan.transaction.reaging.LoanReAgeTransactionBusinessEvent;
import
org.apache.fineract.infrastructure.event.business.domain.loan.transaction.reaging.LoanUndoReAgeTransactionBusinessEvent;
import
org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
@@ -76,6 +78,7 @@ public class LoanReAgingServiceImpl {
reAgingParameterRepository.saveAndFlush(reAgeParameter);
// delinquency recalculation will be triggered by the event in a
decoupled way via a listener
+ businessEventNotifierService.notifyPostBusinessEvent(new
LoanReAgeBusinessEvent(loan));
businessEventNotifierService.notifyPostBusinessEvent(new
LoanReAgeTransactionBusinessEvent(reAgeTransaction));
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
@@ -113,6 +116,7 @@ public class LoanReAgingServiceImpl {
loanTransactionRepository.saveAndFlush(reAgeTransaction);
// delinquency recalculation will be triggered by the event in a
decoupled way via a listener
+ businessEventNotifierService.notifyPostBusinessEvent(new
LoanUndoReAgeBusinessEvent(loan));
businessEventNotifierService.notifyPostBusinessEvent(new
LoanUndoReAgeTransactionBusinessEvent(reAgeTransaction));
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reamortization/LoanReAmortizationServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reamortization/LoanReAmortizationServiceImpl.java
index 4909adbb1..c3ff06eb6 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reamortization/LoanReAmortizationServiceImpl.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/reamortization/LoanReAmortizationServiceImpl.java
@@ -32,6 +32,8 @@ import
org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
import org.apache.fineract.infrastructure.core.domain.ExternalId;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
+import
org.apache.fineract.infrastructure.event.business.domain.loan.reamortization.LoanReAmortizeBusinessEvent;
+import
org.apache.fineract.infrastructure.event.business.domain.loan.reamortization.LoanUndoReAmortizeBusinessEvent;
import
org.apache.fineract.infrastructure.event.business.domain.loan.transaction.reamortization.LoanReAmortizeTransactionBusinessEvent;
import
org.apache.fineract.infrastructure.event.business.domain.loan.transaction.reamortization.LoanUndoReAmortizeTransactionBusinessEvent;
import
org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
@@ -68,6 +70,7 @@ public class LoanReAmortizationServiceImpl {
loanTransactionRepository.saveAndFlush(reAmortizeTransaction);
// delinquency recalculation will be triggered by the event in a
decoupled way via a listener
+ businessEventNotifierService.notifyPostBusinessEvent(new
LoanReAmortizeBusinessEvent(loan));
businessEventNotifierService.notifyPostBusinessEvent(new
LoanReAmortizeTransactionBusinessEvent(reAmortizeTransaction));
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
@@ -96,6 +99,7 @@ public class LoanReAmortizationServiceImpl {
loanTransactionRepository.saveAndFlush(reAmortizeTransaction);
// delinquency recalculation will be triggered by the event in a
decoupled way via a listener
+ businessEventNotifierService.notifyPostBusinessEvent(new
LoanUndoReAmortizeBusinessEvent(loan));
businessEventNotifierService.notifyPostBusinessEvent(new
LoanUndoReAmortizeTransactionBusinessEvent(reAmortizeTransaction));
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
diff --git
a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
index 5b640f42d..986954914 100644
---
a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
+++
b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
@@ -157,4 +157,5 @@
<include file="parts/0135_add_external_event_for_loan_reaging.xml"
relativeToChangelogFile="true" />
<include file="parts/0136_loan_reaging_parameters.xml"
relativeToChangelogFile="true" />
<include file="parts/0137_add_external_event_for_loan_reamortization.xml"
relativeToChangelogFile="true" />
+ <include
file="parts/0138_add_external_event_for_loan_reaging_reamortization_2.xml"
relativeToChangelogFile="true" />
</databaseChangeLog>
diff --git
a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0138_add_external_event_for_loan_reaging_reamortization_2.xml
b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0138_add_external_event_for_loan_reaging_reamortization_2.xml
new file mode 100644
index 000000000..a0950ee35
--- /dev/null
+++
b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0138_add_external_event_for_loan_reaging_reamortization_2.xml
@@ -0,0 +1,49 @@
+<?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.1.xsd">
+ <changeSet author="fineract" id="1">
+ <insert tableName="m_external_event_configuration">
+ <column name="type" value="LoanReAmortizeBusinessEvent"/>
+ <column name="enabled" valueBoolean="false"/>
+ </insert>
+ </changeSet>
+ <changeSet author="fineract" id="2">
+ <insert tableName="m_external_event_configuration">
+ <column name="type" value="LoanUndoReAmortizeBusinessEvent"/>
+ <column name="enabled" valueBoolean="false"/>
+ </insert>
+ </changeSet>
+ <changeSet author="fineract" id="3">
+ <insert tableName="m_external_event_configuration">
+ <column name="type" value="LoanReAgeBusinessEvent"/>
+ <column name="enabled" valueBoolean="false"/>
+ </insert>
+ </changeSet>
+ <changeSet author="fineract" id="4">
+ <insert tableName="m_external_event_configuration">
+ <column name="type" value="LoanUndoReAgeBusinessEvent"/>
+ <column name="enabled" valueBoolean="false"/>
+ </insert>
+ </changeSet>
+</databaseChangeLog>
diff --git
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationValidationServiceTest.java
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationValidationServiceTest.java
index 8c30bdad3..2e25f354f 100644
---
a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationValidationServiceTest.java
+++
b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/service/ExternalEventConfigurationValidationServiceTest.java
@@ -100,7 +100,8 @@ public class
ExternalEventConfigurationValidationServiceTest {
"LoanTransactionDownPaymentPostBusinessEvent",
"LoanTransactionDownPaymentPreBusinessEvent",
"LoanAccountDelinquencyPauseChangedBusinessEvent",
"LoanAccountCustomSnapshotBusinessEvent",
"LoanReAgeTransactionBusinessEvent",
"LoanUndoReAgeTransactionBusinessEvent",
"LoanReAmortizeTransactionBusinessEvent",
- "LoanUndoReAmortizeTransactionBusinessEvent");
+ "LoanUndoReAmortizeTransactionBusinessEvent",
"LoanReAgeBusinessEvent", "LoanUndoReAgeBusinessEvent",
+ "LoanReAmortizeBusinessEvent",
"LoanUndoReAmortizeBusinessEvent");
List<FineractPlatformTenant> tenants = Arrays
.asList(new FineractPlatformTenant(1L, "default", "Default
Tenant", "Europe/Budapest", null));
@@ -182,7 +183,8 @@ public class
ExternalEventConfigurationValidationServiceTest {
"LoanTransactionDownPaymentPostBusinessEvent",
"LoanTransactionDownPaymentPreBusinessEvent",
"LoanAccountDelinquencyPauseChangedBusinessEvent",
"LoanAccountCustomSnapshotBusinessEvent",
"LoanReAgeTransactionBusinessEvent",
"LoanUndoReAgeTransactionBusinessEvent",
"LoanReAmortizeTransactionBusinessEvent",
- "LoanUndoReAmortizeTransactionBusinessEvent");
+ "LoanUndoReAmortizeTransactionBusinessEvent",
"LoanReAgeBusinessEvent", "LoanUndoReAgeBusinessEvent",
+ "LoanReAmortizeBusinessEvent",
"LoanUndoReAmortizeBusinessEvent");
List<FineractPlatformTenant> tenants = Arrays
.asList(new FineractPlatformTenant(1L, "default", "Default
Tenant", "Europe/Budapest", null));
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ExternalEventConfigurationHelper.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ExternalEventConfigurationHelper.java
index 1196b72db..434a2b8d5 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ExternalEventConfigurationHelper.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ExternalEventConfigurationHelper.java
@@ -520,6 +520,26 @@ public class ExternalEventConfigurationHelper {
loanUndoReAmortizeTransactionBusinessEvent.put("enabled", false);
defaults.add(loanUndoReAmortizeTransactionBusinessEvent);
+ Map<String, Object> loanReAgeBusinessEvent = new HashMap<>();
+ loanReAgeBusinessEvent.put("type", "LoanReAgeBusinessEvent");
+ loanReAgeBusinessEvent.put("enabled", false);
+ defaults.add(loanReAgeBusinessEvent);
+
+ Map<String, Object> loanUndoReAgeBusinessEvent = new HashMap<>();
+ loanUndoReAgeBusinessEvent.put("type", "LoanUndoReAgeBusinessEvent");
+ loanUndoReAgeBusinessEvent.put("enabled", false);
+ defaults.add(loanUndoReAgeBusinessEvent);
+
+ Map<String, Object> loanReAmortizeBusinessEvent = new HashMap<>();
+ loanReAmortizeBusinessEvent.put("type", "LoanReAmortizeBusinessEvent");
+ loanReAmortizeBusinessEvent.put("enabled", false);
+ defaults.add(loanReAmortizeBusinessEvent);
+
+ Map<String, Object> loanUndoReAmortizeBusinessEvent = new HashMap<>();
+ loanUndoReAmortizeBusinessEvent.put("type",
"LoanUndoReAmortizeBusinessEvent");
+ loanUndoReAmortizeBusinessEvent.put("enabled", false);
+ defaults.add(loanUndoReAmortizeBusinessEvent);
+
return defaults;
}