Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SELC-4914] feat: remove taxCode and mode filters from getDelegationsUsingToV2 #447

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

This file was deleted.

32 changes: 9 additions & 23 deletions connector/rest/docs/openapi/api-selfcare-core-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -2552,6 +2532,9 @@
"recipientCode" : {
"type" : "string"
},
"taxCodeInvoicing" : {
"type" : "string"
},
"vatNumber" : {
"type" : "string"
}
Expand All @@ -2567,6 +2550,9 @@
"recipientCode" : {
"type" : "string"
},
"taxCodeInvoicing" : {
"type" : "string"
},
"vatNumber" : {
"type" : "string"
}
Expand All @@ -2582,6 +2568,9 @@
"recipientCode" : {
"type" : "string"
},
"taxCodeInvoicing" : {
"type" : "string"
},
"vatNumber" : {
"type" : "string"
}
Expand Down Expand Up @@ -3451,9 +3440,6 @@
"taxCode" : {
"type" : "string"
},
"taxCodeSfe" : {
"type" : "string"
},
"updatedAt" : {
"type" : "string",
"format" : "date-time"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ public List<Delegation> getDelegations(GetDelegationParameters delegationParamet
delegationParameters.getProductId(),
delegationParameters.getSearch(),
delegationParameters.getTaxCode(),
delegationParameters.getMode(),
delegationParameters.getOrder(),
delegationParameters.getPage(),
delegationParameters.getSize())
Expand All @@ -146,7 +145,6 @@ public DelegationWithPagination getDelegationsV2(GetDelegationParameters delegat
delegationParameters.getProductId(),
delegationParameters.getSearch(),
delegationParameters.getTaxCode(),
delegationParameters.getMode(),
delegationParameters.getOrder(),
delegationParameters.getPage(),
delegationParameters.getSize())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void getDelegationUsingFrom_shouldGetData() {
ResponseEntity<List<DelegationResponse>> 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);


Expand All @@ -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);
}

Expand All @@ -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);


Expand All @@ -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);
}

Expand All @@ -273,7 +273,7 @@ void getDelegationsV2_shouldGetData() {
ResponseEntity<DelegationWithPaginationResponse> 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);


Expand All @@ -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);
}

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -219,10 +218,6 @@ public ResponseEntity<List<DelegationResource>> 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,
Expand All @@ -234,8 +229,6 @@ public ResponseEntity<List<DelegationResource>> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -171,10 +170,6 @@ public ResponseEntity<DelegationWithPagination> 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,
Expand All @@ -186,8 +181,6 @@ public ResponseEntity<DelegationWithPagination> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
Loading