Dhanno98 commented on code in PR #5940:
URL: https://github.com/apache/fineract/pull/5940#discussion_r3454322211


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java:
##########
@@ -1236,6 +1238,11 @@ public CommandProcessingResult 
addSavingsAccountCharge(final JsonCommand command
         }
         final SavingsAccountCharge savingsAccountCharge = 
SavingsAccountCharge.createNewFromJson(savingsAccount, chargeDefinition, 
command);
 
+        if (isFlatCharge(savingsAccountCharge) && 
isZeroCharge(savingsAccountCharge, savingsAccount.getCurrency())) {

Review Comment:
   Good point. I updated the implementation to prevent zero-amount savings 
charges from being persisted when the final rounded amount is known at charge 
attachment time.
   
   After the charge amount is rounded according to the savings product currency 
configuration (digitsAfterDecimal/inMultiplesOf), I validate the resulting 
amount before persistence. If the rounded amount becomes zero, a validation 
error is returned, and the charge is not added.
   
   This validation is currently applied only to flat savings charges because 
percentage-based charges (for eg withdrawal fees) are calculated later during 
transaction processing, so the final charge amount is not available when the 
charge is attached.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to