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);
}
Aggregations