You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2021/11/03 00:22:21 UTC

[GitHub] [fineract] ptuomola commented on a change in pull request #1940: FINERACT-1374: Withdraw-charge-discount

ptuomola commented on a change in pull request #1940:
URL: https://github.com/apache/fineract/pull/1940#discussion_r741547343



##########
File path: fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
##########
@@ -1066,15 +1070,98 @@ public BigDecimal calculateWithdrawalFee(final BigDecimal transactionAmount) {
         return result;
     }
 
-    private void payWithdrawalFee(final BigDecimal transactionAmount, final LocalDate transactionDate, final AppUser user) {
+    private void payWithdrawalFee(final BigDecimal transactionAmount, final LocalDate transactionDate, final AppUser user,
+            final PaymentDetail paymentDetail) {
+
         for (SavingsAccountCharge charge : this.charges()) {
+
             if (charge.isWithdrawalFee() && charge.isActive()) {
-                charge.updateWithdralFeeAmount(transactionAmount);
-                this.payCharge(charge, charge.getAmountOutstanding(this.getCurrency()), transactionDate, user);
+                if (charge.getFreeWithdrawalCount() == null) {
+                    charge.setFreeWithdrawalCount(0);
+                }
+
+                if (charge.isEnableFreeWithdrawal()) {
+                    resetFreeChargeDaysCount(charge, transactionAmount, transactionDate, user);

Review comment:
       But what about the case where free withdrawal is _not_ enabled - ie current behaviour?
   
   Currently this function would do the charge by calling this.payCharge(). But this is now removed. So where does the charging now happen?
   
   In other words, do you need an else statement here with:
   
   else  {
   charge.updateWithdralFeeAmount(transactionAmount);
   this.payCharge(charge, charge.getAmountOutstanding(this.getCurrency()), transactionDate, user);
   }




-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org