You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Santosh Math (Jira)" <ji...@apache.org> on 2019/12/10 10:37:00 UTC

[jira] [Commented] (FINERACT-753) incorrect savings account balance when charge transaction is reversed during an overdraft recalculate Daily Balances

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

Santosh Math commented on FINERACT-753:
---------------------------------------

Hi [~andrew.dzak], tested this in my local machine by pulling the PR: [https://github.com/apache/fineract/pull/659] .

I followed the steps mentioned in the description of this PR. When issue was there it was showing wrong savings balace(1st screenshot)  and after correcting it it's showing right value(second screeshot with negative balance). Please confirm.

!previous issue.png!!current .png!

 

> incorrect savings account balance when charge transaction is reversed during an overdraft recalculate Daily Balances
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-753
>                 URL: https://issues.apache.org/jira/browse/FINERACT-753
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Savings
>    Affects Versions: 1.3.1
>            Reporter: andrewDzakpasu
>            Assignee: Ed Cable
>            Priority: Major
>              Labels: p1
>             Fix For: 1.4.0
>
>         Attachments: current .png, previous issue.png, previous issue.png
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> This bug occurs in specific scenarios where there is an overdraft on account  code section where the bug offers is below on 
> protected void recalculateDailyBalances(final Money openingAccountBalance, final LocalDate interestPostingUpToDate)
> {code:java}
> runningBalance = runningBalance.plus(transactionAmount);
> transaction.updateRunningBalance(runningBalance);
> if (overdraftAmount.isZero() && runningBalance.isLessThanZero()) {
>     overdraftAmount = overdraftAmount.plus(runningBalance.getAmount().negate());
> }
> if (transaction.getId() == null && overdraftAmount.isGreaterThanZero()) {
>     transaction.updateOverdraftAmount(overdraftAmount.getAmount());
> } else if (overdraftAmount.isNotEqualTo(transaction.getOverdraftAmount(getCurrency()))) {
>     SavingsAccountTransaction accountTransaction = SavingsAccountTransaction.copyTransaction(transaction);
>     transaction.reverse();
>     if (overdraftAmount.isGreaterThanZero()) {
>         accountTransaction.updateOverdraftAmount(overdraftAmount.getAmount());
>     }
>     accountTransaction.updateRunningBalance(runningBalance);
>     addTransaction(accountTransaction);
>     isTransactionsModified = true;
> }
> {code}
>  
> steps to recreate . 
> Set up a savings account with an overdraft  say 500. 
>  # create saying account and add a charge fee of say 300 with opening balance of 500 approve and activate.
>  # pay charge of 300 balance with now be 200 . charge is paid which creates an object in m_savings_account_charge_paid_by
>  # now reverse the deposit of 500 . 
>  # system will recalculateDailyBalances and reverse the charge transaction on this section of the code 
> {code:java}
> else if (overdraftAmount.isNotEqualTo(transaction.getOverdraftAmount(getCurrency()))) {
>     SavingsAccountTransaction accountTransaction = SavingsAccountTransaction.copyTransaction(transaction);
>     transaction.reverse();
>     if (overdraftAmount.isGreaterThanZero()) {
>         accountTransaction.updateOverdraftAmount(overdraftAmount.getAmount());
>     }
>     accountTransaction.updateRunningBalance(runningBalance);
>     addTransaction(accountTransaction);
>     isTransactionsModified = true;
> {code}
>  #  now since the new charge created does not have the charged paid by object in the table "  m_savings_account_charge_paid_by" recalculating the account balance becomes wrong 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)