FINERACT-1968: Advanced payment allocation - Default allocation
This commit is contained in:
+3
-1
@@ -25,6 +25,7 @@ import jakarta.ws.rs.core.Response;
|
||||
import jakarta.ws.rs.ext.ExceptionMapper;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -40,7 +41,8 @@ public class DefaultExceptionMapper implements FineractExceptionMapper, Exceptio
|
||||
|
||||
@Override
|
||||
public Response toResponse(RuntimeException runtimeException) {
|
||||
return Response.status(SC_INTERNAL_SERVER_ERROR).entity(Map.of("Exception", runtimeException.getMessage()))
|
||||
return Response.status(SC_INTERNAL_SERVER_ERROR)
|
||||
.entity(Map.of("Exception", ObjectUtils.defaultIfNull(runtimeException.getMessage(), "No error message available")))
|
||||
.type(MediaType.APPLICATION_JSON).build();
|
||||
}
|
||||
}
|
||||
|
||||
+8
@@ -433,6 +433,14 @@ public final class MathUtil {
|
||||
return min(min(first, second, notNull), third, notNull);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate percentage of a value
|
||||
*
|
||||
* @param value
|
||||
* @param percentage
|
||||
* @param precision
|
||||
* @return
|
||||
*/
|
||||
public static BigDecimal percentageOf(final BigDecimal value, final BigDecimal percentage, final int precision) {
|
||||
BigDecimal percentageOf = BigDecimal.ZERO;
|
||||
if (isGreaterThanZero(value)) {
|
||||
|
||||
Reference in New Issue
Block a user