From f98681ffdd0b43296b2dadb4618cf9e246850dcf Mon Sep 17 00:00:00 2001 From: Arnold Galovics Date: Thu, 23 Jun 2022 17:00:40 +0200 Subject: [PATCH] Putting back support for pre business events --- .../EmailCampaignDomainServiceImpl.java | 13 +-- .../service/SmsCampaignDomainServiceImpl.java | 26 +++--- .../NotificationDomainServiceImpl.java | 47 ++++++----- ...> LoanChargePaymentPostBusinessEvent.java} | 4 +- .../LoanChargePaymentPreBusinessEvent.java | 29 +++++++ ...CreditBalanceRefundPostBusinessEvent.java} | 4 +- ...anCreditBalanceRefundPreBusinessEvent.java | 29 +++++++ ... => LoanForeClosurePostBusinessEvent.java} | 4 +- .../LoanForeClosurePreBusinessEvent.java | 29 +++++++ .../LoanMakeRepaymentBusinessEvent.java | 28 ------- ...LoanMerchantIssuedRefundBusinessEvent.java | 28 ------- .../LoanPayoutRefundBusinessEvent.java | 28 ------- .../transaction/LoanRefundBusinessEvent.java | 28 ------- ....java => LoanRefundPostBusinessEvent.java} | 4 +- .../LoanRefundPreBusinessEvent.java | 29 +++++++ ...actionGoodwillCreditPostBusinessEvent.java | 28 +++++++ ...sactionGoodwillCreditPreBusinessEvent.java | 29 +++++++ ...sactionMakeRepaymentPostBusinessEvent.java | 28 +++++++ ...nsactionMakeRepaymentPreBusinessEvent.java | 29 +++++++ ...MerchantIssuedRefundPostBusinessEvent.java | 28 +++++++ ...nMerchantIssuedRefundPreBusinessEvent.java | 29 +++++++ ...sactionPayoutRefundPostBusinessEvent.java} | 4 +- ...ansactionPayoutRefundPreBusinessEvent.java | 29 +++++++ ...ctionRecoveryPaymentPostBusinessEvent.java | 28 +++++++ ...actionRecoveryPaymentPreBusinessEvent.java | 29 +++++++ ...a => LoanWrittenOffPostBusinessEvent.java} | 4 +- .../LoanWrittenOffPreBusinessEvent.java | 29 +++++++ .../service/BusinessEventNotifierService.java | 14 +++- .../BusinessEventNotifierServiceImpl.java | 47 ++++++----- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- .../domain/LoanAccountDomainServiceJpa.java | 83 ++++++++++++++----- .../service/GuarantorDomainServiceImpl.java | 31 +++---- ...WritePlatformServiceJpaRepositoryImpl.java | 8 +- .../service/LoanArrearsAgingServiceImpl.java | 49 ++++++----- ...WritePlatformServiceJpaRepositoryImpl.java | 81 ++++++++++++------ ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../SavingsAccountDomainServiceJpa.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 6 +- ...WritePlatformServiceJpaRepositoryImpl.java | 6 +- ...WritePlatformServiceJpaRepositoryImpl.java | 4 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- 43 files changed, 682 insertions(+), 295 deletions(-) rename fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/{LoanChargePaymentBusinessEvent.java => LoanChargePaymentPostBusinessEvent.java} (86%) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPreBusinessEvent.java rename fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/{LoanCreditBalanceRefundBusinessEvent.java => LoanCreditBalanceRefundPostBusinessEvent.java} (85%) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPreBusinessEvent.java rename fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/{LoanRecoveryPaymentBusinessEvent.java => LoanForeClosurePostBusinessEvent.java} (88%) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePreBusinessEvent.java delete mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanMakeRepaymentBusinessEvent.java delete mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanMerchantIssuedRefundBusinessEvent.java delete mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanPayoutRefundBusinessEvent.java delete mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundBusinessEvent.java rename fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/{LoanWrittenOffBusinessEvent.java => LoanRefundPostBusinessEvent.java} (88%) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPreBusinessEvent.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPostBusinessEvent.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPreBusinessEvent.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPostBusinessEvent.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPreBusinessEvent.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPostBusinessEvent.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPreBusinessEvent.java rename fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/{LoanForeClosureBusinessEvent.java => LoanTransactionPayoutRefundPostBusinessEvent.java} (84%) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPreBusinessEvent.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPostBusinessEvent.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPreBusinessEvent.java rename fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/{LoanGoodwillCreditBusinessEvent.java => LoanWrittenOffPostBusinessEvent.java} (88%) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPreBusinessEvent.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignDomainServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignDomainServiceImpl.java index a3b5fa0ad..c7c5c8c37 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignDomainServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/service/EmailCampaignDomainServiceImpl.java @@ -32,7 +32,7 @@ import org.apache.fineract.infrastructure.campaigns.sms.constants.SmsCampaignTri import org.apache.fineract.portfolio.businessevent.BusinessEventListener; import org.apache.fineract.portfolio.businessevent.domain.loan.LoanApprovedBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.LoanRejectedBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanMakeRepaymentBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent; import org.apache.fineract.portfolio.businessevent.service.BusinessEventNotifierService; import org.apache.fineract.portfolio.loanaccount.domain.Loan; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; @@ -49,15 +49,16 @@ public class EmailCampaignDomainServiceImpl implements EmailCampaignDomainServic @PostConstruct public void addListeners() { - businessEventNotifierService.addBusinessEventListener(LoanApprovedBusinessEvent.class, new SendEmailOnLoanApproved()); - businessEventNotifierService.addBusinessEventListener(LoanRejectedBusinessEvent.class, new SendEmailOnLoanRejected()); - businessEventNotifierService.addBusinessEventListener(LoanMakeRepaymentBusinessEvent.class, new SendEmailOnLoanRepayment()); + businessEventNotifierService.addPostBusinessEventListener(LoanApprovedBusinessEvent.class, new SendEmailOnLoanApproved()); + businessEventNotifierService.addPostBusinessEventListener(LoanRejectedBusinessEvent.class, new SendEmailOnLoanRejected()); + businessEventNotifierService.addPostBusinessEventListener(LoanTransactionMakeRepaymentPostBusinessEvent.class, + new SendEmailOnLoanRepayment()); } - private class SendEmailOnLoanRepayment implements BusinessEventListener { + private class SendEmailOnLoanRepayment implements BusinessEventListener { @Override - public void onBusinessEvent(LoanMakeRepaymentBusinessEvent event) { + public void onBusinessEvent(LoanTransactionMakeRepaymentPostBusinessEvent event) { LoanTransaction loanTransaction = event.get(); try { notifyLoanOwner(loanTransaction, "Loan Repayment"); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDomainServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDomainServiceImpl.java index 3dff93c1b..a7b2aae0d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDomainServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDomainServiceImpl.java @@ -49,7 +49,7 @@ import org.apache.fineract.portfolio.businessevent.domain.client.ClientActivateB import org.apache.fineract.portfolio.businessevent.domain.client.ClientRejectBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.LoanApprovedBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.LoanRejectedBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanMakeRepaymentBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.savings.SavingsActivateBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.savings.SavingsRejectBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.savings.transaction.SavingsDepositBusinessEvent; @@ -82,16 +82,18 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService { @PostConstruct public void addListeners() { - businessEventNotifierService.addBusinessEventListener(LoanApprovedBusinessEvent.class, new SendSmsOnLoanApproved()); - businessEventNotifierService.addBusinessEventListener(LoanRejectedBusinessEvent.class, new SendSmsOnLoanRejected()); - businessEventNotifierService.addBusinessEventListener(LoanMakeRepaymentBusinessEvent.class, new SendSmsOnLoanRepayment()); - businessEventNotifierService.addBusinessEventListener(ClientActivateBusinessEvent.class, new ClientActivatedListener()); - businessEventNotifierService.addBusinessEventListener(ClientRejectBusinessEvent.class, new ClientRejectedListener()); - businessEventNotifierService.addBusinessEventListener(SavingsActivateBusinessEvent.class, new SavingsAccountActivatedListener()); - businessEventNotifierService.addBusinessEventListener(SavingsRejectBusinessEvent.class, new SavingsAccountRejectedListener()); - businessEventNotifierService.addBusinessEventListener(SavingsDepositBusinessEvent.class, + businessEventNotifierService.addPostBusinessEventListener(LoanApprovedBusinessEvent.class, new SendSmsOnLoanApproved()); + businessEventNotifierService.addPostBusinessEventListener(LoanRejectedBusinessEvent.class, new SendSmsOnLoanRejected()); + businessEventNotifierService.addPostBusinessEventListener(LoanTransactionMakeRepaymentPostBusinessEvent.class, + new SendSmsOnLoanRepayment()); + businessEventNotifierService.addPostBusinessEventListener(ClientActivateBusinessEvent.class, new ClientActivatedListener()); + businessEventNotifierService.addPostBusinessEventListener(ClientRejectBusinessEvent.class, new ClientRejectedListener()); + businessEventNotifierService.addPostBusinessEventListener(SavingsActivateBusinessEvent.class, + new SavingsAccountActivatedListener()); + businessEventNotifierService.addPostBusinessEventListener(SavingsRejectBusinessEvent.class, new SavingsAccountRejectedListener()); + businessEventNotifierService.addPostBusinessEventListener(SavingsDepositBusinessEvent.class, new DepositSavingsAccountTransactionListener()); - businessEventNotifierService.addBusinessEventListener(SavingsWithdrawalBusinessEvent.class, + businessEventNotifierService.addPostBusinessEventListener(SavingsWithdrawalBusinessEvent.class, new NonDepositSavingsAccountTransactionListener()); } @@ -388,10 +390,10 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService { } } - private class SendSmsOnLoanRepayment implements BusinessEventListener { + private class SendSmsOnLoanRepayment implements BusinessEventListener { @Override - public void onBusinessEvent(LoanMakeRepaymentBusinessEvent event) { + public void onBusinessEvent(LoanTransactionMakeRepaymentPostBusinessEvent event) { sendSmsForLoanRepayment(event.get()); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationDomainServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationDomainServiceImpl.java index d5b66c108..94ee2ac2f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationDomainServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/notification/service/NotificationDomainServiceImpl.java @@ -41,7 +41,7 @@ import org.apache.fineract.portfolio.businessevent.domain.loan.LoanCloseAsResche import org.apache.fineract.portfolio.businessevent.domain.loan.LoanCloseBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.LoanCreatedBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.product.LoanProductCreateBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanMakeRepaymentBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.savings.SavingsApproveBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.savings.SavingsCloseBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.savings.SavingsCreateBusinessEvent; @@ -76,29 +76,32 @@ public class NotificationDomainServiceImpl implements NotificationDomainService @PostConstruct public void addListeners() { - businessEventNotifierService.addBusinessEventListener(ClientCreateBusinessEvent.class, new ClientCreatedListener()); - businessEventNotifierService.addBusinessEventListener(SavingsApproveBusinessEvent.class, new SavingsAccountApprovedListener()); - businessEventNotifierService.addBusinessEventListener(CentersCreateBusinessEvent.class, new CenterCreatedListener()); - businessEventNotifierService.addBusinessEventListener(GroupsCreateBusinessEvent.class, new GroupCreatedListener()); - businessEventNotifierService.addBusinessEventListener(SavingsDepositBusinessEvent.class, new SavingsAccountDepositListener()); - businessEventNotifierService.addBusinessEventListener(ShareProductDividentsCreateBusinessEvent.class, + businessEventNotifierService.addPostBusinessEventListener(ClientCreateBusinessEvent.class, new ClientCreatedListener()); + businessEventNotifierService.addPostBusinessEventListener(SavingsApproveBusinessEvent.class, new SavingsAccountApprovedListener()); + businessEventNotifierService.addPostBusinessEventListener(CentersCreateBusinessEvent.class, new CenterCreatedListener()); + businessEventNotifierService.addPostBusinessEventListener(GroupsCreateBusinessEvent.class, new GroupCreatedListener()); + businessEventNotifierService.addPostBusinessEventListener(SavingsDepositBusinessEvent.class, new SavingsAccountDepositListener()); + businessEventNotifierService.addPostBusinessEventListener(ShareProductDividentsCreateBusinessEvent.class, new ShareProductDividendCreatedListener()); - businessEventNotifierService.addBusinessEventListener(FixedDepositAccountCreateBusinessEvent.class, + businessEventNotifierService.addPostBusinessEventListener(FixedDepositAccountCreateBusinessEvent.class, new FixedDepositAccountCreatedListener()); - businessEventNotifierService.addBusinessEventListener(RecurringDepositAccountCreateBusinessEvent.class, + businessEventNotifierService.addPostBusinessEventListener(RecurringDepositAccountCreateBusinessEvent.class, new RecurringDepositAccountCreatedListener()); - businessEventNotifierService.addBusinessEventListener(SavingsPostInterestBusinessEvent.class, new SavingsPostInterestListener()); - businessEventNotifierService.addBusinessEventListener(LoanCreatedBusinessEvent.class, new LoanCreatedListener()); - businessEventNotifierService.addBusinessEventListener(LoanApprovedBusinessEvent.class, new LoanApprovedListener()); - businessEventNotifierService.addBusinessEventListener(LoanCloseBusinessEvent.class, new LoanClosedListener()); - businessEventNotifierService.addBusinessEventListener(LoanCloseAsRescheduleBusinessEvent.class, + businessEventNotifierService.addPostBusinessEventListener(SavingsPostInterestBusinessEvent.class, + new SavingsPostInterestListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanCreatedBusinessEvent.class, new LoanCreatedListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanApprovedBusinessEvent.class, new LoanApprovedListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanCloseBusinessEvent.class, new LoanClosedListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanCloseAsRescheduleBusinessEvent.class, new LoanCloseAsRescheduledListener()); - businessEventNotifierService.addBusinessEventListener(LoanMakeRepaymentBusinessEvent.class, new LoanMakeRepaymentListener()); - businessEventNotifierService.addBusinessEventListener(LoanProductCreateBusinessEvent.class, new LoanProductCreatedListener()); - businessEventNotifierService.addBusinessEventListener(SavingsCreateBusinessEvent.class, new SavingsAccountCreatedListener()); - businessEventNotifierService.addBusinessEventListener(SavingsCloseBusinessEvent.class, new SavingsAccountClosedListener()); - businessEventNotifierService.addBusinessEventListener(ShareAccountCreateBusinessEvent.class, new ShareAccountCreatedListener()); - businessEventNotifierService.addBusinessEventListener(ShareAccountApproveBusinessEvent.class, new ShareAccountApprovedListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanTransactionMakeRepaymentPostBusinessEvent.class, + new LoanMakeRepaymentListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanProductCreateBusinessEvent.class, new LoanProductCreatedListener()); + businessEventNotifierService.addPostBusinessEventListener(SavingsCreateBusinessEvent.class, new SavingsAccountCreatedListener()); + businessEventNotifierService.addPostBusinessEventListener(SavingsCloseBusinessEvent.class, new SavingsAccountClosedListener()); + businessEventNotifierService.addPostBusinessEventListener(ShareAccountCreateBusinessEvent.class, new ShareAccountCreatedListener()); + businessEventNotifierService.addPostBusinessEventListener(ShareAccountApproveBusinessEvent.class, + new ShareAccountApprovedListener()); } private class ClientCreatedListener implements BusinessEventListener { @@ -244,10 +247,10 @@ public class NotificationDomainServiceImpl implements NotificationDomainService } } - private class LoanMakeRepaymentListener implements BusinessEventListener { + private class LoanMakeRepaymentListener implements BusinessEventListener { @Override - public void onBusinessEvent(LoanMakeRepaymentBusinessEvent event) { + public void onBusinessEvent(LoanTransactionMakeRepaymentPostBusinessEvent event) { Loan loan = event.get().getLoan(); buildNotification("READ_LOAN", "loan", loan.getId(), "Repayment made", "repaymentMade", context.authenticatedUser().getId(), loan.getOfficeId()); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPostBusinessEvent.java similarity index 86% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentBusinessEvent.java rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPostBusinessEvent.java index 666feb8d2..b0194a2f1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentBusinessEvent.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPostBusinessEvent.java @@ -20,9 +20,9 @@ package org.apache.fineract.portfolio.businessevent.domain.loan.transaction; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; -public class LoanChargePaymentBusinessEvent extends LoanTransactionBusinessEvent { +public class LoanChargePaymentPostBusinessEvent extends LoanTransactionBusinessEvent { - public LoanChargePaymentBusinessEvent(LoanTransaction value) { + public LoanChargePaymentPostBusinessEvent(LoanTransaction value) { super(value); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPreBusinessEvent.java new file mode 100644 index 000000000..fe287cc98 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanChargePaymentPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanChargePaymentPreBusinessEvent extends LoanBusinessEvent { + + public LoanChargePaymentPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPostBusinessEvent.java similarity index 85% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundBusinessEvent.java rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPostBusinessEvent.java index b2438a880..1ac43e06b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundBusinessEvent.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPostBusinessEvent.java @@ -20,9 +20,9 @@ package org.apache.fineract.portfolio.businessevent.domain.loan.transaction; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; -public class LoanCreditBalanceRefundBusinessEvent extends LoanTransactionBusinessEvent { +public class LoanCreditBalanceRefundPostBusinessEvent extends LoanTransactionBusinessEvent { - public LoanCreditBalanceRefundBusinessEvent(LoanTransaction value) { + public LoanCreditBalanceRefundPostBusinessEvent(LoanTransaction value) { super(value); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPreBusinessEvent.java new file mode 100644 index 000000000..97a1263b5 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanCreditBalanceRefundPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanCreditBalanceRefundPreBusinessEvent extends LoanBusinessEvent { + + public LoanCreditBalanceRefundPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRecoveryPaymentBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePostBusinessEvent.java similarity index 88% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRecoveryPaymentBusinessEvent.java rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePostBusinessEvent.java index 6445f18ce..7ec43045a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRecoveryPaymentBusinessEvent.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePostBusinessEvent.java @@ -20,9 +20,9 @@ package org.apache.fineract.portfolio.businessevent.domain.loan.transaction; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; -public class LoanRecoveryPaymentBusinessEvent extends LoanTransactionBusinessEvent { +public class LoanForeClosurePostBusinessEvent extends LoanTransactionBusinessEvent { - public LoanRecoveryPaymentBusinessEvent(LoanTransaction value) { + public LoanForeClosurePostBusinessEvent(LoanTransaction value) { super(value); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePreBusinessEvent.java new file mode 100644 index 000000000..0f6279d49 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosurePreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanForeClosurePreBusinessEvent extends LoanBusinessEvent { + + public LoanForeClosurePreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanMakeRepaymentBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanMakeRepaymentBusinessEvent.java deleted file mode 100644 index cbe4d9835..000000000 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanMakeRepaymentBusinessEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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.portfolio.businessevent.domain.loan.transaction; - -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; - -public class LoanMakeRepaymentBusinessEvent extends LoanTransactionBusinessEvent { - - public LoanMakeRepaymentBusinessEvent(LoanTransaction value) { - super(value); - } -} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanMerchantIssuedRefundBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanMerchantIssuedRefundBusinessEvent.java deleted file mode 100644 index aa8c853f3..000000000 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanMerchantIssuedRefundBusinessEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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.portfolio.businessevent.domain.loan.transaction; - -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; - -public class LoanMerchantIssuedRefundBusinessEvent extends LoanTransactionBusinessEvent { - - public LoanMerchantIssuedRefundBusinessEvent(LoanTransaction value) { - super(value); - } -} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanPayoutRefundBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanPayoutRefundBusinessEvent.java deleted file mode 100644 index 00a294f6f..000000000 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanPayoutRefundBusinessEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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.portfolio.businessevent.domain.loan.transaction; - -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; - -public class LoanPayoutRefundBusinessEvent extends LoanTransactionBusinessEvent { - - public LoanPayoutRefundBusinessEvent(LoanTransaction value) { - super(value); - } -} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundBusinessEvent.java deleted file mode 100644 index f50de7a00..000000000 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundBusinessEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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.portfolio.businessevent.domain.loan.transaction; - -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; - -public class LoanRefundBusinessEvent extends LoanTransactionBusinessEvent { - - public LoanRefundBusinessEvent(LoanTransaction value) { - super(value); - } -} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPostBusinessEvent.java similarity index 88% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffBusinessEvent.java rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPostBusinessEvent.java index 8e49123c1..d71cee248 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffBusinessEvent.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPostBusinessEvent.java @@ -20,9 +20,9 @@ package org.apache.fineract.portfolio.businessevent.domain.loan.transaction; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; -public class LoanWrittenOffBusinessEvent extends LoanTransactionBusinessEvent { +public class LoanRefundPostBusinessEvent extends LoanTransactionBusinessEvent { - public LoanWrittenOffBusinessEvent(LoanTransaction value) { + public LoanRefundPostBusinessEvent(LoanTransaction value) { super(value); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPreBusinessEvent.java new file mode 100644 index 000000000..20c81c5b8 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanRefundPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanRefundPreBusinessEvent extends LoanBusinessEvent { + + public LoanRefundPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPostBusinessEvent.java new file mode 100644 index 000000000..c9bb1a0f2 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPostBusinessEvent.java @@ -0,0 +1,28 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; + +public class LoanTransactionGoodwillCreditPostBusinessEvent extends LoanTransactionBusinessEvent { + + public LoanTransactionGoodwillCreditPostBusinessEvent(LoanTransaction value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPreBusinessEvent.java new file mode 100644 index 000000000..fa93ef28e --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionGoodwillCreditPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanTransactionGoodwillCreditPreBusinessEvent extends LoanBusinessEvent { + + public LoanTransactionGoodwillCreditPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPostBusinessEvent.java new file mode 100644 index 000000000..7f1439f9a --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPostBusinessEvent.java @@ -0,0 +1,28 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; + +public class LoanTransactionMakeRepaymentPostBusinessEvent extends LoanTransactionBusinessEvent { + + public LoanTransactionMakeRepaymentPostBusinessEvent(LoanTransaction value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPreBusinessEvent.java new file mode 100644 index 000000000..64f837e56 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMakeRepaymentPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanTransactionMakeRepaymentPreBusinessEvent extends LoanBusinessEvent { + + public LoanTransactionMakeRepaymentPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPostBusinessEvent.java new file mode 100644 index 000000000..8f7415104 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPostBusinessEvent.java @@ -0,0 +1,28 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; + +public class LoanTransactionMerchantIssuedRefundPostBusinessEvent extends LoanTransactionBusinessEvent { + + public LoanTransactionMerchantIssuedRefundPostBusinessEvent(LoanTransaction value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPreBusinessEvent.java new file mode 100644 index 000000000..3ee3faa04 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionMerchantIssuedRefundPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanTransactionMerchantIssuedRefundPreBusinessEvent extends LoanBusinessEvent { + + public LoanTransactionMerchantIssuedRefundPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosureBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPostBusinessEvent.java similarity index 84% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosureBusinessEvent.java rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPostBusinessEvent.java index fa277a80f..0b777a5df 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanForeClosureBusinessEvent.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPostBusinessEvent.java @@ -20,9 +20,9 @@ package org.apache.fineract.portfolio.businessevent.domain.loan.transaction; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; -public class LoanForeClosureBusinessEvent extends LoanTransactionBusinessEvent { +public class LoanTransactionPayoutRefundPostBusinessEvent extends LoanTransactionBusinessEvent { - public LoanForeClosureBusinessEvent(LoanTransaction value) { + public LoanTransactionPayoutRefundPostBusinessEvent(LoanTransaction value) { super(value); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPreBusinessEvent.java new file mode 100644 index 000000000..dbc51cfda --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionPayoutRefundPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanTransactionPayoutRefundPreBusinessEvent extends LoanBusinessEvent { + + public LoanTransactionPayoutRefundPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPostBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPostBusinessEvent.java new file mode 100644 index 000000000..44cccfb27 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPostBusinessEvent.java @@ -0,0 +1,28 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; + +public class LoanTransactionRecoveryPaymentPostBusinessEvent extends LoanTransactionBusinessEvent { + + public LoanTransactionRecoveryPaymentPostBusinessEvent(LoanTransaction value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPreBusinessEvent.java new file mode 100644 index 000000000..657e327d4 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanTransactionRecoveryPaymentPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanTransactionRecoveryPaymentPreBusinessEvent extends LoanBusinessEvent { + + public LoanTransactionRecoveryPaymentPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanGoodwillCreditBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPostBusinessEvent.java similarity index 88% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanGoodwillCreditBusinessEvent.java rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPostBusinessEvent.java index 9ff4b81d2..5637f9696 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanGoodwillCreditBusinessEvent.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPostBusinessEvent.java @@ -20,9 +20,9 @@ package org.apache.fineract.portfolio.businessevent.domain.loan.transaction; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; -public class LoanGoodwillCreditBusinessEvent extends LoanTransactionBusinessEvent { +public class LoanWrittenOffPostBusinessEvent extends LoanTransactionBusinessEvent { - public LoanGoodwillCreditBusinessEvent(LoanTransaction value) { + public LoanWrittenOffPostBusinessEvent(LoanTransaction value) { super(value); } } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPreBusinessEvent.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPreBusinessEvent.java new file mode 100644 index 000000000..9e51d1f4d --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/domain/loan/transaction/LoanWrittenOffPreBusinessEvent.java @@ -0,0 +1,29 @@ +/** + * 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.portfolio.businessevent.domain.loan.transaction; + +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.loanaccount.domain.Loan; + +public class LoanWrittenOffPreBusinessEvent extends LoanBusinessEvent { + + public LoanWrittenOffPreBusinessEvent(Loan value) { + super(value); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierService.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierService.java index dffe2acdc..f4b00f1c1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierService.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierService.java @@ -27,14 +27,24 @@ import org.apache.fineract.portfolio.businessevent.domain.BusinessEvent; */ public interface BusinessEventNotifierService { + /** + * Method should be called to notify listeners after Business event execution for any pre-processing of event + */ + void notifyPreBusinessEvent(BusinessEvent businessEvent); + /** * Method should be called to notify listeners after Business event execution for any post-processing of event */ - void notifyBusinessEvent(BusinessEvent businessEvent); + void notifyPostBusinessEvent(BusinessEvent businessEvent); + + /** + * Method is to register a class as listener for pre-processing of any Business event + */ + > void addPreBusinessEventListener(Class eventType, BusinessEventListener listener); /** * Method is to register a class as listener for post-processing of any Business event */ - > void addBusinessEventListener(Class eventType, BusinessEventListener listener); + > void addPostBusinessEventListener(Class eventType, BusinessEventListener listener); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierServiceImpl.java index e95a236e8..dcc4af8d1 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/businessevent/service/BusinessEventNotifierServiceImpl.java @@ -30,18 +30,12 @@ import org.springframework.stereotype.Service; @SuppressWarnings({ "unchecked", "rawtypes" }) public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierService { - private final Map> listeners = new HashMap<>(); + private final Map> preListeners = new HashMap<>(); + private final Map> postListeners = new HashMap<>(); - /* - * (non-Javadoc) - * - * @see org.apache.fineract.portfolio.businessevent.service.BusinessEventNotifierService - * #notifyBusinessEventWasExecuted (org.apache.fineract.portfolio.common.BusinessEventNotificationConstants - * .BusinessEvents, org.springframework.data.jpa.domain.AbstractPersistable) - */ @Override - public void notifyBusinessEvent(BusinessEvent businessEvent) { - List businessEventListeners = listeners.get(businessEvent.getClass()); + public void notifyPreBusinessEvent(BusinessEvent businessEvent) { + List businessEventListeners = preListeners.get(businessEvent.getClass()); if (businessEventListeners != null) { for (BusinessEventListener eventListener : businessEventListeners) { eventListener.onBusinessEvent(businessEvent); @@ -49,19 +43,32 @@ public class BusinessEventNotifierServiceImpl implements BusinessEventNotifierSe } } - /* - * (non-Javadoc) - * - * @see org.apache.fineract.portfolio.businessevent.service.BusinessEventNotifierService - * #addBusinessEventPostListeners (org.apache.fineract.portfolio.common.BusinessEventNotificationConstants - * .BusinessEvents, org.apache.fineract.portfolio.businessevent.BusinessEventListener) - */ @Override - public > void addBusinessEventListener(Class eventType, BusinessEventListener listener) { - List businessEventListeners = listeners.get(eventType); + public > void addPreBusinessEventListener(Class eventType, BusinessEventListener listener) { + List businessEventListeners = preListeners.get(eventType); if (businessEventListeners == null) { businessEventListeners = new ArrayList<>(); - listeners.put(eventType, businessEventListeners); + preListeners.put(eventType, businessEventListeners); + } + businessEventListeners.add(listener); + } + + @Override + public void notifyPostBusinessEvent(BusinessEvent businessEvent) { + List businessEventListeners = postListeners.get(businessEvent.getClass()); + if (businessEventListeners != null) { + for (BusinessEventListener eventListener : businessEventListeners) { + eventListener.onBusinessEvent(businessEvent); + } + } + } + + @Override + public > void addPostBusinessEventListener(Class eventType, BusinessEventListener listener) { + List businessEventListeners = postListeners.get(eventType); + if (businessEventListeners == null) { + businessEventListeners = new ArrayList<>(); + postListeners.put(eventType, businessEventListeners); } businessEventListeners.add(listener); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java index 270084f14..978943f89 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java @@ -303,7 +303,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP this.clientRepository.saveAndFlush(newClient); if (newClient.isActive()) { - businessEventNotifierService.notifyBusinessEvent(new ClientActivateBusinessEvent(newClient)); + businessEventNotifierService.notifyPostBusinessEvent(new ClientActivateBusinessEvent(newClient)); } if (newClient.isAccountNumberRequiresAutoGeneration()) { AccountNumberFormat accountNumberFormat = this.accountNumberFormatRepository.findByAccountType(EntityAccountType.CLIENT); @@ -337,7 +337,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP command.arrayOfParameterNamed(ClientApiConstants.datatables)); } - businessEventNotifierService.notifyBusinessEvent(new ClientCreateBusinessEvent(newClient)); + businessEventNotifierService.notifyPostBusinessEvent(new ClientCreateBusinessEvent(newClient)); entityDatatableChecksWritePlatformService.runTheCheck(newClient.getId(), EntityTables.CLIENT.getName(), StatusEnum.CREATE.getCode().longValue(), EntityTables.CLIENT.getForeignKeyColumnNameOnDatatable()); @@ -591,7 +591,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP client.activate(currentUser, fmt, activationDate); CommandProcessingResult result = openSavingsAccount(client, fmt); clientRepository.saveAndFlush(client); - businessEventNotifierService.notifyBusinessEvent(new ClientActivateBusinessEvent(client)); + businessEventNotifierService.notifyPostBusinessEvent(new ClientActivateBusinessEvent(client)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withOfficeId(client.officeId()) // @@ -845,7 +845,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP } client.reject(currentUser, rejectionReason, Date.from(rejectionDate.atStartOfDay(ZoneId.systemDefault()).toInstant())); clientRepository.saveAndFlush(client); - businessEventNotifierService.notifyBusinessEvent(new ClientRejectBusinessEvent(client)); + businessEventNotifierService.notifyPostBusinessEvent(new ClientRejectBusinessEvent(client)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withClientId(entityId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java index 1d3fe226d..46cd443ee 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java @@ -257,7 +257,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group CommandProcessingResult commandProcessingResult = createGroupingType(command, GroupTypes.CENTER, centerId); - businessEventNotifierService.notifyBusinessEvent(new CentersCreateBusinessEvent(commandProcessingResult)); + businessEventNotifierService.notifyPostBusinessEvent(new CentersCreateBusinessEvent(commandProcessingResult)); return commandProcessingResult; } @@ -274,7 +274,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group CommandProcessingResult commandProcessingResult = createGroupingType(command, GroupTypes.GROUP, centerId); - businessEventNotifierService.notifyBusinessEvent(new GroupsCreateBusinessEvent(commandProcessingResult)); + businessEventNotifierService.notifyPostBusinessEvent(new GroupsCreateBusinessEvent(commandProcessingResult)); return commandProcessingResult; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java index 3b2370011..41b2f1236 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java @@ -58,16 +58,26 @@ import org.apache.fineract.portfolio.account.domain.AccountTransferTransaction; import org.apache.fineract.portfolio.account.domain.StandingInstructionRepository; import org.apache.fineract.portfolio.account.domain.StandingInstructionStatus; import org.apache.fineract.portfolio.accountdetails.domain.AccountType; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanChargePaymentBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanCreditBalanceRefundBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanForeClosureBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanGoodwillCreditBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanMakeRepaymentBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanMerchantIssuedRefundBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanPayoutRefundBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanRecoveryPaymentBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanRefundBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.LoanBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanChargePaymentPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanChargePaymentPreBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanCreditBalanceRefundPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanCreditBalanceRefundPreBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanForeClosurePostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanForeClosurePreBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanRefundPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanRefundPreBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionGoodwillCreditPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionGoodwillCreditPreBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMakeRepaymentPreBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMerchantIssuedRefundPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMerchantIssuedRefundPreBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionPayoutRefundPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionPayoutRefundPreBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionRecoveryPaymentPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionRecoveryPaymentPreBusinessEvent; import org.apache.fineract.portfolio.businessevent.service.BusinessEventNotifierService; import org.apache.fineract.portfolio.client.domain.Client; import org.apache.fineract.portfolio.client.exception.ClientNotActiveException; @@ -151,6 +161,9 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { AppUser currentUser = getAppUserIfPresent(); checkClientOrGroupActive(loan); + LoanBusinessEvent repaymentEvent = getLoanRepaymentTypeBusinessEvent(repaymentTransactionType, isRecoveryRepayment, loan); + businessEventNotifierService.notifyPreBusinessEvent(repaymentEvent); + // TODO: Is it required to validate transaction date with meeting dates // if repayments is synced with meeting? /* @@ -213,9 +226,9 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { recalculateAccruals(loan); - LoanTransactionBusinessEvent repaymentEvent = getRepaymentTypeBusinessEvent(repaymentTransactionType, isRecoveryRepayment, - newRepaymentTransaction); - businessEventNotifierService.notifyBusinessEvent(repaymentEvent); + LoanTransactionBusinessEvent transactionRepaymentEvent = getTransactionRepaymentTypeBusinessEvent(repaymentTransactionType, + isRecoveryRepayment, newRepaymentTransaction); + businessEventNotifierService.notifyPostBusinessEvent(transactionRepaymentEvent); // disable all active standing orders linked to this loan if status // changes to closed @@ -256,19 +269,36 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { return newRepaymentTransaction; } - private LoanTransactionBusinessEvent getRepaymentTypeBusinessEvent(LoanTransactionType repaymentTransactionType, + private LoanBusinessEvent getLoanRepaymentTypeBusinessEvent(LoanTransactionType repaymentTransactionType, boolean isRecoveryRepayment, + Loan loan) { + LoanBusinessEvent repaymentEvent = null; + if (repaymentTransactionType.isRepayment()) { + repaymentEvent = new LoanTransactionMakeRepaymentPreBusinessEvent(loan); + } else if (repaymentTransactionType.isMerchantIssuedRefund()) { + repaymentEvent = new LoanTransactionMerchantIssuedRefundPreBusinessEvent(loan); + } else if (repaymentTransactionType.isPayoutRefund()) { + repaymentEvent = new LoanTransactionPayoutRefundPreBusinessEvent(loan); + } else if (repaymentTransactionType.isGoodwillCredit()) { + repaymentEvent = new LoanTransactionGoodwillCreditPreBusinessEvent(loan); + } else if (isRecoveryRepayment) { + repaymentEvent = new LoanTransactionRecoveryPaymentPreBusinessEvent(loan); + } + return repaymentEvent; + } + + private LoanTransactionBusinessEvent getTransactionRepaymentTypeBusinessEvent(LoanTransactionType repaymentTransactionType, boolean isRecoveryRepayment, LoanTransaction transaction) { LoanTransactionBusinessEvent repaymentEvent = null; if (repaymentTransactionType.isRepayment()) { - repaymentEvent = new LoanMakeRepaymentBusinessEvent(transaction); + repaymentEvent = new LoanTransactionMakeRepaymentPostBusinessEvent(transaction); } else if (repaymentTransactionType.isMerchantIssuedRefund()) { - repaymentEvent = new LoanMerchantIssuedRefundBusinessEvent(transaction); + repaymentEvent = new LoanTransactionMerchantIssuedRefundPostBusinessEvent(transaction); } else if (repaymentTransactionType.isPayoutRefund()) { - repaymentEvent = new LoanPayoutRefundBusinessEvent(transaction); + repaymentEvent = new LoanTransactionPayoutRefundPostBusinessEvent(transaction); } else if (repaymentTransactionType.isGoodwillCredit()) { - repaymentEvent = new LoanGoodwillCreditBusinessEvent(transaction); + repaymentEvent = new LoanTransactionGoodwillCreditPostBusinessEvent(transaction); } else if (isRecoveryRepayment) { - repaymentEvent = new LoanRecoveryPaymentBusinessEvent(transaction); + repaymentEvent = new LoanTransactionRecoveryPaymentPostBusinessEvent(transaction); } return repaymentEvent; } @@ -334,6 +364,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { AppUser currentUser = getAppUserIfPresent(); boolean isAccountTransfer = true; checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanChargePaymentPreBusinessEvent(loan)); + final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); @@ -368,7 +400,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer); recalculateAccruals(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanChargePaymentBusinessEvent(newPaymentTransaction)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanChargePaymentPostBusinessEvent(newPaymentTransaction)); return newPaymentTransaction; } @@ -417,6 +449,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { boolean isAccountTransfer = true; final Loan loan = this.loanAccountAssembler.assembleFrom(accountId); checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanRefundPreBusinessEvent(loan)); final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); @@ -441,7 +474,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { } postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer); - businessEventNotifierService.notifyBusinessEvent(new LoanRefundBusinessEvent(newRefundTransaction)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanRefundPostBusinessEvent(newRefundTransaction)); builderResult.withEntityId(newRefundTransaction.getId()).withOfficeId(loan.getOfficeId()).withClientId(loan.getClientId()) .withGroupId(loan.getGroupId()); @@ -610,6 +643,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { public CommandProcessingResultBuilder creditBalanceRefund(Long loanId, LocalDate transactionDate, BigDecimal transactionAmount, String noteText, String externalId) { final Loan loan = this.loanAccountAssembler.assembleFrom(loanId); + businessEventNotifierService.notifyPreBusinessEvent(new LoanCreditBalanceRefundPreBusinessEvent(loan)); final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); AppUser currentUser = getAppUserIfPresent(); @@ -630,7 +664,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, false); recalculateAccruals(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanCreditBalanceRefundBusinessEvent(newCreditBalanceRefundTransaction)); + businessEventNotifierService + .notifyPostBusinessEvent(new LoanCreditBalanceRefundPostBusinessEvent(newCreditBalanceRefundTransaction)); return new CommandProcessingResultBuilder().withEntityId(newCreditBalanceRefundTransaction.getId()) // .withOfficeId(loan.getOfficeId()) // @@ -643,6 +678,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { BigDecimal transactionAmount, PaymentDetail paymentDetail, String noteText, String txnExternalId) { final Loan loan = this.loanAccountAssembler.assembleFrom(accountId); checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanRefundPreBusinessEvent(loan)); final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); AppUser currentUser = getAppUserIfPresent(); @@ -668,7 +704,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, false); recalculateAccruals(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanRefundBusinessEvent(newRefundTransaction)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanRefundPostBusinessEvent(newRefundTransaction)); builderResult.withEntityId(newRefundTransaction.getId()).withOfficeId(loan.getOfficeId()).withClientId(loan.getClientId()) .withGroupId(loan.getGroupId()); @@ -678,6 +714,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { @Override public Map foreCloseLoan(final Loan loan, final LocalDate foreClosureDate, final String noteText) { + businessEventNotifierService.notifyPreBusinessEvent(new LoanForeClosurePreBusinessEvent(loan)); MonetaryCurrency currency = loan.getCurrency(); LocalDateTime createdDate = DateUtils.getLocalDateTimeOfTenant(); final Map changes = new LinkedHashMap<>(); @@ -776,7 +813,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { } postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds, false); - businessEventNotifierService.notifyBusinessEvent(new LoanForeClosureBusinessEvent(payment)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanForeClosurePostBusinessEvent(payment)); return changes; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java index 51a69ded5..442c95d4b 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/service/GuarantorDomainServiceImpl.java @@ -44,9 +44,9 @@ import org.apache.fineract.portfolio.businessevent.domain.loan.LoanAdjustTransac import org.apache.fineract.portfolio.businessevent.domain.loan.LoanApprovedBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.LoanUndoApprovalBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.LoanUndoDisbursalBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanMakeRepaymentBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanUndoWrittenOffBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanWrittenOffBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanWrittenOffPostBusinessEvent; import org.apache.fineract.portfolio.businessevent.service.BusinessEventNotifierService; import org.apache.fineract.portfolio.loanaccount.domain.Loan; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; @@ -83,14 +83,17 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService { @PostConstruct public void addListeners() { - businessEventNotifierService.addBusinessEventListener(LoanApprovedBusinessEvent.class, new ValidateOnBusinessEvent()); - businessEventNotifierService.addBusinessEventListener(LoanApprovedBusinessEvent.class, new HoldFundsOnBusinessEvent()); - businessEventNotifierService.addBusinessEventListener(LoanUndoApprovalBusinessEvent.class, new UndoAllFundTransactions()); - businessEventNotifierService.addBusinessEventListener(LoanUndoDisbursalBusinessEvent.class, new ReverseAllFundsOnBusinessEvent()); - businessEventNotifierService.addBusinessEventListener(LoanAdjustTransactionBusinessEvent.class, new AdjustFundsOnBusinessEvent()); - businessEventNotifierService.addBusinessEventListener(LoanMakeRepaymentBusinessEvent.class, new ReleaseFundsOnBusinessEvent()); - businessEventNotifierService.addBusinessEventListener(LoanWrittenOffBusinessEvent.class, new ReleaseAllFunds()); - businessEventNotifierService.addBusinessEventListener(LoanUndoWrittenOffBusinessEvent.class, new ReverseFundsOnBusinessEvent()); + businessEventNotifierService.addPostBusinessEventListener(LoanApprovedBusinessEvent.class, new ValidateOnBusinessEvent()); + businessEventNotifierService.addPostBusinessEventListener(LoanApprovedBusinessEvent.class, new HoldFundsOnBusinessEvent()); + businessEventNotifierService.addPostBusinessEventListener(LoanUndoApprovalBusinessEvent.class, new UndoAllFundTransactions()); + businessEventNotifierService.addPostBusinessEventListener(LoanUndoDisbursalBusinessEvent.class, + new ReverseAllFundsOnBusinessEvent()); + businessEventNotifierService.addPostBusinessEventListener(LoanAdjustTransactionBusinessEvent.class, + new AdjustFundsOnBusinessEvent()); + businessEventNotifierService.addPostBusinessEventListener(LoanTransactionMakeRepaymentPostBusinessEvent.class, + new ReleaseFundsOnBusinessEvent()); + businessEventNotifierService.addPostBusinessEventListener(LoanWrittenOffPostBusinessEvent.class, new ReleaseAllFunds()); + businessEventNotifierService.addPostBusinessEventListener(LoanUndoWrittenOffBusinessEvent.class, new ReverseFundsOnBusinessEvent()); } @Override @@ -528,10 +531,10 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService { } } - private class ReleaseFundsOnBusinessEvent implements BusinessEventListener { + private class ReleaseFundsOnBusinessEvent implements BusinessEventListener { @Override - public void onBusinessEvent(LoanMakeRepaymentBusinessEvent event) { + public void onBusinessEvent(LoanTransactionMakeRepaymentPostBusinessEvent event) { LoanTransaction loanTransaction = event.get(); if (releaseLoanIds.containsKey(loanTransaction.getLoan().getId())) { completeGuarantorFund(loanTransaction); @@ -589,10 +592,10 @@ public class GuarantorDomainServiceImpl implements GuarantorDomainService { } } - private class ReleaseAllFunds implements BusinessEventListener { + private class ReleaseAllFunds implements BusinessEventListener { @Override - public void onBusinessEvent(LoanWrittenOffBusinessEvent event) { + public void onBusinessEvent(LoanWrittenOffPostBusinessEvent event) { LoanTransaction loanTransaction = event.get(); releaseAllGuarantors(loanTransaction); } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java index f4281ca03..368e45bcb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java @@ -590,7 +590,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa StatusEnum.CREATE.getCode().longValue(), EntityTables.LOAN.getForeignKeyColumnNameOnDatatable(), newLoanApplication.productId()); - businessEventNotifierService.notifyBusinessEvent(new LoanCreatedBusinessEvent(newLoanApplication)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanCreatedBusinessEvent(newLoanApplication)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // @@ -1477,7 +1477,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa this.noteRepository.save(note); } - businessEventNotifierService.notifyBusinessEvent(new LoanApprovedBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanApprovedBusinessEvent(loan)); } return new CommandProcessingResultBuilder() // @@ -1555,7 +1555,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa final Note note = Note.loanNote(loan, noteText); this.noteRepository.save(note); } - businessEventNotifierService.notifyBusinessEvent(new LoanUndoApprovalBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanUndoApprovalBusinessEvent(loan)); } return new CommandProcessingResultBuilder() // @@ -1625,7 +1625,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa this.noteRepository.save(note); } } - businessEventNotifierService.notifyBusinessEvent(new LoanRejectedBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanRejectedBusinessEvent(loan)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withEntityId(loan.getId()) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java index ac3076c08..bedca8d9e 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanArrearsAgingServiceImpl.java @@ -42,10 +42,10 @@ import org.apache.fineract.portfolio.businessevent.domain.loan.LoanApplyOverdueC import org.apache.fineract.portfolio.businessevent.domain.loan.LoanDisbursalBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.charge.LoanAddChargeBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.charge.LoanWaiveChargeBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanChargePaymentBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanForeClosureBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanMakeRepaymentBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanRefundBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanChargePaymentPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanForeClosurePostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanRefundPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanUndoWrittenOffBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanWaiveInterestBusinessEvent; import org.apache.fineract.portfolio.businessevent.service.BusinessEventNotifierService; @@ -74,19 +74,22 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService { @PostConstruct public void registerForNotification() { - businessEventNotifierService.addBusinessEventListener(LoanRefundBusinessEvent.class, new RefundEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanAdjustTransactionBusinessEvent.class, + businessEventNotifierService.addPostBusinessEventListener(LoanRefundPostBusinessEvent.class, new RefundEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanAdjustTransactionBusinessEvent.class, new AdjustTransactionBusinessEventEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanMakeRepaymentBusinessEvent.class, new MakeRepaymentEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanUndoWrittenOffBusinessEvent.class, new UndoWrittenOffEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanWaiveInterestBusinessEvent.class, new WaiveInterestEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanAddChargeBusinessEvent.class, new AddChargeEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanWaiveChargeBusinessEvent.class, new WaiveChargeEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanChargePaymentBusinessEvent.class, new LoanChargePaymentEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanApplyOverdueChargeBusinessEvent.class, + businessEventNotifierService.addPostBusinessEventListener(LoanTransactionMakeRepaymentPostBusinessEvent.class, + new MakeRepaymentEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanUndoWrittenOffBusinessEvent.class, new UndoWrittenOffEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanWaiveInterestBusinessEvent.class, new WaiveInterestEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanAddChargeBusinessEvent.class, new AddChargeEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanWaiveChargeBusinessEvent.class, new WaiveChargeEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanChargePaymentPostBusinessEvent.class, + new LoanChargePaymentEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanApplyOverdueChargeBusinessEvent.class, new ApplyOverdueChargeEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanDisbursalBusinessEvent.class, new DisbursementEventListener()); - businessEventNotifierService.addBusinessEventListener(LoanForeClosureBusinessEvent.class, new LoanForeClosureEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanDisbursalBusinessEvent.class, new DisbursementEventListener()); + businessEventNotifierService.addPostBusinessEventListener(LoanForeClosurePostBusinessEvent.class, + new LoanForeClosureEventListener()); } @Transactional @@ -487,11 +490,11 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService { } } - private class RefundEventListener implements BusinessEventListener { + private class RefundEventListener implements BusinessEventListener { @SuppressWarnings("unused") @Override - public void onBusinessEvent(LoanRefundBusinessEvent event) { + public void onBusinessEvent(LoanRefundPostBusinessEvent event) { LoanTransaction loanTransaction = event.get(); Loan loan = loanTransaction.getLoan(); handleArrearsForLoan(loan); @@ -511,10 +514,10 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService { } } - private class MakeRepaymentEventListener implements BusinessEventListener { + private class MakeRepaymentEventListener implements BusinessEventListener { @Override - public void onBusinessEvent(LoanMakeRepaymentBusinessEvent event) { + public void onBusinessEvent(LoanTransactionMakeRepaymentPostBusinessEvent event) { LoanTransaction loanTransaction = event.get(); Loan loan = loanTransaction.getLoan(); handleArrearsForLoan(loan); @@ -541,20 +544,20 @@ public class LoanArrearsAgingServiceImpl implements LoanArrearsAgingService { } } - private class LoanForeClosureEventListener implements BusinessEventListener { + private class LoanForeClosureEventListener implements BusinessEventListener { @Override - public void onBusinessEvent(LoanForeClosureBusinessEvent event) { + public void onBusinessEvent(LoanForeClosurePostBusinessEvent event) { LoanTransaction loanTransaction = event.get(); Loan loan = loanTransaction.getLoan(); handleArrearsForLoan(loan); } } - private class LoanChargePaymentEventListener implements BusinessEventListener { + private class LoanChargePaymentEventListener implements BusinessEventListener { @Override - public void onBusinessEvent(LoanChargePaymentBusinessEvent event) { + public void onBusinessEvent(LoanChargePaymentPostBusinessEvent event) { LoanTransaction loanTransaction = event.get(); Loan loan = loanTransaction.getLoan(); handleArrearsForLoan(loan); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index a1bc6a52d..aeeb40fbb 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -113,7 +113,8 @@ import org.apache.fineract.portfolio.businessevent.domain.loan.charge.LoanWaiveC import org.apache.fineract.portfolio.businessevent.domain.loan.charge.LoanWaiveChargeUndoBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanUndoWrittenOffBusinessEvent; import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanWaiveInterestBusinessEvent; -import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanWrittenOffBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanWrittenOffPostBusinessEvent; +import org.apache.fineract.portfolio.businessevent.domain.loan.transaction.LoanWrittenOffPreBusinessEvent; import org.apache.fineract.portfolio.businessevent.service.BusinessEventNotifierService; import org.apache.fineract.portfolio.calendar.domain.Calendar; import org.apache.fineract.portfolio.calendar.domain.CalendarEntityType; @@ -377,6 +378,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf scheduleGeneratorDTO.isSkipRepaymentOnFirstDayofMonth(), scheduleGeneratorDTO.getNumberOfdays()); } + businessEventNotifierService.notifyPreBusinessEvent(new LoanDisbursalBusinessEvent(loan)); + final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); @@ -525,7 +528,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf updatePostDatedChecks(postDatedChecks); } - businessEventNotifierService.notifyBusinessEvent(new LoanDisbursalBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanDisbursalBusinessEvent(loan)); Long entityId = loan.getId(); @@ -679,6 +682,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf syncExpectedDateWithActualDisbursementDate(loan, actualDisbursementDate); } checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanDisbursalBusinessEvent(loan)); final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); @@ -769,7 +773,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } updateRecurringCalendarDatesForInterestRecalculation(loan); loanAccountDomainService.recalculateAccruals(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanDisbursalBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanDisbursalBusinessEvent(loan)); } return changes; @@ -807,6 +811,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final AppUser currentUser = getAppUserIfPresent(); final Loan loan = this.loanAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanUndoDisbursalBusinessEvent(loan)); removeLoanCycle(loan); final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); @@ -848,7 +853,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Map accountingBridgeData = loan.deriveAccountingBridgeData(applicationCurrency.toData(), existingTransactionIds, existingReversedTransactionIds, isAccountTransfer); journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData); - businessEventNotifierService.notifyBusinessEvent(new LoanUndoDisbursalBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanUndoDisbursalBusinessEvent(loan)); } return new CommandProcessingResultBuilder() // @@ -1017,6 +1022,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf checkClientOrGroupActive(loan); final LoanTransaction transactionToAdjust = this.loanTransactionRepository.findById(transactionId) .orElseThrow(() -> new LoanTransactionNotFoundException(transactionId)); + businessEventNotifierService.notifyPreBusinessEvent( + new LoanAdjustTransactionBusinessEvent(new LoanAdjustTransactionBusinessEvent.Data(transactionToAdjust))); if (this.accountTransfersReadPlatformService.isAccountTransfer(transactionId, PortfolioAccountType.LOAN)) { throw new PlatformServiceUnavailableException("error.msg.loan.transfer.transaction.update.not.allowed", "Loan transaction:" + transactionId + " update not allowed as it involves in account transfer", transactionId); @@ -1129,7 +1136,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf if (newTransactionDetail.isRepaymentType() && newTransactionDetail.isGreaterThanZero(loan.getPrincpal().getCurrency())) { eventData.setNewTransactionDetail(newTransactionDetail); } - businessEventNotifierService.notifyBusinessEvent(new LoanAdjustTransactionBusinessEvent(eventData)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanAdjustTransactionBusinessEvent(eventData)); return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(transactionId) .withOfficeId(loan.getOfficeId()).withClientId(loan.getClientId()).withGroupId(loan.getGroupId()).withLoanId(loanId) @@ -1170,6 +1177,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } final LoanTransaction waiveInterestTransaction = LoanTransaction.waiver(loan.getOffice(), loan, transactionAmountAsMoney, transactionDate, interestComponent, unrecognizedIncome, DateUtils.getLocalDateTimeOfTenant(), currentUser); + businessEventNotifierService.notifyPreBusinessEvent(new LoanWaiveInterestBusinessEvent(waiveInterestTransaction)); LocalDate recalculateFrom = null; if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) { recalculateFrom = transactionDate; @@ -1206,7 +1214,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); loanAccountDomainService.recalculateAccruals(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanWaiveInterestBusinessEvent(waiveInterestTransaction)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanWaiveInterestBusinessEvent(waiveInterestTransaction)); return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(waiveInterestTransaction.getId()) .withOfficeId(loan.getOfficeId()).withClientId(loan.getClientId()).withGroupId(loan.getGroupId()).withLoanId(loanId) .with(changes).build(); @@ -1233,6 +1241,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanWrittenOffPreBusinessEvent(loan)); entityDatatableChecksWritePlatformService.runTheCheckForProduct(loanId, EntityTables.LOAN.getName(), StatusEnum.WRITE_OFF.getCode().longValue(), EntityTables.LOAN.getForeignKeyColumnNameOnDatatable(), loan.productId()); @@ -1268,7 +1277,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); loanAccountDomainService.recalculateAccruals(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanWrittenOffBusinessEvent(writeOff)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanWrittenOffPostBusinessEvent(writeOff)); return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(writeOff.getId()) .withOfficeId(loan.getOfficeId()).withClientId(loan.getClientId()).withGroupId(loan.getGroupId()).withLoanId(loanId) .with(changes).build(); @@ -1284,6 +1293,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Loan loan = this.loanAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanCloseBusinessEvent(loan)); final Map changes = new LinkedHashMap<>(); changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate")); @@ -1325,7 +1335,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } loanAccountDomainService.recalculateAccruals(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanCloseBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanCloseBusinessEvent(loan)); // Update loan transaction on repayment. if (AccountType.fromInt(loan.getLoanType()).isIndividualAccount()) { @@ -1370,6 +1380,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Loan loan = this.loanAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); removeLoanCycle(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanCloseAsRescheduleBusinessEvent(loan)); final Map changes = new LinkedHashMap<>(); changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate")); @@ -1386,7 +1397,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Note note = Note.loanNote(loan, noteText); this.noteRepository.save(note); } - businessEventNotifierService.notifyBusinessEvent(new LoanCloseAsRescheduleBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanCloseAsRescheduleBusinessEvent(loan)); // disable all active standing instructions linked to the loan this.loanAccountDomainService.disableStandingInstructionsLinkedToClosedLoan(loan); @@ -1464,6 +1475,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf disbursementDetail.expectedDisbursementDateAsLocalDate(), null, null); loanTrancheDisbursementCharge = new LoanTrancheDisbursementCharge(loanCharge, disbursementDetail); loanCharge.updateLoanTrancheDisbursementCharge(loanTrancheDisbursementCharge); + businessEventNotifierService.notifyPreBusinessEvent(new LoanAddChargeBusinessEvent(loanCharge)); validateAddLoanCharge(loan, chargeDefinition, loanCharge); addCharge(loan, chargeDefinition, loanCharge); isAppliedOnBackDate = true; @@ -1475,6 +1487,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf loan.addTrancheLoanCharge(chargeDefinition); } else { loanCharge = LoanCharge.createNewFromJson(loan, chargeDefinition, command); + businessEventNotifierService.notifyPreBusinessEvent(new LoanAddChargeBusinessEvent(loanCharge)); validateAddLoanCharge(loan, chargeDefinition, loanCharge); isAppliedOnBackDate = addCharge(loan, chargeDefinition, loanCharge); @@ -1513,7 +1526,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf && loan.isFeeCompoundingEnabledForInterestRecalculation()) { this.loanAccountDomainService.recalculateAccruals(loan); } - businessEventNotifierService.notifyBusinessEvent(new LoanAddChargeBusinessEvent(loanCharge)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanAddChargeBusinessEvent(loanCharge)); return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(loanCharge.getId()) .withOfficeId(loan.getOfficeId()).withClientId(loan.getClientId()).withGroupId(loan.getGroupId()).withLoanId(loanId) .build(); @@ -1628,11 +1641,12 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf throw new LoanChargeCannotBeUpdatedException(LoanChargeCannotBeUpdatedReason.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanCharge.getId()); } + businessEventNotifierService.notifyPreBusinessEvent(new LoanUpdateChargeBusinessEvent(loanCharge)); final Map changes = loan.updateLoanCharge(loanCharge, command); saveLoanWithDataIntegrityViolationChecks(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanUpdateChargeBusinessEvent(loanCharge)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanUpdateChargeBusinessEvent(loanCharge)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withEntityId(loanChargeId) // @@ -1684,6 +1698,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Map changes = new LinkedHashMap<>(3); + businessEventNotifierService.notifyPreBusinessEvent(new LoanWaiveChargeUndoBusinessEvent(loanCharge)); + if (loanCharge.isInstalmentFee()) { LoanInstallmentCharge chargePerInstallment = null; @@ -1770,7 +1786,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf saveLoanWithDataIntegrityViolationChecks(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanWaiveChargeUndoBusinessEvent(loanCharge)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanWaiveChargeUndoBusinessEvent(loanCharge)); LoanTransaction loanTransactionData = this.loanTransactionRepository.getById(command.entityId()); changes.put("principalPortion", loanTransactionData.getPrincipalPortion()); @@ -1811,6 +1827,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } else if (loanCharge.isPaid()) { throw new LoanChargeCannotBeWaivedException(LoanChargeCannotBeWaivedReason.ALREADY_PAID, loanCharge.getId()); } + businessEventNotifierService.notifyPreBusinessEvent(new LoanWaiveChargeBusinessEvent(loanCharge)); Integer loanInstallmentNumber = null; if (loanCharge.isInstalmentFee()) { LoanInstallmentCharge chargePerInstallment = null; @@ -1859,7 +1876,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); - businessEventNotifierService.notifyBusinessEvent(new LoanWaiveChargeBusinessEvent(loanCharge)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanWaiveChargeBusinessEvent(loanCharge)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // @@ -1886,10 +1903,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf throw new LoanChargeCannotBeDeletedException(LoanChargeCannotBeDeletedReason.LOAN_NOT_IN_SUBMITTED_AND_PENDING_APPROVAL_STAGE, loanCharge.getId()); } + businessEventNotifierService.notifyPreBusinessEvent(new LoanDeleteChargeBusinessEvent(loanCharge)); loan.removeLoanCharge(loanCharge); saveLoanWithDataIntegrityViolationChecks(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanDeleteChargeBusinessEvent(loanCharge)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanDeleteChargeBusinessEvent(loanCharge)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withEntityId(loanChargeId) // @@ -2101,6 +2119,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf checkClientOrGroupActive(loan); validateTransactionsForTransfer(loan, transferDate); + businessEventNotifierService.notifyPreBusinessEvent(new LoanInitiateTransferBusinessEvent(loan)); + final List existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds()); final List existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds()); @@ -2113,7 +2133,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf saveLoanWithDataIntegrityViolationChecks(loan); postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); - businessEventNotifierService.notifyBusinessEvent(new LoanInitiateTransferBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanInitiateTransferBusinessEvent(loan)); return newTransferTransaction; } @@ -2123,6 +2143,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Staff loanOfficer) { AppUser currentUser = getAppUserIfPresent(); this.loanAssembler.setHelpers(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanAcceptTransferBusinessEvent(loan)); final List existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds()); final List existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds()); @@ -2142,7 +2163,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf saveLoanWithDataIntegrityViolationChecks(loan); postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); - businessEventNotifierService.notifyBusinessEvent(new LoanAcceptTransferBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanAcceptTransferBusinessEvent(loan)); return newTransferAcceptanceTransaction; } @@ -2152,6 +2173,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf public LoanTransaction withdrawLoanTransfer(final Loan loan, final LocalDate transferDate) { AppUser currentUser = getAppUserIfPresent(); this.loanAssembler.setHelpers(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanWithdrawTransferBusinessEvent(loan)); final List existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds()); final List existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds()); @@ -2165,7 +2187,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf saveLoanWithDataIntegrityViolationChecks(loan); postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); - businessEventNotifierService.notifyBusinessEvent(new LoanWithdrawTransferBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanWithdrawTransferBusinessEvent(loan)); return newTransferAcceptanceTransaction; } @@ -2174,9 +2196,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf @Override public void rejectLoanTransfer(final Loan loan) { this.loanAssembler.setHelpers(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanRejectTransferBusinessEvent(loan)); loan.setLoanStatus(LoanStatus.TRANSFER_ON_HOLD.getValue()); saveLoanWithDataIntegrityViolationChecks(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanRejectTransferBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanRejectTransferBusinessEvent(loan)); } @Transactional @@ -2194,6 +2217,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Loan loan = this.loanAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanReassignOfficerBusinessEvent(loan)); if (!loan.hasLoanOfficer(fromLoanOfficer)) { throw new LoanOfficerAssignmentException(loanId, fromLoanOfficerId); } @@ -2201,7 +2225,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf loan.reassignLoanOfficer(toLoanOfficer, dateOfLoanOfficerAssignment); saveLoanWithDataIntegrityViolationChecks(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanReassignOfficerBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanReassignOfficerBusinessEvent(loan)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // @@ -2231,6 +2255,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf for (final String loanIdString : loanIds) { final Long loanId = Long.valueOf(loanIdString); final Loan loan = this.loanAssembler.assembleFrom(loanId); + businessEventNotifierService.notifyPreBusinessEvent(new LoanReassignOfficerBusinessEvent(loan)); checkClientOrGroupActive(loan); if (!loan.hasLoanOfficer(fromLoanOfficer)) { @@ -2239,7 +2264,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf loan.reassignLoanOfficer(toLoanOfficer, dateOfLoanOfficerAssignment); saveLoanWithDataIntegrityViolationChecks(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanReassignOfficerBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanReassignOfficerBusinessEvent(loan)); } this.loanRepositoryWrapper.flush(); @@ -2264,10 +2289,12 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf if (loan.getLoanOfficer() == null) { throw new LoanOfficerUnassignmentException(loanId); } + businessEventNotifierService.notifyPreBusinessEvent(new LoanRemoveOfficerBusinessEvent(loan)); + loan.removeLoanOfficer(dateOfLoanOfficerunAssigned); saveLoanWithDataIntegrityViolationChecks(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanRemoveOfficerBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanRemoveOfficerBusinessEvent(loan)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // @@ -2635,7 +2662,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf && loan.isFeeCompoundingEnabledForInterestRecalculation()) { this.loanAccountDomainService.recalculateAccruals(loan); } - businessEventNotifierService.notifyBusinessEvent(new LoanApplyOverdueChargeBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanApplyOverdueChargeBusinessEvent(loan)); } } @@ -2715,6 +2742,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf LocalDate recalculateFrom = DateUtils.getLocalDateOfTenant(); if (loan != null) { + businessEventNotifierService.notifyPreBusinessEvent(new LoanApplyOverdueChargeBusinessEvent(loan)); for (Map.Entry entry : scheduleDates.entrySet()) { final LoanCharge loanCharge = LoanCharge.createNewFromJson(loan, chargeDefinition, command, entry.getValue()); @@ -2754,6 +2782,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } LocalDate recalculateFrom = null; LoanTransaction writeOffTransaction = loan.findWriteOffTransaction(); + businessEventNotifierService.notifyPreBusinessEvent(new LoanUndoWrittenOffBusinessEvent(writeOffTransaction)); ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, recalculateFrom); @@ -2770,7 +2799,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); this.loanAccountDomainService.recalculateAccruals(loan); if (writeOffTransaction != null) { - businessEventNotifierService.notifyBusinessEvent(new LoanUndoWrittenOffBusinessEvent(writeOffTransaction)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanUndoWrittenOffBusinessEvent(writeOffTransaction)); } return new CommandProcessingResultBuilder() // .withOfficeId(loan.getOfficeId()) // @@ -3022,6 +3051,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf Loan loan = this.loanAssembler.assembleFrom(loanId); LocalDate recalculateFrom = loan.fetchInterestRecalculateFromDate(); AppUser currentUser = getAppUserIfPresent(); + businessEventNotifierService.notifyPreBusinessEvent(new LoanInterestRecalculationBusinessEvent(loan)); final List existingTransactionIds = new ArrayList<>(); final List existingReversedTransactionIds = new ArrayList<>(); @@ -3043,7 +3073,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); loanAccountDomainService.recalculateAccruals(loan); - businessEventNotifierService.notifyBusinessEvent(new LoanInterestRecalculationBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanInterestRecalculationBusinessEvent(loan)); } @Override @@ -3190,6 +3220,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final LocalDate recalculateFromDate = loan.getLastRepaymentDate(); validateIsMultiDisbursalLoanAndDisbursedMoreThanOneTranche(loan); checkClientOrGroupActive(loan); + businessEventNotifierService.notifyPreBusinessEvent(new LoanUndoLastDisbursalBusinessEvent(loan)); final MonetaryCurrency currency = loan.getCurrency(); final ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency); @@ -3214,7 +3245,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Map accountingBridgeData = loan.deriveAccountingBridgeData(applicationCurrency.toData(), existingTransactionIds, existingReversedTransactionIds, isAccountTransfer); journalEntryWritePlatformService.createJournalEntriesForLoan(accountingBridgeData); - businessEventNotifierService.notifyBusinessEvent(new LoanUndoLastDisbursalBusinessEvent(loan)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanUndoLastDisbursalBusinessEvent(loan)); } return new CommandProcessingResultBuilder() // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java index 1b31bcaeb..8b6cff4cc 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java @@ -148,7 +148,7 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro fineractEntityAccessUtil.checkConfigurationAndAddProductResrictionsForUserOffice( FineractEntityAccessType.OFFICE_ACCESS_TO_LOAN_PRODUCTS, loanProduct.getId()); - businessEventNotifierService.notifyBusinessEvent(new LoanProductCreateBusinessEvent(loanProduct)); + businessEventNotifierService.notifyPostBusinessEvent(new LoanProductCreateBusinessEvent(loanProduct)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java index d25b94566..92456da73 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java @@ -138,7 +138,7 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds, transactionBooleanValues.isAccountTransfer(), backdatedTxnsAllowedTill); - businessEventNotifierService.notifyBusinessEvent(new SavingsWithdrawalBusinessEvent(withdrawal)); + businessEventNotifierService.notifyPostBusinessEvent(new SavingsWithdrawalBusinessEvent(withdrawal)); return withdrawal; } @@ -213,7 +213,7 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi this.savingsAccountRepository.saveAndFlush(account); postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds, isAccountTransfer, backdatedTxnsAllowedTill); - businessEventNotifierService.notifyBusinessEvent(new SavingsDepositBusinessEvent(deposit)); + businessEventNotifierService.notifyPostBusinessEvent(new SavingsDepositBusinessEvent(deposit)); return deposit; } diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java index 2cf66788d..9bc289577 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java @@ -230,7 +230,7 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl } final Long savingsId = account.getId(); - businessEventNotifierService.notifyBusinessEvent(new FixedDepositAccountCreateBusinessEvent(account)); + businessEventNotifierService.notifyPostBusinessEvent(new FixedDepositAccountCreateBusinessEvent(account)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // @@ -289,7 +289,7 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl financialYearBeginningMonth); account.validateApplicableInterestRate(); savingAccountRepository.save(account); - businessEventNotifierService.notifyBusinessEvent(new RecurringDepositAccountCreateBusinessEvent(account)); + businessEventNotifierService.notifyPostBusinessEvent(new RecurringDepositAccountCreateBusinessEvent(account)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java index 1bd5291e4..2e12c0b48 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java @@ -273,7 +273,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi } postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds, false); - businessEventNotifierService.notifyBusinessEvent(new SavingsActivateBusinessEvent(account)); + businessEventNotifierService.notifyPostBusinessEvent(new SavingsActivateBusinessEvent(account)); return new CommandProcessingResultBuilder() // .withEntityId(savingsId) // @@ -577,7 +577,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi } postInterest(account, postInterestAs, transactionDate, backdatedTxnsAllowedTill); - businessEventNotifierService.notifyBusinessEvent(new SavingsPostInterestBusinessEvent(account)); + businessEventNotifierService.notifyPostBusinessEvent(new SavingsPostInterestBusinessEvent(account)); return new CommandProcessingResultBuilder() // .withEntityId(savingsId) // .withOfficeId(account.officeId()) // @@ -1031,7 +1031,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi } - businessEventNotifierService.notifyBusinessEvent(new SavingsCloseBusinessEvent(account)); + businessEventNotifierService.notifyPostBusinessEvent(new SavingsCloseBusinessEvent(account)); // disable all standing orders linked to the savings account disableStandingInstructionsLinkedToClosedSavings(account); return new CommandProcessingResultBuilder() // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java index 78ba63d97..9e9a00f17 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java @@ -265,7 +265,7 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl this.entityDatatableChecksWritePlatformService.runTheCheckForProduct(savingsId, EntityTables.SAVING.getName(), StatusEnum.CREATE.getCode().longValue(), EntityTables.SAVING.getForeignKeyColumnNameOnDatatable(), account.productId()); - businessEventNotifierService.notifyBusinessEvent(new SavingsCreateBusinessEvent(account)); + businessEventNotifierService.notifyPostBusinessEvent(new SavingsCreateBusinessEvent(account)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // @@ -493,7 +493,7 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl } } - businessEventNotifierService.notifyBusinessEvent(new SavingsApproveBusinessEvent(savingsAccount)); + businessEventNotifierService.notifyPostBusinessEvent(new SavingsApproveBusinessEvent(savingsAccount)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // @@ -615,7 +615,7 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl this.noteRepository.save(note); } } - businessEventNotifierService.notifyBusinessEvent(new SavingsRejectBusinessEvent(savingsAccount)); + businessEventNotifierService.notifyPostBusinessEvent(new SavingsRejectBusinessEvent(savingsAccount)); return new CommandProcessingResultBuilder() // .withCommandId(command.commandId()) // .withEntityId(savingsId) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountWritePlatformServiceJpaRepositoryImpl.java index 622abd6c4..7c5a1010d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/service/ShareAccountWritePlatformServiceJpaRepositoryImpl.java @@ -105,7 +105,7 @@ public class ShareAccountWritePlatformServiceJpaRepositoryImpl implements ShareA journalEntryWritePlatformService.createJournalEntriesForShares( populateJournalEntries(account, account.getPendingForApprovalSharePurchaseTransactions())); - businessEventNotifierService.notifyBusinessEvent(new ShareAccountCreateBusinessEvent(account)); + businessEventNotifierService.notifyPostBusinessEvent(new ShareAccountCreateBusinessEvent(account)); return new CommandProcessingResultBuilder() // .withCommandId(jsonCommand.commandId()) // @@ -281,7 +281,7 @@ public class ShareAccountWritePlatformServiceJpaRepositoryImpl implements ShareA this.journalEntryWritePlatformService.createJournalEntriesForShares(populateJournalEntries(account, journalTransactions)); - businessEventNotifierService.notifyBusinessEvent(new ShareAccountApproveBusinessEvent(account)); + businessEventNotifierService.notifyPostBusinessEvent(new ShareAccountApproveBusinessEvent(account)); return new CommandProcessingResultBuilder() // .withCommandId(jsonCommand.commandId()) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductWritePlatformServiceJpaRepositoryImpl.java index 1edd2cf3f..e8f7fc345 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/service/ShareProductWritePlatformServiceJpaRepositoryImpl.java @@ -131,7 +131,7 @@ public class ShareProductWritePlatformServiceJpaRepositoryImpl implements ShareP } this.shareProductDividentPayOutDetailsRepository.save(dividendPayOutDetails); - businessEventNotifierService.notifyBusinessEvent(new ShareProductDividentsCreateBusinessEvent(productId)); + businessEventNotifierService.notifyPostBusinessEvent(new ShareProductDividentsCreateBusinessEvent(productId)); return new CommandProcessingResultBuilder() // .withCommandId(jsonCommand.commandId()) //