danhandev opened a new pull request, #6789: URL: https://github.com/apache/fineract/pull/6789
## Description Fixes [FINERACT-3023](https://issues.apache.org/jira/browse/FINERACT-3023). **Original issue** When the "Update Deposit Accounts Maturity details" job matures a fixed deposit with a maturity instruction, the journal entries of the payout are posted more than once: three times for "reinvest principal and interest" (300) and "reinvest principal only" (400), twice for "transfer to savings" (200). The payout is posted by the withdrawal or transfer itself, again by `postJournalEntries` at the end of `DepositAccountDomainServiceJpa#handleFDAccountMaturityClosure`, and again at the end of `DepositAccountWritePlatformServiceJpaRepositoryImpl#updateMaturityDetails`, each with transaction ids taken before the payout. The transfer branch already skips the second one with `updateAlreadyPostedTransactions`. FINERACT-1401 fixed the same double posting for a manual close. **What changed** - `handleFDAccountMaturityClosure` marks the withdrawal as posted after `handleWithdrawal`, in the reinvest and withdrawal branches, as the transfer branch does. - `updateMaturityDetails` refreshes the posted transaction ids after the closure, which posts the transactions it creates. Interest posted by the maturity update before the closure is still posted once at the end, as before. - `transferToSavingsId` is documented on `PostFixedDepositAccountsRequest`. The API already accepts it; without it the generated client cannot open a deposit with instruction 200 (integration-feign IT-05). This only adds a request property. **How it is covered** New `FixedDepositTest` cases for 200, 300 and 400 run the job on a mature deposit and check that every transaction of the deposit has exactly one debit and one credit. All three fail on unmodified develop (the payout has 6 or 4 entries) and pass with the fix. `FixedDepositTest` (52), `RecurringDepositTest` (39), `AccountTransferTest` (11) and `FeignDepositProductArchivingTest` (9) pass locally on PostgreSQL; `spotlessCheck` passes. Before (instruction 300): payout of 108,445.72 debited three times (325,337.15). After: once. **Out of scope** The reinvested deposit being funded with the principal only (FINERACT-3022, #6788) is a separate PR. Both touch `updateMaturityDetails` in different lines and merge cleanly together. ## 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). - [x] 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 (`transferToSavingsId` added to the request schema) - [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]
