Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-752: Fix duplicate manual interest posting when posting at period end - #6665

Merged
adamsaghy merged 1 commit into
apache:developfrom
abhinavjha0239:FINERACT-752-manual-interest-posting-period-end
Oct 15, 2026
Merged

adamsaghy merged 1 commit into
apache:developfrom
abhinavjha0239:FINERACT-752-manual-interest-posting-period-end

Conversation

@abhinavjha0239

@abhinavjha0239 abhinavjha0239 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes FINERACT-752. With savings-interest-posting-current-period-end enabled, a manual ("post interest as on") interest posting is duplicated when a backdated transaction recalculates interest, and every further backdated transaction adds one more posting for the same period.

Cause

With the configuration enabled, PostingPeriod dates a manual posting on the period end date instead of the day after it. On recalculation, SavingsAccount.calculateInterestUsing passed that stored date to SavingsHelper.determineInterestPostingPeriods, which treats every date as a posting date and ends the period on the previous day. The period moved one day earlier, the existing posting no longer matched it, and another posting was created.

Change

When the configuration is enabled, the stored manual posting dates are shifted forward by one day before the periods are split, so they mark the same period boundary as when the configuration is disabled. Nothing changes when the configuration is disabled.

Test

The configuration description says "There is no difference in the interest amount posted". testManualInterestPostingIsNotDuplicatedWhenPostingAtPeriodEnd runs the same scenario (business date 02 April 2019: deposit, post interest as on 25 March, two backdated transactions) with the configuration disabled and enabled, and checks that the interest postings have the same amounts and are dated one day earlier. It fails on develop (expected: <2> but was: <4>) and passes with this change.

Reproduction (steps from the Jira issue, develop d924f025d2, PostgreSQL 18)

Interest postings before the 26 March withdrawal
Configuration disabled 25 Mar: 144.75
Enabled, develop 23 Mar: 138.72 and 24 Mar: 144.75
Enabled, this change 24 Mar: 144.75

I also compared develop and this change in 16 API scenarios (as on the first and last day of a month, backdated deposit, several recalculations, undo, quarterly posting, daily compounding, withdrawal fee, pivot mode, business dates). With this change the enabled case matches the disabled case in all transaction scenarios, and the disabled case is unchanged in every scenario.

Notes

  • An account that already has the duplicate gets the correct total on the next backdated transaction (the extra posting is reduced to one day of interest). There is no data migration.
  • The Post Interest For Savings job does not load the manual flag of transactions, so it does not see manual postings and posts their interest again, with the configuration enabled or disabled. That is a separate cause; I will open a separate Jira issue for it, and this PR does not change the job.

Checklist

  • Write the commit message as per our guidelines
  • 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 for verifying the changes made.
  • Follow our 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 (not applicable, no API change)
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • 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.

…eriod end

With savings-interest-posting-current-period-end enabled, a manual
("post interest as on") interest posting is dated on the period end
date instead of the day after it. When a later backdated transaction
recalculated interest, SavingsAccount passed that stored date to
determineInterestPostingPeriods as if it were a posting date, so the
period was split one day earlier and another interest posting was
created for the same period. Every further backdated transaction added
one more.

Shift the stored manual posting dates forward by one day when the
configuration is enabled, so they mark the same period boundary again.

@adamsaghy adamsaghy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Traced the FINERACT-752 scenario: shifting the stored manual posting dates by one day restores the same period split as with the configuration disabled, so the existing manual posting is corrected instead of duplicated. Disabled path is unchanged.

@adamsaghy
adamsaghy merged commit dd48e89 into apache:develop Oct 15, 2026
96 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants