[
https://issues.apache.org/jira/browse/FINERACT-2896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18125702#comment-18125702
]
Piotr Wargulak commented on FINERACT-2896:
------------------------------------------
I closed the PR ([#6578|https://github.com/apache/fineract/pull/6578]). As
[~adamsaghy] pointed out in the review, a free transaction date on the waive
is only safe if the waive charge transaction takes part in reverse-replay,
otherwise the waived amount can go wrong. Leaving the scenarios here for
whoever picks this up.
Charge of 100, repayment of 60 pays part of it, then the remaining 40 is waived
with transactionDate D:
# The repayment of 60 is reversed later. The charge has 100 outstanding again,
but the waiver still says 40 and is not recalculated.
# A backdated repayment dated before D is added and pays the rest of the
charge in the replay. The charge is fully paid before D, but the waiver of 40
stays, so the charge is over-covered.
# A backdated repayment dated after D: the charge is already waived on that
date, so it should not take anything, and the replay order has to respect that.
Expected, in my opinion: on reverse-replay the waive is recalculated as the
outstanding amount of the charge on its own date, and if nothing is outstanding
anymore it is reversed. A simpler intermediate option is to reject a
transactionDate earlier than the last non-reversed monetary transaction, but it
does not cover reversals that happen after the waive, so I don't think it is
enough on its own.
> Allow an optional transactionDate when waiving a loan charge
> ------------------------------------------------------------
>
> Key: FINERACT-2896
> URL: https://issues.apache.org/jira/browse/FINERACT-2896
> Project: Apache Fineract
> Issue Type: Bug
> Components: Charges
> Reporter: Piotr Wargulak
> Priority: Major
>
> Waiving a loan charge offers no way to choose the waiver's transaction date.
> {{LoanChargeWritePlatformServiceImpl}} derives it: the charge's due date if
> that has passed, otherwise the current business date. That date also drives
> schedule recalculation and the loan's lifecycle transition, so a waiver that
> closes a loan stamps the closing date as well.
> When a waiver is the consequence of an earlier-dated event, it gets the date
> the request happened to be processed, not the date of the event. An example
> is a backdated repayment that settles the loan. Statements, the closing date
> and any later replay then follow the processing date. Correcting the date
> after the fact is not safe, because the recalculation and the lifecycle
> transition have already used it.
> *Proposed change:*
> * Accept an optional {{transactionDate}} (with
> {{{}dateFormat{}}}/{{{}locale{}}}) on the waive-charge command.
> * When it is given, use it in place of the derived date for the waiver
> transaction, for the schedule recalculation and for the lifecycle transition.
> * Validate it as other loan transaction dates are validated: not in the
> future, not before disbursement.
> * When it is absent, behaviour is unchanged.
> * Add unit and integration tests for a backdated waiver that closes the loan.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)