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

Foo Developer updated FINERACT-2891:
------------------------------------
    Component/s: Savings

> Undoing a partial payment of a recurring savings fee resets the outstanding 
> to the full fee and moves the due date back a cycle
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2891
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2891
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Organization, Savings
>            Reporter: Foo Developer
>            Assignee: Foo Developer
>            Priority: Major
>
> h3. Steps to reproduce
> # Create a savings product and activate an account on it. Add a weekly fee 
> charge of 45.00 due on the activation date.
> # Deposit 10.00.
> # Pay the charge twice, 2.00 each: {{POST 
> /v1/savingsaccounts/\{accountId\}/charges/\{chargeId\}?command=paycharge}}
> {code:json}
> {"amount": 2, "dueDate": "<date>", "dateFormat": "dd MMMM yyyy", "locale": 
> "en"}
> {code}
> The charge now shows paid 4.00, outstanding 41.00, and the same due date.
> # Undo the second payment: {{POST 
> /v1/savingsaccounts/\{accountId\}/transactions/\{transactionId\}?command=undo}}
> h3. Expected
> Paid 2.00, outstanding 43.00, due date unchanged.
> h3. Actual
> Paid 2.00, outstanding 45.00, and the due date moves back one week. Paid plus 
> outstanding is more than the fee amount.
> h3. Root cause
> {{SavingsAccountCharge.pay()}} closes a recurring fee's cycle (advances the 
> due date, resets the outstanding) only when the outstanding reaches zero, so 
> a partial payment leaves the cycle open. 
> {{SavingsAccountCharge.undoPayment()}} always does the reverse: it calls 
> {{resetPropertiesForRecurringFees()}} and {{updateToPreviousDueDate()}} 
> unconditionally. That is only right when the undone payment closed the cycle. 
> Even then the cycle's outstanding is reset to the whole fee, which loses its 
> other partial payments. {{undoWaiver()}} has the same problem for a waiver 
> that closed a partly paid cycle.
> h3. Proposed fix
> {{SavingsAccount}} works out what the charge received after the undone 
> transaction (later non-reversed payments and waivers on the same charge) and 
> passes it to the charge. The fee's transactions are undone latest first:
> * a payment on the open cycle goes back to that cycle, and the due date stays;
> * the latest payment that closed the previous cycle reopens that cycle with 
> the undone amount outstanding, and the due date moves back one interval;
> * undoing a payment or waiver of an earlier cycle while later ones exist is 
> refused with a validation error; the later ones have to be undone first.
> Non-recurring charges are unchanged.
> h3. Tests
> Unit tests in {{SavingsAccountChargeUndoPaymentTest}} ({{fineract-savings}}) 
> for each case above.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to