This is an automated email from the ASF dual-hosted git repository.

adamsaghy 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 3999b761b FINERACT-1734: Loan installment rescheduled event
3999b761b is described below

commit 3999b761b66ae278f7d004e19343471840c35128
Author: Adam Saghy <[email protected]>
AuthorDate: Thu Apr 6 17:03:34 2023 +0200

    FINERACT-1734: Loan installment rescheduled event
---
 ...nRescheduledDueAdjustScheduleBusinessEvent.java | 35 ++++++++++++++++++++++
 ...nRescheduleRequestWritePlatformServiceImpl.java |  4 +++
 .../db/changelog/tenant/changelog-tenant.xml       |  1 +
 ...0102_add_external_event_for_loan_reschedule.xml | 31 +++++++++++++++++++
 ...nalEventConfigurationValidationServiceTest.java |  6 ++--
 .../common/ExternalEventConfigurationHelper.java   |  5 ++++
 6 files changed, 80 insertions(+), 2 deletions(-)

diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/LoanRescheduledDueAdjustScheduleBusinessEvent.java
 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/LoanRescheduledDueAdjustScheduleBusinessEvent.java
new file mode 100644
index 000000000..90264dc4b
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/business/domain/loan/LoanRescheduledDueAdjustScheduleBusinessEvent.java
@@ -0,0 +1,35 @@
+/**
+ * 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;
+
+import org.apache.fineract.portfolio.loanaccount.domain.Loan;
+
+public class LoanRescheduledDueAdjustScheduleBusinessEvent extends 
LoanBusinessEvent {
+
+    private static final String TYPE = 
"LoanRescheduledDueAdjustScheduleBusinessEvent";
+
+    public LoanRescheduledDueAdjustScheduleBusinessEvent(Loan value) {
+        super(value);
+    }
+
+    @Override
+    public String getType() {
+        return TYPE;
+    }
+}
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java
index 8368e603d..27d798cf9 100644
--- 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/service/LoanRescheduleRequestWritePlatformServiceImpl.java
@@ -43,6 +43,8 @@ import 
org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRu
 import 
org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
 import 
org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
 import org.apache.fineract.infrastructure.core.service.DateUtils;
+import 
org.apache.fineract.infrastructure.event.business.domain.loan.LoanRescheduledDueAdjustScheduleBusinessEvent;
+import 
org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
 import 
org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
 import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
 import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
@@ -117,6 +119,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl 
implements LoanResche
     private final LoanRepaymentScheduleInstallmentRepository 
repaymentScheduleInstallmentRepository;
     private final ReplayedTransactionBusinessEventService 
replayedTransactionBusinessEventService;
     private final LoanAccrualTransactionBusinessEventService 
loanAccrualTransactionBusinessEventService;
+    private final BusinessEventNotifierService businessEventNotifierService;
 
     /**
      * create a new instance of the LoanRescheduleRequest object from the 
JsonCommand object and persist
@@ -470,6 +473,7 @@ public class LoanRescheduleRequestWritePlatformServiceImpl 
implements LoanResche
             
loanAccrualTransactionBusinessEventService.raiseBusinessEventForAccrualTransactions(loan,
 existingTransactionIds);
 
             this.loanAccountDomainService.recalculateAccruals(loan, true);
+            businessEventNotifierService.notifyPostBusinessEvent(new 
LoanRescheduledDueAdjustScheduleBusinessEvent(loan));
 
             return new 
CommandProcessingResultBuilder().withCommandId(jsonCommand.commandId()).withEntityId(loanRescheduleRequestId)
                     
.withLoanId(loanRescheduleRequest.getLoan().getId()).with(changes).withClientId(loan.getClientId())
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 ab937e3c0..84d8e7be6 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
@@ -121,4 +121,5 @@
     <include 
file="parts/0099_add_accrual_transaction_external_event_configuration.xml" 
relativeToChangelogFile="true" />
     <include file="parts/0100_new_repayment_strategy.xml" 
relativeToChangelogFile="true" />
     <include file="parts/0101_update_transaction_summary_table_report.xml" 
relativeToChangelogFile="true" />
+    <include file="parts/0102_add_external_event_for_loan_reschedule.xml" 
relativeToChangelogFile="true" />
 </databaseChangeLog>
diff --git 
a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0102_add_external_event_for_loan_reschedule.xml
 
b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0102_add_external_event_for_loan_reschedule.xml
new file mode 100644
index 000000000..4d06a0892
--- /dev/null
+++ 
b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0102_add_external_event_for_loan_reschedule.xml
@@ -0,0 +1,31 @@
+<?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="LoanRescheduledDueAdjustScheduleBusinessEvent"/>
+            <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 c2a4e3d9a..5c5fbe810 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
@@ -95,7 +95,8 @@ public class ExternalEventConfigurationValidationServiceTest {
                 "ShareAccountApproveBusinessEvent", 
"ShareAccountCreateBusinessEvent", "ShareProductDividentsCreateBusinessEvent",
                 "LoanChargeAdjustmentPostBusinessEvent", 
"LoanChargeAdjustmentPreBusinessEvent", 
"LoanDelinquencyRangeChangeBusinessEvent",
                 "LoanAccountsStayedLockedBusinessEvent", "MockBusinessEvent", 
"LoanChargeOffPreBusinessEvent",
-                "LoanChargeOffPostBusinessEvent", 
"LoanUndoChargeOffBusinessEvent", "LoanAccrualTransactionCreatedBusinessEvent");
+                "LoanChargeOffPostBusinessEvent", 
"LoanUndoChargeOffBusinessEvent", "LoanAccrualTransactionCreatedBusinessEvent",
+                "LoanRescheduledDueAdjustScheduleBusinessEvent");
 
         List<FineractPlatformTenant> tenants = Arrays
                 .asList(new FineractPlatformTenant(1L, "default", "Default 
Tenant", "Europe/Budapest", null));
@@ -172,7 +173,8 @@ public class 
ExternalEventConfigurationValidationServiceTest {
                 "ShareAccountApproveBusinessEvent", 
"ShareAccountCreateBusinessEvent", "ShareProductDividentsCreateBusinessEvent",
                 "LoanChargeAdjustmentPostBusinessEvent", 
"LoanChargeAdjustmentPreBusinessEvent", 
"LoanDelinquencyRangeChangeBusinessEvent",
                 "LoanAccountsStayedLockedBusinessEvent", 
"LoanChargeOffPreBusinessEvent", "LoanChargeOffPostBusinessEvent",
-                "LoanUndoChargeOffBusinessEvent", 
"LoanAccrualTransactionCreatedBusinessEvent");
+                "LoanUndoChargeOffBusinessEvent", 
"LoanAccrualTransactionCreatedBusinessEvent",
+                "LoanRescheduledDueAdjustScheduleBusinessEvent");
 
         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 853ff21e6..58f7d32bc 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
@@ -465,6 +465,11 @@ public class ExternalEventConfigurationHelper {
         loanAccrualTransactionCreatedBusinessEvent.put("enabled", false);
         defaults.add(loanAccrualTransactionCreatedBusinessEvent);
 
+        Map<String, Object> loanRescheduledDueAdjustScheduleBusinessEvent = 
new HashMap<>();
+        loanRescheduledDueAdjustScheduleBusinessEvent.put("type", 
"LoanRescheduledDueAdjustScheduleBusinessEvent");
+        loanRescheduledDueAdjustScheduleBusinessEvent.put("enabled", false);
+        defaults.add(loanRescheduledDueAdjustScheduleBusinessEvent);
+
         return defaults;
 
     }

Reply via email to