[
https://issues.apache.org/jira/browse/FINERACT-753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16836258#comment-16836258
]
andrewDzakpasu commented on FINERACT-753:
-----------------------------------------
[~vishwasbabu] [~l_pramod79] will set a PR for this fix in by the end of the
day
> 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
> Affects Versions: 1.4.0
> Reporter: andrewDzakpasu
> Priority: Major
>
> 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
(v7.6.3#76005)