FINERACT-2421: Refractor redundant and some deprecated code as per new Java 21 style (Phase 3)
This commit is contained in:
@@ -24,12 +24,11 @@ import org.apache.fineract.cob.domain.BatchBusinessStep;
|
|||||||
import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
|
import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.Mappings;
|
|
||||||
|
|
||||||
@Mapper(config = MapstructMapperConfig.class)
|
@Mapper(config = MapstructMapperConfig.class)
|
||||||
public interface BusinessStepMapper {
|
public interface BusinessStepMapper {
|
||||||
|
|
||||||
@Mappings({ @Mapping(target = "order", source = "source.stepOrder") })
|
@Mapping(target = "order", source = "source.stepOrder")
|
||||||
BusinessStep map(BatchBusinessStep source);
|
BusinessStep map(BatchBusinessStep source);
|
||||||
|
|
||||||
List<BusinessStep> map(List<BatchBusinessStep> source);
|
List<BusinessStep> map(List<BatchBusinessStep> source);
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import io.swagger.v3.oas.annotations.media.Content;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.ws.rs.Consumes;
|
import jakarta.ws.rs.Consumes;
|
||||||
import jakarta.ws.rs.DefaultValue;
|
import jakarta.ws.rs.DefaultValue;
|
||||||
@@ -63,13 +62,14 @@ import org.springframework.stereotype.Component;
|
|||||||
*/
|
*/
|
||||||
@Path("/v1/batches")
|
@Path("/v1/batches")
|
||||||
@Component
|
@Component
|
||||||
@Tag(name = "Batch API", description = "The Apache Fineract Batch API enables a consumer to access significant amounts of data in a single call or to make changes to several objects at once. Batching allows a consumer to pass instructions for several operations in a single HTTP request. A consumer can also specify dependencies between related operations. Once all operations have been completed, a consolidated response will be passed back and the HTTP connection will be closed.\n"
|
@Tag(name = "Batch API", description = """
|
||||||
+ "\n"
|
The Apache Fineract Batch API enables a consumer to access significant amounts of data in a single call or to make changes to several objects at once. Batching allows a consumer to pass instructions for several operations in a single HTTP request. A consumer can also specify dependencies between related operations. Once all operations have been completed, a consolidated response will be passed back and the HTTP connection will be closed.
|
||||||
+ "The Batch API takes in an array of logical HTTP requests represented as JSON arrays - each request has a requestId (the id of a request used to specify the sequence and as a dependency between requests), a method (corresponding to HTTP method GET/PUT/POST/DELETE etc.), a relativeUrl (the portion of the URL after https://example.org/api/v2/), optional headers array (corresponding to HTTP headers), optional reference parameter if a request is dependent on another request and an optional body (for POST and PUT requests). The Batch API returns an array of logical HTTP responses represented as JSON arrays - each response has a requestId, a status code, an optional headers array and an optional body (which is a JSON encoded string).\n"
|
|
||||||
+ "\n"
|
The Batch API takes in an array of logical HTTP requests represented as JSON arrays - each request has a requestId (the id of a request used to specify the sequence and as a dependency between requests), a method (corresponding to HTTP method GET/PUT/POST/DELETE etc.), a relativeUrl (the portion of the URL after https://example.org/api/v2/), optional headers array (corresponding to HTTP headers), optional reference parameter if a request is dependent on another request and an optional body (for POST and PUT requests). The Batch API returns an array of logical HTTP responses represented as JSON arrays - each response has a requestId, a status code, an optional headers array and an optional body (which is a JSON encoded string).
|
||||||
+ "Batch API uses Json Path to handle dependent parameters. For example, if request '2' is referencing request '1' and in the \"body\" or in \"relativeUrl\" of request '2', there is a dependent parameter (which will look like \"$.parameter_name\"), then Batch API will internally substitute this dependent parameter from the response body of request '1'.\n"
|
|
||||||
+ "\n"
|
Batch API uses Json Path to handle dependent parameters. For example, if request '2' is referencing request '1' and in the "body" or in "relativeUrl" of request '2', there is a dependent parameter (which will look like "$.parameter_name"), then Batch API will internally substitute this dependent parameter from the response body of request '1'.
|
||||||
+ "Batch API is able to handle deeply nested dependent requests as well nested parameters. As shown in the example, requests are dependent on each other as, 1<--2<--6, i.e a nested dependency, where request '6' is not directly dependent on request '1' but still it is one of the nested child of request '1'. In the same way Batch API could handle a deeply nested dependent value, such as {..[..{..,$.parameter_name,..}..]}.")
|
|
||||||
|
Batch API is able to handle deeply nested dependent requests as well nested parameters. As shown in the example, requests are dependent on each other as, 1<--2<--6, i.e a nested dependency, where request '6' is not directly dependent on request '1' but still it is one of the nested child of request '1'. In the same way Batch API could handle a deeply nested dependent value, such as {..[..{..,$.parameter_name,..}..]}.""")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class BatchApiResource {
|
public class BatchApiResource {
|
||||||
|
|
||||||
@@ -88,12 +88,12 @@ public class BatchApiResource {
|
|||||||
@POST
|
@POST
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Operation(summary = "Batch requests in a single transaction", description = "The Apache Fineract Batch API is also capable of executing all the requests in a single transaction, by setting a Query Parameter, \"enclosingTransaction=true\". So, if one or more of the requests in a batch returns an erroneous response all of the Data base transactions made by other successful requests will be rolled back.\n"
|
@Operation(summary = "Batch requests in a single transaction", description = """
|
||||||
+ "\n"
|
The Apache Fineract Batch API is also capable of executing all the requests in a single transaction, by setting a Query Parameter, "enclosingTransaction=true". So, if one or more of the requests in a batch returns an erroneous response all of the Data base transactions made by other successful requests will be rolled back.
|
||||||
+ "If there has been a rollback in a transaction then a single response will be provided, with a '400' status code and a body consisting of the error details of the first failed request.")
|
|
||||||
|
If there has been a rollback in a transaction then a single response will be provided, with a '400' status code and a body consisting of the error details of the first failed request.""")
|
||||||
@RequestBody(required = true, content = @Content(array = @ArraySchema(schema = @Schema(implementation = BatchRequest.class, description = "request body"))))
|
@RequestBody(required = true, content = @Content(array = @ArraySchema(schema = @Schema(implementation = BatchRequest.class, description = "request body"))))
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "Success", content = @Content(array = @ArraySchema(schema = @Schema(implementation = BatchResponse.class))))
|
||||||
@ApiResponse(responseCode = "200", description = "Success", content = @Content(array = @ArraySchema(schema = @Schema(implementation = BatchResponse.class)))) })
|
|
||||||
public List<BatchResponse> handleBatchRequests(
|
public List<BatchResponse> handleBatchRequests(
|
||||||
@DefaultValue("false") @QueryParam("enclosingTransaction") @Parameter(description = "enclosingTransaction", required = false) final boolean enclosingTransaction,
|
@DefaultValue("false") @QueryParam("enclosingTransaction") @Parameter(description = "enclosingTransaction", required = false) final boolean enclosingTransaction,
|
||||||
@Parameter(hidden = true) List<BatchRequest> requestList, @Context UriInfo uriInfo) {
|
@Parameter(hidden = true) List<BatchRequest> requestList, @Context UriInfo uriInfo) {
|
||||||
|
|||||||
+1
-2
@@ -45,7 +45,6 @@ public class BatchRequestJsonHelper extends FromJsonHelper {
|
|||||||
*/
|
*/
|
||||||
public List<BatchRequest> extractList(final String json) {
|
public List<BatchRequest> extractList(final String json) {
|
||||||
final Type listType = new TypeToken<List<BatchRequest>>() {}.getType();
|
final Type listType = new TypeToken<List<BatchRequest>>() {}.getType();
|
||||||
final List<BatchRequest> requests = super.getGsonConverter().fromJson(json, listType);
|
return super.getGsonConverter().fromJson(json, listType);
|
||||||
return requests;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-13
@@ -20,7 +20,9 @@ package org.apache.fineract.infrastructure.bulkimport.data;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public enum GlobalEntityType {
|
public enum GlobalEntityType {
|
||||||
|
|
||||||
INVALID(0, "invalid"), //
|
INVALID(0, "invalid"), //
|
||||||
@@ -91,27 +93,17 @@ public enum GlobalEntityType {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode() {
|
|
||||||
return this.code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GlobalEntityType fromInt(final int i) {
|
public static GlobalEntityType fromInt(final int i) {
|
||||||
final GlobalEntityType entityType = intToEnumMap.get(Integer.valueOf(i));
|
return intToEnumMap.get(i);
|
||||||
return entityType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GlobalEntityType fromCode(final String key) {
|
public static GlobalEntityType fromCode(final String key) {
|
||||||
final GlobalEntityType entityType = stringToEnumMap.get(key);
|
return stringToEnumMap.get(key);
|
||||||
return entityType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString();
|
return name();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -27,12 +27,12 @@ import org.apache.fineract.infrastructure.businessdate.domain.BusinessDate;
|
|||||||
import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
|
import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.Mappings;
|
|
||||||
|
|
||||||
@Mapper(config = MapstructMapperConfig.class)
|
@Mapper(config = MapstructMapperConfig.class)
|
||||||
public interface BusinessDateMapper {
|
public interface BusinessDateMapper {
|
||||||
|
|
||||||
@Mappings({ @Mapping(target = "description", source = "type.description"), @Mapping(target = "changes", ignore = true) })
|
@Mapping(target = "description", source = "type.description")
|
||||||
|
@Mapping(target = "changes", ignore = true)
|
||||||
BusinessDateDTO mapEntity(BusinessDate source);
|
BusinessDateDTO mapEntity(BusinessDate source);
|
||||||
|
|
||||||
List<BusinessDateDTO> mapEntity(List<BusinessDate> sources);
|
List<BusinessDateDTO> mapEntity(List<BusinessDate> sources);
|
||||||
|
|||||||
+1
-4
@@ -50,10 +50,7 @@ public class ApplicationCurrencyRepositoryWrapper {
|
|||||||
throw new CurrencyNotFoundException(currency.getCode());
|
throw new CurrencyNotFoundException(currency.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
final ApplicationCurrency applicationCurrency = ApplicationCurrency.from(defaultApplicationCurrency,
|
return ApplicationCurrency.from(defaultApplicationCurrency, currency.getDigitsAfterDecimal(), currency.getInMultiplesOf());
|
||||||
currency.getDigitsAfterDecimal(), currency.getInMultiplesOf());
|
|
||||||
|
|
||||||
return applicationCurrency;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-20
@@ -72,7 +72,7 @@ public final class AnnualCompoundingPeriod implements CompoundingPeriod {
|
|||||||
final BigDecimal minOverdraftForInterestCalculation) {
|
final BigDecimal minOverdraftForInterestCalculation) {
|
||||||
|
|
||||||
BigDecimal cumulativeBalance = BigDecimal.ZERO;
|
BigDecimal cumulativeBalance = BigDecimal.ZERO;
|
||||||
Integer numberOfDays = Integer.valueOf(0);
|
Integer numberOfDays = 0;
|
||||||
|
|
||||||
for (final EndOfDayBalance balance : this.endOfDayBalances) {
|
for (final EndOfDayBalance balance : this.endOfDayBalances) {
|
||||||
final BigDecimal endOfDayCumulativeBalance = balance.cumulativeBalance(interestToCompound);
|
final BigDecimal endOfDayCumulativeBalance = balance.cumulativeBalance(interestToCompound);
|
||||||
@@ -126,28 +126,10 @@ public final class AnnualCompoundingPeriod implements CompoundingPeriod {
|
|||||||
daysInYear, minBalanceForInterestCalculation, overdraftInterestRateAsFraction,
|
daysInYear, minBalanceForInterestCalculation, overdraftInterestRateAsFraction,
|
||||||
minOverdraftForInterestCalculation);
|
minOverdraftForInterestCalculation);
|
||||||
break;
|
break;
|
||||||
case MONTHLY:
|
case MONTHLY, ANNUAL, BI_ANNUAL, QUATERLY:
|
||||||
interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear,
|
interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear,
|
||||||
minBalanceForInterestCalculation, overdraftInterestRateAsFraction, minOverdraftForInterestCalculation);
|
minBalanceForInterestCalculation, overdraftInterestRateAsFraction, minOverdraftForInterestCalculation);
|
||||||
break;
|
break;
|
||||||
case QUATERLY:
|
|
||||||
interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear,
|
|
||||||
minBalanceForInterestCalculation, overdraftInterestRateAsFraction, minOverdraftForInterestCalculation);
|
|
||||||
break;
|
|
||||||
// case WEEKLY:
|
|
||||||
// break;
|
|
||||||
// case BIWEEKLY:
|
|
||||||
// break;
|
|
||||||
case BI_ANNUAL:
|
|
||||||
interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear,
|
|
||||||
minBalanceForInterestCalculation, overdraftInterestRateAsFraction, minOverdraftForInterestCalculation);
|
|
||||||
break;
|
|
||||||
case ANNUAL:
|
|
||||||
interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear,
|
|
||||||
minBalanceForInterestCalculation, overdraftInterestRateAsFraction, minOverdraftForInterestCalculation);
|
|
||||||
break;
|
|
||||||
// case NO_COMPOUNDING_SIMPLE_INTEREST:
|
|
||||||
// break;
|
|
||||||
case INVALID:
|
case INVALID:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-17
@@ -20,7 +20,10 @@ package org.apache.fineract.useradministration.data;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||||
import org.apache.fineract.organisation.staff.data.StaffData;
|
import org.apache.fineract.organisation.staff.data.StaffData;
|
||||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||||
@@ -43,6 +46,7 @@ public final class AppUserData {
|
|||||||
private List<Long> roles;
|
private List<Long> roles;
|
||||||
private Boolean sendPasswordToEmail;
|
private Boolean sendPasswordToEmail;
|
||||||
private Long staffId;
|
private Long staffId;
|
||||||
|
@Getter
|
||||||
private transient Integer rowIndex;
|
private transient Integer rowIndex;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@@ -53,6 +57,7 @@ public final class AppUserData {
|
|||||||
private final StaffData staff;
|
private final StaffData staff;
|
||||||
private final Boolean isSelfServiceUser;
|
private final Boolean isSelfServiceUser;
|
||||||
|
|
||||||
|
@Setter
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private Set<ClientData> clients;
|
private Set<ClientData> clients;
|
||||||
|
|
||||||
@@ -85,10 +90,6 @@ public final class AppUserData {
|
|||||||
this.clients = null;
|
this.clients = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getRowIndex() {
|
|
||||||
return rowIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AppUserData template(final AppUserData user, final Collection<OfficeData> officesForDropdown) {
|
public static AppUserData template(final AppUserData user, final Collection<OfficeData> officesForDropdown) {
|
||||||
return new AppUserData(user.id, user.username, user.email, user.officeId, user.officeName, user.firstname, user.lastname,
|
return new AppUserData(user.id, user.username, user.email, user.officeId, user.officeName, user.firstname, user.lastname,
|
||||||
user.availableRoles, user.selfServiceRoles, user.selectedRoles, officesForDropdown, user.staff, user.passwordNeverExpires,
|
user.availableRoles, user.selfServiceRoles, user.selectedRoles, officesForDropdown, user.staff, user.passwordNeverExpires,
|
||||||
@@ -146,17 +147,11 @@ public final class AppUserData {
|
|||||||
if (this == o) {
|
if (this == o) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (o == null || !(o instanceof AppUserData)) {
|
if (!(o instanceof AppUserData that)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppUserData that = (AppUserData) o;
|
return Objects.equals(id, that.id);
|
||||||
|
|
||||||
if (id != null ? !id.equals(that.id) : that.id != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -164,12 +159,8 @@ public final class AppUserData {
|
|||||||
return id != null ? id.hashCode() : 0;
|
return id != null ? id.hashCode() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClients(Set<ClientData> clients) {
|
|
||||||
this.clients = clients;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSelfServiceUser() {
|
public boolean isSelfServiceUser() {
|
||||||
return this.isSelfServiceUser == null ? false : this.isSelfServiceUser;
|
return this.isSelfServiceUser != null && this.isSelfServiceUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ public class AppUserClientMapping extends AbstractPersistableCustom<Long> {
|
|||||||
|
|
||||||
AppUserClientMapping that = (AppUserClientMapping) obj;
|
AppUserClientMapping that = (AppUserClientMapping) obj;
|
||||||
|
|
||||||
return null == this.client.getId() ? false : this.client.getId().equals(that.client.getId());
|
return null != this.client.getId() && this.client.getId().equals(that.client.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-4
@@ -101,9 +101,7 @@ public class DocumentWritePlatformServiceJpaRepositoryImpl implements DocumentWr
|
|||||||
final DocumentCommand documentCommand = new DocumentCommand(null, null, entityType, entityId, name, fileName, fileSize, mimeType,
|
final DocumentCommand documentCommand = new DocumentCommand(null, null, entityType, entityId, name, fileName, fileSize, mimeType,
|
||||||
description, null);
|
description, null);
|
||||||
|
|
||||||
final Long documentId = createDocument(documentCommand, inputStream);
|
return createDocument(documentCommand, inputStream);
|
||||||
|
|
||||||
return documentId;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +194,7 @@ public class DocumentWritePlatformServiceJpaRepositoryImpl implements DocumentWr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-5
@@ -645,11 +645,8 @@ public class AssetExternalizationStepDef extends AbstractStepDef {
|
|||||||
|
|
||||||
PageExternalTransferData transfersResponse = externalAssetOwnersApi().getTransfers(Map.of("loanId", loanId));
|
PageExternalTransferData transfersResponse = externalAssetOwnersApi().getTransfers(Map.of("loanId", loanId));
|
||||||
List<ExternalTransferData> content = transfersResponse.getContent();
|
List<ExternalTransferData> content = transfersResponse.getContent();
|
||||||
ExternalTransferData result = content.stream().filter(bizEvent -> bizEvent.getTransferExternalId().equals(transferExternalId))
|
return content.stream().filter(bizEvent -> bizEvent.getTransferExternalId().equals(transferExternalId)).toList().stream()
|
||||||
.toList().stream().reduce((first, second) -> second)
|
.reduce((first, second) -> second).orElseThrow(() -> new IllegalStateException("transfersResponse.getContent() is empty"));
|
||||||
.orElseThrow(() -> new IllegalStateException("transfersResponse.getContent() is empty"));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Then("The asset external owner has the following OWNER Journal entries:")
|
@Then("The asset external owner has the following OWNER Journal entries:")
|
||||||
|
|||||||
+6
-7
@@ -21,7 +21,6 @@ package org.apache.fineract.investor.service;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -29,9 +28,9 @@ import static org.mockito.Mockito.when;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||||
@@ -107,7 +106,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
||||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(eq(command.entityId()));
|
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(command.entityId());
|
||||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +133,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
||||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(eq(command.entityId()));
|
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(command.entityId());
|
||||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
||||||
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
||||||
}
|
}
|
||||||
@@ -157,7 +156,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
||||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(eq(1L));
|
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(1L);
|
||||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
||||||
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
||||||
Assertions.assertEquals(thrownException.getMessage(), "Loan product attribute with id " + 1L + " was not found");
|
Assertions.assertEquals(thrownException.getMessage(), "Loan product attribute with id " + 1L + " was not found");
|
||||||
@@ -188,7 +187,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
verify(testContext.loanProductRepository).existsById(testContext.loanProductId);
|
||||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(eq(command.entityId()));
|
verify(testContext.externalAssetOwnerLoanProductAttributesRepository).findById(command.entityId());
|
||||||
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
verify(testContext.externalAssetOwnerLoanProductAttributesRepository, times(0))
|
||||||
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
.saveAndFlush(loanProductAttributeArgumentCaptor.capture());
|
||||||
Assertions.assertEquals(thrownException.getMessage(),
|
Assertions.assertEquals(thrownException.getMessage(),
|
||||||
@@ -365,7 +364,7 @@ public class ExternalAssetOwnerLoanProductAttributesWriteServiceImplTest {
|
|||||||
private ExternalAssetOwnerLoanProductAttributesWriteServiceImpl externalAssetOwnerLoanProductAttributesWriteService;
|
private ExternalAssetOwnerLoanProductAttributesWriteServiceImpl externalAssetOwnerLoanProductAttributesWriteService;
|
||||||
|
|
||||||
private final FromJsonHelper fromJsonHelper = new FromJsonHelper();
|
private final FromJsonHelper fromJsonHelper = new FromJsonHelper();
|
||||||
private final Long loanProductId = Long.valueOf(RandomStringUtils.randomNumeric(2));
|
private final Long loanProductId = ThreadLocalRandom.current().nextLong(10, 100);
|
||||||
@Setter
|
@Setter
|
||||||
private String attributeKey = "SETTLEMENT_MODEL";
|
private String attributeKey = "SETTLEMENT_MODEL";
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
+8
-11
@@ -3150,9 +3150,8 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
|
|||||||
.orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
final List<LoanCharge> liftedLoanCharges = new ArrayList<>();
|
final List<LoanCharge> liftedLoanCharges = new ArrayList<>();
|
||||||
installments.stream().filter(installment -> !installment.getDueDate().isBefore(transactionDate)).forEach(i -> {
|
installments.stream().filter(installment -> !installment.getDueDate().isBefore(transactionDate))
|
||||||
liftedLoanCharges.addAll(getLoanChargesOfInstallment(ctx.getCharges(), i, 1));
|
.forEach(i -> liftedLoanCharges.addAll(getLoanChargesOfInstallment(ctx.getCharges(), i, 1)));
|
||||||
});
|
|
||||||
|
|
||||||
installments.removeIf(i -> i.getInstallmentNumber() != null && !i.isDownPayment() && !i.getDueDate().isBefore(transactionDate));
|
installments.removeIf(i -> i.getInstallmentNumber() != null && !i.isDownPayment() && !i.getDueDate().isBefore(transactionDate));
|
||||||
|
|
||||||
@@ -3308,10 +3307,10 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
|
|||||||
private LocalDate calculateReAgedNextDate(final PeriodFrequencyType frequencyType, final LocalDate dueDate,
|
private LocalDate calculateReAgedNextDate(final PeriodFrequencyType frequencyType, final LocalDate dueDate,
|
||||||
final Integer frequencyNumber) {
|
final Integer frequencyNumber) {
|
||||||
return switch (frequencyType) {
|
return switch (frequencyType) {
|
||||||
case DAYS -> dueDate.plusDays((long) frequencyNumber);
|
case DAYS -> dueDate.plusDays(frequencyNumber);
|
||||||
case WEEKS -> dueDate.plusWeeks((long) frequencyNumber);
|
case WEEKS -> dueDate.plusWeeks(frequencyNumber);
|
||||||
case MONTHS -> dueDate.plusMonths((long) frequencyNumber);
|
case MONTHS -> dueDate.plusMonths(frequencyNumber);
|
||||||
case YEARS -> dueDate.plusYears((long) frequencyNumber);
|
case YEARS -> dueDate.plusYears(frequencyNumber);
|
||||||
default -> throw new UnsupportedOperationException();
|
default -> throw new UnsupportedOperationException();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -3799,10 +3798,8 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep
|
|||||||
|
|
||||||
private void createChargeMappingsForInstallment(final LoanRepaymentScheduleInstallment installment,
|
private void createChargeMappingsForInstallment(final LoanRepaymentScheduleInstallment installment,
|
||||||
List<ReAgedChargeEqualAmortizationValues> reAgedChargeEqualAmortizationValues, Integer index) {
|
List<ReAgedChargeEqualAmortizationValues> reAgedChargeEqualAmortizationValues, Integer index) {
|
||||||
reAgedChargeEqualAmortizationValues.forEach(amortizationValue -> {
|
reAgedChargeEqualAmortizationValues.forEach(amortizationValue -> installment.getInstallmentCharges().add(new LoanInstallmentCharge(
|
||||||
installment.getInstallmentCharges().add(new LoanInstallmentCharge(
|
amortizationValue.equalAmortizationValues.calculateValueBigDecimal(index), amortizationValue.charge, installment)));
|
||||||
amortizationValue.equalAmortizationValues.calculateValueBigDecimal(index), amortizationValue.charge, installment));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private FirstReAgeInstallmentProps calculateFirstReAgeInstallmentProps(List<LoanRepaymentScheduleInstallment> installments,
|
private FirstReAgeInstallmentProps calculateFirstReAgeInstallmentProps(List<LoanRepaymentScheduleInstallment> installments,
|
||||||
|
|||||||
+5
-6
@@ -78,9 +78,8 @@ public class AdvancedPaymentAllocationsValidator {
|
|||||||
AtomicInteger pastDueRuleInteger = new AtomicInteger();
|
AtomicInteger pastDueRuleInteger = new AtomicInteger();
|
||||||
AtomicInteger dueRuleInteger = new AtomicInteger();
|
AtomicInteger dueRuleInteger = new AtomicInteger();
|
||||||
AtomicInteger inAdvanceRuleInteger = new AtomicInteger();
|
AtomicInteger inAdvanceRuleInteger = new AtomicInteger();
|
||||||
paymentAllocationRule.getAllocationTypes().forEach(paymentAllocationType -> {
|
paymentAllocationRule.getAllocationTypes().forEach(paymentAllocationType -> validateAllocationType(paymentAllocationType,
|
||||||
validateAllocationType(paymentAllocationType, pastDueRuleInteger, dueRuleInteger, inAdvanceRuleInteger);
|
pastDueRuleInteger, dueRuleInteger, inAdvanceRuleInteger));
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,14 +121,14 @@ public class AdvancedPaymentAllocationsValidator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasAtLeastOneDefaultPaymentAllocation(List<LoanProductPaymentAllocationRule> rules) {
|
private boolean hasAtLeastOneDefaultPaymentAllocation(List<LoanProductPaymentAllocationRule> rules) {
|
||||||
return rules != null && rules.stream() //
|
return rules != null && !rules.stream() //
|
||||||
.filter(r -> PaymentAllocationTransactionType.DEFAULT.equals(r.getTransactionType())) //
|
.filter(r -> PaymentAllocationTransactionType.DEFAULT.equals(r.getTransactionType())) //
|
||||||
.toList() //
|
.toList() //
|
||||||
.size() > 0;
|
.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasLoanProductPaymentAllocationRule(List<LoanProductPaymentAllocationRule> rules) {
|
private boolean hasLoanProductPaymentAllocationRule(List<LoanProductPaymentAllocationRule> rules) {
|
||||||
return rules != null && rules.size() > 0;
|
return rules != null && !rules.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void raiseValidationError(String globalisationMessageCode, String msg) {
|
private void raiseValidationError(String globalisationMessageCode, String msg) {
|
||||||
|
|||||||
+2
-2
@@ -258,12 +258,12 @@ class AdvancedPaymentScheduleTransactionProcessorTest {
|
|||||||
when(loan.getPaymentAllocationRules()).thenReturn(List.of(loanPaymentAllocationRule));
|
when(loan.getPaymentAllocationRules()).thenReturn(List.of(loanPaymentAllocationRule));
|
||||||
when(loanPaymentAllocationRule.getTransactionType()).thenReturn(PaymentAllocationTransactionType.DEFAULT);
|
when(loanPaymentAllocationRule.getTransactionType()).thenReturn(PaymentAllocationTransactionType.DEFAULT);
|
||||||
when(loanPaymentAllocationRule.getAllocationTypes()).thenReturn(List.of(PaymentAllocationType.DUE_PRINCIPAL));
|
when(loanPaymentAllocationRule.getAllocationTypes()).thenReturn(List.of(PaymentAllocationType.DUE_PRINCIPAL));
|
||||||
when(loanTransaction.isOn(eq(transactionDate))).thenReturn(true);
|
when(loanTransaction.isOn(transactionDate)).thenReturn(true);
|
||||||
|
|
||||||
underTest.processLatestTransaction(loanTransaction,
|
underTest.processLatestTransaction(loanTransaction,
|
||||||
new TransactionCtx(currency, List.of(installment), Set.of(charge), new MoneyHolder(overpaidAmount), null));
|
new TransactionCtx(currency, List.of(installment), Set.of(charge), new MoneyHolder(overpaidAmount), null));
|
||||||
|
|
||||||
Mockito.verify(installment, times(1)).payFeeChargesComponent(eq(transactionDate), eq(chargeAmountMoney));
|
Mockito.verify(installment, times(1)).payFeeChargesComponent(transactionDate, chargeAmountMoney);
|
||||||
Mockito.verify(loanTransaction, times(1)).updateComponents(refEq(zero), refEq(zero), refEq(chargeAmountMoney), refEq(zero));
|
Mockito.verify(loanTransaction, times(1)).updateComponents(refEq(zero), refEq(zero), refEq(chargeAmountMoney), refEq(zero));
|
||||||
assertEquals(0, BigDecimal.valueOf(20).compareTo(loanTransaction.getAmount(currency).minus(chargeAmountMoney).getAmount()));
|
assertEquals(0, BigDecimal.valueOf(20).compareTo(loanTransaction.getAmount(currency).minus(chargeAmountMoney).getAmount()));
|
||||||
assertEquals(0, chargeAmount.compareTo(installment.getFeeChargesCharged(currency).getAmount()));
|
assertEquals(0, chargeAmount.compareTo(installment.getFeeChargesCharged(currency).getAmount()));
|
||||||
|
|||||||
+3
-6
@@ -220,18 +220,15 @@ class AdvancedPaymentAllocationsJsonParserTest {
|
|||||||
|
|
||||||
private static List<Pair<Integer, PaymentAllocationType>> createPaymentAllocationTypeList() {
|
private static List<Pair<Integer, PaymentAllocationType>> createPaymentAllocationTypeList() {
|
||||||
AtomicInteger i = new AtomicInteger(1);
|
AtomicInteger i = new AtomicInteger(1);
|
||||||
List<Pair<Integer, PaymentAllocationType>> list = EnumSet.allOf(PaymentAllocationType.class).stream()
|
return EnumSet.allOf(PaymentAllocationType.class).stream().map(p -> Pair.of(i.getAndIncrement(), p)).toList();
|
||||||
.map(p -> Pair.of(i.getAndIncrement(), p)).toList();
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private JsonCommand createJsonCommand(Map<String, Object> jsonMap) throws JsonProcessingException {
|
private JsonCommand createJsonCommand(Map<String, Object> jsonMap) throws JsonProcessingException {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
String json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonMap);
|
String json = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonMap);
|
||||||
JsonCommand command = JsonCommand.from(json, JsonParser.parseString(json), fromJsonHelper, null, 1L, 2L, 3L, 4L, null, null, null,
|
return JsonCommand.from(json, JsonParser.parseString(json), fromJsonHelper, null, 1L, 2L, 3L, 4L, null, null, null, null, null,
|
||||||
null, null, null, null, null, null);
|
null, null, null, null);
|
||||||
return command;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-22
@@ -280,16 +280,14 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
|||||||
return offices;
|
return offices;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private List<ChargeData> fetchCharges() {
|
private List<ChargeData> fetchCharges() {
|
||||||
return (List) this.chargeReadPlatformService.retrieveAllCharges();
|
return this.chargeReadPlatformService.retrieveAllCharges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private List<StaffData> fetchStaff(final Long staffId) {
|
private List<StaffData> fetchStaff(final Long staffId) {
|
||||||
List<StaffData> staff = null;
|
List<StaffData> staff = null;
|
||||||
if (staffId == null) {
|
if (staffId == null) {
|
||||||
staff = (List) this.staffReadPlatformService.retrieveAllStaff(null, Boolean.FALSE, null);
|
staff = this.staffReadPlatformService.retrieveAllStaff(null, Boolean.FALSE, null);
|
||||||
} else {
|
} else {
|
||||||
staff = new ArrayList<>();
|
staff = new ArrayList<>();
|
||||||
staff.add(this.staffReadPlatformService.retrieveStaff(staffId));
|
staff.add(this.staffReadPlatformService.retrieveStaff(staffId));
|
||||||
@@ -308,8 +306,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<SavingsProductData> fetchSavingsProducts() {
|
private List<SavingsProductData> fetchSavingsProducts() {
|
||||||
List<SavingsProductData> savingsProducts = (List<SavingsProductData>) savingsProductReadPlatformService.retrieveAll();
|
return (List<SavingsProductData>) savingsProductReadPlatformService.retrieveAll();
|
||||||
return savingsProducts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkbookPopulator populateCenterWorkbook(Long officeId, Long staffId) {
|
private WorkbookPopulator populateCenterWorkbook(Long officeId, Long staffId) {
|
||||||
@@ -396,23 +393,19 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<CurrencyData> fetchCurrencies() {
|
private List<CurrencyData> fetchCurrencies() {
|
||||||
List<CurrencyData> currencies = (List<CurrencyData>) this.currencyReadPlatformService.retrieveAllPlatformCurrencies();
|
return this.currencyReadPlatformService.retrieveAllPlatformCurrencies();
|
||||||
return currencies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PaymentTypeData> fetchPaymentTypes() {
|
private List<PaymentTypeData> fetchPaymentTypes() {
|
||||||
List<PaymentTypeData> paymentTypeData = (List<PaymentTypeData>) this.paymentTypeReadPlatformService.retrieveAllPaymentTypes();
|
return this.paymentTypeReadPlatformService.retrieveAllPaymentTypes();
|
||||||
return paymentTypeData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<FundData> fetchFunds() {
|
private List<FundData> fetchFunds() {
|
||||||
List<FundData> funds = (List<FundData>) this.fundReadPlatformService.retrieveAllFunds();
|
return this.fundReadPlatformService.retrieveAllFunds();
|
||||||
return funds;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LoanProductData> fetchLoanProducts() {
|
private List<LoanProductData> fetchLoanProducts() {
|
||||||
List<LoanProductData> loanproducts = (List<LoanProductData>) this.loanProductReadPlatformService.retrieveAllLoanProducts();
|
return (List<LoanProductData>) this.loanProductReadPlatformService.retrieveAllLoanProducts();
|
||||||
return loanproducts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<GroupGeneralData> fetchGroups(Long officeId) {
|
private List<GroupGeneralData> fetchGroups(Long officeId) {
|
||||||
@@ -470,8 +463,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<GLAccountData> fetchGLAccounts() {
|
private List<GLAccountData> fetchGLAccounts() {
|
||||||
List<GLAccountData> glaccounts = this.glAccountReadPlatformService.retrieveAllGLAccounts(null, null, null, null, null, null);
|
return this.glAccountReadPlatformService.retrieveAllGLAccounts(null, null, null, null, null, null);
|
||||||
return glaccounts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkbookPopulator populateGuarantorWorkbook(Long officeId) {
|
private WorkbookPopulator populateGuarantorWorkbook(Long officeId) {
|
||||||
@@ -504,12 +496,12 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
|||||||
return new OfficeWorkbookPopulator(offices);
|
return new OfficeWorkbookPopulator(offices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: officeId seems to be unused and used in getTemplate() needs to be evaluated and removed
|
||||||
private WorkbookPopulator populateChartOfAccountsWorkbook(Long officeId) {
|
private WorkbookPopulator populateChartOfAccountsWorkbook(Long officeId) {
|
||||||
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GL_ACCOUNT_ENTITY_TYPE);
|
this.context.authenticatedUser().validateHasReadPermission(TemplatePopulateImportConstants.GL_ACCOUNT_ENTITY_TYPE);
|
||||||
List<GLAccountData> glAccounts = fetchGLAccounts();
|
List<GLAccountData> glAccounts = fetchGLAccounts();
|
||||||
List<OfficeData> offices = fetchOffices(null);
|
List<OfficeData> offices = fetchOffices(null);
|
||||||
return new ChartOfAccountsWorkbook(glAccounts, offices,
|
return new ChartOfAccountsWorkbook(glAccounts, offices, this.currencyReadPlatformService.retrieveAllowedCurrencies());
|
||||||
(List<CurrencyData>) this.currencyReadPlatformService.retrieveAllowedCurrencies());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkbookPopulator populateStaffWorkbook(Long officeId) {
|
private WorkbookPopulator populateStaffWorkbook(Long officeId) {
|
||||||
@@ -531,8 +523,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<ChargeData> fetchChargesForShares() {
|
private List<ChargeData> fetchChargesForShares() {
|
||||||
List<ChargeData> chargesForShares = (List<ChargeData>) chargeReadPlatformService.retrieveSharesApplicableCharges();
|
return chargeReadPlatformService.retrieveSharesApplicableCharges();
|
||||||
return chargesForShares;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ShareProductData> fetchSharedProducts() {
|
private List<ShareProductData> fetchSharedProducts() {
|
||||||
@@ -655,8 +646,7 @@ public class BulkImportWorkbookPopulatorServiceImpl implements BulkImportWorkboo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<RoleData> fetchRoles() {
|
private List<RoleData> fetchRoles() {
|
||||||
List<RoleData> rolesList = (List<RoleData>) roleReadPlatformService.retrieveAllActiveRoles();
|
return (List<RoleData>) roleReadPlatformService.retrieveAllActiveRoles();
|
||||||
return rolesList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkbookPopulator populateFixedDepositTransactionsWorkbook(Long officeId) {
|
private WorkbookPopulator populateFixedDepositTransactionsWorkbook(Long officeId) {
|
||||||
|
|||||||
+8
-8
@@ -40,8 +40,8 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.apache.commons.lang3.RandomUtils;
|
|
||||||
import org.apache.fineract.batch.command.internal.AdjustLoanTransactionCommandStrategy;
|
import org.apache.fineract.batch.command.internal.AdjustLoanTransactionCommandStrategy;
|
||||||
import org.apache.fineract.batch.command.internal.CreateTransactionLoanCommandStrategy;
|
import org.apache.fineract.batch.command.internal.CreateTransactionLoanCommandStrategy;
|
||||||
import org.apache.fineract.batch.command.internal.GetDatatableEntryByAppTableIdAndDataTableIdCommandStrategy;
|
import org.apache.fineract.batch.command.internal.GetDatatableEntryByAppTableIdAndDataTableIdCommandStrategy;
|
||||||
@@ -413,7 +413,7 @@ public class BatchApiTest extends BaseLoanIntegrationTest {
|
|||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.currencyDetails("0", "100").build(null);
|
.currencyDetails("0", "100").build(null);
|
||||||
|
|
||||||
final Long applyLoanRequestId = Long.valueOf(RandomStringUtils.randomNumeric(4));
|
final Long applyLoanRequestId = ThreadLocalRandom.current().nextLong(1000, 10_000);
|
||||||
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
||||||
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
||||||
final Long createChargeRequestId = disburseLoanRequestId + 1;
|
final Long createChargeRequestId = disburseLoanRequestId + 1;
|
||||||
@@ -474,7 +474,7 @@ public class BatchApiTest extends BaseLoanIntegrationTest {
|
|||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.currencyDetails("0", "100").build(null);
|
.currencyDetails("0", "100").build(null);
|
||||||
|
|
||||||
final Long applyLoanRequestId = Long.valueOf(RandomStringUtils.randomNumeric(4));
|
final Long applyLoanRequestId = ThreadLocalRandom.current().nextLong(1000, 10_000);
|
||||||
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
||||||
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
||||||
final Long createChargeRequestId = disburseLoanRequestId + 1;
|
final Long createChargeRequestId = disburseLoanRequestId + 1;
|
||||||
@@ -1671,7 +1671,7 @@ public class BatchApiTest extends BaseLoanIntegrationTest {
|
|||||||
final Integer productId = new LoanTransactionHelper(this.requestSpec, this.responseSpec).getLoanProductId(loanProductJSON);
|
final Integer productId = new LoanTransactionHelper(this.requestSpec, this.responseSpec).getLoanProductId(loanProductJSON);
|
||||||
|
|
||||||
final LocalDate date = LocalDate.now(Utils.getZoneIdOfTenant());
|
final LocalDate date = LocalDate.now(Utils.getZoneIdOfTenant());
|
||||||
final Long applyLoanRequestId = Long.valueOf(RandomStringUtils.randomNumeric(4));
|
final Long applyLoanRequestId = ThreadLocalRandom.current().nextLong(1000, 10_000);
|
||||||
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
||||||
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
||||||
final Long getLoanBeforeTxnRequestId = disburseLoanRequestId + 1;
|
final Long getLoanBeforeTxnRequestId = disburseLoanRequestId + 1;
|
||||||
@@ -2275,7 +2275,7 @@ public class BatchApiTest extends BaseLoanIntegrationTest {
|
|||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.currencyDetails("0", "100").build(null);
|
.currencyDetails("0", "100").build(null);
|
||||||
|
|
||||||
final Long applyLoanRequestId = RandomUtils.nextLong(100, 1000);
|
final Long applyLoanRequestId = ThreadLocalRandom.current().nextLong(100, 1000);
|
||||||
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
||||||
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
||||||
final Long updateLoanRequestId = disburseLoanRequestId + 1;
|
final Long updateLoanRequestId = disburseLoanRequestId + 1;
|
||||||
@@ -2332,7 +2332,7 @@ public class BatchApiTest extends BaseLoanIntegrationTest {
|
|||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.currencyDetails("0", "100").build(null);
|
.currencyDetails("0", "100").build(null);
|
||||||
|
|
||||||
final Long applyLoanRequestId = RandomUtils.nextLong(100, 1000);
|
final long applyLoanRequestId = ThreadLocalRandom.current().nextLong(100, 1000);
|
||||||
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
||||||
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
||||||
final Long updateLoanRequestId = disburseLoanRequestId + 1;
|
final Long updateLoanRequestId = disburseLoanRequestId + 1;
|
||||||
@@ -2399,7 +2399,7 @@ public class BatchApiTest extends BaseLoanIntegrationTest {
|
|||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.currencyDetails("0", "100").build(null);
|
.currencyDetails("0", "100").build(null);
|
||||||
|
|
||||||
final Long applyLoanRequestId = RandomUtils.nextLong(100, 1000);
|
final long applyLoanRequestId = ThreadLocalRandom.current().nextLong(100, 1000);
|
||||||
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
||||||
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
||||||
final Long getLoanRequestId = disburseLoanRequestId + 1;
|
final Long getLoanRequestId = disburseLoanRequestId + 1;
|
||||||
@@ -2481,7 +2481,7 @@ public class BatchApiTest extends BaseLoanIntegrationTest {
|
|||||||
.withInterestTypeAsDecliningBalance() //
|
.withInterestTypeAsDecliningBalance() //
|
||||||
.currencyDetails("0", "100").build(null);
|
.currencyDetails("0", "100").build(null);
|
||||||
|
|
||||||
final Long applyLoanRequestId = RandomUtils.nextLong(100, 1000);
|
final Long applyLoanRequestId = ThreadLocalRandom.current().nextLong(100, 1000);
|
||||||
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
final Long approveLoanRequestId = applyLoanRequestId + 1;
|
||||||
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
final Long disburseLoanRequestId = approveLoanRequestId + 1;
|
||||||
final Long getLoanRequestId = disburseLoanRequestId + 1;
|
final Long getLoanRequestId = disburseLoanRequestId + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user