[ 
https://issues.apache.org/jira/browse/FINERACT-2899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Piotr Wargulak updated FINERACT-2899:
-------------------------------------
    Description: 
{{POST /loans/\{loanId}/transactions/\{transactionId}?command=undo}} is 
accepted for a {{WAIVE_CHARGES}} transaction and returns 200. 
The transaction is marked reversed, but the charge stays waived.

The loan is left inconsistent with no error reported, and it cannot be repaired 
afterwards: undo-waive refuses the waiver as already reversed.

*Steps to reproduce:*
 # Create a loan with a fee and waive the fee.

 # Undo the waiver with {{{}POST 
/loans/\{loanId}/transactions/\{transactionId}?command=undo{}}}.

 # Observe that the transaction is reversed while the charge is still waived.

*Proposed fix:* reject adjust/undo of {{WAIVE_CHARGES}} transactions, as is 
already done for interest refunds, with a validation error that points to 
undo-waive ({{{}PUT /loans/\{loanId}/transactions/\{transactionId}{}}}), which 
restores the charge correctly. This prevents users from corrupting loans 
through the generic endpoint. Add a test for the rejection.

  was:
{{{}POST /loans/\{loanId}/transactions/\{transactionId}?command=undo{}}}, or an 
adjustment with amount 0, is accepted for a {{WAIVE_CHARGES}} transaction and 
returns 200. 
The transaction is marked reversed, but the charge keeps its waived state and 
waived amount. 
The loan then holds a reversed waiver for a charge that is still waived, and 
the dedicated undo-waive operation refuses it as already reversed.

*Steps to reproduce:*
 # Create a loan with a fee and waive the fee.

 # Undo the waiver transaction through the generic transaction-adjustment 
endpoint.

 # Observe that the transaction is reversed while the charge is still waived.

*Proposed fix:* reject the generic adjust/undo for {{WAIVE_CHARGES}} 
transactions with a validation error that points to the dedicated undo-waive 
operation, which correctly restores the charge. Add a test for the rejection.


> Undoing a WAIVE_CHARGES transaction through transaction adjustment reverses 
> it but leaves the charge waived
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2899
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2899
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Charges
>    Affects Versions: 1.16.0
>            Reporter: Piotr Wargulak
>            Priority: Major
>
> {{POST /loans/\{loanId}/transactions/\{transactionId}?command=undo}} is 
> accepted for a {{WAIVE_CHARGES}} transaction and returns 200. 
> The transaction is marked reversed, but the charge stays waived.
> The loan is left inconsistent with no error reported, and it cannot be 
> repaired afterwards: undo-waive refuses the waiver as already reversed.
> *Steps to reproduce:*
>  # Create a loan with a fee and waive the fee.
>  # Undo the waiver with {{{}POST 
> /loans/\{loanId}/transactions/\{transactionId}?command=undo{}}}.
>  # Observe that the transaction is reversed while the charge is still waived.
> *Proposed fix:* reject adjust/undo of {{WAIVE_CHARGES}} transactions, as is 
> already done for interest refunds, with a validation error that points to 
> undo-waive ({{{}PUT /loans/\{loanId}/transactions/\{transactionId}{}}}), 
> which restores the charge correctly. This prevents users from corrupting 
> loans through the generic endpoint. Add a test for the rejection.



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

Reply via email to