diff --git a/custom/docker/build.gradle b/custom/docker/build.gradle index 50253a22c..b2259a9a7 100644 --- a/custom/docker/build.gradle +++ b/custom/docker/build.gradle @@ -68,6 +68,7 @@ jib { allowInsecureRegistries = true dependencies { + implementation project(':fineract-core') implementation project(':fineract-provider') // NOTE: dynamically load all custom modules file("${rootDir}/custom").eachDir { companyDir -> diff --git a/fineract-core/dependencies.gradle b/fineract-core/dependencies.gradle index 1c41c9971..c13b498a2 100644 --- a/fineract-core/dependencies.gradle +++ b/fineract-core/dependencies.gradle @@ -35,7 +35,6 @@ dependencies { 'com.google.code.gson:gson', 'org.apache.commons:commons-lang3', - 'org.liquibase:liquibase-core', 'com.jayway.jsonpath:json-path', @@ -49,7 +48,12 @@ dependencies { 'io.github.resilience4j:resilience4j-spring-boot2', ) - + implementation ('org.springframework.boot:spring-boot-starter-data-jpa') { + exclude group: 'org.hibernate' + } + implementation('org.eclipse.persistence:org.eclipse.persistence.jpa') { + exclude group: 'org.eclipse.persistence', module: 'jakarta.persistence' + } implementation('org.springframework.boot:spring-boot-starter-jersey') { exclude group: 'org.glassfish.hk2.external', module: 'aopalliance-repackaged' exclude group: 'org.glassfish.hk2', module: 'hk2-runlevel' diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java rename to fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityData.java b/fineract-core/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityData.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityData.java rename to fineract-core/src/main/java/org/apache/fineract/accounting/financialactivityaccount/data/FinancialActivityData.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountType.java b/fineract-core/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountType.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountType.java rename to fineract-core/src/main/java/org/apache/fineract/accounting/glaccount/domain/GLAccountType.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java b/fineract-core/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java rename to fineract-core/src/main/java/org/apache/fineract/commands/domain/CommandWrapper.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java b/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java rename to fineract-core/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/data/AccountNumberFormatData.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/data/AccountNumberFormatData.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/data/AccountNumberFormatData.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/data/AccountNumberFormatData.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatConstants.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatConstants.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatConstants.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatConstants.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ApiParameterHelper.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ApiParameterHelper.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ApiParameterHelper.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ApiParameterHelper.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ApiRequestParameterHelper.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ApiRequestParameterHelper.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ApiRequestParameterHelper.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ApiRequestParameterHelper.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/DateAdapter.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/DateAdapter.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/DateAdapter.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/DateAdapter.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ExternalIdAdapter.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ExternalIdAdapter.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ExternalIdAdapter.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ExternalIdAdapter.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JodaDateTimeAdapter.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/JodaDateTimeAdapter.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JodaDateTimeAdapter.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/JodaDateTimeAdapter.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JodaMonthDayAdapter.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/JodaMonthDayAdapter.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/JodaMonthDayAdapter.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/JodaMonthDayAdapter.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/LocalDateAdapter.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/LocalDateAdapter.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/LocalDateAdapter.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/LocalDateAdapter.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/LocalDateTimeAdapter.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/LocalDateTimeAdapter.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/LocalDateTimeAdapter.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/LocalDateTimeAdapter.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/LocalTimeAdapter.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/LocalTimeAdapter.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/LocalTimeAdapter.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/LocalTimeAdapter.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/OffsetDateTimeAdapter.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/OffsetDateTimeAdapter.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/OffsetDateTimeAdapter.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/OffsetDateTimeAdapter.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ParameterListExclusionStrategy.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ParameterListExclusionStrategy.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ParameterListExclusionStrategy.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ParameterListExclusionStrategy.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ParameterListInclusionStrategy.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ParameterListInclusionStrategy.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/api/ParameterListInclusionStrategy.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/api/ParameterListInclusionStrategy.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/EnumOptionData.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/EnumOptionData.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/data/EnumOptionData.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/data/EnumOptionData.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AbstractAuditableCustom.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/domain/AbstractAuditableCustom.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AbstractAuditableCustom.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/domain/AbstractAuditableCustom.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AbstractPersistableCustom.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/domain/AbstractPersistableCustom.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/domain/AbstractPersistableCustom.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/domain/AbstractPersistableCustom.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/ApiRequestJsonSerializationSettings.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/ApiRequestJsonSerializationSettings.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/ApiRequestJsonSerializationSettings.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/ApiRequestJsonSerializationSettings.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandProcessingResultJsonSerializer.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandProcessingResultJsonSerializer.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandProcessingResultJsonSerializer.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandProcessingResultJsonSerializer.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandSerializer.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandSerializer.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandSerializer.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandSerializer.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandSerializerDefaultToJson.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandSerializerDefaultToJson.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandSerializerDefaultToJson.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/CommandSerializerDefaultToJson.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/DefaultToApiJsonSerializer.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/DefaultToApiJsonSerializer.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/DefaultToApiJsonSerializer.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/DefaultToApiJsonSerializer.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOffJsonSerializerGoogleGson.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/ExcludeNothingWithPrettyPrintingOnJsonSerializerGoogleGson.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/GoogleGsonSerializerHelper.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/GoogleGsonSerializerHelper.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/GoogleGsonSerializerHelper.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/GoogleGsonSerializerHelper.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/ToApiJsonSerializer.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/ToApiJsonSerializer.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/serialization/ToApiJsonSerializer.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/serialization/ToApiJsonSerializer.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/Page.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/service/Page.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/Page.java rename to fineract-core/src/main/java/org/apache/fineract/infrastructure/core/service/Page.java diff --git a/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformUserRightsContext.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformUserRightsContext.java new file mode 100644 index 000000000..519be83d7 --- /dev/null +++ b/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformUserRightsContext.java @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.infrastructure.security.service; + +public interface PlatformUserRightsContext { + + void isAuthenticated(); +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java similarity index 98% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java rename to fineract-core/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java index 334a12992..86bd93231 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java +++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/client/api/ClientApiConstants.java @@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.client.api; import java.util.Arrays; import java.util.HashSet; import java.util.Set; -import org.apache.fineract.portfolio.client.data.ClientData; @SuppressWarnings({ "HideUtilityClassConstructor" }) public class ClientApiConstants { @@ -189,8 +188,8 @@ public class ClientApiConstants { Arrays.asList("loanAccounts", "savingsAccounts", "shareAccounts")); /** - * These parameters will match the class level parameters of {@link ClientData}. Where possible, we try to get - * response parameters to match those of request parameters. + * These parameters will match the class level parameters of ClientData. Where possible, we try to get response + * parameters to match those of request parameters. */ protected static final Set CLIENT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName, externalIdParamName, statusParamName, activeParamName, activationDateParamName, firstnameParamName, middlenameParamName, diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java rename to fineract-core/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResourceConstants.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java rename to fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java rename to fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsApiConstants.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiConstants.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiConstants.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiConstants.java rename to fineract-core/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiConstants.java diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java b/fineract-core/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java similarity index 100% rename from fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java rename to fineract-core/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiConstants.java diff --git a/fineract-investor/dependencies.gradle b/fineract-investor/dependencies.gradle index d6f93f2c3..c2c6fb8dd 100644 --- a/fineract-investor/dependencies.gradle +++ b/fineract-investor/dependencies.gradle @@ -24,11 +24,40 @@ dependencies { // implementation dependencies are directly used (compiled against) in src/main (and src/test) // - api(project(path: ':fineract-core')) + implementation(project(path: ':fineract-core')) + + implementation( + 'org.springframework.boot:spring-boot-starter-web', + 'org.springframework.boot:spring-boot-starter-security', + 'jakarta.ws.rs:jakarta.ws.rs-api', + 'org.glassfish.jersey.media:jersey-media-multipart', + + 'com.google.guava:guava', + 'com.google.code.gson:gson', + + 'org.apache.commons:commons-lang3', + + 'com.jayway.jsonpath:json-path', + + 'com.github.spotbugs:spotbugs-annotations', + 'io.swagger.core.v3:swagger-annotations', + + 'com.squareup.retrofit2:converter-gson', + + 'org.springdoc:springdoc-openapi-security', + 'org.mapstruct:mapstruct', + + 'io.github.resilience4j:resilience4j-spring-boot2', + ) compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' annotationProcessor 'org.mapstruct:mapstruct-processor' - + implementation ('org.springframework.boot:spring-boot-starter-data-jpa') { + exclude group: 'org.hibernate' + } + implementation('org.eclipse.persistence:org.eclipse.persistence.jpa') { + exclude group: 'org.eclipse.persistence', module: 'jakarta.persistence' + } // testCompile dependencies are ONLY used in src/test, not src/main. // Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly! // diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/api/ExternalAssetOwnersApiResource.java b/fineract-investor/src/main/java/org/apache/fineract/investor/api/ExternalAssetOwnersApiResource.java new file mode 100644 index 000000000..0213e26af --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/api/ExternalAssetOwnersApiResource.java @@ -0,0 +1,79 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.api; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.NotImplementedException; +import org.apache.fineract.infrastructure.security.service.PlatformUserRightsContext; +import org.springframework.stereotype.Component; + +@Path("/external-asset-owners") +@Component +@Tag(name = "External Asset Owners", description = "External Asset Owners") +@RequiredArgsConstructor +public class ExternalAssetOwnersApiResource { + + private final PlatformUserRightsContext platformUserRightsContext; + + @POST + @Path("/transfers/loans/{loanId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public String transferRequestWithLoanId(@PathParam("loanId") final Long loanId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + platformUserRightsContext.isAuthenticated(); + + throw new NotImplementedException("Not implemented yet"); + } + + @POST + @Path("/transfers/loans//external-id/{loanExternalId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public String transferRequestWithLoanExternalId(@PathParam("loanExternalId") final Long loanId, + @QueryParam("command") @Parameter(description = "command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + platformUserRightsContext.isAuthenticated(); + + throw new NotImplementedException("Not implemented yet"); + } + + @GET + @Path("/transfers") + @Produces({ MediaType.APPLICATION_JSON }) + public String getTransfer( + @QueryParam("transferExternalId") @Parameter(description = "transferExternalId") final String transferExternalId, + @QueryParam("loanId") @Parameter(description = "loanId") final String loanId, + @QueryParam("loanExternalId") @Parameter(description = "loanExternalId") final String loanExternalId) { + platformUserRightsContext.isAuthenticated(); + + throw new NotImplementedException("Not implemented yet"); + } +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferData.java b/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferData.java new file mode 100644 index 000000000..83dec6e34 --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferData.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import lombok.Data; + +@Data +public class ExternalTransferData { + + private final Long transferId; + private final ExternalTransferOwnerData owner; + private final ExternalTransferLoanMappingData loan; + private final String transferExternalId; + private final BigDecimal purchasePriceRatio; + private final LocalDate settlementDate; + private final ExternalTransferStatus status; + private final LocalDate effectiveFrom; + private final LocalDate effectiveTo; + private final String dateFormat; + private final String locale; +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferLoanMappingData.java b/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferLoanMappingData.java new file mode 100644 index 000000000..0dfd8fa8d --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferLoanMappingData.java @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.data; + +import lombok.Data; + +@Data +public class ExternalTransferLoanMappingData { + + private final Long loanId; + private final String externalId; +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferOwnerData.java b/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferOwnerData.java new file mode 100644 index 000000000..edc1602bd --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferOwnerData.java @@ -0,0 +1,27 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.data; + +import lombok.Data; + +@Data +public class ExternalTransferOwnerData { + + private final String externalId; +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferStatus.java b/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferStatus.java new file mode 100644 index 000000000..74a410cdf --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/data/ExternalTransferStatus.java @@ -0,0 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.data; + +public enum ExternalTransferStatus { + ACTIVE, DECLINED, PENDING, BUYBACK, CANCELLED +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwner.java b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwner.java new file mode 100644 index 000000000..ba186a81b --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwner.java @@ -0,0 +1,40 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom; + +@Getter +@Setter +@Entity +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Table(name = "m_external_asset_owner") +public class ExternalAssetOwner extends AbstractAuditableCustom { + + @Column(name = "external_id", nullable = false, length = 100, unique = true) + private String externalId; + +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerRepository.java b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerRepository.java new file mode 100644 index 000000000..eee4e5d8e --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerRepository.java @@ -0,0 +1,27 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.domain; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface ExternalAssetOwnerRepository + extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransfer.java b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransfer.java new file mode 100644 index 000000000..a638ec802 --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransfer.java @@ -0,0 +1,60 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.domain; + +import java.math.BigDecimal; +import java.time.LocalDate; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom; + +@Getter +@Setter +@Table(name = "m_external_asset_owner_transfer") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Entity +public class ExternalAssetOwnerTransfer extends AbstractAuditableCustom { + + @Column(name = "owner_id") + private Long ownerId; + + @Column(name = "external_id", length = 100) + private String externalId; + + @Column(name = "status", length = 50) + private String status; + + @Column(name = "purchase_price_ratio", precision = 19, scale = 6) + private BigDecimal purchasePriceRatio; + + @Column(name = "settlement_date") + private LocalDate settlementDate; + + @Column(name = "effective_date_from") + private LocalDate effectiveDateFrom; + + @Column(name = "effective_date_to") + private LocalDate effectiveDateTo; + +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransferLoanMapping.java b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransferLoanMapping.java new file mode 100644 index 000000000..37a9d4ac3 --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransferLoanMapping.java @@ -0,0 +1,43 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom; + +@Getter +@Setter +@Table(name = "m_external_asset_owner_transfer_loan_mapping") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Entity +public class ExternalAssetOwnerTransferLoanMapping extends AbstractAuditableCustom { + + @Column(name = "loan_id", nullable = false) + private Long loanId; + + @Column(name = "owner_transfer_id") + private Long ownerTransferId; + +} diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransferRepository.java b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransferRepository.java new file mode 100644 index 000000000..68675d870 --- /dev/null +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/domain/ExternalAssetOwnerTransferRepository.java @@ -0,0 +1,27 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.investor.domain; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +public interface ExternalAssetOwnerTransferRepository + extends JpaRepository, JpaSpecificationExecutor { + +} diff --git a/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/module-changelog-master.xml b/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/module-changelog-master.xml index 065386811..7f959be36 100644 --- a/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/module-changelog-master.xml +++ b/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/module-changelog-master.xml @@ -22,5 +22,6 @@ - + + diff --git a/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/parts/0002_asset_schemas.xml b/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/parts/0002_asset_schemas.xml new file mode 100644 index 000000000..1cb1f6c36 --- /dev/null +++ b/fineract-investor/src/main/resources/db/changelog/tenant/module/investor/parts/0002_asset_schemas.xml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformSecurityContext.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformSecurityContext.java index 55831ce21..c02bce647 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformSecurityContext.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/PlatformSecurityContext.java @@ -21,7 +21,7 @@ package org.apache.fineract.infrastructure.security.service; import org.apache.fineract.commands.domain.CommandWrapper; import org.apache.fineract.useradministration.domain.AppUser; -public interface PlatformSecurityContext { +public interface PlatformSecurityContext extends PlatformUserRightsContext { AppUser authenticatedUser(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java index 3052ca416..2c44e11da 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/service/SpringSecurityPlatformSecurityContext.java @@ -78,6 +78,11 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo return currentUser; } + @Override + public void isAuthenticated() { + authenticatedUser(); + } + @Override public AppUser getAuthenticatedUserIfPresent() {