You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ju...@apache.org on 2019/10/09 07:39:16 UTC

[fineract-cn-cheques] 02/41: ignore proportional charges while issuing cheques

This is an automated email from the ASF dual-hosted git repository.

juhan pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-cheques.git

commit d574660536e02aba76dced6399109d6eda7fb104
Author: mgeiss <mg...@mifos.org>
AuthorDate: Mon Aug 21 16:39:03 2017 +0200

    ignore proportional charges while issuing cheques
---
 .../service/internal/service/helper/AccountingService.java       | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/service/src/main/java/io/mifos/cheque/service/internal/service/helper/AccountingService.java b/service/src/main/java/io/mifos/cheque/service/internal/service/helper/AccountingService.java
index 238e3c4..95ef589 100644
--- a/service/src/main/java/io/mifos/cheque/service/internal/service/helper/AccountingService.java
+++ b/service/src/main/java/io/mifos/cheque/service/internal/service/helper/AccountingService.java
@@ -54,7 +54,14 @@ public class AccountingService {
 
   public void bookCharges(final String sourceAccount, final List<Charge> charges) {
 
-    final Double totalCharges = charges.stream().mapToDouble(Charge::getAmount).sum();
+    final Double totalCharges = charges.stream().mapToDouble(charge -> {
+      if (charge.getProportional()) {
+        this.logger.info("Charges for issuing cheques must be fixed.");
+        return 0.00D;
+      } else {
+        return charge.getAmount();
+      }
+    }).sum();
     if (totalCharges == 0.00D) {
       return;
     }