FINERACT-2178: Ability to retrieve a loan's balance at a certain point in time in the past

This commit is contained in:
Arnold Galovics
2025-02-17 21:48:05 +01:00
committed by Arnold Gálovics
parent 986dceea1c
commit 0f1be3c913
29 changed files with 1523 additions and 8 deletions
@@ -30,6 +30,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.fortuna.ical4j.model.property.RRule;
import net.fortuna.ical4j.validate.ValidationException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.infrastructure.core.service.DateUtils;
@@ -616,6 +617,21 @@ public class DataValidatorBuilder {
return this;
}
public DataValidatorBuilder listNotEmpty() {
if (this.value == null && this.ignoreNullValue) {
return this;
}
final List<Object> list = (List<Object>) this.value;
if (CollectionUtils.isEmpty(list)) {
String validationErrorCode = "validation.msg." + this.resource + "." + this.parameter + ".cannot.be.empty";
String defaultEnglishMessage = "The parameter `" + this.parameter + "` cannot be empty. You must select at least one.";
final ApiParameterError error = ApiParameterError.parameterError(validationErrorCode, defaultEnglishMessage, this.parameter);
this.dataValidationErrors.add(error);
}
return this;
}
public DataValidatorBuilder jsonArrayNotEmpty() {
if (this.value == null && this.ignoreNullValue) {
return this;
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.infrastructure.core.service;
import java.util.List;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
@@ -35,6 +37,11 @@ public class ExternalIdFactory {
return StringUtils.isBlank(value) ? ExternalId.empty() : new ExternalId(value);
}
public static List<ExternalId> produce(List<String> values) {
Objects.requireNonNull(values, "values must not be null");
return values.stream().map(ExternalIdFactory::produce).toList();
}
public ExternalId createFromCommand(JsonCommand command, final String externalIdKey) {
String externalIdStr = null;
if (command.parsedJson() != null) {
@@ -21,6 +21,8 @@ package org.apache.fineract.organisation.monetary.data;
import java.io.Serializable;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
/**
* Immutable data object representing currency.
@@ -87,4 +89,12 @@ public class CurrencyData implements Serializable {
return builder.toString();
}
@org.mapstruct.Mapper(config = MapstructMapperConfig.class)
public interface Mapper {
default CurrencyData map(MonetaryCurrency source) {
return source.toData();
}
}
}