Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
fixed bug when no charges are applied
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeiss committed Jun 22, 2017
1 parent e8a0e97 commit d898f75
Showing 1 changed file with 17 additions and 7 deletions.
Expand Up @@ -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<>();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<>();
Expand Down

0 comments on commit d898f75

Please sign in to comment.