Search in sources :

Example 1 with CreditUpdateBelowDistributedAmountException

use of io.imunity.furms.api.validation.exceptions.CreditUpdateBelowDistributedAmountException in project furms by unity-idm.

the class ResourceCreditServiceValidator method assertAmountAboveAlreadyDistributed.

private void assertAmountAboveAlreadyDistributed(ResourceCredit updated, ResourceCredit existing) {
    BigDecimal remaining = communityAllocationRepository.getAvailableAmount(existing.id);
    BigDecimal distributed = existing.amount.subtract(remaining);
    assertTrue(updated.amount.compareTo(distributed) >= 0, CreditUpdateBelowDistributedAmountException::new);
}
Also used : CreditUpdateBelowDistributedAmountException(io.imunity.furms.api.validation.exceptions.CreditUpdateBelowDistributedAmountException) BigDecimal(java.math.BigDecimal)

Aggregations

CreditUpdateBelowDistributedAmountException (io.imunity.furms.api.validation.exceptions.CreditUpdateBelowDistributedAmountException)1 BigDecimal (java.math.BigDecimal)1