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

Piotr Wargulak updated FINERACT-2898:
-------------------------------------
    Description: 
On progressive loans, ChangeOperation#compareTo orders charges by effective 
date, then by submitted date, then by creation time. Two charges submitted on 
the same day therefore replay in creation order.

When a payment made before that day is reprocessed, it is applied to those 
charges in that order. A charge due later can then be paid ahead of one due 
earlier. The order of rows in the loan's charge set is not meaningful, so the 
outcome can differ between otherwise identical loans.

*Steps to reproduce:*

# Create a progressive loan.
# Add several specified-due-date fees on the same day, in an order different 
from their due dates.
# Post an in-advance payment dated before that day.
# Observe which fees it pays.

*Proposed fix:* when both operations are charges with equal effective and 
submitted dates, compare their due dates (nulls last) before falling back to 
creation time. Add a unit test with charges created out of due-date order.

  was:
On progressive loans, ChangeOperation#compareTo orders charges by effective 
date, then by submitted date, then by creation time. Two charges submitted on 
the same day therefore replay in creation order.

When a payment made before that day is reprocessed, it is applied to those 
charges in that order. A charge due later can then be paid ahead of one due 
earlier. The order of rows in the loan's charge set is not meaningful, so the 
outcome can differ between otherwise identical loans.

Steps to reproduce:

Create a progressive loan.

Add several specified-due-date fees on the same day, in an order different from 
their due dates.

Post an in-advance payment dated before that day.

Observe which fees it pays.

Proposed fix: when both operations are charges with equal effective and 
submitted dates, compare their due dates (nulls last) before falling back to 
creation time. Add a unit test with charges created out of due-date order.


> Charges submitted on the same day replay in creation order instead of 
> due-date order
> ------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2898
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2898
>             Project: Apache Fineract
>          Issue Type: Bug
>            Reporter: Piotr Wargulak
>            Priority: Major
>
> On progressive loans, ChangeOperation#compareTo orders charges by effective 
> date, then by submitted date, then by creation time. Two charges submitted on 
> the same day therefore replay in creation order.
> When a payment made before that day is reprocessed, it is applied to those 
> charges in that order. A charge due later can then be paid ahead of one due 
> earlier. The order of rows in the loan's charge set is not meaningful, so the 
> outcome can differ between otherwise identical loans.
> *Steps to reproduce:*
> # Create a progressive loan.
> # Add several specified-due-date fees on the same day, in an order different 
> from their due dates.
> # Post an in-advance payment dated before that day.
> # Observe which fees it pays.
> *Proposed fix:* when both operations are charges with equal effective and 
> submitted dates, compare their due dates (nulls last) before falling back to 
> creation time. Add a unit test with charges created out of due-date order.



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

Reply via email to