Abhishek6122008 opened a new pull request, #6817: URL: https://github.com/apache/fineract/pull/6817
## Description FINERACT-3047, follow-up to #6761 (FINERACT-2909). **Shared interest posting rules.** `SavingsInterestPostingLegs` turns an interest posting into its debit and credit legs: the part that pays down an overdraft goes to Overdraft Portfolio Control, the rest to Savings Control, debited from Interest on Savings (cash-based) or Interest Payable (accrual). Both savings accounting processors and the Post Interest For Savings job now book from it, so `selectAccountId` keeps only the overdraft interest rule. Overdraft interest postings are left out on purpose. The job books them Dr Overdraft Portfolio Control (or Savings Control) / Cr Income from Interest or Interest Receivable, while the processors book Dr Savings Reference / Cr Income from Interest. Sharing them would change one of the two, so that needs its own ticket. **Reversals mirror the stored entries.** A reversed savings transaction now gets the opposite of each entry stored for it (`createJournalEntriesForReversedSavingsTransaction`), the way `createJournalEntryForReversedLoanTransaction` already works for loans. Before, the processor rebuilt the entries from its current rules and swapped debit and credit, so a posting the job booked differently, or one booked under GL mappings changed since, didn't net to zero. This also covers the pre-FINERACT-2909 postings in its upgrade note. A transaction with nothing booked gets no reversal entries. The lookup goes by transaction id only, because the job stores its credit entries with entity type 1 (it passes the journal entry type there). That's a separate fix. Tests: - `SavingsInterestPostingLegsTest`: account in credit, partly and fully overdrawn, no interest; cash-based and accrual - `CashBasedAccountingProcessorForSavingsTest`, `AccrualBasedAccountingProcessorForSavingsTest`: interest postings book the shared legs; a reversal mirrors the stored entries and rebuilds nothing - `AccountingProcessorHelperImplTest`: mirrors keep each entry's account, amount and entity type with debit and credit swapped; nothing booked, nothing reversed - `SavingsSchedularInterestPosterJournalEntriesTest`: the job books interest postings from the shared legs, cash-based and accrual - `SavingsAccrualAccountingIntegrationTest`: reversing a job-posted overdraft interest posting with a backdated deposit nets every GL account to zero. Rebuilding gave Dr Income from Interest / Cr Savings Reference against the job's Dr Overdraft Portfolio Control / Cr Income from Interest. ## Checklist Please make sure these boxes are checked before submitting your pull request - thanks! - [ ] 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. - [ ] Create/update [unit or integration tests](https://fineract.apache.org/docs/current/#_testing) for verifying the changes made. - [ ] 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 - [ ] [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. - [ ] I followed the [AI Policy](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#ai-policy). Your assigned reviewer(s) will follow our [guidelines for code reviews](https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide). -- 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]
