[FINERACT-1859] Missing configuration for LoanAccountsStayedLockedBusinessEvent
This commit is contained in:
committed by
Arnold Gálovics
parent
09a91bba01
commit
4a250b7a56
+2
-2
@@ -21,12 +21,12 @@ package org.apache.fineract.cob.loan;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.fineract.infrastructure.event.business.domain.AbstractBusinessEvent;
|
import org.apache.fineract.infrastructure.event.business.domain.AbstractBusinessEvent;
|
||||||
|
|
||||||
public class LoanAccountStayedLockedBusinessEvent extends AbstractBusinessEvent<List<Long>> {
|
public class LoanAccountsStayedLockedBusinessEvent extends AbstractBusinessEvent<List<Long>> {
|
||||||
|
|
||||||
private static final String CATEGORY = "Loan COB";
|
private static final String CATEGORY = "Loan COB";
|
||||||
private static final String TYPE = "LoanAccountsStayedLockedBusinessEvent";
|
private static final String TYPE = "LoanAccountsStayedLockedBusinessEvent";
|
||||||
|
|
||||||
public LoanAccountStayedLockedBusinessEvent(List<Long> value) {
|
public LoanAccountsStayedLockedBusinessEvent(List<Long> value) {
|
||||||
super(value);
|
super(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-1
@@ -41,7 +41,7 @@ public class StayedLockedLoansTasklet implements Tasklet {
|
|||||||
List<LoanAccountLock> loanAccountLocks = loanAccountLockRepository.findAll();
|
List<LoanAccountLock> loanAccountLocks = loanAccountLockRepository.findAll();
|
||||||
if (!loanAccountLocks.isEmpty()) {
|
if (!loanAccountLocks.isEmpty()) {
|
||||||
List<Long> loanIds = loanAccountLocks.stream().map(LoanAccountLock::getLoanId).toList();
|
List<Long> loanIds = loanAccountLocks.stream().map(LoanAccountLock::getLoanId).toList();
|
||||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanAccountStayedLockedBusinessEvent(loanIds));
|
businessEventNotifierService.notifyPostBusinessEvent(new LoanAccountsStayedLockedBusinessEvent(loanIds));
|
||||||
}
|
}
|
||||||
return RepeatStatus.FINISHED;
|
return RepeatStatus.FINISHED;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class ExternalEventSourceProviderConfig {
|
public class ExternalEventSourceProviderConfig {
|
||||||
|
|
||||||
private static final String EXTERNAL_EVENT_CLASSES_BASE_PACKAGE = "org.apache.fineract.infrastructure.event.business.domain";
|
private static final String EXTERNAL_EVENT_CLASSES_BASE_PACKAGE = "org.apache.fineract";
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ExternalEventSourceProvider fineractExternalEventSourceProvider() {
|
public ExternalEventSourceProvider fineractExternalEventSourceProvider() {
|
||||||
|
|||||||
@@ -99,4 +99,5 @@
|
|||||||
<include file="parts/0077_add_overpaid_date_for_loan.xml" relativeToChangelogFile="true" />
|
<include file="parts/0077_add_overpaid_date_for_loan.xml" relativeToChangelogFile="true" />
|
||||||
<include file="parts/0078_add_configuration_cob_bulk_event.xml" relativeToChangelogFile="true" />
|
<include file="parts/0078_add_configuration_cob_bulk_event.xml" relativeToChangelogFile="true" />
|
||||||
<include file="parts/0079_add_charge_off_details_to_loan.xml" relativeToChangelogFile="true" />
|
<include file="parts/0079_add_charge_off_details_to_loan.xml" relativeToChangelogFile="true" />
|
||||||
|
<include file="parts/0080_add_external_event_configuration_for_stayed_locked_loans_business_event.xml" relativeToChangelogFile="true" />
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
+31
@@ -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.3.xsd">
|
||||||
|
<changeSet author="fineract" id="1">
|
||||||
|
<insert tableName="m_external_event_configuration">
|
||||||
|
<column name="type" value="LoanAccountsStayedLockedBusinessEvent"/>
|
||||||
|
<column name="enabled" valueBoolean="false"/>
|
||||||
|
</insert>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
||||||
+22
-20
@@ -93,7 +93,8 @@ public class ExternalEventConfigurationValidationServiceTest {
|
|||||||
"SavingsCloseBusinessEvent", "SavingsCreateBusinessEvent", "SavingsDepositBusinessEvent",
|
"SavingsCloseBusinessEvent", "SavingsCreateBusinessEvent", "SavingsDepositBusinessEvent",
|
||||||
"SavingsPostInterestBusinessEvent", "SavingsRejectBusinessEvent", "SavingsWithdrawalBusinessEvent",
|
"SavingsPostInterestBusinessEvent", "SavingsRejectBusinessEvent", "SavingsWithdrawalBusinessEvent",
|
||||||
"ShareAccountApproveBusinessEvent", "ShareAccountCreateBusinessEvent", "ShareProductDividentsCreateBusinessEvent",
|
"ShareAccountApproveBusinessEvent", "ShareAccountCreateBusinessEvent", "ShareProductDividentsCreateBusinessEvent",
|
||||||
"LoanChargeAdjustmentPostBusinessEvent", "LoanChargeAdjustmentPreBusinessEvent", "LoanDelinquencyRangeChangeBusinessEvent");
|
"LoanChargeAdjustmentPostBusinessEvent", "LoanChargeAdjustmentPreBusinessEvent", "LoanDelinquencyRangeChangeBusinessEvent",
|
||||||
|
"LoanAccountsStayedLockedBusinessEvent", "MockBusinessEvent");
|
||||||
|
|
||||||
List<FineractPlatformTenant> tenants = Arrays
|
List<FineractPlatformTenant> tenants = Arrays
|
||||||
.asList(new FineractPlatformTenant(1L, "default", "Default Tenant", "Europe/Budapest", null));
|
.asList(new FineractPlatformTenant(1L, "default", "Default Tenant", "Europe/Budapest", null));
|
||||||
@@ -102,7 +103,7 @@ public class ExternalEventConfigurationValidationServiceTest {
|
|||||||
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
||||||
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
||||||
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(configurations);
|
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(configurations);
|
||||||
List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
|
List<String> sourcePackage = Arrays.asList("org.apache.fineract");
|
||||||
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
||||||
// when
|
// when
|
||||||
underTest.afterPropertiesSet();
|
underTest.afterPropertiesSet();
|
||||||
@@ -122,7 +123,7 @@ public class ExternalEventConfigurationValidationServiceTest {
|
|||||||
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
||||||
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
||||||
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(new ArrayList<>());
|
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(new ArrayList<>());
|
||||||
List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
|
List<String> sourcePackage = Arrays.asList("org.apache.fineract");
|
||||||
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
||||||
// when
|
// when
|
||||||
ExternalEventConfigurationNotFoundException exceptionThrown = assertThrows(ExternalEventConfigurationNotFoundException.class,
|
ExternalEventConfigurationNotFoundException exceptionThrown = assertThrows(ExternalEventConfigurationNotFoundException.class,
|
||||||
@@ -140,21 +141,21 @@ public class ExternalEventConfigurationValidationServiceTest {
|
|||||||
public void givenMissingEventConfigurationWhenValidatedThenThrowException() throws Exception {
|
public void givenMissingEventConfigurationWhenValidatedThenThrowException() throws Exception {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
List<String> configurationWithMissingCentersCreateBusinessEvent = Arrays.asList("MockBusinessEvent", "ClientActivateBusinessEvent",
|
List<String> configurationWithMissingCentersCreateBusinessEvent = Arrays.asList("MockBusinessEvent", "MockBusinessEvent",
|
||||||
"ClientCreateBusinessEvent", "ClientRejectBusinessEvent", "FixedDepositAccountCreateBusinessEvent",
|
"ClientActivateBusinessEvent", "ClientCreateBusinessEvent", "ClientRejectBusinessEvent",
|
||||||
"GroupsCreateBusinessEvent", "LoanAcceptTransferBusinessEvent", "LoanAddChargeBusinessEvent",
|
"FixedDepositAccountCreateBusinessEvent", "GroupsCreateBusinessEvent", "LoanAcceptTransferBusinessEvent",
|
||||||
"LoanAdjustTransactionBusinessEvent", "LoanApplyOverdueChargeBusinessEvent", "LoanApprovedBusinessEvent",
|
"LoanAddChargeBusinessEvent", "LoanAdjustTransactionBusinessEvent", "LoanApplyOverdueChargeBusinessEvent",
|
||||||
"LoanBalanceChangedBusinessEvent", "LoanChargebackTransactionBusinessEvent", "LoanChargePaymentPostBusinessEvent",
|
"LoanApprovedBusinessEvent", "LoanBalanceChangedBusinessEvent", "LoanChargebackTransactionBusinessEvent",
|
||||||
"LoanChargePaymentPreBusinessEvent", "LoanChargeRefundBusinessEvent", "LoanCloseAsRescheduleBusinessEvent",
|
"LoanChargePaymentPostBusinessEvent", "LoanChargePaymentPreBusinessEvent", "LoanChargeRefundBusinessEvent",
|
||||||
"LoanCloseBusinessEvent", "LoanCreatedBusinessEvent", "LoanCreditBalanceRefundPostBusinessEvent",
|
"LoanCloseAsRescheduleBusinessEvent", "LoanCloseBusinessEvent", "LoanCreatedBusinessEvent",
|
||||||
"LoanCreditBalanceRefundPreBusinessEvent", "LoanDeleteChargeBusinessEvent", "LoanDisbursalBusinessEvent",
|
"LoanCreditBalanceRefundPostBusinessEvent", "LoanCreditBalanceRefundPreBusinessEvent", "LoanDeleteChargeBusinessEvent",
|
||||||
"LoanDisbursalTransactionBusinessEvent", "LoanForeClosurePostBusinessEvent", "LoanForeClosurePreBusinessEvent",
|
"LoanDisbursalBusinessEvent", "LoanDisbursalTransactionBusinessEvent", "LoanForeClosurePostBusinessEvent",
|
||||||
"LoanInitiateTransferBusinessEvent", "LoanInterestRecalculationBusinessEvent", "LoanProductCreateBusinessEvent",
|
"LoanForeClosurePreBusinessEvent", "LoanInitiateTransferBusinessEvent", "LoanInterestRecalculationBusinessEvent",
|
||||||
"LoanReassignOfficerBusinessEvent", "LoanRefundPostBusinessEvent", "LoanRefundPreBusinessEvent",
|
"LoanProductCreateBusinessEvent", "LoanReassignOfficerBusinessEvent", "LoanRefundPostBusinessEvent",
|
||||||
"LoanRejectedBusinessEvent", "LoanRejectTransferBusinessEvent", "LoanRemoveOfficerBusinessEvent",
|
"LoanRefundPreBusinessEvent", "LoanRejectedBusinessEvent", "LoanRejectTransferBusinessEvent",
|
||||||
"LoanRepaymentDueBusinessEvent", "LoanRepaymentOverdueBusinessEvent", "LoanRescheduledDueCalendarChangeBusinessEvent",
|
"LoanRemoveOfficerBusinessEvent", "LoanRepaymentDueBusinessEvent", "LoanRepaymentOverdueBusinessEvent",
|
||||||
"LoanRescheduledDueHolidayBusinessEvent", "LoanScheduleVariationsAddedBusinessEvent",
|
"LoanRescheduledDueCalendarChangeBusinessEvent", "LoanRescheduledDueHolidayBusinessEvent",
|
||||||
"LoanScheduleVariationsDeletedBusinessEvent", "LoanStatusChangedBusinessEvent",
|
"LoanScheduleVariationsAddedBusinessEvent", "LoanScheduleVariationsDeletedBusinessEvent", "LoanStatusChangedBusinessEvent",
|
||||||
"LoanTransactionGoodwillCreditPostBusinessEvent", "LoanTransactionGoodwillCreditPreBusinessEvent",
|
"LoanTransactionGoodwillCreditPostBusinessEvent", "LoanTransactionGoodwillCreditPreBusinessEvent",
|
||||||
"LoanTransactionMakeRepaymentPostBusinessEvent", "LoanTransactionMakeRepaymentPreBusinessEvent",
|
"LoanTransactionMakeRepaymentPostBusinessEvent", "LoanTransactionMakeRepaymentPreBusinessEvent",
|
||||||
"LoanTransactionMerchantIssuedRefundPostBusinessEvent", "LoanTransactionMerchantIssuedRefundPreBusinessEvent",
|
"LoanTransactionMerchantIssuedRefundPostBusinessEvent", "LoanTransactionMerchantIssuedRefundPreBusinessEvent",
|
||||||
@@ -168,7 +169,8 @@ public class ExternalEventConfigurationValidationServiceTest {
|
|||||||
"SavingsCloseBusinessEvent", "SavingsCreateBusinessEvent", "SavingsDepositBusinessEvent",
|
"SavingsCloseBusinessEvent", "SavingsCreateBusinessEvent", "SavingsDepositBusinessEvent",
|
||||||
"SavingsPostInterestBusinessEvent", "SavingsRejectBusinessEvent", "SavingsWithdrawalBusinessEvent",
|
"SavingsPostInterestBusinessEvent", "SavingsRejectBusinessEvent", "SavingsWithdrawalBusinessEvent",
|
||||||
"ShareAccountApproveBusinessEvent", "ShareAccountCreateBusinessEvent", "ShareProductDividentsCreateBusinessEvent",
|
"ShareAccountApproveBusinessEvent", "ShareAccountCreateBusinessEvent", "ShareProductDividentsCreateBusinessEvent",
|
||||||
"LoanChargeAdjustmentPostBusinessEvent", "LoanChargeAdjustmentPreBusinessEvent", "LoanDelinquencyRangeChangeBusinessEvent");
|
"LoanChargeAdjustmentPostBusinessEvent", "LoanChargeAdjustmentPreBusinessEvent", "LoanDelinquencyRangeChangeBusinessEvent",
|
||||||
|
"LoanAccountsStayedLockedBusinessEvent");
|
||||||
|
|
||||||
List<FineractPlatformTenant> tenants = Arrays
|
List<FineractPlatformTenant> tenants = Arrays
|
||||||
.asList(new FineractPlatformTenant(1L, "default", "Default Tenant", "Europe/Budapest", null));
|
.asList(new FineractPlatformTenant(1L, "default", "Default Tenant", "Europe/Budapest", null));
|
||||||
@@ -177,7 +179,7 @@ public class ExternalEventConfigurationValidationServiceTest {
|
|||||||
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
when(tenantDetailsService.findAllTenants()).thenReturn(tenants);
|
||||||
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
when(jdbcTemplateFactory.create(any())).thenReturn(jdbcTemplate);
|
||||||
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(configurationWithMissingCentersCreateBusinessEvent);
|
when(jdbcTemplate.queryForList(anyString(), eq(String.class))).thenReturn(configurationWithMissingCentersCreateBusinessEvent);
|
||||||
List<String> sourcePackage = Arrays.asList("org.apache.fineract.infrastructure.event.business.domain");
|
List<String> sourcePackage = Arrays.asList("org.apache.fineract");
|
||||||
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
when(externalEventSourceService.getSourcePackages()).thenReturn(sourcePackage);
|
||||||
// when
|
// when
|
||||||
ExternalEventConfigurationNotFoundException exceptionThrown = assertThrows(ExternalEventConfigurationNotFoundException.class,
|
ExternalEventConfigurationNotFoundException exceptionThrown = assertThrows(ExternalEventConfigurationNotFoundException.class,
|
||||||
|
|||||||
+5
@@ -440,6 +440,11 @@ public class ExternalEventConfigurationHelper {
|
|||||||
loanDelinquencyRangeChangeBusinessEvent.put("enabled", false);
|
loanDelinquencyRangeChangeBusinessEvent.put("enabled", false);
|
||||||
defaults.add(loanDelinquencyRangeChangeBusinessEvent);
|
defaults.add(loanDelinquencyRangeChangeBusinessEvent);
|
||||||
|
|
||||||
|
Map<String, Object> loanAccountsStayedLockedBusinessEvent = new HashMap<>();
|
||||||
|
loanAccountsStayedLockedBusinessEvent.put("type", "LoanAccountsStayedLockedBusinessEvent");
|
||||||
|
loanAccountsStayedLockedBusinessEvent.put("enabled", false);
|
||||||
|
defaults.add(loanAccountsStayedLockedBusinessEvent);
|
||||||
|
|
||||||
return defaults;
|
return defaults;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user