Abhishek Chaudhary created FINERACT-3017:
--------------------------------------------

             Summary: Overdraft-enabled savings with an interest receivable 
mapping earn interest for overdrawn days
                 Key: FINERACT-3017
                 URL: https://issues.apache.org/jira/browse/FINERACT-3017
             Project: Apache Fineract
          Issue Type: Bug
          Components: Savings
    Affects Versions: 1.16.1
            Reporter: Abhishek Chaudhary


When a savings product allows overdraft and has an Interest Receivable GL 
account mapped, 
{{SavingsAccountInterestPostingServiceImpl.calculateInterestUsing}} builds two 
posting periods for each posting interval: one for the days the account is in 
credit and one for the days it is overdrawn. 
{{CompoundInterestHelper.calculateInterestForAllPostingPeriods}} then treats 
them as consecutive periods and carries the interest of the days in credit into 
the overdrawn days of the same interval, although that interest is only posted 
at the end of the interval.

So for the month an account goes from credit into overdraft, it earns savings 
interest on a balance it never had, and the overdraft interest it owes is not 
charged. Without the Interest Receivable mapping the same account gets the 
correct amount, so the interest depends on a GL mapping.

*Example*
Monthly posting and compounding, daily balance, 365 days, 10% nominal rate, 21% 
overdraft rate, overdraft limit 10,000.
# Activate on 02 August 2021 and deposit 10,000.
# Withdraw 10,010 on 09 August 2021 (overdrawn by 10 from 9 to 31 August).
# Run *Post Interest For Savings* on 02 September 2021.

* Without an Interest Receivable mapping, August is posted as 19.05: 19.18 for 
the 7 days in credit, less 0.13 overdraft interest on -10 for 23 days.
* With the mapping, August is posted as 19.18 plus a second interest posting of 
0.06. The 19.18 is carried into the overdrawn days, so they are calculated on 
+9.18 instead of -10. No overdraft interest is posted.

With a 0% overdraft rate the overdrawn days still produce that second interest 
posting (0.0578 with 4 decimals). It showed up in the accrual integration test 
of FINERACT-2909 (PR #6761).

*Expected*
The two periods of one interval should not compound into each other. August 
should be posted as 19.18 interest for the days in credit and 0.13 overdraft 
interest, the same 19.05 in total as without the mapping.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to