FINERACT-2148: Stop recalculating interest if the loan is charged-off
This commit is contained in:
committed by
Adam Saghy
parent
e1d043bb2d
commit
4f1184f20b
+8
@@ -79,6 +79,14 @@ final class LoanTransactionsApiResourceSwagger {
|
||||
|
||||
@Schema(example = "200.000000")
|
||||
public Double amount;
|
||||
@Schema(example = "100.000000")
|
||||
public Double principalPortion;
|
||||
@Schema(example = "80.000000")
|
||||
public Double interestPortion;
|
||||
@Schema(example = "20.000000")
|
||||
public Double feeChargesPortion;
|
||||
@Schema(example = "20.000000")
|
||||
public Double penaltyChargesPortion;
|
||||
|
||||
public GetLoanCurrency currency;
|
||||
}
|
||||
|
||||
+7
-1
@@ -2722,7 +2722,7 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
public OutstandingAmountsDTO fetchPrepaymentDetail(final ScheduleGeneratorDTO scheduleGeneratorDTO, final LocalDate onDate) {
|
||||
OutstandingAmountsDTO outstandingAmounts;
|
||||
|
||||
if (this.loanRepaymentScheduleDetail.isInterestRecalculationEnabled()) {
|
||||
if (this.loanRepaymentScheduleDetail.isInterestRecalculationEnabled() && !isChargeOffOnDate(onDate)) {
|
||||
final MathContext mc = MoneyHelper.getMathContext();
|
||||
|
||||
final InterestMethod interestMethod = this.loanRepaymentScheduleDetail.getInterestMethod();
|
||||
@@ -3571,4 +3571,10 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
||||
public boolean isProgressiveSchedule() {
|
||||
return getLoanProductRelatedDetail().getLoanScheduleType() == PROGRESSIVE;
|
||||
}
|
||||
|
||||
public boolean isChargeOffOnDate(final LocalDate onDate) {
|
||||
final LoanTransaction chargeOffTransaction = findChargedOffTransaction();
|
||||
return (chargeOffTransaction == null) ? false : (chargeOffTransaction.getDateOf().compareTo(onDate) <= 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ public class LoanScheduleService {
|
||||
}
|
||||
|
||||
public void recalculateScheduleFromLastTransaction(final Loan loan, final ScheduleGeneratorDTO generatorDTO) {
|
||||
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled() && !loan.isChargedOff()) {
|
||||
regenerateRepaymentScheduleWithInterestRecalculation(loan, generatorDTO);
|
||||
} else {
|
||||
regenerateRepaymentSchedule(loan, generatorDTO);
|
||||
@@ -73,7 +73,7 @@ public class LoanScheduleService {
|
||||
* loanTransaction.getTransactionDate().isAfter(recalculateFrom)) { recalculateFrom =
|
||||
* loanTransaction.getTransactionDate(); } } generatorDTO.setRecalculateFrom(recalculateFrom);
|
||||
*/
|
||||
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled() && !loan.isChargedOff()) {
|
||||
regenerateRepaymentScheduleWithInterestRecalculation(loan, generatorDTO);
|
||||
} else {
|
||||
regenerateRepaymentSchedule(loan, generatorDTO);
|
||||
|
||||
Reference in New Issue
Block a user