FINERACT-1971 Credit balance refund for future date shall be rejected

This commit is contained in:
Peter Bagrij
2023-11-30 16:27:52 +01:00
committed by Adam Saghy
parent 5e5511f70a
commit 8505145fde
3 changed files with 58 additions and 5 deletions
@@ -688,6 +688,10 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
@Override
public LoanTransaction creditBalanceRefund(final Loan loan, final LocalDate transactionDate, final BigDecimal transactionAmount,
final String noteText, final ExternalId externalId, PaymentDetail paymentDetail) {
if (transactionDate.isAfter(DateUtils.getBusinessLocalDate())) {
throw new GeneralPlatformDomainRuleException("error.msg.transaction.date.cannot.be.in.the.future",
"Loan: " + loan.getId() + ", Credit Balance Refund transaction cannot be created for the future.", loan.getId());
}
if (loan.isChargedOff() && DateUtils.isBefore(transactionDate, loan.getChargedOffOnDate())) {
throw new GeneralPlatformDomainRuleException("error.msg.transaction.date.cannot.be.earlier.than.charge.off.date", "Loan: "
+ loan.getId()