Skip to content

Commit d50906b

Browse files
somasorosdpcadamsaghy
authored andcommitted
FINERACT-2384: Incorrect reage transaction date and repayment schedule
1 parent d6323be commit d50906b

File tree

5 files changed

+187
-85
lines changed

5 files changed

+187
-85
lines changed

fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/DataValidatorBuilder.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,25 @@ public DataValidatorBuilder validateDateBefore(final LocalDate date) {
10171017
return this;
10181018
}
10191019

1020+
public DataValidatorBuilder validateDateAfterOrEqual(final LocalDate date) {
1021+
if (this.value == null && this.ignoreNullValue) {
1022+
return this;
1023+
}
1024+
1025+
if (this.value != null && date != null) {
1026+
final LocalDate dateVal = (LocalDate) this.value;
1027+
if (DateUtils.isBefore(dateVal, date)) {
1028+
String validationErrorCode = "validation.msg." + this.resource + "." + this.parameter + ".is.before.than.date";
1029+
String defaultEnglishMessage = "The parameter `" + this.parameter + "` must be greater than or equal to the provided date: "
1030+
+ date;
1031+
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode, defaultEnglishMessage, this.parameter,
1032+
dateVal, date);
1033+
this.dataValidationErrors.add(error);
1034+
}
1035+
}
1036+
return this;
1037+
}
1038+
10201039
public DataValidatorBuilder validateDateBeforeOrEqual(final LocalDate date) {
10211040
if (this.value == null && this.ignoreNullValue) {
10221041
return this;

fineract-e2e-tests-runner/src/test/resources/features/LoanReAging.feature

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,3 +2139,59 @@ Feature: LoanReAging
21392139
Then Loan Charges tab has the following data:
21402140
| Name | isPenalty | Payment due at | Due as of | Calculation type | Due | Paid | Waived | Outstanding |
21412141
| NSF fee | true | Specified due date | 03 May 2025 | Flat | 20.0 | 0.0 | 0.0 | 20.0 |
2142+
Scenario: Verify that Loan re-aging transaction - can be performed before maturity date and merges the corresponding normal installments
2143+
When Admin sets the business date to "01 January 2024"
2144+
When Admin creates a client with random data
2145+
When Admin creates a fully customized loan with the following data:
2146+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
2147+
| LP2_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
2148+
And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024"
2149+
When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount
2150+
When Admin sets the business date to "09 March 2024"
2151+
When Admin creates a Loan re-aging transaction by Loan external ID with the following data:
2152+
| frequencyNumber | frequencyType | startDate | numberOfInstallments |
2153+
| 1 | MONTHS | 15 March 2024 | 6 |
2154+
2155+
Scenario: Verify that Loan re-aging transaction - can be performed before maturity date and removes additional normal installments
2156+
When Admin sets the business date to "01 January 2024"
2157+
When Admin creates a client with random data
2158+
When Admin creates a fully customized loan with the following data:
2159+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
2160+
| LP2_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
2161+
And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024"
2162+
When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount
2163+
When Admin sets the business date to "09 March 2024"
2164+
When Admin creates a Loan re-aging transaction by Loan external ID with the following data:
2165+
| frequencyNumber | frequencyType | startDate | numberOfInstallments |
2166+
| 1 | MONTHS | 15 March 2024 | 1 |
2167+
2168+
Scenario: Verify that Loan re-aging transaction - can be performed before maturity date and removes n+1
2169+
When Admin sets the business date to "01 January 2024"
2170+
When Admin creates a client with random data
2171+
When Admin creates a fully customized loan with the following data:
2172+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
2173+
| LP2_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
2174+
And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024"
2175+
When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount
2176+
When Admin adds "LOAN_NSF_FEE" due date charge with "1 October 2024" due date and 20 EUR transaction amount
2177+
2178+
When Admin sets the business date to "09 March 2024"
2179+
When Admin creates a Loan re-aging transaction by Loan external ID with the following data:
2180+
| frequencyNumber | frequencyType | startDate | numberOfInstallments |
2181+
| 1 | MONTHS | 15 March 2024 | 10 |
2182+
2183+
Scenario: Verify that Loan re-aging transaction - can be performed before maturity date and removes additional normal installments and not modifies n+1
2184+
When Admin sets the business date to "01 January 2024"
2185+
When Admin creates a client with random data
2186+
When Admin creates a fully customized loan with the following data:
2187+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
2188+
| LP2_DOWNPAYMENT_ADV_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 January 2024 | 1000 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
2189+
And Admin successfully approves the loan on "01 January 2024" with "1000" amount and expected disbursement date on "01 January 2024"
2190+
When Admin successfully disburse the loan on "01 January 2024" with "1000" EUR transaction amount
2191+
When Admin adds "LOAN_NSF_FEE" due date charge with "1 October 2024" due date and 20 EUR transaction amount
2192+
When Admin adds "LOAN_NSF_FEE" due date charge with "1 November 2024" due date and 30 EUR transaction amount
2193+
2194+
When Admin sets the business date to "09 March 2024"
2195+
When Admin creates a Loan re-aging transaction by Loan external ID with the following data:
2196+
| frequencyNumber | frequencyType | startDate | numberOfInstallments |
2197+
| 1 | MONTHS | 15 March 2024 | 2 |

0 commit comments

Comments
 (0)