From c5a5fd3990b36683e02833b8c6502b01ae4793f2 Mon Sep 17 00:00:00 2001 From: Giulia Tremolada <124147597+giulia-tremolada@users.noreply.github.com> Date: Mon, 27 May 2024 11:17:15 +0200 Subject: [PATCH] [SELC-4914] feat: remove taxCode and mode filters from getDelegationsUsingToV2 (#447) --- app/src/main/resources/swagger/api-docs.json | 38 ------------------- .../delegation/GetDelegationParameters.java | 1 - .../model/delegation/GetDelegationsMode.java | 6 --- .../docs/openapi/api-selfcare-core-docs.json | 32 +++++----------- .../connector/rest/CoreConnectorImpl.java | 2 - .../connector/rest/CoreConnectorImplTest.java | 13 +++---- .../core/DelegationServiceImplTest.java | 1 - .../web/controller/InstitutionController.java | 7 ---- .../controller/InstitutionV2Controller.java | 7 ---- .../controller/InstitutionControllerTest.java | 9 +++-- .../InstitutionV2ControllerTest.java | 8 ++-- 11 files changed, 23 insertions(+), 101 deletions(-) delete mode 100644 connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/GetDelegationsMode.java diff --git a/app/src/main/resources/swagger/api-docs.json b/app/src/main/resources/swagger/api-docs.json index c5f8afa2..0ffeb184 100644 --- a/app/src/main/resources/swagger/api-docs.json +++ b/app/src/main/resources/swagger/api-docs.json @@ -497,25 +497,6 @@ "schema" : { "type" : "string" } - }, { - "name" : "taxCode", - "in" : "query", - "description" : "Institution's tax code", - "required" : false, - "style" : "form", - "schema" : { - "type" : "string" - } - }, { - "name" : "mode", - "in" : "query", - "description" : "Mode (full or normal) to retrieve institution's delegations", - "required" : false, - "style" : "form", - "schema" : { - "type" : "string", - "enum" : [ "FULL", "NORMAL" ] - } }, { "name" : "order", "in" : "query", @@ -990,25 +971,6 @@ "schema" : { "type" : "string" } - }, { - "name" : "taxCode", - "in" : "query", - "description" : "Institution's tax code", - "required" : false, - "style" : "form", - "schema" : { - "type" : "string" - } - }, { - "name" : "mode", - "in" : "query", - "description" : "Mode (full or normal) to retrieve institution's delegations", - "required" : false, - "style" : "form", - "schema" : { - "type" : "string", - "enum" : [ "FULL", "NORMAL" ] - } }, { "name" : "order", "in" : "query", diff --git a/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/GetDelegationParameters.java b/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/GetDelegationParameters.java index a9186550..5e0ae28d 100644 --- a/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/GetDelegationParameters.java +++ b/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/GetDelegationParameters.java @@ -11,7 +11,6 @@ public class GetDelegationParameters { private String productId; private String search; private String taxCode; - private String mode; private String order; private Integer page; private Integer size; diff --git a/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/GetDelegationsMode.java b/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/GetDelegationsMode.java deleted file mode 100644 index 33d1d9a6..00000000 --- a/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/GetDelegationsMode.java +++ /dev/null @@ -1,6 +0,0 @@ -package it.pagopa.selfcare.dashboard.connector.model.delegation; - -public enum GetDelegationsMode { - FULL, - NORMAL -} diff --git a/connector/rest/docs/openapi/api-selfcare-core-docs.json b/connector/rest/docs/openapi/api-selfcare-core-docs.json index 92ec38ae..44779d6a 100644 --- a/connector/rest/docs/openapi/api-selfcare-core-docs.json +++ b/connector/rest/docs/openapi/api-selfcare-core-docs.json @@ -89,16 +89,6 @@ "schema" : { "type" : "string" } - }, { - "name" : "mode", - "in" : "query", - "description" : "Mode (full or normal) to retreieve institution's delegations", - "required" : false, - "style" : "form", - "schema" : { - "type" : "string", - "enum" : [ "FULL", "NORMAL" ] - } }, { "name" : "order", "in" : "query", @@ -399,16 +389,6 @@ "schema" : { "type" : "string" } - }, { - "name" : "mode", - "in" : "query", - "description" : "Mode (full or normal) to retreieve institution's delegations", - "required" : false, - "style" : "form", - "schema" : { - "type" : "string", - "enum" : [ "FULL", "NORMAL" ] - } }, { "name" : "order", "in" : "query", @@ -2552,6 +2532,9 @@ "recipientCode" : { "type" : "string" }, + "taxCodeInvoicing" : { + "type" : "string" + }, "vatNumber" : { "type" : "string" } @@ -2567,6 +2550,9 @@ "recipientCode" : { "type" : "string" }, + "taxCodeInvoicing" : { + "type" : "string" + }, "vatNumber" : { "type" : "string" } @@ -2582,6 +2568,9 @@ "recipientCode" : { "type" : "string" }, + "taxCodeInvoicing" : { + "type" : "string" + }, "vatNumber" : { "type" : "string" } @@ -3451,9 +3440,6 @@ "taxCode" : { "type" : "string" }, - "taxCodeSfe" : { - "type" : "string" - }, "updatedAt" : { "type" : "string", "format" : "date-time" diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImpl.java b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImpl.java index c9004629..d58469db 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImpl.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImpl.java @@ -119,7 +119,6 @@ public List getDelegations(GetDelegationParameters delegationParamet delegationParameters.getProductId(), delegationParameters.getSearch(), delegationParameters.getTaxCode(), - delegationParameters.getMode(), delegationParameters.getOrder(), delegationParameters.getPage(), delegationParameters.getSize()) @@ -146,7 +145,6 @@ public DelegationWithPagination getDelegationsV2(GetDelegationParameters delegat delegationParameters.getProductId(), delegationParameters.getSearch(), delegationParameters.getTaxCode(), - delegationParameters.getMode(), delegationParameters.getOrder(), delegationParameters.getPage(), delegationParameters.getSize()) diff --git a/connector/rest/src/test/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImplTest.java b/connector/rest/src/test/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImplTest.java index 36341c74..1b59fe52 100644 --- a/connector/rest/src/test/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImplTest.java +++ b/connector/rest/src/test/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImplTest.java @@ -216,7 +216,7 @@ void getDelegationUsingFrom_shouldGetData() { ResponseEntity> delegationResponseEntity = new ResponseEntity<>(delegationResponseList, null, HttpStatus.OK); GetDelegationParameters parameters = dummyDelegationParameters(); - when(coreDelegationApiRestClient._getDelegationsUsingGET(any(), any(), any(), any(), any(), any(), any(), any(), any())) + when(coreDelegationApiRestClient._getDelegationsUsingGET(any(), any(), any(), any(), any(), any(), any(), any())) .thenReturn(delegationResponseEntity); @@ -235,7 +235,7 @@ void getDelegationUsingFrom_shouldGetData() { assertEquals(delegationResponseList.get(0).getBrokerName(), delegationList.get(0).getBrokerName()); verify(coreDelegationApiRestClient, times(1)) - ._getDelegationsUsingGET(parameters.getFrom(), parameters.getTo(), parameters.getProductId(), parameters.getSearch(), parameters.getTaxCode(), parameters.getMode(), parameters.getOrder(), parameters.getPage(), parameters.getSize()); + ._getDelegationsUsingGET(parameters.getFrom(), parameters.getTo(), parameters.getProductId(), parameters.getSearch(), parameters.getTaxCode(), parameters.getOrder(), parameters.getPage(), parameters.getSize()); verifyNoMoreInteractions(coreDelegationApiRestClient); } @@ -247,7 +247,7 @@ void getDelegationUsingFrom_shouldGetEmptyData() { when(delegationResponseEntity.getBody()).thenReturn(null); - when(coreDelegationApiRestClient._getDelegationsUsingGET(any(), any(), any(), any(), any(), any(), any(), any(), any())) + when(coreDelegationApiRestClient._getDelegationsUsingGET(any(), any(), any(), any(), any(), any(), any(), any())) .thenReturn(delegationResponseEntity); @@ -258,7 +258,7 @@ void getDelegationUsingFrom_shouldGetEmptyData() { assertEquals(0, delegationList.size()); verify(coreDelegationApiRestClient, times(1)) - ._getDelegationsUsingGET(parameters.getFrom(), parameters.getTo(), parameters.getProductId(), parameters.getSearch(), parameters.getTaxCode(), parameters.getMode(), parameters.getOrder(), parameters.getPage(), parameters.getSize()); + ._getDelegationsUsingGET(parameters.getFrom(), parameters.getTo(), parameters.getProductId(), parameters.getSearch(), parameters.getTaxCode(), parameters.getOrder(), parameters.getPage(), parameters.getSize()); verifyNoMoreInteractions(coreDelegationApiRestClient); } @@ -273,7 +273,7 @@ void getDelegationsV2_shouldGetData() { ResponseEntity delegationResponseEntity = new ResponseEntity<>(delegationWithPaginationResponse, null, HttpStatus.OK); GetDelegationParameters parameters = dummyDelegationParameters(); - when(coreDelegationApiRestClient._getDelegationsUsingGET1(any(), any(), any(), any(), any(), any(), any(), any(), any())) + when(coreDelegationApiRestClient._getDelegationsUsingGET1(any(), any(), any(), any(), any(), any(), any(), any())) .thenReturn(delegationResponseEntity); @@ -292,7 +292,7 @@ void getDelegationsV2_shouldGetData() { assertEquals(delegationResponseList.get(0).getBrokerName(), response.getDelegations().get(0).getBrokerName()); verify(coreDelegationApiRestClient, times(1)) - ._getDelegationsUsingGET1(parameters.getFrom(), parameters.getTo(), parameters.getProductId(), parameters.getSearch(), parameters.getTaxCode(), parameters.getMode(), parameters.getOrder(), parameters.getPage(), parameters.getSize()); + ._getDelegationsUsingGET1(parameters.getFrom(), parameters.getTo(), parameters.getProductId(), parameters.getSearch(), parameters.getTaxCode(), parameters.getOrder(), parameters.getPage(), parameters.getSize()); verifyNoMoreInteractions(coreDelegationApiRestClient); } @@ -519,7 +519,6 @@ private GetDelegationParameters dummyDelegationParameters() { .productId("setProductId") .taxCode("taxCode") .search("name") - .mode(GetDelegationsMode.FULL.name()) .order(Order.ASC.name()) .page(0) .size(1000) diff --git a/core/src/test/java/it/pagopa/selfcare/dashboard/core/DelegationServiceImplTest.java b/core/src/test/java/it/pagopa/selfcare/dashboard/core/DelegationServiceImplTest.java index 3e420f69..f530f064 100644 --- a/core/src/test/java/it/pagopa/selfcare/dashboard/core/DelegationServiceImplTest.java +++ b/core/src/test/java/it/pagopa/selfcare/dashboard/core/DelegationServiceImplTest.java @@ -122,7 +122,6 @@ private GetDelegationParameters dummyDelegationParametersTo() { .productId("product-io") .taxCode("taxCode") .search("name") - .mode(GetDelegationsMode.FULL.name()) .order(Order.ASC.name()) .page(0) .size(1000) diff --git a/web/src/main/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionController.java b/web/src/main/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionController.java index aaa76ba7..7cd96cf7 100644 --- a/web/src/main/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionController.java +++ b/web/src/main/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionController.java @@ -5,7 +5,6 @@ import io.swagger.annotations.ApiParam; import it.pagopa.selfcare.commons.base.logging.LogUtils; import it.pagopa.selfcare.dashboard.connector.model.delegation.GetDelegationParameters; -import it.pagopa.selfcare.dashboard.connector.model.delegation.GetDelegationsMode; import it.pagopa.selfcare.dashboard.connector.model.delegation.Order; import it.pagopa.selfcare.dashboard.connector.model.institution.GeographicTaxonomyList; import it.pagopa.selfcare.dashboard.connector.model.institution.Institution; @@ -219,10 +218,6 @@ public ResponseEntity> getDelegationsUsingTo(@ApiParam( @RequestParam(name = "productId", required = false) String productId, @ApiParam("${swagger.dashboard.delegation.model.description}") @RequestParam(name = "search", required = false) String search, - @ApiParam("${swagger.dashboard.delegation.model.taxCode}") - @RequestParam(name = "taxCode", required = false) String taxCode, - @ApiParam("${swagger.dashboard.delegation.delegations.mode}") - @RequestParam(name = "mode", required = false) GetDelegationsMode mode, @ApiParam("${swagger.dashboard.delegation.delegations.order}") @RequestParam(name = "order", required = false) Order order, @RequestParam(name = "page", required = false) Integer page, @@ -234,8 +229,6 @@ public ResponseEntity> getDelegationsUsingTo(@ApiParam( .to(institutionId) .productId(productId) .search(search) - .taxCode(taxCode) - .mode(Objects.nonNull(mode) ? mode.name() : null) .order(Objects.nonNull(order) ? order.name() : null) .page(page) .size(size) diff --git a/web/src/main/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionV2Controller.java b/web/src/main/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionV2Controller.java index 9c8f6c09..381d80e4 100644 --- a/web/src/main/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionV2Controller.java +++ b/web/src/main/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionV2Controller.java @@ -7,7 +7,6 @@ import it.pagopa.selfcare.commons.base.security.SelfCareUser; import it.pagopa.selfcare.dashboard.connector.model.delegation.DelegationWithPagination; import it.pagopa.selfcare.dashboard.connector.model.delegation.GetDelegationParameters; -import it.pagopa.selfcare.dashboard.connector.model.delegation.GetDelegationsMode; import it.pagopa.selfcare.dashboard.connector.model.delegation.Order; import it.pagopa.selfcare.dashboard.connector.model.institution.Institution; import it.pagopa.selfcare.dashboard.connector.model.institution.InstitutionBase; @@ -171,10 +170,6 @@ public ResponseEntity getDelegationsUsingTo(@ApiParam( @RequestParam(name = "productId", required = false) String productId, @ApiParam("${swagger.dashboard.delegation.model.description}") @RequestParam(name = "search", required = false) String search, - @ApiParam("${swagger.dashboard.delegation.model.taxCode}") - @RequestParam(name = "taxCode", required = false) String taxCode, - @ApiParam("${swagger.dashboard.delegation.delegations.mode}") - @RequestParam(name = "mode", required = false) GetDelegationsMode mode, @ApiParam("${swagger.dashboard.delegation.delegations.order}") @RequestParam(name = "order", required = false) Order order, @RequestParam(name = "page", required = false) @Min(0) Integer page, @@ -186,8 +181,6 @@ public ResponseEntity getDelegationsUsingTo(@ApiParam( .to(institutionId) .productId(productId) .search(search) - .taxCode(taxCode) - .mode(Objects.nonNull(mode) ? mode.name() : null) .order(Objects.nonNull(order) ? order.name() : null) .page(page) .size(size) diff --git a/web/src/test/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionControllerTest.java b/web/src/test/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionControllerTest.java index 3b01fb3d..bbb90ecc 100644 --- a/web/src/test/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionControllerTest.java +++ b/web/src/test/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionControllerTest.java @@ -2,7 +2,10 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import it.pagopa.selfcare.dashboard.connector.model.delegation.*; +import it.pagopa.selfcare.dashboard.connector.model.delegation.Delegation; +import it.pagopa.selfcare.dashboard.connector.model.delegation.DelegationType; +import it.pagopa.selfcare.dashboard.connector.model.delegation.GetDelegationParameters; +import it.pagopa.selfcare.dashboard.connector.model.delegation.Order; import it.pagopa.selfcare.dashboard.connector.model.institution.GeographicTaxonomy; import it.pagopa.selfcare.dashboard.connector.model.institution.GeographicTaxonomyList; import it.pagopa.selfcare.dashboard.connector.model.institution.Institution; @@ -311,7 +314,7 @@ void getDelegationsUsingFrom_shouldGetData() throws Exception { } /** - * Method under test: {@link InstitutionController#getDelegationsUsingTo(String, String, String, String, GetDelegationsMode, Order, Integer, Integer)} + * Method under test: {@link InstitutionController#getDelegationsUsingTo(String, String, String, Order, Integer, Integer)} */ @Test void getDelegationsUsingTo_shouldGetData() throws Exception { @@ -402,9 +405,7 @@ private GetDelegationParameters dummyDelegationParametersTo() { return GetDelegationParameters.builder() .to("to") .productId("setProductId") - .taxCode("taxCode") .search("name") - .mode(GetDelegationsMode.FULL.name()) .order(Order.ASC.name()) .page(0) .size(1000) diff --git a/web/src/test/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionV2ControllerTest.java b/web/src/test/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionV2ControllerTest.java index 15e59bea..5bdb2f56 100644 --- a/web/src/test/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionV2ControllerTest.java +++ b/web/src/test/java/it/pagopa/selfcare/dashboard/web/controller/InstitutionV2ControllerTest.java @@ -326,7 +326,7 @@ void getDelegationsUsingTo_shouldGetData() throws Exception { // Given DelegationWithInfo expectedDelegation = dummyDelegation(); PageInfo exptectedPageInfo = new PageInfo(10, 0, 1, 1); - GetDelegationParameters delegationParameters = createDelegationParameters(null, "to", "prod-id", "taxCode", "search", GetDelegationsMode.FULL, Order.ASC, 0, 10); + GetDelegationParameters delegationParameters = createDelegationParameters(null, "to", "prod-id", "search", Order.ASC, 0, 10); DelegationWithPagination expectedDelegationWithPagination = new DelegationWithPagination(List.of(expectedDelegation), exptectedPageInfo); when(delegationServiceMock.getDelegationsV2(any())).thenReturn(expectedDelegationWithPagination); @@ -384,15 +384,13 @@ private DelegationWithInfo createDelegation(String pattern, String from, String } private GetDelegationParameters createDelegationParameters(String from, String to, String productId, - String search, String taxCode, GetDelegationsMode mode, - Order order, Integer page, Integer size) { + String search, Order order, + Integer page, Integer size) { return GetDelegationParameters.builder() .from(from) .to(to) .productId(productId) .search(search) - .taxCode(taxCode) - .mode(mode.name()) .order(order.name()) .page(page) .size(size)