Skip to content
Permalink
Browse files
Merge pull request #19 from markusgeiss/develop
fixed amount calculation for account opening
  • Loading branch information
markusgeiss committed Oct 7, 2017
2 parents 942b2d7 + cda5f5e commit be0c5c21a88ed47c1c96bd55b2454d5bd7c705bc
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 be0c5c2

Please sign in to comment.