FINERACT-2346: Refractor, Minor Sonar fixes and remove some deprecated code
This commit is contained in:
+15
-16
@@ -24,6 +24,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
|
|||||||
import static com.github.tomakehurst.wiremock.client.WireMock.get;
|
import static com.github.tomakehurst.wiremock.client.WireMock.get;
|
||||||
import static com.github.tomakehurst.wiremock.client.WireMock.post;
|
import static com.github.tomakehurst.wiremock.client.WireMock.post;
|
||||||
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
|
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
|
||||||
|
import static com.github.tomakehurst.wiremock.common.ContentTypes.APPLICATION_JSON;
|
||||||
|
import static com.github.tomakehurst.wiremock.common.ContentTypes.AUTHORIZATION;
|
||||||
|
import static com.github.tomakehurst.wiremock.common.ContentTypes.CONTENT_TYPE;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
|
|
||||||
@@ -66,9 +69,8 @@ class FineractFeignClientIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJsonEncoding() {
|
void testJsonEncoding() {
|
||||||
wireMockServer
|
wireMockServer.stubFor(post(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, APPLICATION_JSON)
|
||||||
.stubFor(post(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
|
.withBody("{\"id\":1,\"message\":\"success\",\"timestamp\":\"2024-01-15T10:30:00\"}")));
|
||||||
.withBody("{\"id\":1,\"message\":\"success\",\"timestamp\":\"2024-01-15T10:30:00\"}")));
|
|
||||||
|
|
||||||
TestApi client = config.createClient(TestApi.class);
|
TestApi client = config.createClient(TestApi.class);
|
||||||
TestRequest request = new TestRequest();
|
TestRequest request = new TestRequest();
|
||||||
@@ -85,9 +87,8 @@ class FineractFeignClientIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testJsonDecoding() {
|
void testJsonDecoding() {
|
||||||
wireMockServer
|
wireMockServer.stubFor(get(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, APPLICATION_JSON)
|
||||||
.stubFor(get(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
|
.withBody("{\"id\":42,\"message\":\"decoded-message\",\"timestamp\":\"2024-12-25T18:45:30\"}")));
|
||||||
.withBody("{\"id\":42,\"message\":\"decoded-message\",\"timestamp\":\"2024-12-25T18:45:30\"}")));
|
|
||||||
|
|
||||||
TestApi client = config.createClient(TestApi.class);
|
TestApi client = config.createClient(TestApi.class);
|
||||||
TestResponse response = client.getTest();
|
TestResponse response = client.getTest();
|
||||||
@@ -101,7 +102,7 @@ class FineractFeignClientIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
void testJava8DateTimeSerialization() {
|
void testJava8DateTimeSerialization() {
|
||||||
wireMockServer.stubFor(post(urlEqualTo("/test")).withRequestBody(containing("2024-06-30"))
|
wireMockServer.stubFor(post(urlEqualTo("/test")).withRequestBody(containing("2024-06-30"))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, APPLICATION_JSON)
|
||||||
.withBody("{\"id\":99,\"message\":\"date-test\",\"timestamp\":\"2024-06-30T12:00:00\"}")));
|
.withBody("{\"id\":99,\"message\":\"date-test\",\"timestamp\":\"2024-06-30T12:00:00\"}")));
|
||||||
|
|
||||||
TestApi client = config.createClient(TestApi.class);
|
TestApi client = config.createClient(TestApi.class);
|
||||||
@@ -131,7 +132,7 @@ class FineractFeignClientIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
void testErrorDecoderWithServerError() {
|
void testErrorDecoderWithServerError() {
|
||||||
wireMockServer.stubFor(
|
wireMockServer.stubFor(
|
||||||
get(urlEqualTo("/error")).willReturn(aResponse().withStatus(500).withHeader("Content-Type", "application/json").withBody(
|
get(urlEqualTo("/error")).willReturn(aResponse().withStatus(500).withHeader(CONTENT_TYPE, APPLICATION_JSON).withBody(
|
||||||
"{\"developerMessage\":\"Internal server error occurred\",\"httpStatusCode\":\"500\",\"defaultUserMessage\":\"Server Error\"}")));
|
"{\"developerMessage\":\"Internal server error occurred\",\"httpStatusCode\":\"500\",\"defaultUserMessage\":\"Server Error\"}")));
|
||||||
|
|
||||||
TestApi client = config.createClient(TestApi.class);
|
TestApi client = config.createClient(TestApi.class);
|
||||||
@@ -144,9 +145,8 @@ class FineractFeignClientIntegrationTest {
|
|||||||
FineractFeignClientConfig ttlConfig = FineractFeignClientConfig.builder().baseUrl(baseUrl).credentials("testuser", "testpass")
|
FineractFeignClientConfig ttlConfig = FineractFeignClientConfig.builder().baseUrl(baseUrl).credentials("testuser", "testpass")
|
||||||
.connectionTimeToLive(5, TimeUnit.MINUTES).build();
|
.connectionTimeToLive(5, TimeUnit.MINUTES).build();
|
||||||
|
|
||||||
wireMockServer
|
wireMockServer.stubFor(get(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, APPLICATION_JSON)
|
||||||
.stubFor(get(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
|
.withBody("{\"id\":1,\"message\":\"ttl-test\",\"timestamp\":\"2024-01-01T00:00:00\"}")));
|
||||||
.withBody("{\"id\":1,\"message\":\"ttl-test\",\"timestamp\":\"2024-01-01T00:00:00\"}")));
|
|
||||||
|
|
||||||
TestApi client = ttlConfig.createClient(TestApi.class);
|
TestApi client = ttlConfig.createClient(TestApi.class);
|
||||||
TestResponse response = client.getTest();
|
TestResponse response = client.getTest();
|
||||||
@@ -157,8 +157,8 @@ class FineractFeignClientIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testBasicAuthentication() {
|
void testBasicAuthentication() {
|
||||||
wireMockServer.stubFor(get(urlEqualTo("/test")).withHeader("Authorization", equalTo("Basic dGVzdHVzZXI6dGVzdHBhc3M="))
|
wireMockServer.stubFor(get(urlEqualTo("/test")).withHeader(AUTHORIZATION, equalTo("Basic dGVzdHVzZXI6dGVzdHBhc3M="))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, APPLICATION_JSON)
|
||||||
.withBody("{\"id\":1,\"message\":\"authenticated\",\"timestamp\":\"2024-01-01T00:00:00\"}")));
|
.withBody("{\"id\":1,\"message\":\"authenticated\",\"timestamp\":\"2024-01-01T00:00:00\"}")));
|
||||||
|
|
||||||
TestApi client = config.createClient(TestApi.class);
|
TestApi client = config.createClient(TestApi.class);
|
||||||
@@ -170,9 +170,8 @@ class FineractFeignClientIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testNullValueHandling() {
|
void testNullValueHandling() {
|
||||||
wireMockServer
|
wireMockServer.stubFor(post(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, APPLICATION_JSON)
|
||||||
.stubFor(post(urlEqualTo("/test")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json")
|
.withBody("{\"id\":1,\"message\":null,\"timestamp\":\"2024-01-01T00:00:00\"}")));
|
||||||
.withBody("{\"id\":1,\"message\":null,\"timestamp\":\"2024-01-01T00:00:00\"}")));
|
|
||||||
|
|
||||||
TestApi client = config.createClient(TestApi.class);
|
TestApi client = config.createClient(TestApi.class);
|
||||||
TestRequest request = new TestRequest();
|
TestRequest request = new TestRequest();
|
||||||
|
|||||||
+11
-10
@@ -24,6 +24,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
|
|||||||
import static com.github.tomakehurst.wiremock.client.WireMock.get;
|
import static com.github.tomakehurst.wiremock.client.WireMock.get;
|
||||||
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
|
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
|
||||||
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
|
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
|
||||||
|
import static com.github.tomakehurst.wiremock.common.ContentTypes.CONTENT_TYPE;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
import com.github.tomakehurst.wiremock.WireMockServer;
|
import com.github.tomakehurst.wiremock.WireMockServer;
|
||||||
@@ -75,14 +76,14 @@ class ImagesApiIntegrationTest {
|
|||||||
void testRetrieveClientImage() throws IOException {
|
void testRetrieveClientImage() throws IOException {
|
||||||
byte[] imageData = new byte[] { (byte) 0xFF, (byte) 0xD8, (byte) 0xFF, 0x10, 0x11, 0x12 };
|
byte[] imageData = new byte[] { (byte) 0xFF, (byte) 0xD8, (byte) 0xFF, 0x10, 0x11, 0x12 };
|
||||||
wireMockServer.stubFor(get(urlEqualTo("/v1/clients/123/images"))
|
wireMockServer.stubFor(get(urlEqualTo("/v1/clients/123/images"))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "image/jpeg").withBody(imageData)));
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, "image/jpeg").withBody(imageData)));
|
||||||
|
|
||||||
ImagesApi api = config.createClient(ImagesApi.class);
|
ImagesApi api = config.createClient(ImagesApi.class);
|
||||||
Response response = api.get("clients", 123L, new HashMap<>());
|
Response response = api.get("clients", 123L, new HashMap<>());
|
||||||
|
|
||||||
assertThat(response.status()).isEqualTo(200);
|
assertThat(response.status()).isEqualTo(200);
|
||||||
assertThat(response.headers()).containsKey("Content-Type");
|
assertThat(response.headers()).containsKey(CONTENT_TYPE);
|
||||||
assertThat(response.headers().get("Content-Type")).contains("image/jpeg");
|
assertThat(response.headers().get(CONTENT_TYPE)).contains("image/jpeg");
|
||||||
assertThat(response.body().asInputStream().readAllBytes()).isEqualTo(imageData);
|
assertThat(response.body().asInputStream().readAllBytes()).isEqualTo(imageData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ class ImagesApiIntegrationTest {
|
|||||||
byte[] resizedImage = new byte[] { (byte) 0xFF, (byte) 0xD8, (byte) 0xFF, 0x20, 0x21 };
|
byte[] resizedImage = new byte[] { (byte) 0xFF, (byte) 0xD8, (byte) 0xFF, 0x20, 0x21 };
|
||||||
wireMockServer.stubFor(get(urlPathEqualTo("/v1/clients/123/images")).withQueryParam("maxWidth", equalTo("100"))
|
wireMockServer.stubFor(get(urlPathEqualTo("/v1/clients/123/images")).withQueryParam("maxWidth", equalTo("100"))
|
||||||
.withQueryParam("maxHeight", equalTo("100"))
|
.withQueryParam("maxHeight", equalTo("100"))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "image/jpeg").withBody(resizedImage)));
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, "image/jpeg").withBody(resizedImage)));
|
||||||
|
|
||||||
ImagesApi api = config.createClient(ImagesApi.class);
|
ImagesApi api = config.createClient(ImagesApi.class);
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
@@ -108,7 +109,7 @@ class ImagesApiIntegrationTest {
|
|||||||
void testRetrieveClientImageWithMaxWidthOnly() throws IOException {
|
void testRetrieveClientImageWithMaxWidthOnly() throws IOException {
|
||||||
byte[] resizedImage = new byte[] { (byte) 0xFF, (byte) 0xD8, (byte) 0xFF, 0x30 };
|
byte[] resizedImage = new byte[] { (byte) 0xFF, (byte) 0xD8, (byte) 0xFF, 0x30 };
|
||||||
wireMockServer.stubFor(get(urlPathEqualTo("/v1/clients/123/images")).withQueryParam("maxWidth", equalTo("200"))
|
wireMockServer.stubFor(get(urlPathEqualTo("/v1/clients/123/images")).withQueryParam("maxWidth", equalTo("200"))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "image/jpeg").withBody(resizedImage)));
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, "image/jpeg").withBody(resizedImage)));
|
||||||
|
|
||||||
ImagesApi api = config.createClient(ImagesApi.class);
|
ImagesApi api = config.createClient(ImagesApi.class);
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
@@ -123,7 +124,7 @@ class ImagesApiIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
void testDeleteClientImage() {
|
void testDeleteClientImage() {
|
||||||
wireMockServer.stubFor(delete(urlEqualTo("/v1/clients/123/images"))
|
wireMockServer.stubFor(delete(urlEqualTo("/v1/clients/123/images"))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("{\"resourceId\":123}")));
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, "application/json").withBody("{\"resourceId\":123}")));
|
||||||
|
|
||||||
ImagesApi api = config.createClient(ImagesApi.class);
|
ImagesApi api = config.createClient(ImagesApi.class);
|
||||||
Response response = api.delete("clients", 123L);
|
Response response = api.delete("clients", 123L);
|
||||||
@@ -134,7 +135,7 @@ class ImagesApiIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
void testDeleteStaffImage() {
|
void testDeleteStaffImage() {
|
||||||
wireMockServer.stubFor(delete(urlEqualTo("/v1/staff/456/images"))
|
wireMockServer.stubFor(delete(urlEqualTo("/v1/staff/456/images"))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("{\"resourceId\":456}")));
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, "application/json").withBody("{\"resourceId\":456}")));
|
||||||
|
|
||||||
ImagesApi api = config.createClient(ImagesApi.class);
|
ImagesApi api = config.createClient(ImagesApi.class);
|
||||||
Response response = api.delete("staff", 456L);
|
Response response = api.delete("staff", 456L);
|
||||||
@@ -146,13 +147,13 @@ class ImagesApiIntegrationTest {
|
|||||||
void testRetrieveImageWithPngFormat() throws IOException {
|
void testRetrieveImageWithPngFormat() throws IOException {
|
||||||
byte[] pngImage = new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A };
|
byte[] pngImage = new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A };
|
||||||
wireMockServer.stubFor(get(urlEqualTo("/v1/clients/123/images"))
|
wireMockServer.stubFor(get(urlEqualTo("/v1/clients/123/images"))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "image/png").withBody(pngImage)));
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, "image/png").withBody(pngImage)));
|
||||||
|
|
||||||
ImagesApi api = config.createClient(ImagesApi.class);
|
ImagesApi api = config.createClient(ImagesApi.class);
|
||||||
Response response = api.get("clients", 123L, new HashMap<>());
|
Response response = api.get("clients", 123L, new HashMap<>());
|
||||||
|
|
||||||
assertThat(response.status()).isEqualTo(200);
|
assertThat(response.status()).isEqualTo(200);
|
||||||
assertThat(response.headers().get("Content-Type")).contains("image/png");
|
assertThat(response.headers().get(CONTENT_TYPE)).contains("image/png");
|
||||||
assertThat(response.body().asInputStream().readAllBytes()).isEqualTo(pngImage);
|
assertThat(response.body().asInputStream().readAllBytes()).isEqualTo(pngImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,7 +167,7 @@ class ImagesApiIntegrationTest {
|
|||||||
Long entityId = entityIds[i];
|
Long entityId = entityIds[i];
|
||||||
|
|
||||||
wireMockServer.stubFor(get(urlEqualTo("/v1/" + entityType + "/" + entityId + "/images"))
|
wireMockServer.stubFor(get(urlEqualTo("/v1/" + entityType + "/" + entityId + "/images"))
|
||||||
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "image/jpeg").withBody(new byte[] { 0x01 })));
|
.willReturn(aResponse().withStatus(200).withHeader(CONTENT_TYPE, "image/jpeg").withBody(new byte[] { 0x01 })));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImagesApi api = config.createClient(ImagesApi.class);
|
ImagesApi api = config.createClient(ImagesApi.class);
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ public enum GLAccountJsonInputParams {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString().replaceAll("_", " ");
|
return name().replace("_", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ public enum GLAccountType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString();
|
return name();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAssetType() {
|
public boolean isAssetType() {
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ public abstract class IdTypeResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String formatIdType(String idType) {
|
public static String formatIdType(String idType) {
|
||||||
return idType == null ? null : idType.replaceAll("-", "_").toUpperCase();
|
return idType == null ? null : idType.replace("-", "_").toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RuntimeException resolveFailed(String idType, Exception e) {
|
public static RuntimeException resolveFailed(String idType, Exception e) {
|
||||||
|
|||||||
+5
-5
@@ -54,17 +54,17 @@ public class IdempotencyStoreFilter extends OncePerRequestFilter {
|
|||||||
extractIdempotentKeyFromHttpServletRequest(request).ifPresent(idempotentKey -> fineractRequestContextHolder
|
extractIdempotentKeyFromHttpServletRequest(request).ifPresent(idempotentKey -> fineractRequestContextHolder
|
||||||
.setAttribute(SynchronousCommandProcessingService.IDEMPOTENCY_KEY_ATTRIBUTE, idempotentKey, request));
|
.setAttribute(SynchronousCommandProcessingService.IDEMPOTENCY_KEY_ATTRIBUTE, idempotentKey, request));
|
||||||
|
|
||||||
filterChain.doFilter(request, wrapper.getValue() != null ? wrapper.getValue() : response);
|
filterChain.doFilter(request, wrapper.get() != null ? wrapper.get() : response);
|
||||||
Optional<Long> commandId = helper.getCommandId(request);
|
Optional<Long> commandId = helper.getCommandId(request);
|
||||||
boolean isSuccessWithoutStored = commandId.isPresent() && wrapper.getValue() != null && helper.isStoreIdempotencyKey(request)
|
boolean isSuccessWithoutStored = commandId.isPresent() && wrapper.get() != null && helper.isStoreIdempotencyKey(request)
|
||||||
&& helper.isAllowedContentTypeResponse(response);
|
&& helper.isAllowedContentTypeResponse(response);
|
||||||
if (isSuccessWithoutStored) {
|
if (isSuccessWithoutStored) {
|
||||||
helper.storeCommandResult(response.getStatus(), Optional.ofNullable(wrapper.getValue())
|
helper.storeCommandResult(response.getStatus(), Optional.ofNullable(wrapper.get())
|
||||||
.map(ContentCachingResponseWrapper::getContentAsByteArray).map(s -> new String(s, StandardCharsets.UTF_8)).orElse(null),
|
.map(ContentCachingResponseWrapper::getContentAsByteArray).map(s -> new String(s, StandardCharsets.UTF_8)).orElse(null),
|
||||||
commandId.get());
|
commandId.get());
|
||||||
}
|
}
|
||||||
if (wrapper.getValue() != null) {
|
if (wrapper.get() != null) {
|
||||||
wrapper.getValue().copyBodyToResponse();
|
wrapper.get().copyBodyToResponse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -642,7 +642,7 @@ public class JsonParserHelper {
|
|||||||
// http://bugs.sun.com/view_bug.do?bug_id=4510618
|
// http://bugs.sun.com/view_bug.do?bug_id=4510618
|
||||||
final char groupingSeparator = symbols.getGroupingSeparator();
|
final char groupingSeparator = symbols.getGroupingSeparator();
|
||||||
if (groupingSeparator == '\u00a0') {
|
if (groupingSeparator == '\u00a0') {
|
||||||
source = source.replaceAll(" ", Character.toString('\u00a0'));
|
source = source.replace(" ", Character.toString('\u00a0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Number parsedNumber = df.parse(source);
|
final Number parsedNumber = df.parse(source);
|
||||||
@@ -727,9 +727,8 @@ public class JsonParserHelper {
|
|||||||
// http://bugs.sun.com/view_bug.do?bug_id=4510618
|
// http://bugs.sun.com/view_bug.do?bug_id=4510618
|
||||||
final char groupingSeparator = symbols.getGroupingSeparator();
|
final char groupingSeparator = symbols.getGroupingSeparator();
|
||||||
if (groupingSeparator == '\u00a0') {
|
if (groupingSeparator == '\u00a0') {
|
||||||
source = source.replaceAll(" ", Character.toString('\u00a0'));
|
source = source.replace(" ", Character.toString('\u00a0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
final NumberStyleFormatter numberFormatter = new NumberStyleFormatter();
|
final NumberStyleFormatter numberFormatter = new NumberStyleFormatter();
|
||||||
final Number parsedNumber = numberFormatter.parse(source, clientApplicationLocale);
|
final Number parsedNumber = numberFormatter.parse(source, clientApplicationLocale);
|
||||||
if (parsedNumber instanceof BigDecimal) {
|
if (parsedNumber instanceof BigDecimal) {
|
||||||
|
|||||||
+5
-10
@@ -41,16 +41,11 @@ public enum LegalForm {
|
|||||||
|
|
||||||
public static LegalForm fromInt(final Integer type) {
|
public static LegalForm fromInt(final Integer type) {
|
||||||
|
|
||||||
LegalForm legalForm = null;
|
return switch (type) {
|
||||||
switch (type) {
|
case 1 -> LegalForm.PERSON;
|
||||||
case 1:
|
case 2 -> LegalForm.ENTITY;
|
||||||
legalForm = LegalForm.PERSON;
|
default -> null;
|
||||||
break;
|
};
|
||||||
case 2:
|
|
||||||
legalForm = LegalForm.ENTITY;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return legalForm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPerson() {
|
public boolean isPerson() {
|
||||||
|
|||||||
+1
-1
@@ -207,7 +207,7 @@ public class ImagesApiResource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -128,7 +128,7 @@ public class FileSystemContentRepository implements ContentRepository {
|
|||||||
*/
|
*/
|
||||||
private String generateFileParentDirectory(final String entityType, final Long entityId) {
|
private String generateFileParentDirectory(final String entityType, final Long entityId) {
|
||||||
return fineractProperties.getContent().getFilesystem().getRootFolder() + File.separator
|
return fineractProperties.getContent().getFilesystem().getRootFolder() + File.separator
|
||||||
+ ThreadLocalContextUtil.getTenant().getName().replaceAll(" ", "").trim() + File.separator + "documents" + File.separator
|
+ ThreadLocalContextUtil.getTenant().getName().replace(" ", "").trim() + File.separator + "documents" + File.separator
|
||||||
+ entityType + File.separator + entityId + File.separator + ContentRepositoryUtils.generateRandomString();
|
+ entityType + File.separator + entityId + File.separator + ContentRepositoryUtils.generateRandomString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ public class FileSystemContentRepository implements ContentRepository {
|
|||||||
*/
|
*/
|
||||||
private String generateClientImageParentDirectory(final Long resourceId) {
|
private String generateClientImageParentDirectory(final Long resourceId) {
|
||||||
return fineractProperties.getContent().getFilesystem().getRootFolder() + File.separator
|
return fineractProperties.getContent().getFilesystem().getRootFolder() + File.separator
|
||||||
+ ThreadLocalContextUtil.getTenant().getName().replaceAll(" ", "").trim() + File.separator + "images" + File.separator
|
+ ThreadLocalContextUtil.getTenant().getName().replace(" ", "").trim() + File.separator + "images" + File.separator
|
||||||
+ "clients" + File.separator + resourceId;
|
+ "clients" + File.separator + resourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -46,22 +46,18 @@ public class LoanProductPaymentAllocationRuleMerger {
|
|||||||
Set<PaymentAllocationTransactionType> existing = new HashSet<>(originalItems.keySet());
|
Set<PaymentAllocationTransactionType> existing = new HashSet<>(originalItems.keySet());
|
||||||
Set<PaymentAllocationTransactionType> newSet = new HashSet<>(newItems.keySet());
|
Set<PaymentAllocationTransactionType> newSet = new HashSet<>(newItems.keySet());
|
||||||
existing.removeAll(newSet);
|
existing.removeAll(newSet);
|
||||||
if (existing.size() > 0) {
|
if (!existing.isEmpty()) {
|
||||||
updated = true;
|
updated = true;
|
||||||
existing.forEach(type -> {
|
existing.forEach(type -> loanProduct.getPaymentAllocationRules().remove(originalItems.get(type)));
|
||||||
loanProduct.getPaymentAllocationRules().remove(originalItems.get(type));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// elements to be added
|
// elements to be added
|
||||||
existing = new HashSet<>(originalItems.keySet());
|
existing = new HashSet<>(originalItems.keySet());
|
||||||
newSet = new HashSet<>(newItems.keySet());
|
newSet = new HashSet<>(newItems.keySet());
|
||||||
newSet.removeAll(existing);
|
newSet.removeAll(existing);
|
||||||
if (newSet.size() > 0) {
|
if (!newSet.isEmpty()) {
|
||||||
updated = true;
|
updated = true;
|
||||||
newSet.forEach(type -> {
|
newSet.forEach(type -> loanProduct.getPaymentAllocationRules().add(newItems.get(type)));
|
||||||
loanProduct.getPaymentAllocationRules().add(newItems.get(type));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// elements to be merged
|
// elements to be merged
|
||||||
|
|||||||
+17
-34
@@ -27,7 +27,6 @@ import io.swagger.v3.oas.annotations.media.Content;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.ws.rs.Consumes;
|
import jakarta.ws.rs.Consumes;
|
||||||
import jakarta.ws.rs.DELETE;
|
import jakarta.ws.rs.DELETE;
|
||||||
@@ -90,7 +89,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("health")
|
@Path("health")
|
||||||
@Operation(summary = "Query Interoperation Health Request", description = "")
|
@Operation(summary = "Query Interoperation Health Request", description = "")
|
||||||
@ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") })
|
@ApiResponse(responseCode = "200", description = "OK")
|
||||||
public String health(@Context UriInfo uriInfo) {
|
public String health(@Context UriInfo uriInfo) {
|
||||||
return "OK";
|
return "OK";
|
||||||
}
|
}
|
||||||
@@ -100,8 +99,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("accounts/{accountId}")
|
@Path("accounts/{accountId}")
|
||||||
@Operation(summary = "Query Interoperation Account details", description = "")
|
@Operation(summary = "Query Interoperation Account details", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropAccountData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropAccountData.class))) })
|
|
||||||
public String getAccountDetails(@PathParam("accountId") @Parameter(description = "accountId") String accountId,
|
public String getAccountDetails(@PathParam("accountId") @Parameter(description = "accountId") String accountId,
|
||||||
@Context UriInfo uriInfo) {
|
@Context UriInfo uriInfo) {
|
||||||
InteropAccountData result = interopService.getAccountDetails(accountId);
|
InteropAccountData result = interopService.getAccountDetails(accountId);
|
||||||
@@ -115,8 +113,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("accounts/{accountId}/transactions")
|
@Path("accounts/{accountId}/transactions")
|
||||||
@Operation(summary = "Query transactions by Account Id", description = "")
|
@Operation(summary = "Query transactions by Account Id", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionsData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionsData.class))) })
|
|
||||||
public String getAccountTransactions(@PathParam("accountId") @Parameter(description = "accountId") String accountId,
|
public String getAccountTransactions(@PathParam("accountId") @Parameter(description = "accountId") String accountId,
|
||||||
@DefaultValue("true") @QueryParam("debit") @Parameter(description = "debit") boolean debit,
|
@DefaultValue("true") @QueryParam("debit") @Parameter(description = "debit") boolean debit,
|
||||||
@DefaultValue("false") @QueryParam("credit") @Parameter(description = "credit") boolean credit,
|
@DefaultValue("false") @QueryParam("credit") @Parameter(description = "credit") boolean credit,
|
||||||
@@ -139,8 +136,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("accounts/{accountId}/identifiers")
|
@Path("accounts/{accountId}/identifiers")
|
||||||
@Operation(summary = "Query Interoperation secondary identifiers by Account Id", description = "")
|
@Operation(summary = "Query Interoperation secondary identifiers by Account Id", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifiersResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifiersResponseData.class))) })
|
|
||||||
public String getAccountIdentifiers(@PathParam("accountId") @Parameter(description = "accountId") String accountId,
|
public String getAccountIdentifiers(@PathParam("accountId") @Parameter(description = "accountId") String accountId,
|
||||||
@Context UriInfo uriInfo) {
|
@Context UriInfo uriInfo) {
|
||||||
InteropIdentifiersResponseData result = interopService.getAccountIdentifiers(accountId);
|
InteropIdentifiersResponseData result = interopService.getAccountIdentifiers(accountId);
|
||||||
@@ -154,8 +150,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("parties/{idType}/{idValue}")
|
@Path("parties/{idType}/{idValue}")
|
||||||
@Operation(summary = "Query Interoperation Account by secondary identifier", description = "")
|
@Operation(summary = "Query Interoperation Account by secondary identifier", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) })
|
|
||||||
public String getAccountByIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
public String getAccountByIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
||||||
@PathParam("idValue") @Parameter(description = "idValue") String idValue, @Context UriInfo uriInfo) {
|
@PathParam("idValue") @Parameter(description = "idValue") String idValue, @Context UriInfo uriInfo) {
|
||||||
InteropIdentifierAccountResponseData result = interopService.getAccountByIdentifier(idType, idValue, null);
|
InteropIdentifierAccountResponseData result = interopService.getAccountByIdentifier(idType, idValue, null);
|
||||||
@@ -169,8 +164,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("parties/{idType}/{idValue}/{subIdOrType}")
|
@Path("parties/{idType}/{idValue}/{subIdOrType}")
|
||||||
@Operation(summary = "Query Interoperation Account by secondary identifier", description = "")
|
@Operation(summary = "Query Interoperation Account by secondary identifier", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) })
|
|
||||||
public String getAccountByIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
public String getAccountByIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
||||||
@PathParam("idValue") @Parameter(description = "idValue") String idValue,
|
@PathParam("idValue") @Parameter(description = "idValue") String idValue,
|
||||||
@PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType, @Context UriInfo uriInfo) {
|
@PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType, @Context UriInfo uriInfo) {
|
||||||
@@ -186,8 +180,7 @@ public class InteropApiResource {
|
|||||||
@Path("parties/{idType}/{idValue}")
|
@Path("parties/{idType}/{idValue}")
|
||||||
@Operation(summary = "Interoperation Identifier registration", description = "")
|
@Operation(summary = "Interoperation Identifier registration", description = "")
|
||||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class)))
|
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class)))
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) })
|
|
||||||
public String registerAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
public String registerAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
||||||
@PathParam("idValue") @Parameter(description = "idValue") String idValue, @Parameter(hidden = true) String identifierJson,
|
@PathParam("idValue") @Parameter(description = "idValue") String idValue, @Parameter(hidden = true) String identifierJson,
|
||||||
@Context UriInfo uriInfo) {
|
@Context UriInfo uriInfo) {
|
||||||
@@ -207,8 +200,7 @@ public class InteropApiResource {
|
|||||||
@Path("parties/{idType}/{idValue}/{subIdOrType}")
|
@Path("parties/{idType}/{idValue}/{subIdOrType}")
|
||||||
@Operation(summary = "Interoperation Identifier registration", description = "")
|
@Operation(summary = "Interoperation Identifier registration", description = "")
|
||||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class)))
|
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class)))
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) })
|
|
||||||
public String registerAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
public String registerAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
||||||
@PathParam("idValue") @Parameter(description = "idValue") String idValue,
|
@PathParam("idValue") @Parameter(description = "idValue") String idValue,
|
||||||
@PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType,
|
@PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType,
|
||||||
@@ -229,8 +221,7 @@ public class InteropApiResource {
|
|||||||
@Path("parties/{idType}/{idValue}")
|
@Path("parties/{idType}/{idValue}")
|
||||||
@Operation(summary = "Allow Interoperation Identifier registration", description = "")
|
@Operation(summary = "Allow Interoperation Identifier registration", description = "")
|
||||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class)))
|
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class)))
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) })
|
|
||||||
public String deleteAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
public String deleteAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
||||||
@PathParam("idValue") @Parameter(description = "idValue") String idValue, @Context UriInfo uriInfo) {
|
@PathParam("idValue") @Parameter(description = "idValue") String idValue, @Context UriInfo uriInfo) {
|
||||||
CommandWrapper commandRequest = new InteropWrapperBuilder().deleteAccountIdentifier(idType, idValue, null).build();
|
CommandWrapper commandRequest = new InteropWrapperBuilder().deleteAccountIdentifier(idType, idValue, null).build();
|
||||||
@@ -248,8 +239,7 @@ public class InteropApiResource {
|
|||||||
@Path("parties/{idType}/{idValue}/{subIdOrType}")
|
@Path("parties/{idType}/{idValue}/{subIdOrType}")
|
||||||
@Operation(summary = "Allow Interoperation Identifier registration", description = "")
|
@Operation(summary = "Allow Interoperation Identifier registration", description = "")
|
||||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class)))
|
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropIdentifierRequestData.class)))
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropIdentifierAccountResponseData.class))) })
|
|
||||||
public String deleteAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
public String deleteAccountIdentifier(@PathParam("idType") @Parameter(description = "idType") InteropIdentifierType idType,
|
||||||
@PathParam("idValue") @Parameter(description = "idValue") String idValue,
|
@PathParam("idValue") @Parameter(description = "idValue") String idValue,
|
||||||
@PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType, @Context UriInfo uriInfo) {
|
@PathParam("subIdOrType") @Parameter(description = "subIdOrType") String subIdOrType, @Context UriInfo uriInfo) {
|
||||||
@@ -267,8 +257,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("transactions/{transactionCode}/requests/{requestCode}")
|
@Path("transactions/{transactionCode}/requests/{requestCode}")
|
||||||
@Operation(summary = "Query Interoperation Transaction Request", description = "")
|
@Operation(summary = "Query Interoperation Transaction Request", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionRequestResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionRequestResponseData.class))) })
|
|
||||||
public String getTransactionRequest(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode,
|
public String getTransactionRequest(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode,
|
||||||
@PathParam("requestCode") @Parameter(description = "requestCode") String requestCode, @Context UriInfo uriInfo) {
|
@PathParam("requestCode") @Parameter(description = "requestCode") String requestCode, @Context UriInfo uriInfo) {
|
||||||
context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_REQUEST);
|
context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_REQUEST);
|
||||||
@@ -285,8 +274,7 @@ public class InteropApiResource {
|
|||||||
@Path("requests")
|
@Path("requests")
|
||||||
@Operation(summary = "Allow Interoperation Transaction Request", description = "")
|
@Operation(summary = "Allow Interoperation Transaction Request", description = "")
|
||||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropTransactionRequestData.class)))
|
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropTransactionRequestData.class)))
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionRequestResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransactionRequestResponseData.class))) })
|
|
||||||
public String createTransactionRequest(@Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) {
|
public String createTransactionRequest(@Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) {
|
||||||
CommandWrapper commandRequest = new InteropWrapperBuilder().createTransactionRequest().withJson(quotesJson).build();
|
CommandWrapper commandRequest = new InteropWrapperBuilder().createTransactionRequest().withJson(quotesJson).build();
|
||||||
|
|
||||||
@@ -302,8 +290,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("transactions/{transactionCode}/quotes/{quoteCode}")
|
@Path("transactions/{transactionCode}/quotes/{quoteCode}")
|
||||||
@Operation(summary = "Query Interoperation Quote", description = "")
|
@Operation(summary = "Query Interoperation Quote", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropQuoteResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropQuoteResponseData.class))) })
|
|
||||||
public String getQuote(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode,
|
public String getQuote(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode,
|
||||||
@PathParam("quoteCode") @Parameter(description = "quoteCode") String quoteCode, @Context UriInfo uriInfo) {
|
@PathParam("quoteCode") @Parameter(description = "quoteCode") String quoteCode, @Context UriInfo uriInfo) {
|
||||||
context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_QUOTE);
|
context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_QUOTE);
|
||||||
@@ -320,8 +307,7 @@ public class InteropApiResource {
|
|||||||
@Path("quotes")
|
@Path("quotes")
|
||||||
@Operation(summary = "Calculate Interoperation Quote", description = "")
|
@Operation(summary = "Calculate Interoperation Quote", description = "")
|
||||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropQuoteRequestData.class)))
|
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropQuoteRequestData.class)))
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropQuoteResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropQuoteResponseData.class))) })
|
|
||||||
public String createQuote(@Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) {
|
public String createQuote(@Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) {
|
||||||
CommandWrapper commandRequest = new InteropWrapperBuilder().createQuotes().withJson(quotesJson).build();
|
CommandWrapper commandRequest = new InteropWrapperBuilder().createQuotes().withJson(quotesJson).build();
|
||||||
|
|
||||||
@@ -336,8 +322,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("transactions/{transactionCode}/transfers/{transferCode}")
|
@Path("transactions/{transactionCode}/transfers/{transferCode}")
|
||||||
@Operation(summary = "Query Interoperation Transfer", description = "")
|
@Operation(summary = "Query Interoperation Transfer", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransferResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransferResponseData.class))) })
|
|
||||||
public String getTransfer(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode,
|
public String getTransfer(@PathParam("transactionCode") @Parameter(description = "transactionCode") String transactionCode,
|
||||||
@PathParam("transferCode") @Parameter(description = "transferCode") String transferCode, @Context UriInfo uriInfo) {
|
@PathParam("transferCode") @Parameter(description = "transferCode") String transferCode, @Context UriInfo uriInfo) {
|
||||||
context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_QUOTE);
|
context.authenticatedUser().validateHasReadPermission(ENTITY_NAME_QUOTE);
|
||||||
@@ -354,8 +339,7 @@ public class InteropApiResource {
|
|||||||
@Path("transfers")
|
@Path("transfers")
|
||||||
@Operation(summary = "Prepare Interoperation Transfer", description = "")
|
@Operation(summary = "Prepare Interoperation Transfer", description = "")
|
||||||
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropTransferRequestData.class)))
|
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = InteropTransferRequestData.class)))
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransferResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropTransferResponseData.class))) })
|
|
||||||
public String performTransfer(@QueryParam("action") @Parameter(description = "action") String action,
|
public String performTransfer(@QueryParam("action") @Parameter(description = "action") String action,
|
||||||
@Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) {
|
@Parameter(hidden = true) String quotesJson, @Context UriInfo uriInfo) {
|
||||||
|
|
||||||
@@ -383,8 +367,7 @@ public class InteropApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Path("accounts/{accountId}/kyc")
|
@Path("accounts/{accountId}/kyc")
|
||||||
@Operation(summary = "Query KYC by Account Id", description = "")
|
@Operation(summary = "Query KYC by Account Id", description = "")
|
||||||
@ApiResponses({
|
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropKycResponseData.class)))
|
||||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = InteropKycResponseData.class))) })
|
|
||||||
public String getClientKyc(@PathParam("accountId") @Parameter(description = "accountId") String accountId, @Context UriInfo uriInfo) {
|
public String getClientKyc(@PathParam("accountId") @Parameter(description = "accountId") String accountId, @Context UriInfo uriInfo) {
|
||||||
InteropKycResponseData result = interopService.getKyc(accountId);
|
InteropKycResponseData result = interopService.getKyc(accountId);
|
||||||
ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||||
|
|||||||
+6
-8
@@ -458,17 +458,15 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
|
|
||||||
private void checkClientOrGroupActive(final Loan loan) {
|
private void checkClientOrGroupActive(final Loan loan) {
|
||||||
final Client client = loan.client();
|
final Client client = loan.client();
|
||||||
if (client != null) {
|
if (client != null && client.isNotActive()) {
|
||||||
if (client.isNotActive()) {
|
throw new ClientNotActiveException(client.getId());
|
||||||
throw new ClientNotActiveException(client.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Group group = loan.group();
|
final Group group = loan.group();
|
||||||
if (group != null) {
|
if (group != null && group.isNotActive()) {
|
||||||
if (group.isNotActive()) {
|
throw new GroupNotActiveException(group.getId());
|
||||||
throw new GroupNotActiveException(group.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+2
-2
@@ -46,7 +46,7 @@ public class GenerateAdhocClientScheduleTasklet implements Tasklet {
|
|||||||
@Override
|
@Override
|
||||||
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
|
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
|
||||||
final Collection<AdHocData> adhocs = adHocReadPlatformService.retrieveAllActiveAdHocQuery();
|
final Collection<AdHocData> adhocs = adHocReadPlatformService.retrieveAllActiveAdHocQuery();
|
||||||
if (adhocs.size() > 0) {
|
if (!adhocs.isEmpty()) {
|
||||||
adhocs.forEach(adhoc -> {
|
adhocs.forEach(adhoc -> {
|
||||||
boolean run = true;
|
boolean run = true;
|
||||||
LocalDate next = null;
|
LocalDate next = null;
|
||||||
@@ -83,7 +83,7 @@ public class GenerateAdhocClientScheduleTasklet implements Tasklet {
|
|||||||
final StringBuilder insertSqlBuilder = new StringBuilder(900);
|
final StringBuilder insertSqlBuilder = new StringBuilder(900);
|
||||||
insertSqlBuilder.append("INSERT INTO ").append(adhoc.getTableName()).append("(").append(adhoc.getTableFields())
|
insertSqlBuilder.append("INSERT INTO ").append(adhoc.getTableName()).append("(").append(adhoc.getTableFields())
|
||||||
.append(") ").append(adhoc.getQuery());
|
.append(") ").append(adhoc.getQuery());
|
||||||
if (insertSqlBuilder.length() > 0) {
|
if (!insertSqlBuilder.isEmpty()) {
|
||||||
final int result = jdbcTemplate.update(insertSqlBuilder.toString());
|
final int result = jdbcTemplate.update(insertSqlBuilder.toString());
|
||||||
log.debug("{}: Records affected by generateClientSchedule: {}", ThreadLocalContextUtil.getTenant().getName(),
|
log.debug("{}: Records affected by generateClientSchedule: {}", ThreadLocalContextUtil.getTenant().getName(),
|
||||||
result);
|
result);
|
||||||
|
|||||||
+1
-12
@@ -150,7 +150,7 @@ public class InterestIncentivesFields {
|
|||||||
public void validateIncentiveData(final DataValidatorBuilder baseDataValidator) {
|
public void validateIncentiveData(final DataValidatorBuilder baseDataValidator) {
|
||||||
|
|
||||||
switch (attributeName()) {
|
switch (attributeName()) {
|
||||||
case GENDER:
|
case GENDER, CLIENT_CLASSIFICATION, CLIENT_TYPE:
|
||||||
baseDataValidator.reset().parameter(attributeValueParamName).value(this.attributeValue).longGreaterThanZero();
|
baseDataValidator.reset().parameter(attributeValueParamName).value(this.attributeValue).longGreaterThanZero();
|
||||||
baseDataValidator.reset().parameter(conditionTypeParamName).value(this.conditionType)
|
baseDataValidator.reset().parameter(conditionTypeParamName).value(this.conditionType)
|
||||||
.isOneOfTheseValues(ConditionType.EQUAL.getValue(), ConditionType.NOT_EQUAL.getValue());
|
.isOneOfTheseValues(ConditionType.EQUAL.getValue(), ConditionType.NOT_EQUAL.getValue());
|
||||||
@@ -158,17 +158,6 @@ public class InterestIncentivesFields {
|
|||||||
case AGE:
|
case AGE:
|
||||||
baseDataValidator.reset().parameter(attributeValueParamName).value(this.attributeValue).longGreaterThanZero();
|
baseDataValidator.reset().parameter(attributeValueParamName).value(this.attributeValue).longGreaterThanZero();
|
||||||
break;
|
break;
|
||||||
case CLIENT_CLASSIFICATION:
|
|
||||||
baseDataValidator.reset().parameter(attributeValueParamName).value(this.attributeValue).longGreaterThanZero();
|
|
||||||
baseDataValidator.reset().parameter(conditionTypeParamName).value(this.conditionType)
|
|
||||||
.isOneOfTheseValues(ConditionType.EQUAL.getValue(), ConditionType.NOT_EQUAL.getValue());
|
|
||||||
break;
|
|
||||||
case CLIENT_TYPE:
|
|
||||||
baseDataValidator.reset().parameter(attributeValueParamName).value(this.attributeValue).longGreaterThanZero();
|
|
||||||
baseDataValidator.reset().parameter(conditionTypeParamName).value(this.conditionType)
|
|
||||||
.isOneOfTheseValues(ConditionType.EQUAL.getValue(), ConditionType.NOT_EQUAL.getValue());
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public enum InterestIncentiveEntityType {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name().toString().replaceAll("_", " ");
|
return name().replace("_", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getValue() {
|
public Integer getValue() {
|
||||||
|
|||||||
+8
-8
@@ -41,25 +41,25 @@ public final class FixedDepositAccountStatusChecker {
|
|||||||
public static void verifyFixedDepositIsApproved(final HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositIsApproved(final HashMap fixedDepositStatusHashMap) {
|
||||||
LOG.info("-------------------- VERIFYING FIXED DEPOSIT APPLICATION IS APPROVED --------------------");
|
LOG.info("-------------------- VERIFYING FIXED DEPOSIT APPLICATION IS APPROVED --------------------");
|
||||||
assertTrue(getStatus(fixedDepositStatusHashMap, "approved"), "Error in Approving Fixed deposit application");
|
assertTrue(getStatus(fixedDepositStatusHashMap, "approved"), "Error in Approving Fixed deposit application");
|
||||||
LOG.info("{}", fixedDepositStatusHashMap.toString());
|
LOG.info("{}", fixedDepositStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyFixedDepositIsPending(final HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositIsPending(final HashMap fixedDepositStatusHashMap) {
|
||||||
LOG.info("-------------------- VERIFYING FIXED DEPOSIT APPLICATION IS PENDING --------------------");
|
LOG.info("-------------------- VERIFYING FIXED DEPOSIT APPLICATION IS PENDING --------------------");
|
||||||
assertTrue(getStatus(fixedDepositStatusHashMap, "submittedAndPendingApproval"), "FIXED DEPOSIT ACCOUNT IS NOT IN PENDING STATE");
|
assertTrue(getStatus(fixedDepositStatusHashMap, "submittedAndPendingApproval"), "FIXED DEPOSIT ACCOUNT IS NOT IN PENDING STATE");
|
||||||
LOG.info("{}", fixedDepositStatusHashMap.toString());
|
LOG.info("{}", fixedDepositStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyFixedDepositIsActive(final HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositIsActive(final HashMap fixedDepositStatusHashMap) {
|
||||||
LOG.info("----------------- VERIFYING FIXED DEPOSIT APPLICATION IS ACTIVE -----------------");
|
LOG.info("----------------- VERIFYING FIXED DEPOSIT APPLICATION IS ACTIVE -----------------");
|
||||||
assertTrue(getStatus(fixedDepositStatusHashMap, "active"), "ERROR IN ACTIVATING THE FIXED DEPOSIT APPLICATION");
|
assertTrue(getStatus(fixedDepositStatusHashMap, "active"), "ERROR IN ACTIVATING THE FIXED DEPOSIT APPLICATION");
|
||||||
LOG.info("{}", fixedDepositStatusHashMap.toString());
|
LOG.info("{}", fixedDepositStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyFixedDepositIsRejected(final HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositIsRejected(final HashMap fixedDepositStatusHashMap) {
|
||||||
LOG.info("-------------- VERIFYING FIXED DEPOSIT APPLICATION IS REJECTED ----------------");
|
LOG.info("-------------- VERIFYING FIXED DEPOSIT APPLICATION IS REJECTED ----------------");
|
||||||
assertTrue(getStatus(fixedDepositStatusHashMap, "rejected"), "ERROR IN REJECTING THE FIXED DEPOSIT APPLICATION");
|
assertTrue(getStatus(fixedDepositStatusHashMap, "rejected"), "ERROR IN REJECTING THE FIXED DEPOSIT APPLICATION");
|
||||||
LOG.info("{}", fixedDepositStatusHashMap.toString());
|
LOG.info("{}", fixedDepositStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyFixedDepositIsWithdrawn(final HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositIsWithdrawn(final HashMap fixedDepositStatusHashMap) {
|
||||||
@@ -71,13 +71,13 @@ public final class FixedDepositAccountStatusChecker {
|
|||||||
public static void verifyFixedDepositAccountIsClosed(final HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositAccountIsClosed(final HashMap fixedDepositStatusHashMap) {
|
||||||
LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS CLOSED ---------------------");
|
LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS CLOSED ---------------------");
|
||||||
assertTrue(getStatus(fixedDepositStatusHashMap, "closed"), "ERROR IN CLOSING THE FIXED DEPOSIT APPLICATION");
|
assertTrue(getStatus(fixedDepositStatusHashMap, "closed"), "ERROR IN CLOSING THE FIXED DEPOSIT APPLICATION");
|
||||||
LOG.info("{}", fixedDepositStatusHashMap.toString());
|
LOG.info("{}", fixedDepositStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyFixedDepositAccountIsNotActive(final HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositAccountIsNotActive(final HashMap fixedDepositStatusHashMap) {
|
||||||
LOG.info("------------------ VERIFYING FIXED DEPOSIT APPLICATION IS INACTIVE --------------------");
|
LOG.info("------------------ VERIFYING FIXED DEPOSIT APPLICATION IS INACTIVE --------------------");
|
||||||
Assertions.assertFalse(getStatus(fixedDepositStatusHashMap, "active"));
|
Assertions.assertFalse(getStatus(fixedDepositStatusHashMap, "active"));
|
||||||
LOG.info("{}", fixedDepositStatusHashMap.toString());
|
LOG.info("{}", fixedDepositStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap getStatusOfFixedDepositAccount(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
public static HashMap getStatusOfFixedDepositAccount(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||||
@@ -90,13 +90,13 @@ public final class FixedDepositAccountStatusChecker {
|
|||||||
public static void verifyFixedDepositAccountIsPrematureClosed(HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositAccountIsPrematureClosed(HashMap fixedDepositStatusHashMap) {
|
||||||
LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS CLOSED ---------------------");
|
LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS CLOSED ---------------------");
|
||||||
assertTrue(getStatus(fixedDepositStatusHashMap, "prematureClosed"), "ERROR IN PREMATURELY CLOSING THE FIXED DEPOSIT ACCOUNT");
|
assertTrue(getStatus(fixedDepositStatusHashMap, "prematureClosed"), "ERROR IN PREMATURELY CLOSING THE FIXED DEPOSIT ACCOUNT");
|
||||||
LOG.info("{}", fixedDepositStatusHashMap.toString());
|
LOG.info("{}", fixedDepositStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void verifyFixedDepositAccountIsMatured(HashMap fixedDepositStatusHashMap) {
|
public static void verifyFixedDepositAccountIsMatured(HashMap fixedDepositStatusHashMap) {
|
||||||
LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS MATURED ---------------------");
|
LOG.info("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS MATURED ---------------------");
|
||||||
assertTrue(getStatus(fixedDepositStatusHashMap, "matured"), "ERROR IN MATURITY JOB OF THE FIXED DEPOSIT ACCOUNT");
|
assertTrue(getStatus(fixedDepositStatusHashMap, "matured"), "ERROR IN MATURITY JOB OF THE FIXED DEPOSIT ACCOUNT");
|
||||||
LOG.info("{}", fixedDepositStatusHashMap.toString());
|
LOG.info("{}", fixedDepositStatusHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean getStatus(final HashMap fixedDepositStatusMap, final String fixedDepositStatusString) {
|
private static boolean getStatus(final HashMap fixedDepositStatusMap, final String fixedDepositStatusString) {
|
||||||
|
|||||||
Reference in New Issue
Block a user