[ 
https://issues.apache.org/jira/browse/FINERACT-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18128261#comment-18128261
 ] 

Abhinav Kumar Jha commented on FINERACT-1850:
---------------------------------------------

I reproduced this on current develop (8247ebd, PostgreSQL 18) with the steps 
above, using business dates and running the Post Interest For Savings job once 
per day (overdraft interest 10%, daily compounding and posting, withdrawal fee 
10, no accounting):

||After||Balance with the job||Expected balance||
|reversing the 03 Sep deposit of 500 (07 Sep)|-1225.09|-1221.73|
|the next job run (08 Sep)|*-727.09*|-1222.06|

After the next job run the reversed deposit counts again, and the overdraft 
interest is calculated on that balance (0.20 a day instead of 0.33).

*Cause:* the job loads transactions with 
{{SavingAccountMapperForInterestPosting}}, which does not select 
{{tr.is_reversal}}, so the reversal row of the deposit is treated as a normal 
deposit. When the job saves the account, {{SavingsSchedularInterestPoster}} 
also writes {{is_reversal = false}} back to the loaded transactions, so the 
reversal row stays a live deposit afterwards. This affects every transaction 
reversed with the reverse command, not only in overdraft. A simpler case: 
deposit 1000, reverse it, run the job once: the balance includes the 1000 again.

(The repeated overdraft interest postings in the same scenario are 
FINERACT-2855.)

I am taking this and will open a PR with a test.


> Interest Wrongly Calculated after Reversal
> ------------------------------------------
>
>                 Key: FINERACT-1850
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1850
>             Project: Apache Fineract
>          Issue Type: Bug
>            Reporter: Frank Nkuyahaga
>            Assignee: Abhinav Kumar Jha
>            Priority: Major
>
> # Create a savings account with overdraft turned on.
>  # Set interest posting to daily.
>  # Add withdrawal fee charge.
>  # Withdraw funds from the account to take it into overdraft
>  # Wait a couple of days (verify that interest posting happens correctly on 
> those days)
>  # Make a deposit (partial repayment i.e the account should still be in 
> overdraft after this)
>  # Wait a few days then make another withdrawal
>  # Wait another day then reverse the deposit make above
>  #  Check the account after a couple of days
> *Expected*
> The interest posting should be correct even after the reversal
> *Actual*
> The interest posting is wrong after the reversal



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to