pwargulak opened a new pull request, #6759: URL: https://github.com/apache/fineract/pull/6759
## Description [FINERACT-3009](https://issues.apache.org/jira/browse/FINERACT-3009) Most Working Capital amount reads used `FromJsonHelper#extractBigDecimalNamed(name, element, Set)`, which parses text in `Locale.US` whatever the request's `locale`. Under a comma-decimal locale a decimal comma was taken as a grouping separator and dropped: `"123,45"` with `"locale": "pl"` was stored as 12345, `"1095000,50"` as 109500050, with HTTP 200 and no warning. The principal was already read with the locale, so one request could mix both readings. These reads now use the request's locale (`extractBigDecimalWithLocaleNamed`), as the loan modules do: 52 reads in the Working Capital loan and product validators, the loan assembler and the write services (approve, disburse, repayment and the other transactions, adjustments, discount fee, rate change, recovery payment, near-breach action). The loan assembler also reads `delinquencyGraceDays` / `breachGraceDays` with the locale, as its validator already does. `FromJsonHelper` is unchanged. The breach and near-breach configuration validators are left as they are: those endpoints bind the body to a typed request and serialize it again, so the amount always arrives as a JSON number. **Behaviour change:** text that only parsed because of the US reading is now refused with `validation.msg.invalid.decimal.format`, as it is for loans and already was for the Working Capital principal. For example `"100.00"` with `"locale": "pl"` was accepted on approve, disburse and repayment and is now 400. JSON numbers, and text matching the request's locale, are read as before. Tests: - new `FeignWorkingCapitalLoanAmountLocaleTest` (3), through the batch API so the amounts can be sent as text: `pl` text through submit, approve, disburse and repayment (`"100000,50"` → 100000.50, `"5000,00"` → 5000, `"123,45"` → 123.45); `pl` `"100.00"` refused with `invalid.decimal.format`; a JSON number under `pl` and English text unchanged. On `develop` the first two fail (the payment volume is stored as 10000050, and `"100.00"` under `pl` is accepted); - new `WorkingCapitalLoanDataValidatorAmountLocaleTest` (4), on a real `FromJsonHelper`; two fail on `develop`; - `WorkingCapitalLoanAdjustByDeltaReplayTest` and `WorkingCapitalLoanRecoveryPaymentWriteServiceTest` mock the new read. Run locally on develop 106816440a: rat, spotless, checkstyle, spotbugs, javadoc and modernizer of the touched modules are clean; the `fineract-working-capital-loan` unit suite (1719 tests), no failures; and every Working Capital integration test class (`*WorkingCapital*`, 67 classes, 695 tests) on PostgreSQL, MariaDB and MySQL, no failures. Two tests failed once each on a random four-character product short name colliding with an existing one (`error.msg.wc.product.duplicate.shortName`; `WorkingCapitalLoanRepaymentAccountingTest` on PostgreSQL, `FeignWorkingCapitalLoanFlatAmortizationTest` on MySQL) and passed on rerun. Not run: the other integration test classes and the e2e (Cucumber) suite. ## Checklist - [x] Write the commit message as per [our guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests) - [x] 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). - [x] 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). -- 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]
