This is an automated email from the ASF dual-hosted git repository.
adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 4e3bcbf97 FINERACT-2150: disbursement not allowed on charged-off loan
4e3bcbf97 is described below
commit 4e3bcbf970219e05fb338f51716e8d70c40d0022
Author: adam.magyari <[email protected]>
AuthorDate: Thu Nov 21 13:50:49 2024 +0100
FINERACT-2150: disbursement not allowed on charged-off loan
---
.../loanaccount/serialization/LoanTransactionValidator.java | 8 +++-----
.../fineract/integrationtests/ClientLoanIntegrationTest.java | 10 +++++++++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanTransactionValidator.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanTransactionValidator.java
index 317babae0..a15efeb0f 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanTransactionValidator.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanTransactionValidator.java
@@ -152,11 +152,9 @@ public final class LoanTransactionValidator {
validateLoanClientIsActive(loan);
validateLoanGroupIsActive(loan);
- if (loan.isChargedOff() &&
DateUtils.isBefore(actualDisbursementDate, loan.getChargedOffOnDate())) {
- throw new
GeneralPlatformDomainRuleException("error.msg.transaction.date.cannot.be.earlier.than.charge.off.date",
"Loan: "
- + loan.getId()
- + " backdated transaction is not allowed. Transaction
date cannot be earlier than the charge-off date of the loan",
- loan.getId());
+ if (loan.isChargedOff()) {
+ throw new
GeneralPlatformDomainRuleException("error.msg.loan.disbursal.not.allowed.on.charged.off",
+ "Loan: " + loan.getId() + " disbursement is not
allowed on charged-off loan.");
}
boolean isSingleDisburseLoan =
!loan.getLoanProduct().isMultiDisburseLoan();
diff --git
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
index a7490ce99..8f8b7a6ff 100644
---
a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
+++
b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
@@ -6362,7 +6362,15 @@ public class ClientLoanIntegrationTest extends
BaseLoanIntegrationTest {
.locale("en").dateFormat(DATETIME_PATTERN));
});
assertEquals(403, exception.getResponse().code());
-
assertTrue(exception.getMessage().contains("error.msg.transaction.date.cannot.be.earlier.than.charge.off.date"));
+
assertTrue(exception.getMessage().contains("error.msg.loan.disbursal.not.allowed.on.charged.off"));
+
+ exception = assertThrows(CallFailedRuntimeException.class, () -> {
+ errorLoanTransactionHelper.disburseLoan((long) loanID,
+ new PostLoansLoanIdRequest().actualDisbursementDate("7
September 2022").transactionAmount(new BigDecimal("10"))
+ .locale("en").dateFormat(DATETIME_PATTERN));
+ });
+ assertEquals(403, exception.getResponse().code());
+
assertTrue(exception.getMessage().contains("error.msg.loan.disbursal.not.allowed.on.charged.off"));
LOAN_TRANSACTION_HELPER.makeLoanRepayment((long) loanID, new
PostLoansLoanIdTransactionsRequest().dateFormat(DATETIME_PATTERN)
.transactionDate("07 September
2022").locale("en").transactionAmount(5000.0));