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:
committed by
Adam Saghy
parent
bc0293bfa1
commit
69317d62c8
+13
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user