Skip to content
Permalink
Browse files
fixed amount calculation for account opening
  • Loading branch information
mgeiss committed Oct 7, 2017
1 parent 942b2d7 commit cda5f5ebf24f7f6567490bfa3719a53bef3498af
Showing 1 changed file with 5 additions and 1 deletion.
@@ -25,6 +25,7 @@
import io.mifos.deposit.api.v1.definition.domain.ProductDefinition;
import io.mifos.teller.ServiceConstants;
import io.mifos.teller.api.v1.PermittableGroupIds;
import io.mifos.teller.api.v1.domain.Charge;
import io.mifos.teller.api.v1.domain.MICR;
import io.mifos.teller.api.v1.domain.Teller;
import io.mifos.teller.api.v1.domain.TellerTransaction;
@@ -349,7 +350,10 @@ private void verifyTellerTransaction(final Teller teller, final TellerTransactio

final TellerTransactionCosts tellerTransactionCosts =
this.tellerTransactionProcessor.getCosts(tellerTransaction);
final BigDecimal costs = tellerTransactionCosts.getTotalAmount();
final BigDecimal costs = tellerTransactionCosts.getCharges()
.stream()
.map(Charge::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
final BigDecimal amountExcludingCosts = transactionAmount.subtract(costs != null ? costs : BigDecimal.ZERO);
if (amountExcludingCosts.compareTo(minimumBalance) < 0) {
throw ServiceException.conflict(

0 comments on commit cda5f5e

Please sign in to comment.