FINERACT-2205: Add tests when charge is added after the charge off date and forbid backdated charge-off transactions in the middle of the monetary activity.

This commit is contained in:
mariiaKraievska
2025-02-03 16:29:45 +01:00
committed by Adam Saghy
parent bc0293bfa1
commit 69317d62c8
11 changed files with 582 additions and 215 deletions
@@ -3581,4 +3581,17 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
return (chargeOffTransaction == null) ? false : (chargeOffTransaction.getDateOf().compareTo(onDate) <= 0);
}
public boolean hasMonetaryActivityAfter(final LocalDate transactionDate) {
for (LoanTransaction transaction : this.getLoanTransactions()) {
if (transaction.getTransactionDate().isAfter(transactionDate) && !transaction.isNonMonetaryTransaction()) {
return true;
}
}
for (LoanCharge loanCharge : this.getLoanCharges()) {
if (!loanCharge.determineIfFullyPaid() && loanCharge.getSubmittedOnDate().isAfter(transactionDate)) {
return true;
}
}
return false;
}
}
@@ -511,7 +511,7 @@ public class LoanCharge extends AbstractAuditableWithUTCDateTimeCustom<Long> {
return this.dueDate; // TODO delete duplicated method
}
private boolean determineIfFullyPaid() {
public boolean determineIfFullyPaid() {
if (this.amount == null) {
return true;
}