Skip to content
Permalink
Browse files
fixed bug when no charges are applied
  • Loading branch information
mgeiss committed Jun 22, 2017
1 parent e8a0e97 commit d898f75d84076f801a3ba802e5f2622b3de1cc97
Showing 1 changed file with 17 additions and 7 deletions.
@@ -115,7 +115,11 @@ private void processTransfer(final TellerTransaction tellerTransaction) {

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 @@ private void processCashDeposit(final String tellerCode, final TellerTransaction
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 @@ private void processCashWithdrawal(final String tellerCode, final TellerTransact

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<>();

0 comments on commit d898f75

Please sign in to comment.