FINERACT-1954: Waive null pointer and due date fix

- [x] Fix Waive due date handle
- [x] Fix null pointer exception
- [x] Integration test
This commit is contained in:
Janos Haber
2023-07-27 13:37:43 +02:00
committed by Adam Saghy
parent fe5d7cccee
commit ea172db712
6 changed files with 193 additions and 3 deletions
@@ -1081,7 +1081,12 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom {
transactionDate = loanCharge.getDueLocalDate();
}
} else if (loanCharge.isInstalmentFee()) {
transactionDate = loanCharge.getInstallmentLoanCharge(loanInstallmentNumber).getRepaymentInstallment().getDueDate();
LocalDate repaymentDueDate = loanCharge.getInstallmentLoanCharge(loanInstallmentNumber).getRepaymentInstallment().getDueDate();
if (repaymentDueDate.isAfter(DateUtils.getBusinessLocalDate())) {
transactionDate = DateUtils.getBusinessLocalDate();
} else {
transactionDate = repaymentDueDate;
}
}
scheduleGeneratorDTO.setRecalculateFrom(transactionDate);
@@ -25,6 +25,7 @@ import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
import org.apache.fineract.interoperation.util.MathUtil;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.portfolio.loanaccount.data.LoanInstallmentChargeData;
@@ -168,7 +169,7 @@ public class LoanInstallmentCharge extends AbstractPersistableCustom implements
}
public boolean isPending() {
return !(isPaid() || isWaived());
return !MathUtil.isZero(this.amountOutstanding);
}
public boolean isChargeAmountpaid(MonetaryCurrency currency) {