shubhamchaudhary29 opened a new pull request, #6675: URL: https://github.com/apache/fineract/pull/6675
## Description Fixes the `daysInYearCustomStrategy` plumbing defects listed in [FINERACT-2936](https://issues.apache.org/jira/browse/FINERACT-2936). **This PR changes the OpenAPI spec. The Fineract client must be regenerated.** ### Swagger / OpenAPI (client-visible) - `PostLoansRequest.daysInYearCustomStrategy`: `allowableValues` was the single string `"FULL_LEAP_YEAR, FEB_29_PERIOD_ONLY"`, so the generated enum had one merged constant, `FULL_LEAP_YEAR_FEB_29_PERIOD_ONLY`. It is now an array, which gives two constants. - `GetLoansLoanIdResponse` gains `daysInYearCustomStrategy` (`StringEnumOptionData`). The server already returned it. - `GetLoanProductsTemplateResponse`: the field was misnamed `daysInYearTypeCustomStrategyOptions`, so it never matched the server's `daysInYearCustomStrategyOptions` and was always null. It is renamed. This is a compile break for any external caller of the old getter; there are no callers in this repo. - Not listed in the Jira, but needed for the loan-modify fix below: `PutLoansLoanIdRequest.daysInYearCustomStrategy` (with the same allowable values) and `GetLoansTemplateResponse.daysInYearCustomStrategyOptions`. ### Server - **`LoanApplicationValidator`** - Create looked up the parameter by the string literal `"daysInYearCustomStrategyParameterName"`, so the lookup returned null and the progressive-only and ACTUAL-only checks never ran. It now uses the constant and rejects invalid values with a 400. - The check now uses the effective `daysInYearType`: the request's value if present, otherwise the product's. - Modify gets the same validation, falling back to the loan's current value. The field also counts as an update parameter. - **`LoanScheduleAssembler`** - On create, the loan-level value was accepted but ignored. It is now a per-loan override, following the `interestRecognitionOnDisbursementDate` pattern. This affects both the schedule preview and the persisted `m_loan` value. - `PUT /loans/{id}` now detects changes to the field and applies them. The schedule is recalculated from the loan's own state. - **`LoanApplicationTerms(Builder)`**: the constructor dropped `daysInYearCustomStrategy`, so the embeddable generator and other Builder users ignored the strategy. - **`LoanProductRelatedDetailUpdateUtil`**: an explicit `null` became `valueOf("")`, a 500, so the value could not be cleared. Invalid values were also 500s, and every PUT reported the field as changed. It now uses `enumValueOfParameterNamed`, supports clearing, and records a change only when the value actually changes. - **`LoanProductDataValidator`** - Create and update now have an `isOneOfEnumValues` check. - Update rejects clearing the value while the resulting product is progressive with ACTUAL days in year. As the Jira says, it can only be cleared for cumulative products or non-ACTUAL days in year. - **`AdvancedPaymentScheduleTransactionProcessor.handleReAgeWithInterestRecalculationEnabled`**: `daysInMonthType`, `daysInYearType`, `interestRecognitionOnDisbursementDate`, `daysInYearCustomStrategy` and `allowPartialPeriodInterestCalculation` are now read from the loan, not the product. ### Tests - **Unit tests** - `LoanProductRelatedDetailUpdateUtilTest`: clear, change, unchanged and invalid values. - `LoanProductDataValidatorDaysInYearCustomStrategyTest`: invalid values on create and update, and the clearing rule. - `LoanApplicationTermsTest`: the Builder keeps the strategy. - **`DaysInYearCustomStrategyTest` (integration)** - A loan-level override of the product value, checked against both GET and the schedule. - The override applies to the schedule preview. - An invalid loan value returns 400. - A strategy combined with a non-ACTUAL `daysInYearType` returns 400. - Modifying the loan. - Clearing the product value while switching to 360, clearing it on a progressive ACTUAL product (rejected), and an invalid product value (400). - The generated client enum has two constants. ## Checklist - [x] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests) - [ ] Acknowledge that we will not review PRs that are not passing the build _("green")_ - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers. - [x] Create/update [unit or integration tests](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made. - [x] Follow our [coding conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions). - [ ] Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes - [x] [This PR must not be a "code dump"](https://cwiki.apache.org/confluence/display/FINERACT/Pull+Request+Size+Limit). Large changes can be made in a branch, with assistance. Ask for help on the [developer mailing list](https://fineract.apache.org/#contribute). - [ ] If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately. - [x] I followed the [AI Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy). 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
