You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by my...@apache.org on 2018/01/22 15:32:15 UTC

[fineract-cn-teller] 17/30: fixed bug when no charges are applied

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

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

commit d898f75d84076f801a3ba802e5f2622b3de1cc97
Author: mgeiss <mg...@mifos.org>
AuthorDate: Thu Jun 22 18:11:06 2017 +0200

    fixed bug when no charges are applied
---
 .../processor/TellerTransactionProcessor.java      | 24 +++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/service/src/main/java/io/mifos/teller/service/internal/processor/TellerTransactionProcessor.java b/service/src/main/java/io/mifos/teller/service/internal/processor/TellerTransactionProcessor.java
index 64bda9c..7c62568 100644
--- a/service/src/main/java/io/mifos/teller/service/internal/processor/TellerTransactionProcessor.java
+++ b/service/src/main/java/io/mifos/teller/service/internal/processor/TellerTransactionProcessor.java
@@ -115,7 +115,11 @@ public class TellerTransactionProcessor {
 
     final Debtor debtor = new Debtor();
     debtor.setAccountNumber(tellerTransaction.getCustomerAccountIdentifier());
-    debtor.setAmount(tellerTransactionCosts.getTotalAmount().toString());
+    if (!tellerTransactionCosts.getCharges().isEmpty()) {
+      debtor.setAmount(tellerTransactionCosts.getTotalAmount().toString());
+    } else {
+      debtor.setAmount(tellerTransaction.getAmount().toString());
+    }
     debtors.add(debtor);
 
     final HashSet<Creditor> creditors = new HashSet<>();
@@ -150,11 +154,13 @@ public class TellerTransactionProcessor {
     tellerDebtor.setAmount(tellerTransaction.getAmount().toString());
     debtors.add(tellerDebtor);
 
-    final Double chargesTotal = tellerTransactionCosts.getTotalAmount() - tellerTransaction.getAmount();
-    final Debtor customerDebtor = new Debtor();
-    customerDebtor.setAccountNumber(tellerTransaction.getCustomerAccountIdentifier());
-    customerDebtor.setAmount(chargesTotal.toString());
-    debtors.add(customerDebtor);
+    if (!tellerTransactionCosts.getCharges().isEmpty()) {
+      final Double chargesTotal = tellerTransactionCosts.getTotalAmount() - tellerTransaction.getAmount();
+      final Debtor customerDebtor = new Debtor();
+      customerDebtor.setAccountNumber(tellerTransaction.getCustomerAccountIdentifier());
+      customerDebtor.setAmount(chargesTotal.toString());
+      debtors.add(customerDebtor);
+    }
 
     final HashSet<Creditor> creditors = new HashSet<>();
     journalEntry.setCreditors(creditors);
@@ -185,7 +191,11 @@ public class TellerTransactionProcessor {
 
     final Debtor customerDebtor = new Debtor();
     customerDebtor.setAccountNumber(tellerTransaction.getCustomerAccountIdentifier());
-    customerDebtor.setAmount(tellerTransactionCosts.getTotalAmount().toString());
+    if (!tellerTransactionCosts.getCharges().isEmpty()) {
+      customerDebtor.setAmount(tellerTransactionCosts.getTotalAmount().toString());
+    } else {
+      customerDebtor.setAmount(tellerTransaction.getAmount().toString());
+    }
     debtors.add(customerDebtor);
 
     final HashSet<Creditor> creditors = new HashSet<>();

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.