FINERACT-2081: Fix Accrual activity - reverse and replayed couple of times after backdated repayment
This commit is contained in:
committed by
Adam Saghy
parent
991a2c1af4
commit
7642530393
+5
@@ -1058,4 +1058,9 @@ public class LoanRepaymentScheduleInstallment extends AbstractAuditableWithUTCDa
|
||||
public enum PaymentAction {
|
||||
PAY, UNPAY
|
||||
}
|
||||
|
||||
public boolean isTransactionDateWithinPeriod(LocalDate referenceDate) {
|
||||
return DateUtils.isAfter(referenceDate, getFromDate()) && !DateUtils.isAfter(referenceDate, getDueDate());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
@@ -1035,4 +1035,8 @@ public class LoanTransaction extends AbstractAuditableWithUTCDateTimeCustom<Long
|
||||
|
||||
// TODO missing hashCode(), equals(Object obj), but probably OK as long as
|
||||
// this is never stored in a Collection.
|
||||
|
||||
public void updateTransactionDate(final LocalDate transactionDate) {
|
||||
this.dateOf = transactionDate;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-1
@@ -239,7 +239,16 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen
|
||||
Money interestPortion = currentInstallment.getInterestCharged(currency);
|
||||
Money feeChargesPortion = currentInstallment.getFeeChargesCharged(currency);
|
||||
Money penaltyChargesPortion = currentInstallment.getPenaltyChargesCharged(currency);
|
||||
loanTransaction.updateComponentsAndTotal(principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion);
|
||||
if (interestPortion.plus(feeChargesPortion).plus(penaltyChargesPortion).isZero()) {
|
||||
loanTransaction.reverse();
|
||||
} else {
|
||||
loanTransaction.updateComponentsAndTotal(principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion);
|
||||
final Loan loan = loanTransaction.getLoan();
|
||||
if ((loan.isClosedObligationsMet() || loan.isOverPaid()) && currentInstallment.isObligationsMet()
|
||||
&& currentInstallment.isTransactionDateWithinPeriod(currentInstallment.getObligationsMetOnDate())) {
|
||||
loanTransaction.updateTransactionDate(currentInstallment.getObligationsMetOnDate());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user