[FINERACT-1958] Business events for down payment installments
This commit is contained in:
+2
@@ -375,6 +375,8 @@ final class LoansApiResourceSwagger {
|
||||
public Double totalInstallmentAmountForPeriod;
|
||||
@Schema(example = "2.000000")
|
||||
public Double totalCredits;
|
||||
@Schema(example = "true")
|
||||
public Boolean downPaymentPeriod;
|
||||
}
|
||||
|
||||
static final class GetLoansLoanIdDisbursementDetails {
|
||||
|
||||
+2
-4
@@ -53,8 +53,6 @@ import org.apache.fineract.infrastructure.event.business.domain.loan.transaction
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanRefundPostBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanRefundPreBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionDownPaymentPostBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionDownPaymentPreBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionGoodwillCreditPostBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionGoodwillCreditPreBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent;
|
||||
@@ -292,7 +290,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
} else if (isRecoveryRepayment) {
|
||||
repaymentEvent = new LoanTransactionRecoveryPaymentPreBusinessEvent(loan);
|
||||
} else if (repaymentTransactionType.isDownPayment()) {
|
||||
repaymentEvent = new LoanTransactionDownPaymentPreBusinessEvent(loan);
|
||||
repaymentEvent = new LoanTransactionMakeRepaymentPreBusinessEvent(loan);
|
||||
}
|
||||
return repaymentEvent;
|
||||
}
|
||||
@@ -313,7 +311,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
||||
} else if (isRecoveryRepayment) {
|
||||
repaymentEvent = new LoanTransactionRecoveryPaymentPostBusinessEvent(transaction);
|
||||
} else if (repaymentTransactionType.isDownPayment()) {
|
||||
repaymentEvent = new LoanTransactionDownPaymentPostBusinessEvent(transaction);
|
||||
repaymentEvent = new LoanTransactionMakeRepaymentPostBusinessEvent(transaction);
|
||||
}
|
||||
return repaymentEvent;
|
||||
}
|
||||
|
||||
+10
-1
@@ -82,6 +82,8 @@ import org.apache.fineract.infrastructure.event.business.domain.loan.transaction
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanChargeOffPostBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanChargeOffPreBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanDisbursalTransactionBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionMakeRepaymentPostBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanTransactionMakeRepaymentPreBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanUndoChargeOffBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanUndoWrittenOffBusinessEvent;
|
||||
import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanWaiveInterestBusinessEvent;
|
||||
@@ -456,7 +458,14 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO, null, downPaymentEnabled);
|
||||
}
|
||||
loan.adjustNetDisbursalAmount(amountToDisburse.getAmount());
|
||||
loan.handleDownPayment(amountToDisburse.getAmount(), command, scheduleGeneratorDTO);
|
||||
if (loan.isAutoRepaymentForDownPaymentEnabled()) {
|
||||
businessEventNotifierService.notifyPreBusinessEvent(new LoanTransactionMakeRepaymentPreBusinessEvent(loan));
|
||||
LoanTransaction downPaymentTransaction = loan.handleDownPayment(amountToDisburse.getAmount(), command,
|
||||
scheduleGeneratorDTO);
|
||||
businessEventNotifierService
|
||||
.notifyPostBusinessEvent(new LoanTransactionMakeRepaymentPostBusinessEvent(downPaymentTransaction));
|
||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanBalanceChangedBusinessEvent(loan));
|
||||
}
|
||||
}
|
||||
if (!changes.isEmpty()) {
|
||||
if (changedTransactionDetail != null) {
|
||||
|
||||
Reference in New Issue
Block a user