FINERACT-1418: Upgrade to Jersey 2
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
4bcae92a3d
commit
d3400888fa
+1
-1
@@ -52,7 +52,7 @@ before_install:
|
||||
install:
|
||||
- unset _JAVA_OPTIONS
|
||||
- sudo apt-get -q update
|
||||
- sudo apt-get -yq install gnupg curl
|
||||
- sudo apt-get -yq install gnupg curl dirmngr
|
||||
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9
|
||||
- curl -O https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb
|
||||
- sudo apt-get -yq install ./zulu-repo_1.0.0-3_all.deb
|
||||
|
||||
+7
-3
@@ -24,20 +24,24 @@ WORKDIR /fineract
|
||||
|
||||
RUN ./gradlew --no-daemon -q -x rat -x compileTestJava -x test -x spotlessJavaCheck -x spotlessJava bootJar
|
||||
|
||||
WORKDIR /fineract/target
|
||||
RUN jar -xf /fineract/fineract-provider/build/libs/fineract-provider.jar
|
||||
|
||||
# https://issues.apache.org/jira/browse/LEGAL-462
|
||||
# https://issues.apache.org/jira/browse/FINERACT-762
|
||||
# We include an alternative JDBC driver (which is faster, but not allowed to be default in Apache distribution)
|
||||
# allowing implementations to switch the driver used by changing start-up parameters (for both tenants and each tenant DB)
|
||||
# The commented out lines in the docker-compose.yml illustrate how to do this.
|
||||
WORKDIR /fineract/libs
|
||||
WORKDIR /fineract/target/BOOT-INF/libs
|
||||
RUN wget -q https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.23/mysql-connector-java-8.0.23.jar
|
||||
|
||||
# =========================================
|
||||
|
||||
FROM azul/zulu-openjdk-alpine:11 AS fineract
|
||||
|
||||
COPY --from=builder /fineract/fineract-provider/build/libs /app
|
||||
COPY --from=builder /fineract/libs /app/libs
|
||||
COPY --from=builder /fineract/target/BOOT-INF/lib /app/lib
|
||||
COPY --from=builder /fineract/target/META-INF /app/META-INF
|
||||
COPY --from=builder /fineract/target/BOOT-INF/classes /app
|
||||
|
||||
WORKDIR /
|
||||
|
||||
|
||||
@@ -131,7 +131,6 @@ allprojects {
|
||||
dependency 'jakarta.jms:jakarta.jms-api:2.0.3'
|
||||
dependency 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
|
||||
dependency 'org.glassfish.jaxb:jaxb-runtime:2.3.5'
|
||||
dependency 'jakarta.validation:jakarta.validation-api:3.0.0'
|
||||
dependency 'org.apache.activemq:activemq-broker:5.16.3'
|
||||
dependency 'org.apache.bval:org.apache.bval.bundle:2.0.5'
|
||||
|
||||
@@ -191,16 +190,6 @@ allprojects {
|
||||
exclude 'pull-parser:pull-parser'
|
||||
}
|
||||
|
||||
dependencySet(group: 'com.sun.jersey', version: jerseyVersion) {
|
||||
entry 'jersey-core'
|
||||
entry 'jersey-servlet'
|
||||
entry 'jersey-server'
|
||||
entry 'jersey-json'
|
||||
}
|
||||
dependencySet(group: 'com.sun.jersey.contribs', version: jerseyVersion) {
|
||||
entry 'jersey-spring'
|
||||
entry 'jersey-multipart'
|
||||
}
|
||||
dependencySet(group: 'org.apache.poi', version: '4.1.2') {
|
||||
entry 'poi'
|
||||
entry 'poi-ooxml'
|
||||
|
||||
+20
-1
@@ -1,4 +1,23 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
@@ -8,5 +27,5 @@ while ! nc -zvw3 fineractmysql 3306 ; do
|
||||
done
|
||||
>&2 echo "DB Server is up - executing command"
|
||||
|
||||
java -Dloader.path=/app/libs/ -jar /app/fineract-provider.jar
|
||||
java -cp "app:app/lib/*" org.apache.fineract.ServerApplication
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
dependencies {
|
||||
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
|
||||
|
||||
@@ -26,27 +27,21 @@ dependencies {
|
||||
// implementation dependencies are directly used (compiled against) in src/main (and src/test)
|
||||
//
|
||||
implementation(
|
||||
//'ch.vorburger.mariaDB4j:mariaDB4j:2.4.0',
|
||||
|
||||
'org.springframework.boot:spring-boot-starter-web',
|
||||
'org.springframework.boot:spring-boot-starter-security',
|
||||
'org.springframework.boot:spring-boot-starter-cache',
|
||||
|
||||
'org.glassfish.jersey.media:jersey-media-multipart:2.30.1',
|
||||
|
||||
'org.springframework:spring-jms',
|
||||
'org.springframework:spring-context-support',
|
||||
'org.springframework.security.oauth:spring-security-oauth2',
|
||||
|
||||
'com.sun.jersey:jersey-servlet',
|
||||
'com.sun.jersey:jersey-server',
|
||||
'com.sun.jersey.contribs:jersey-spring',
|
||||
'com.sun.jersey.contribs:jersey-multipart',
|
||||
|
||||
'com.google.guava:guava',
|
||||
'com.google.code.gson:gson',
|
||||
'com.sun.jersey:jersey-core',
|
||||
|
||||
'jakarta.jms:jakarta.jms-api',
|
||||
'jakarta.management.j2ee:jakarta.management.j2ee-api',
|
||||
'jakarta.validation:jakarta.validation-api',
|
||||
|
||||
'com.squareup.retrofit2:retrofit',
|
||||
'com.squareup.okhttp3:okhttp',
|
||||
@@ -74,8 +69,13 @@ dependencies {
|
||||
|
||||
'com.google.cloud.sql:mysql-socket-factory-connector-j-8:1.4.0',
|
||||
'com.squareup.retrofit2:converter-gson',
|
||||
'com.sun.activation:jakarta.activation:1.2.2'
|
||||
)
|
||||
|
||||
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'
|
||||
exclude group: 'org.hibernate.validator', module: 'hibernate-validator'
|
||||
}
|
||||
implementation('org.apache.commons:commons-email') {
|
||||
exclude group: 'javax.activation'
|
||||
}
|
||||
@@ -85,9 +85,6 @@ dependencies {
|
||||
implementation ('jakarta.xml.bind:jakarta.xml.bind-api') {
|
||||
exclude group: 'jakarta.activation'
|
||||
}
|
||||
implementation ('com.sun.jersey:jersey-json') {
|
||||
exclude group: 'com.sun.xml.bind'
|
||||
}
|
||||
implementation ('org.apache.activemq:activemq-broker') {
|
||||
exclude group: 'org.apache.geronimo.specs'
|
||||
}
|
||||
@@ -113,12 +110,15 @@ dependencies {
|
||||
exclude group: 'com.sun.activation'
|
||||
}
|
||||
|
||||
runtimeOnly('org.glassfish.jaxb:jaxb-runtime') {
|
||||
exclude group: 'com.sun.activation'
|
||||
}
|
||||
|
||||
// runtimeOnly dependencies are things that Fineract code has no direct compile time dependency on, but which must be present at run-time
|
||||
runtimeOnly(
|
||||
'org.apache.bval:org.apache.bval.bundle',
|
||||
'org.springframework.boot:spring-boot-starter-actuator',
|
||||
'org.webjars.npm:swagger-ui-dist',
|
||||
'org.glassfish.jaxb:jaxb-runtime',
|
||||
|
||||
// Although fineract (at the time of writing) doesn't have any compile time dep. on httpclient,
|
||||
// it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.glaccount.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -68,6 +66,8 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -66,6 +64,8 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+1
-1
@@ -18,13 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.bulkimport.service;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.fineract.infrastructure.bulkimport.data.GlobalEntityType;
|
||||
import org.apache.fineract.infrastructure.bulkimport.data.ImportData;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.data.DocumentData;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
|
||||
public interface BulkImportWorkbookService {
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.bulkimport.service;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@@ -52,6 +51,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.tika.Tika;
|
||||
import org.apache.tika.io.TikaInputStream;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+2
-2
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.data;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -41,8 +43,6 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+2
-2
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.service;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -31,8 +33,6 @@ import org.apache.fineract.portfolio.common.service.BusinessEventListener;
|
||||
import org.apache.fineract.portfolio.common.service.BusinessEventNotifierService;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+2
-2
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.service;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.mustachejava.DefaultMustacheFactory;
|
||||
import com.github.mustachejava.Mustache;
|
||||
import com.github.mustachejava.MustacheFactory;
|
||||
@@ -89,8 +91,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanRepository;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepository;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+2
-2
@@ -19,6 +19,8 @@
|
||||
|
||||
package org.apache.fineract.infrastructure.campaigns.sms.service;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -53,8 +55,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
|
||||
import org.apache.fineract.portfolio.loanaccount.exception.InvalidLoanTypeException;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+3
-3
@@ -18,6 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.sms.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.mustachejava.DefaultMustacheFactory;
|
||||
import com.github.mustachejava.Mustache;
|
||||
import com.github.mustachejava.MustacheFactory;
|
||||
@@ -83,9 +86,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.exception.InvalidLoanTypeException;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.codehaus.jackson.JsonParseException;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
*/
|
||||
@Configuration
|
||||
@Import({ WebXmlConfiguration.class, WebXmlOauthConfiguration.class, WebFrontEndConfiguration.class, MessagingConfiguration.class,
|
||||
WebTwoFactorXmlConfiguration.class })
|
||||
WebTwoFactorXmlConfiguration.class, JerseyConfig.class })
|
||||
@ImportResource({ "classpath*:META-INF/spring/appContext.xml" })
|
||||
@PropertySource(value = "classpath:META-INF/spring/jdbc.properties")
|
||||
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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.core.boot;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
import org.glassfish.jersey.server.ServerProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ApplicationPath("/api/v1")
|
||||
public class JerseyConfig extends ResourceConfig {
|
||||
|
||||
JerseyConfig() {
|
||||
register(org.glassfish.jersey.media.multipart.MultiPartFeature.class);
|
||||
property(ServerProperties.WADL_FEATURE_DISABLE, true);
|
||||
|
||||
packages("org.apache.fineract");
|
||||
}
|
||||
}
|
||||
-20
@@ -18,12 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.boot;
|
||||
|
||||
import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
|
||||
import org.apache.fineract.infrastructure.core.filters.ResponseCorsFilter;
|
||||
import org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
@@ -41,23 +38,6 @@ public class WebXmlConfiguration {
|
||||
@Autowired
|
||||
private TenantAwareBasicAuthenticationFilter basicAuthenticationProcessingFilter;
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean jersey() {
|
||||
ServletRegistrationBean<SpringServlet> jerseyServletRegistration = new ServletRegistrationBean<SpringServlet>();
|
||||
jerseyServletRegistration.setServlet(new SpringServlet());
|
||||
jerseyServletRegistration.addUrlMappings("/api/v1/*");
|
||||
jerseyServletRegistration.setName("jersey-servlet");
|
||||
jerseyServletRegistration.setLoadOnStartup(1);
|
||||
jerseyServletRegistration.addInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true");
|
||||
jerseyServletRegistration.addInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters",
|
||||
ResponseCorsFilter.class.getName());
|
||||
jerseyServletRegistration.addInitParameter("com.sun.jersey.config.feature.DisableWADL", "true");
|
||||
// debugging for development:
|
||||
// jerseyServletRegistration.addInitParameter("com.sun.jersey.spi.container.ContainerRequestFilters",
|
||||
// LoggingFilter.class.getName());
|
||||
return jerseyServletRegistration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean filterRegistrationBean() {
|
||||
FilterRegistrationBean<TenantAwareBasicAuthenticationFilter> filterRegistrationBean = new FilterRegistrationBean<TenantAwareBasicAuthenticationFilter>();
|
||||
|
||||
-18
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.boot;
|
||||
|
||||
import com.sun.jersey.spi.spring.container.servlet.SpringServlet;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -35,23 +34,6 @@ import org.springframework.web.servlet.DispatcherServlet;
|
||||
@Profile("oauth")
|
||||
public class WebXmlOauthConfiguration {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean jersey() {
|
||||
ServletRegistrationBean<SpringServlet> jerseyServletRegistration = new ServletRegistrationBean<SpringServlet>();
|
||||
jerseyServletRegistration.setServlet(new SpringServlet());
|
||||
jerseyServletRegistration.addUrlMappings("/api/v1/*");
|
||||
jerseyServletRegistration.setName("jersey-servlet");
|
||||
jerseyServletRegistration.setLoadOnStartup(1);
|
||||
jerseyServletRegistration.addInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true");
|
||||
// jerseyServletRegistration.addInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters",
|
||||
// ResponseCorsFilter.class.getName());
|
||||
jerseyServletRegistration.addInitParameter("com.sun.jersey.config.feature.DisableWADL", "true");
|
||||
// debugging for development:
|
||||
// jerseyServletRegistration.addInitParameter("com.sun.jersey.spi.container.ContainerRequestFilters",
|
||||
// LoggingFilter.class.getName());
|
||||
return jerseyServletRegistration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean dispatcherRegistration(DispatcherServlet dispatcherServlet) {
|
||||
ServletRegistrationBean<DispatcherServlet> registrationBean = new ServletRegistrationBean<DispatcherServlet>(dispatcherServlet);
|
||||
|
||||
+3
-4
@@ -18,10 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -53,6 +52,7 @@ public class ApiGlobalErrorResponse {
|
||||
* A list of zero or more of the actual reasons for the HTTP error should they be needed. Typically used to express
|
||||
* data validation errors with parameters passed to API.
|
||||
*/
|
||||
|
||||
private List<ApiParameterError> errors = new ArrayList<>();
|
||||
|
||||
public static ApiGlobalErrorResponse unAuthenticated() {
|
||||
@@ -194,8 +194,7 @@ public class ApiGlobalErrorResponse {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "errors")
|
||||
@XmlElement(name = "errorResponse")
|
||||
@JsonProperty("errors")
|
||||
public List<ApiParameterError> getErrors() {
|
||||
return this.errors;
|
||||
}
|
||||
|
||||
+13
-18
@@ -18,37 +18,32 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.filters;
|
||||
|
||||
import com.sun.jersey.spi.container.ContainerRequest;
|
||||
import com.sun.jersey.spi.container.ContainerResponse;
|
||||
import com.sun.jersey.spi.container.ContainerResponseFilter;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
import javax.ws.rs.container.ContainerRequestContext;
|
||||
import javax.ws.rs.container.ContainerResponseContext;
|
||||
import javax.ws.rs.container.ContainerResponseFilter;
|
||||
import javax.ws.rs.ext.Provider;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Filter that returns a response with headers that allows for Cross-Origin Requests (CORs) to be performed against the
|
||||
* platform API.
|
||||
*/
|
||||
|
||||
@Provider
|
||||
public class ResponseCorsFilter implements ContainerResponseFilter {
|
||||
|
||||
@Override
|
||||
public ContainerResponse filter(final ContainerRequest request, final ContainerResponse response) {
|
||||
public void filter(final ContainerRequestContext request, final ContainerResponseContext response) {
|
||||
|
||||
final ResponseBuilder resp = Response.fromResponse(response.getResponse());
|
||||
response.getHeaders().add("Access-Control-Allow-Origin", "*");
|
||||
// .header("Access-Control-Expose-Headers",
|
||||
// "Fineract-Platform-TenantId")
|
||||
response.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
||||
|
||||
resp.header("Access-Control-Allow-Origin", "*")
|
||||
// .header("Access-Control-Expose-Headers",
|
||||
// "Fineract-Platform-TenantId")
|
||||
.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
||||
|
||||
final String reqHead = request.getHeaderValue("Access-Control-Request-Headers");
|
||||
final String reqHead = request.getHeaders().getFirst("Access-Control-Request-Headers");
|
||||
|
||||
if (null != reqHead && StringUtils.hasText(reqHead)) {
|
||||
resp.header("Access-Control-Allow-Headers", reqHead);
|
||||
response.getHeaders().add("Access-Control-Allow-Headers", reqHead);
|
||||
}
|
||||
|
||||
response.setResponse(resp.build());
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,8 +20,6 @@
|
||||
package org.apache.fineract.infrastructure.creditbureau.api;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
@@ -52,6 +50,8 @@ import org.apache.fineract.infrastructure.creditbureau.data.CreditReportData;
|
||||
import org.apache.fineract.infrastructure.creditbureau.service.CreditReportReadPlatformService;
|
||||
import org.apache.fineract.infrastructure.creditbureau.service.CreditReportWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.creditbureau.service;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import java.io.File;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
|
||||
public interface CreditReportWritePlatformService {
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.creditbureau.service;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
@@ -47,6 +46,7 @@ import org.apache.fineract.infrastructure.creditbureau.domain.CreditReportReposi
|
||||
import org.apache.fineract.infrastructure.creditbureau.domain.TokenRepositoryWrapper;
|
||||
import org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauTokenCommandFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
|
||||
+1
-1
@@ -18,11 +18,11 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.creditbureau.service;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import java.io.File;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauReportData;
|
||||
import org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauToken;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
|
||||
public interface ThitsaWorksCreditBureauIntegrationWritePlatformService {
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,6 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonNull;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
@@ -56,6 +55,7 @@ import org.apache.fineract.infrastructure.creditbureau.domain.CreditReportReposi
|
||||
import org.apache.fineract.infrastructure.creditbureau.domain.TokenRepositoryWrapper;
|
||||
import org.apache.fineract.infrastructure.creditbureau.serialization.CreditBureauTokenCommandFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+4
-1
@@ -45,6 +45,7 @@ import org.apache.fineract.infrastructure.report.service.ReportingProcessService
|
||||
import org.apache.fineract.infrastructure.security.exception.NoAuthorizationException;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.glassfish.jersey.internal.util.collection.MultivaluedStringMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -97,7 +98,9 @@ public class RunreportsApiResource {
|
||||
@Context final UriInfo uriInfo,
|
||||
@DefaultValue("false") @QueryParam(IS_SELF_SERVICE_USER_REPORT_PARAMETER) @Parameter(description = IS_SELF_SERVICE_USER_REPORT_PARAMETER) final boolean isSelfServiceUserReport) {
|
||||
|
||||
final MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
|
||||
MultivaluedMap<String, String> queryParams = new MultivaluedStringMap();
|
||||
queryParams.putAll(uriInfo.getQueryParameters());
|
||||
|
||||
final boolean parameterType = ApiParameterHelper.parameterType(queryParams);
|
||||
|
||||
checkUserPermissionForReport(reportName, parameterType);
|
||||
|
||||
+9
-15
@@ -18,9 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.documentmanagement.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataBodyPart;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -57,6 +54,9 @@ import org.apache.fineract.infrastructure.documentmanagement.data.FileData;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.service.DocumentReadPlatformService;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.service.DocumentWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -126,20 +126,16 @@ public class DocumentManagementApiResource {
|
||||
public String createDocument(@PathParam("entityType") @Parameter(description = "entityType") final String entityType,
|
||||
@PathParam("entityId") @Parameter(description = "entityId") final Long entityId,
|
||||
@HeaderParam("Content-Length") @Parameter(description = "Content-Length") final Long fileSize,
|
||||
@FormDataParam("file") @Parameter(description = "file") final InputStream inputStream,
|
||||
@FormDataParam("file") @Parameter(description = "file") final FormDataContentDisposition fileDetails,
|
||||
@FormDataParam("file") @Parameter(description = "file") final FormDataBodyPart bodyPart,
|
||||
@FormDataParam("name") @Parameter(description = "name") final String name,
|
||||
@FormDataParam("description") @Parameter(description = "description") final String description) {
|
||||
@FormDataParam("file") final InputStream inputStream, @FormDataParam("file") final FormDataContentDisposition fileDetails,
|
||||
@FormDataParam("file") final FormDataBodyPart bodyPart, @FormDataParam("name") final String name,
|
||||
@FormDataParam("description") final String description) {
|
||||
|
||||
// TODO: stop reading from stream after max size is reached to protect against malicious clients
|
||||
// TODO: need to extract the actual file type and determine if they are permissible
|
||||
|
||||
fileUploadValidator.validate(fileSize, inputStream, fileDetails, bodyPart);
|
||||
|
||||
final DocumentCommand documentCommand = new DocumentCommand(null, null, entityType, entityId, name, fileDetails.getFileName(),
|
||||
fileSize, bodyPart.getMediaType().toString(), description, null);
|
||||
|
||||
final Long documentId = this.documentWritePlatformService.createDocument(documentCommand, inputStream);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(CommandProcessingResult.resourceResult(documentId, null));
|
||||
@@ -158,11 +154,9 @@ public class DocumentManagementApiResource {
|
||||
@PathParam("entityId") @Parameter(description = "entityId") final Long entityId,
|
||||
@PathParam("documentId") @Parameter(description = "documentId") final Long documentId,
|
||||
@HeaderParam("Content-Length") @Parameter(description = "Content-Length") final Long fileSize,
|
||||
@FormDataParam("file") @Parameter(description = "file") final InputStream inputStream,
|
||||
@FormDataParam("file") @Parameter(description = "file") final FormDataContentDisposition fileDetails,
|
||||
@FormDataParam("file") @Parameter(description = "file") final FormDataBodyPart bodyPart,
|
||||
@FormDataParam("name") @Parameter(description = "name") final String name,
|
||||
@FormDataParam("description") @Parameter(description = "description") final String description) {
|
||||
@FormDataParam("file") final InputStream inputStream, @FormDataParam("file") final FormDataContentDisposition fileDetails,
|
||||
@FormDataParam("file") final FormDataBodyPart bodyPart, @FormDataParam("name") final String name,
|
||||
@FormDataParam("description") final String description) {
|
||||
|
||||
final Set<String> modifiedParams = new HashSet<>();
|
||||
modifiedParams.add("name");
|
||||
|
||||
+2
-2
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.documentmanagement.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataBodyPart;
|
||||
import java.io.InputStream;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -18,9 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.documentmanagement.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataBodyPart;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Base64;
|
||||
@@ -50,6 +47,9 @@ import org.apache.fineract.infrastructure.documentmanagement.service.ImageReadPl
|
||||
import org.apache.fineract.infrastructure.documentmanagement.service.ImageWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+3
-3
@@ -20,6 +20,9 @@ package org.apache.fineract.infrastructure.hooks.processor;
|
||||
|
||||
import static org.apache.fineract.infrastructure.hooks.api.HookApiConstants.apiKeyName;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
@@ -34,9 +37,6 @@ import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
|
||||
import org.apache.fineract.template.service.TemplateMergeService;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.codehaus.jackson.JsonParseException;
|
||||
import org.codehaus.jackson.map.JsonMappingException;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import retrofit2.Callback;
|
||||
|
||||
+2
-2
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.service;
|
||||
|
||||
import com.sun.jersey.core.util.MultivaluedMapImpl;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -63,6 +62,7 @@ import org.apache.fineract.infrastructure.reportmailingjob.validation.ReportMail
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.portfolio.calendar.service.CalendarUtils;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.glassfish.jersey.internal.util.collection.MultivaluedStringMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -266,7 +266,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
final StringBuilder errorLog = new StringBuilder();
|
||||
final Map<String, String> validateStretchyReportParamMap = this.reportMailingJobValidator
|
||||
.validateStretchyReportParamMap(reportMailingJob.getStretchyReportParamMap());
|
||||
MultivaluedMap<String, String> reportParams = new MultivaluedMapImpl();
|
||||
MultivaluedMap<String, String> reportParams = new MultivaluedStringMap();
|
||||
|
||||
if (validateStretchyReportParamMap != null) {
|
||||
Iterator<Map.Entry<String, String>> validateStretchyReportParamMapEntries = validateStretchyReportParamMap
|
||||
|
||||
+2
-2
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.validation;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -41,8 +43,6 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.reportmailingjob.ReportMailingJobConstants;
|
||||
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobEmailAttachmentFileFormat;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+3
-2
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.infrastructure.security.api;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sun.jersey.core.util.Base64;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -30,6 +29,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import javax.ws.rs.Consumes;
|
||||
@@ -125,7 +125,8 @@ public class AuthenticationApiResource {
|
||||
permissions.add(grantedAuthority.getAuthority());
|
||||
}
|
||||
|
||||
final byte[] base64EncodedAuthenticationKey = Base64.encode(request.username + ":" + request.password);
|
||||
final byte[] base64EncodedAuthenticationKey = Base64.getEncoder()
|
||||
.encode((request.username + ":" + request.password).getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
final AppUser principal = (AppUser) authenticationCheck.getPrincipal();
|
||||
final Collection<RoleData> roles = new ArrayList<>();
|
||||
|
||||
+1
-1
@@ -22,9 +22,9 @@ import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_KEY;
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_VALUE;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
|
||||
|
||||
+1
-1
@@ -22,9 +22,9 @@ import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_LATITUDE
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_LONGITUDE;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
|
||||
|
||||
+1
-1
@@ -18,12 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifier;
|
||||
import org.apache.fineract.portfolio.accountdetails.domain.AccountType;
|
||||
|
||||
+6
-6
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
|
||||
public class InteropIdentifierAccountResponseData extends CommandProcessingResult {
|
||||
@@ -39,12 +39,12 @@ public class InteropIdentifierAccountResponseData extends CommandProcessingResul
|
||||
return new InteropIdentifierAccountResponseData(resourceId, officeId, commandId, changesOnly, accountId);
|
||||
}
|
||||
|
||||
protected static InteropIdentifierAccountResponseData build(Long commandId, @NotNull String accountId) {
|
||||
return build(null, null, commandId, null, accountId);
|
||||
public static InteropIdentifierAccountResponseData build(Long resourceId, @NotNull String accountId) {
|
||||
return build(resourceId, null, null, null, accountId);
|
||||
}
|
||||
|
||||
public static InteropIdentifierAccountResponseData build(@NotNull String accountId) {
|
||||
return build(null, accountId);
|
||||
public static InteropIdentifierAccountResponseData empty() {
|
||||
return build(null, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifier;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifierType;
|
||||
|
||||
|
||||
+2
-2
@@ -21,9 +21,9 @@ package org.apache.fineract.interoperation.data;
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_ACCOUNT_ID;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifierType;
|
||||
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifier;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
||||
|
||||
+1
-1
@@ -35,10 +35,10 @@ import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSACT
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSACTION_TYPE;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.interoperation.domain.InteropAmountType;
|
||||
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.interoperation.domain.InteropActionState;
|
||||
|
||||
public final class InteropQuoteResponseData extends InteropResponseData {
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
public class InteropRefundData {
|
||||
|
||||
|
||||
+4
-4
@@ -32,20 +32,20 @@ import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSACT
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSACTION_ROLE;
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSACTION_TYPE;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.interoperation.domain.InteropTransactionRole;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.codehaus.jackson.map.annotate.JsonDeserialize;
|
||||
import org.codehaus.jackson.map.ext.JodaDeserializers;
|
||||
|
||||
public class InteropRequestData {
|
||||
|
||||
@@ -66,7 +66,7 @@ public class InteropRequestData {
|
||||
|
||||
private GeoCodeData geoCode;
|
||||
|
||||
@JsonDeserialize(using = JodaDeserializers.LocalDateTimeDeserializer.class)
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
private LocalDateTime expiration;
|
||||
|
||||
private List<ExtensionData> extensionList;
|
||||
|
||||
+1
-1
@@ -18,13 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.beans.Transient;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.interoperation.domain.InteropActionState;
|
||||
|
||||
+1
-1
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.interoperation.util.MathUtil;
|
||||
import org.apache.fineract.portfolio.note.domain.Note;
|
||||
|
||||
+1
-1
@@ -32,10 +32,10 @@ import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSACT
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSACTION_TYPE;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.interoperation.domain.InteropTransactionRole;
|
||||
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.interoperation.domain.InteropActionState;
|
||||
|
||||
public final class InteropTransactionRequestResponseData extends InteropResponseData {
|
||||
|
||||
+2
-2
@@ -26,10 +26,10 @@ import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_SCENARIO
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_SUB_SCENARIO;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.interoperation.domain.InteropInitiatorType;
|
||||
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
||||
|
||||
+1
-1
@@ -33,10 +33,10 @@ import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSACT
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_TRANSFER_CODE;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.interoperation.domain.InteropTransactionRole;
|
||||
|
||||
+1
-1
@@ -18,12 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.beans.Transient;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.interoperation.domain.InteropActionState;
|
||||
|
||||
public final class InteropTransferResponseData extends InteropResponseData {
|
||||
|
||||
+1
-1
@@ -24,10 +24,10 @@ import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_CURRENCY
|
||||
import static org.apache.fineract.interoperation.util.InteropUtil.PARAM_LOCALE;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.interoperation.util.MathUtil;
|
||||
|
||||
+1
-1
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.domain;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import javax.persistence.Column;
|
||||
@@ -31,6 +30,7 @@ import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
||||
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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.interoperation.exception;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifierType;
|
||||
|
||||
/**
|
||||
* A {@link RuntimeException} thrown when a code is not found.
|
||||
*/
|
||||
public class InteropAccountNotFoundException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
public InteropAccountNotFoundException(@NotNull InteropIdentifierType idType, @NotNull String idValue, String subIdOrType) {
|
||||
|
||||
super("error.msg.interop.account.not.found",
|
||||
"Account not found for identifier " + idType + "/" + idValue + (subIdOrType == null ? "" : ("/" + subIdOrType)));
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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.interoperation.exception;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
public class InteropAccountTransactionNotAllowedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
public InteropAccountTransactionNotAllowedException(@NotNull String accountId) {
|
||||
super("error.msg.interop.transaction.not.allowed", "Transaction not allowed on account " + accountId);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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.interoperation.exception;
|
||||
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
|
||||
|
||||
public class InteropKycDataNotFoundException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
public InteropKycDataNotFoundException(Long clientId, Exception e) {
|
||||
super("error.msg.interop.kyc.data.not.found", "No KYC data found for clientID " + clientId, e);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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.interoperation.exception;
|
||||
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
public class InteropTransferAlreadyCommittedException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
public InteropTransferAlreadyCommittedException(String accountId, String transferCode) {
|
||||
super("error.msg.interop.transfer.already.on.hold",
|
||||
"Transaction with transferCode " + transferCode + " already on hold for account " + accountId);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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.interoperation.exception;
|
||||
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
public class InteropTransferAlreadyOnHoldException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
public InteropTransferAlreadyOnHoldException(String accountId, String transferCode) {
|
||||
super("error.msg.interop.transfer.already.committed",
|
||||
"Transaction with transferCode " + transferCode + " already committed for account " + accountId);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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.interoperation.exception;
|
||||
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
|
||||
|
||||
public class InteropTransferMissingException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
public InteropTransferMissingException(String accountId, String transferCode) {
|
||||
super("error.msg.interop.onhold.transfer.missing",
|
||||
"No matching transaction with transferCode " + transferCode + " found for account " + accountId);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -20,8 +20,8 @@ package org.apache.fineract.interoperation.serialization;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.service;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.interoperation.data.InteropAccountData;
|
||||
import org.apache.fineract.interoperation.data.InteropIdentifierAccountResponseData;
|
||||
|
||||
+77
-40
@@ -26,7 +26,6 @@ import static org.apache.fineract.portfolio.savings.SavingsAccountTransactionTyp
|
||||
import static org.apache.fineract.portfolio.savings.SavingsAccountTransactionType.WITHDRAWAL;
|
||||
import static org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction.releaseAmount;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@@ -38,16 +37,19 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Predicate;
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.interoperation.data.InteropAccountData;
|
||||
import org.apache.fineract.interoperation.data.InteropIdentifierAccountResponseData;
|
||||
@@ -68,15 +70,23 @@ import org.apache.fineract.interoperation.domain.InteropActionState;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifier;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifierRepository;
|
||||
import org.apache.fineract.interoperation.domain.InteropIdentifierType;
|
||||
import org.apache.fineract.interoperation.exception.InteropAccountNotFoundException;
|
||||
import org.apache.fineract.interoperation.exception.InteropAccountTransactionNotAllowedException;
|
||||
import org.apache.fineract.interoperation.exception.InteropKycDataNotFoundException;
|
||||
import org.apache.fineract.interoperation.exception.InteropTransferAlreadyCommittedException;
|
||||
import org.apache.fineract.interoperation.exception.InteropTransferAlreadyOnHoldException;
|
||||
import org.apache.fineract.interoperation.exception.InteropTransferMissingException;
|
||||
import org.apache.fineract.interoperation.serialization.InteropDataValidator;
|
||||
import org.apache.fineract.interoperation.util.MathUtil;
|
||||
import org.apache.fineract.organisation.monetary.domain.ApplicationCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.ApplicationCurrencyRepository;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
import org.apache.fineract.portfolio.account.exception.DifferentCurrenciesException;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.LoanAccountData;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepository;
|
||||
import org.apache.fineract.portfolio.loanaccount.exception.LoanNotFoundException;
|
||||
import org.apache.fineract.portfolio.note.domain.Note;
|
||||
import org.apache.fineract.portfolio.note.domain.NoteRepository;
|
||||
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
|
||||
@@ -91,19 +101,19 @@ import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransactionRepository;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransactionSummaryWrapper;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsHelper;
|
||||
import org.apache.fineract.portfolio.savings.exception.InsufficientAccountBalanceException;
|
||||
import org.apache.fineract.portfolio.savings.exception.SavingsAccountNotFoundException;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
@Service
|
||||
public class InteropServiceImpl implements InteropService {
|
||||
@@ -214,7 +224,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
public InteropTransactionsData getAccountTransactions(@NotNull String accountId, boolean debit, boolean credit,
|
||||
java.time.LocalDateTime transactionsFrom, java.time.LocalDateTime transactionsTo) {
|
||||
SavingsAccount savingsAccount = validateAndGetSavingAccount(accountId);
|
||||
ZoneId zoneId = ZoneId.of(ThreadLocalContextUtil.getTenant().getTimezoneId());
|
||||
|
||||
Predicate<SavingsAccountTransaction> transFilter = t -> {
|
||||
SavingsAccountTransactionType transactionType = SavingsAccountTransactionType.fromInt(t.getTypeOf());
|
||||
if (debit != transactionType.isDebit() && credit != transactionType.isCredit()) {
|
||||
@@ -247,48 +257,57 @@ public class InteropServiceImpl implements InteropService {
|
||||
String subIdOrType) {
|
||||
InteropIdentifier identifier = findIdentifier(idType, idValue, subIdOrType);
|
||||
if (identifier == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST,
|
||||
"Account not found for identifier " + idType + "/" + idValue + (subIdOrType == null ? "" : ("/" + subIdOrType)));
|
||||
throw new InteropAccountNotFoundException(idType, idValue, subIdOrType);
|
||||
}
|
||||
|
||||
return InteropIdentifierAccountResponseData.build(identifier.getAccount().getExternalId());
|
||||
return InteropIdentifierAccountResponseData.build(identifier.getId(), identifier.getAccount().getExternalId());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
@Transactional
|
||||
@Override
|
||||
public InteropIdentifierAccountResponseData registerAccountIdentifier(@NotNull InteropIdentifierType idType, @NotNull String idValue,
|
||||
String subIdOrType, @NotNull JsonCommand command) {
|
||||
|
||||
InteropIdentifierRequestData request = dataValidator.validateAndParseCreateIdentifier(idType, idValue, subIdOrType, command);
|
||||
// TODO: error handling
|
||||
SavingsAccount savingsAccount = validateAndGetSavingAccount(request.getAccountId());
|
||||
|
||||
AppUser createdBy = getLoginUser();
|
||||
try {
|
||||
AppUser createdBy = getLoginUser();
|
||||
|
||||
InteropIdentifier identifier = new InteropIdentifier(savingsAccount, request.getIdType(), request.getIdValue(),
|
||||
request.getSubIdOrType(), createdBy.getUsername(), DateUtils.getDateOfTenant());
|
||||
InteropIdentifier identifier = new InteropIdentifier(savingsAccount, request.getIdType(), request.getIdValue(),
|
||||
request.getSubIdOrType(), createdBy.getUsername(), DateUtils.getDateOfTenant());
|
||||
|
||||
identifierRepository.save(identifier);
|
||||
identifierRepository.save(identifier);
|
||||
|
||||
return InteropIdentifierAccountResponseData.build(savingsAccount.getExternalId());
|
||||
return InteropIdentifierAccountResponseData.build(identifier.getId(), savingsAccount.getExternalId());
|
||||
} catch (final JpaSystemException | DataIntegrityViolationException dve) {
|
||||
handleInteropDataIntegrityIssues(idType, request.getAccountId(), dve.getMostSpecificCause(), dve);
|
||||
return InteropIdentifierAccountResponseData.empty();
|
||||
} catch (final PersistenceException dve) {
|
||||
Throwable throwable = ExceptionUtils.getRootCause(dve.getCause());
|
||||
handleInteropDataIntegrityIssues(idType, request.getAccountId(), throwable, dve);
|
||||
return InteropIdentifierAccountResponseData.empty();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
@Transactional
|
||||
@Override
|
||||
public InteropIdentifierAccountResponseData deleteAccountIdentifier(@NotNull InteropIdentifierType idType, @NotNull String idValue,
|
||||
String subIdOrType) {
|
||||
InteropIdentifier identifier = findIdentifier(idType, idValue, subIdOrType);
|
||||
if (identifier == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST,
|
||||
"Account not found for identifier " + idType + "/" + idValue + (subIdOrType == null ? "" : ("/" + subIdOrType)));
|
||||
throw new InteropAccountNotFoundException(idType, idValue, subIdOrType);
|
||||
}
|
||||
|
||||
String accountId = identifier.getAccount().getExternalId();
|
||||
Long id = identifier.getId();
|
||||
|
||||
identifierRepository.delete(identifier);
|
||||
|
||||
return InteropIdentifierAccountResponseData.build(accountId);
|
||||
return InteropIdentifierAccountResponseData.build(id, accountId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -299,7 +318,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
@Transactional
|
||||
public InteropTransactionRequestResponseData createTransactionRequest(@NotNull JsonCommand command) {
|
||||
// only when Payee request transaction from Payer, so here role must be
|
||||
// always Payer
|
||||
@@ -319,7 +338,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
@Transactional
|
||||
public InteropQuoteResponseData createQuote(@NotNull JsonCommand command) {
|
||||
InteropQuoteRequestData request = dataValidator.validateAndParseCreateQuote(command);
|
||||
|
||||
@@ -330,7 +349,8 @@ public class InteropServiceImpl implements InteropService {
|
||||
if (transactionType.isDebit()) {
|
||||
fee = savingsAccount.calculateWithdrawalFee(request.getAmount().getAmount());
|
||||
if (MathUtil.isLessThan(savingsAccount.getWithdrawableBalance(), request.getAmount().getAmount().add(fee))) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Not enough balance amount for requested amount plus fees!");
|
||||
throw new InsufficientAccountBalanceException(savingsAccount.getExternalId(), savingsAccount.getWithdrawableBalance(), fee,
|
||||
request.getAmount().getAmount());
|
||||
}
|
||||
} else {
|
||||
fee = BigDecimal.ZERO;
|
||||
@@ -348,7 +368,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
@Transactional
|
||||
public InteropTransferResponseData prepareTransfer(@NotNull JsonCommand command) {
|
||||
InteropTransferRequestData request = dataValidator.validateAndParseTransferRequest(command);
|
||||
String transferCode = request.getTransferCode();
|
||||
@@ -363,10 +383,11 @@ public class InteropServiceImpl implements InteropService {
|
||||
BigDecimal total = calculateTotalTransferAmount(request, savingsAccount);
|
||||
|
||||
if (MathUtil.isLessThan(savingsAccount.getWithdrawableBalance(), total)) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Not enough balance amount for requested amount plus fees!");
|
||||
throw new InsufficientAccountBalanceException(savingsAccount.getExternalId(), savingsAccount.getWithdrawableBalance(), null,
|
||||
total);
|
||||
}
|
||||
if (findTransaction(savingsAccount, transferCode, AMOUNT_HOLD.getValue()) != null) {
|
||||
throw new HttpClientErrorException(HttpStatus.TOO_MANY_REQUESTS, "Transfer amount was already put on hold " + transferCode);
|
||||
throw new InteropTransferAlreadyOnHoldException(savingsAccount.getExternalId(), transferCode);
|
||||
}
|
||||
|
||||
PaymentDetail paymentDetail = instance(findPaymentType(), savingsAccount.getExternalId(), null, getRoutingCode(), transferCode,
|
||||
@@ -391,7 +412,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
@Transactional
|
||||
public InteropTransferResponseData commitTransfer(@NotNull JsonCommand command) {
|
||||
InteropTransferRequestData request = dataValidator.validateAndParseTransferRequest(command);
|
||||
boolean isDebit = request.getTransactionRole().getTransactionType().isDebit();
|
||||
@@ -399,7 +420,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
String transferCode = request.getTransferCode();
|
||||
|
||||
if (findTransaction(savingsAccount, transferCode, (isDebit ? WITHDRAWAL : DEPOSIT).getValue()) != null) {
|
||||
throw new HttpClientErrorException(HttpStatus.TOO_MANY_REQUESTS, "Transfer was already committed with code: " + transferCode);
|
||||
throw new InteropTransferAlreadyCommittedException(savingsAccount.getExternalId(), transferCode);
|
||||
}
|
||||
|
||||
LocalDateTime transactionDateTime = DateUtils.getLocalDateTimeOfTenant();
|
||||
@@ -410,17 +431,17 @@ public class InteropServiceImpl implements InteropService {
|
||||
if (isDebit) {
|
||||
SavingsAccountTransaction holdTransaction = findTransaction(savingsAccount, transferCode, AMOUNT_HOLD.getValue());
|
||||
if (holdTransaction == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.NOT_FOUND, "Missing onhold transaction for transfer: " + transferCode);
|
||||
throw new InteropTransferMissingException(savingsAccount.getExternalId(), transferCode);
|
||||
}
|
||||
|
||||
BigDecimal totalTransferAmount = calculateTotalTransferAmount(request, savingsAccount);
|
||||
if (holdTransaction.getAmount().compareTo(totalTransferAmount) != 0) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST,
|
||||
"Transfer request amount plus fees does not match with onhold amount!");
|
||||
throw new InteropTransferMissingException(savingsAccount.getExternalId(), transferCode);
|
||||
}
|
||||
|
||||
if (MathUtil.isLessThan(savingsAccount.getWithdrawableBalance().add(holdTransaction.getAmount()), totalTransferAmount)) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Not enough balance amount!");
|
||||
throw new InsufficientAccountBalanceException(savingsAccount.getExternalId(), savingsAccount.getWithdrawableBalance(), null,
|
||||
totalTransferAmount);
|
||||
}
|
||||
|
||||
if (holdTransaction.getReleaseIdOfHoldAmountTransaction() == null) {
|
||||
@@ -452,7 +473,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.MANDATORY)
|
||||
@Transactional
|
||||
public @NotNull InteropTransferResponseData releaseTransfer(@NotNull JsonCommand command) {
|
||||
InteropTransferRequestData request = dataValidator.validateAndParseTransferRequest(command);
|
||||
SavingsAccount savingsAccount = validateAndGetSavingAccount(request);
|
||||
@@ -475,8 +496,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
|
||||
savingsAccountRepository.save(savingsAccount);
|
||||
} else {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST,
|
||||
"No active onhold transaction exists with transferCode " + request.getTransferCode());
|
||||
throw new InteropTransferMissingException(savingsAccount.getExternalId(), request.getTransferCode());
|
||||
}
|
||||
|
||||
return InteropTransferResponseData.build(command.commandId(), request.getTransactionCode(), InteropActionState.ACCEPTED,
|
||||
@@ -497,7 +517,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
|
||||
return InteropKycResponseData.build(accountKyc);
|
||||
} catch (final EmptyResultDataAccessException e) {
|
||||
throw new HttpClientErrorException(HttpStatus.NO_CONTENT, "Error in retrieving KYC information: " + e);
|
||||
throw new InteropKycDataNotFoundException(client_id, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +547,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
private Loan validateAndGetLoan(String accountId) {
|
||||
Loan loan = loanRepository.findNonClosedLoanByAccountNumber(accountId);
|
||||
if (loan == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.NOT_FOUND, "Loan not found for the given account No: " + accountId);
|
||||
throw new LoanNotFoundException(accountId);
|
||||
}
|
||||
return loan;
|
||||
}
|
||||
@@ -539,12 +559,12 @@ public class InteropServiceImpl implements InteropService {
|
||||
|
||||
ApplicationCurrency requestCurrency = currencyRepository.findOneByCode(request.getAmount().getCurrency());
|
||||
if (!savingsAccount.getCurrency().getCode().equals(requestCurrency.getCode())) {
|
||||
throw new HttpClientErrorException(HttpStatus.CONFLICT, "Account and request has different currencies!");
|
||||
throw new DifferentCurrenciesException(savingsAccount.getCurrency().getCode(), requestCurrency.getCode());
|
||||
}
|
||||
|
||||
SavingsAccountTransactionType transactionType = request.getTransactionRole().getTransactionType();
|
||||
if (!savingsAccount.isTransactionAllowed(transactionType, request.getExpirationLocalDate())) {
|
||||
throw new HttpClientErrorException(HttpStatus.NOT_ACCEPTABLE, "Transaction not allowed on account!");
|
||||
throw new InteropAccountTransactionNotAllowedException(request.getAccountId());
|
||||
}
|
||||
|
||||
request.normalizeAmounts(savingsAccount.getCurrency());
|
||||
@@ -557,7 +577,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
MoneyData requestFee = request.getFspFee();
|
||||
if (requestFee != null) {
|
||||
if (!savingsAccount.getCurrency().getCode().equals(requestFee.getCurrency())) {
|
||||
throw new HttpClientErrorException(HttpStatus.resolve(400));
|
||||
throw new DifferentCurrenciesException(savingsAccount.getCurrency().getCode(), requestFee.getCurrency());
|
||||
}
|
||||
// TODO: compare with calculated quote fee
|
||||
total = MathUtil.add(total, requestFee.getAmount());
|
||||
@@ -565,7 +585,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
MoneyData requestCommission = request.getFspCommission();
|
||||
if (requestCommission != null) {
|
||||
if (!savingsAccount.getCurrency().getCode().equals(requestCommission.getCurrency())) {
|
||||
throw new HttpClientErrorException(HttpStatus.resolve(400));
|
||||
throw new DifferentCurrenciesException(savingsAccount.getCurrency().getCode(), requestCommission.getCurrency());
|
||||
}
|
||||
// TODO: compare with calculated quote commission
|
||||
total = MathUtil.subtractToZero(total, requestCommission.getAmount());
|
||||
@@ -614,6 +634,23 @@ public class InteropServiceImpl implements InteropService {
|
||||
return securityContext.getAuthenticatedUserIfPresent();
|
||||
}
|
||||
|
||||
/*
|
||||
* Guaranteed to throw an exception no matter what the data integrity issue is.
|
||||
*/
|
||||
private void handleInteropDataIntegrityIssues(InteropIdentifierType idType, String accountId, final Throwable realCause,
|
||||
final Exception dve) {
|
||||
|
||||
if (realCause.getMessage().contains("uk_interop_identifier_account")) {
|
||||
throw new PlatformDataIntegrityException("error.msg.interop.duplicate.account.identifier",
|
||||
"Account identifier of type `" + idType.name() + "' already exists for account with externalId `" + accountId + "`",
|
||||
"idType", idType.name(), accountId);
|
||||
}
|
||||
|
||||
LOG.error("Error occured.", dve);
|
||||
throw new PlatformDataIntegrityException("error.msg.interop.unknown.data.integrity.issue",
|
||||
"Unknown data integrity issue with resource.");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
String getRoutingCode() {
|
||||
return DEFAULT_ROUTING_CODE;
|
||||
|
||||
+1
-1
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.util;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
||||
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.office.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -61,6 +59,8 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.staff.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -62,6 +60,8 @@ import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
|
||||
import org.apache.fineract.organisation.staff.data.StaffData;
|
||||
import org.apache.fineract.organisation.staff.service.StaffReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.accounts.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -57,6 +55,8 @@ import org.apache.fineract.portfolio.accounts.constants.AccountsApiConstants;
|
||||
import org.apache.fineract.portfolio.accounts.data.AccountData;
|
||||
import org.apache.fineract.portfolio.accounts.service.AccountReadPlatformService;
|
||||
import org.apache.fineract.portfolio.products.exception.ResourceNotFoundException;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.client.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -73,6 +71,8 @@ import org.apache.fineract.portfolio.loanaccount.guarantor.data.ObligeeData;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.service.GuarantorReadPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -19,8 +19,6 @@
|
||||
package org.apache.fineract.portfolio.group.api;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -88,6 +86,8 @@ import org.apache.fineract.portfolio.group.data.StaffCenterData;
|
||||
import org.apache.fineract.portfolio.group.service.CenterReadPlatformService;
|
||||
import org.apache.fineract.portfolio.meeting.data.MeetingData;
|
||||
import org.apache.fineract.portfolio.meeting.service.MeetingReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -19,8 +19,6 @@
|
||||
package org.apache.fineract.portfolio.group.api;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -95,6 +93,8 @@ import org.apache.fineract.portfolio.meeting.data.MeetingData;
|
||||
import org.apache.fineract.portfolio.meeting.service.MeetingReadPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.data.GSIMContainer;
|
||||
import org.apache.fineract.portfolio.savings.service.GSIMReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -21,8 +21,6 @@ package org.apache.fineract.portfolio.loanaccount.api;
|
||||
import static org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations.interestType;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -140,6 +138,8 @@ import org.apache.fineract.portfolio.rate.data.RateData;
|
||||
import org.apache.fineract.portfolio.rate.service.RateReadService;
|
||||
import org.apache.fineract.portfolio.savings.DepositAccountType;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountStatusType;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+4
@@ -33,4 +33,8 @@ public class LoanNotFoundException extends AbstractPlatformResourceNotFoundExcep
|
||||
public LoanNotFoundException(Long id, EmptyResultDataAccessException e) {
|
||||
super("error.msg.loan.id.invalid", "Loan with identifier " + id + " does not exist", id, e);
|
||||
}
|
||||
|
||||
public LoanNotFoundException(String accountId) {
|
||||
super("error.msg.loan.account.id.invalid", "Loan with account ID " + accountId + " does not exist", accountId);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.loanaccount.guarantor.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
@@ -66,6 +64,8 @@ import org.apache.fineract.portfolio.loanaccount.guarantor.domain.GuarantorType;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.service.GuarantorEnumerations;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.service.GuarantorReadPlatformService;
|
||||
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -19,8 +19,6 @@
|
||||
package org.apache.fineract.portfolio.savings.api;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -80,6 +78,8 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
|
||||
import org.apache.fineract.portfolio.savings.service.DepositAccountPreMatureCalculationPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -19,8 +19,6 @@
|
||||
package org.apache.fineract.portfolio.savings.api;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -77,6 +75,8 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
|
||||
import org.apache.fineract.portfolio.savings.service.DepositAccountPreMatureCalculationPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.savings.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -70,6 +68,8 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
|
||||
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPlatformService;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+1
-1
@@ -26,7 +26,6 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.feeOnMon
|
||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.localeParamName;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.time.LocalDate;
|
||||
@@ -44,6 +43,7 @@ import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
+3
-3
@@ -18,9 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.portfolio.self.client.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataBodyPart;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -53,6 +50,9 @@ import org.apache.fineract.portfolio.client.exception.ClientNotFoundException;
|
||||
import org.apache.fineract.portfolio.self.client.data.SelfClientDataValidator;
|
||||
import org.apache.fineract.portfolio.self.client.service.AppuserClientMapperReadService;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+1
-1
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.template.api;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -63,7 +64,6 @@ import org.apache.fineract.template.domain.TemplateEntity;
|
||||
import org.apache.fineract.template.domain.TemplateType;
|
||||
import org.apache.fineract.template.service.TemplateDomainService;
|
||||
import org.apache.fineract.template.service.TemplateMergeService;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.template.domain;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import java.util.ArrayList;
|
||||
@@ -37,7 +38,6 @@ import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_template", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "unq_name") })
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.template.domain;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
@JsonSerialize(using = TemplateEntitySerializer.class)
|
||||
public enum TemplateEntity {
|
||||
|
||||
+4
-4
@@ -18,11 +18,11 @@
|
||||
*/
|
||||
package org.apache.fineract.template.domain;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import java.io.IOException;
|
||||
import org.codehaus.jackson.JsonGenerator;
|
||||
import org.codehaus.jackson.JsonProcessingException;
|
||||
import org.codehaus.jackson.map.JsonSerializer;
|
||||
import org.codehaus.jackson.map.SerializerProvider;
|
||||
|
||||
public class TemplateEntitySerializer extends JsonSerializer<TemplateEntity> {
|
||||
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.template.domain;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.codehaus.jackson.map.annotate.JsonSerialize;
|
||||
|
||||
@JsonSerialize(using = TemplateTypeSerializer.class)
|
||||
public enum TemplateType {
|
||||
|
||||
+4
-4
@@ -18,11 +18,11 @@
|
||||
*/
|
||||
package org.apache.fineract.template.domain;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
import java.io.IOException;
|
||||
import org.codehaus.jackson.JsonGenerator;
|
||||
import org.codehaus.jackson.JsonProcessingException;
|
||||
import org.codehaus.jackson.map.JsonSerializer;
|
||||
import org.codehaus.jackson.map.SerializerProvider;
|
||||
|
||||
public class TemplateTypeSerializer extends JsonSerializer<TemplateType> {
|
||||
|
||||
|
||||
+1
-1
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.template.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.mustachejava.DefaultMustacheFactory;
|
||||
import com.github.mustachejava.Mustache;
|
||||
import com.github.mustachejava.MustacheFactory;
|
||||
@@ -39,7 +40,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.template.domain.Template;
|
||||
import org.apache.fineract.template.domain.TemplateFunctions;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
+2
-2
@@ -18,8 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.useradministration.api;
|
||||
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -62,6 +60,8 @@ import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
|
||||
import org.apache.fineract.useradministration.data.AppUserData;
|
||||
import org.apache.fineract.useradministration.service.AppUserReadPlatformService;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
+1
-1
@@ -23,12 +23,12 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.sun.jersey.core.header.FormDataContentDisposition;
|
||||
import java.io.File;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.creditbureau.service.CreditReportWritePlatformServiceImpl;
|
||||
import org.apache.fineract.infrastructure.creditbureau.service.ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
|
||||
+6
-4
@@ -68,7 +68,8 @@ public class InteropTest {
|
||||
private RequestSpecification requestSpec;
|
||||
private ResponseSpecification responseSpec;
|
||||
private ResponseSpecification responseClientErrorSpec;
|
||||
private ResponseSpecification responseErrorSpec;
|
||||
private ResponseSpecification responseNotFoundErrorSpec;
|
||||
private ResponseSpecification responseForbiddenErrorSpec;
|
||||
|
||||
private AccountHelper accountHelper;
|
||||
private SavingsAccountHelper savingsAccountHelper;
|
||||
@@ -90,7 +91,8 @@ public class InteropTest {
|
||||
|
||||
responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||
responseClientErrorSpec = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
responseErrorSpec = new ResponseSpecBuilder().expectStatusCode(500).build();
|
||||
responseForbiddenErrorSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
responseNotFoundErrorSpec = new ResponseSpecBuilder().expectStatusCode(404).build();
|
||||
|
||||
String savingsExternalId = UUID.randomUUID().toString();
|
||||
String transactionCode = UUID.randomUUID().toString();
|
||||
@@ -178,7 +180,7 @@ public class InteropTest {
|
||||
String accountId = interopHelper.postParty(InteropIdentifierType.MSISDN, idValue);
|
||||
Assertions.assertEquals(interopHelper.getAccountExternalId(), accountId);
|
||||
|
||||
interopHelper.setResponseSpec(responseErrorSpec);
|
||||
interopHelper.setResponseSpec(responseForbiddenErrorSpec);
|
||||
accountId = interopHelper.postParty(InteropIdentifierType.MSISDN, idValue);
|
||||
Assertions.assertNull(accountId);
|
||||
interopHelper.setResponseSpec(responseSpec);
|
||||
@@ -189,7 +191,7 @@ public class InteropTest {
|
||||
accountId = interopHelper.deleteParty(InteropIdentifierType.MSISDN, idValue);
|
||||
Assertions.assertEquals(interopHelper.getAccountExternalId(), accountId);
|
||||
|
||||
interopHelper.setResponseSpec(responseErrorSpec);
|
||||
interopHelper.setResponseSpec(responseNotFoundErrorSpec);
|
||||
accountId = interopHelper.getParty(InteropIdentifierType.MSISDN, idValue);
|
||||
Assertions.assertNull(accountId);
|
||||
interopHelper.setResponseSpec(responseSpec);
|
||||
|
||||
Reference in New Issue
Block a user