[ 
https://issues.apache.org/jira/browse/FINERACT-2284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18063227#comment-18063227
 ] 

Dhananjay Bhagat edited comment on FINERACT-2284 at 3/5/26 1:39 PM:
--------------------------------------------------------------------

Hi [~adamsaghy] ,

I went through the above discussion, which clarified many aspects for me. I 
investigated the *Loan charge creation* flow while debugging this issue and 
wanted to confirm my understanding before proposing a fix.

1. I was able to reproduce the behavior described in the ticket by creating a 
flat loan charge (ex., 19.8). During debugging, I observed that for {*}Flat 
Charges{*}, the amount is assigned directly as a BigDecimal in LoanCharge: 
{code:java}
loanCharge.setAmount(chargeAmount);{code}
Because of this, the rounding logic implemented in Money.java is never applied 
for flat charges.

 

2. For *Percentage-based Charges* (for ex., % of Amount), the calculated amount 
eventually passes through:
{code:java}
Money.of(this.loan.getCurrency(), minMaxCap){code}
which applies the rounding logic defined in Money, including the 
*{{_inMultiplesOf_}}* rule from the currency configuration.

Based on this, it appears that rounding is already applied for percentage-based 
charges but not for flat charges because they bypass the Money abstraction.

Before proposing a fix, I would like to confirm:

1. Should Flat Charges also pass through the Money abstraction so that the same 
currency rounding rules are applied consistently to all charge calculation 
types?

2. Additionally, I observed this behavior while testing the {*}Loan charge 
flow{*}. Should the same rounding behavior also apply across other charge flows 
such as Savings, Client, and Share accounts, or is the intended scope limited 
to loans?

Looking forward to your guidance so that the implementation aligns fully with 
the intended architecture.

Thank you!


was (Author: JIRAUSER312255):
Hi [~adamsaghy] ,

I went through the above discussion, which clarified many aspects for me. I 
investigated the *Loan charge creation* flow while debugging this issue and 
wanted to confirm my understanding before proposing a fix.

1. I was able to reproduce the behavior described in the ticket by creating a 
flat loan charge (ex., 19.8). During debugging, I observed that for {*}Flat 
Charges{*}, the amount is assigned directly as a BigDecimal in LoanCharge: 
{code:java}
loanCharge.setAmount(chargeAmount);{code}
Because of this, the rounding logic implemented in Money.java is never applied 
for flat charges.

 

2. For *Percentage-based Charges* (for ex., % of Amount), the calculated amount 
eventually passes through:
{code:java}
Money.of(this.loan.getCurrency(), minMaxCap){code}
which applies the rounding logic defined in Money, including the 
*{{_inMultiplesOf_}}* rule from the currency configuration.


Based on this, it appears that rounding is already applied for percentage-based 
charges but not for flat charges because they bypass the Money abstraction.

Before proposing a fix, I would like to confirm:

1. Should Flat Charges also pass through the Money abstraction so that the same 
currency rounding rules are applied consistently to all charge calculation 
types?

Looking forward to your guidance so that the implementation aligns fully with 
the intended architecture.

Thank you!

> Charge should check Money inMultiplesOf settings and enforce it!
> ----------------------------------------------------------------
>
>                 Key: FINERACT-2284
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2284
>             Project: Apache Fineract
>          Issue Type: New Feature
>    Affects Versions: 1.12.1
>            Reporter: Adam Saghy
>            Assignee: Ashok Auty
>            Priority: Major
>
> Charge should check Money inMultiplesOf settings and enforce it!
> Issue:
>  - Currency set 1 multiples of.
>  - Charge with amount that is not multiple of 1 should be rounded based on 
> rounding mode!
> *Example*
>  - Currency set 1 multiples of.
>  - Add charge with amount of $19.8, should be rounded to $20!



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

Reply via email to