Piotr Wargulak created FINERACT-2895:
----------------------------------------

             Summary: Reverse-replay replaces a WAIVE_CHARGES transaction 
without its charge link, so the waiver can no longer be undone
                 Key: FINERACT-2895
                 URL: https://issues.apache.org/jira/browse/FINERACT-2895
             Project: Apache Fineract
          Issue Type: Bug
          Components: Charges
    Affects Versions: 1.16.0
            Reporter: Piotr Wargulak


On a progressive loan (advanced payment allocation), reprocessing after a 
backdated or reversed transaction can replace a WAIVE_CHARGES transaction, even 
though waivers are not reprocessed.

AdvancedPaymentScheduleTransactionProcessor#useOldTransactionIfApplicable keeps 
the original waiver only when nothing else on the same date was replaced. 
Otherwise it returns null, and the caller creates a new waiver transaction. 
copyTransactionProperties copies charge links (m_loan_charge_paid_by) only for 
CHARGE_PAYMENT and REPAYMENT_AT_DISBURSEMENT, so the new waiver has no link to 
the charge it waived.

Result: undo-waive fails on the copy ("loan charge cannot be found") and on the 
reversed original ("already reversed"). The charge stays waived with no 
supported way back. Balances remain correct, so the problem stays hidden until 
someone tries to undo the waiver.

*Steps to reproduce:*
 # Create a progressive loan with a specified-due-date fee.

 # Make two repayments on the same day, then waive the fee on that day.

 # Reverse the first repayment.

 # Try to undo the waiver.

*Proposed fix:* in useOldTransactionIfApplicable, always keep the original 
WAIVE_CHARGES transaction. This matches the existing comment there 
("WAIVE_CHARGES is not reprocessed"). Add a unit test covering a same-day 
replacement.



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

Reply via email to