diff --git a/app/src/main/resources/swagger/api-docs.json b/app/src/main/resources/swagger/api-docs.json index 5da09826..523c5dd3 100644 --- a/app/src/main/resources/swagger/api-docs.json +++ b/app/src/main/resources/swagger/api-docs.json @@ -3278,7 +3278,7 @@ "type" : { "type" : "string", "description" : "Delegation type", - "enum" : [ "AOO", "PT", "UO" ] + "enum" : [ "AOO", "EA", "PT", "UO" ] } } }, @@ -3309,7 +3309,7 @@ }, "type" : { "type" : "string", - "enum" : [ "AOO", "PT", "UO" ] + "enum" : [ "AOO", "EA", "PT", "UO" ] } } }, @@ -3359,7 +3359,7 @@ }, "type" : { "type" : "string", - "enum" : [ "AOO", "PT", "UO" ] + "enum" : [ "AOO", "EA", "PT", "UO" ] }, "updatedAt" : { "type" : "string", @@ -3720,7 +3720,7 @@ "role" : { "type" : "string", "description" : "User's role", - "enum" : [ "ADMIN", "LIMITED" ] + "enum" : [ "ADMIN", "ADMIN_EA", "LIMITED" ] }, "status" : { "type" : "string", @@ -3972,7 +3972,7 @@ "selcRole" : { "type" : "string", "description" : "User's role", - "enum" : [ "ADMIN", "LIMITED" ] + "enum" : [ "ADMIN", "ADMIN_EA", "LIMITED" ] }, "status" : { "type" : "string", @@ -4010,7 +4010,7 @@ "selcRole" : { "type" : "string", "description" : "Self Care role", - "enum" : [ "ADMIN", "LIMITED" ] + "enum" : [ "ADMIN", "ADMIN_EA", "LIMITED" ] } } }, @@ -4056,7 +4056,7 @@ "role" : { "type" : "string", "description" : "User's role", - "enum" : [ "ADMIN", "LIMITED" ] + "enum" : [ "ADMIN", "ADMIN_EA", "LIMITED" ] }, "status" : { "type" : "string", diff --git a/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/DelegationType.java b/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/DelegationType.java index 6873cabc..7ee8d788 100644 --- a/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/DelegationType.java +++ b/connector-api/src/main/java/it/pagopa/selfcare/dashboard/connector/model/delegation/DelegationType.java @@ -4,5 +4,6 @@ public enum DelegationType { PT, AOO, - UO; + UO, + EA; } diff --git a/connector/rest/docs/openapi/api-selfcare-core-docs.json b/connector/rest/docs/openapi/api-selfcare-core-docs.json index 44779d6a..22f5f0d4 100644 --- a/connector/rest/docs/openapi/api-selfcare-core-docs.json +++ b/connector/rest/docs/openapi/api-selfcare-core-docs.json @@ -1,7 +1,7 @@ { "openapi" : "3.0.3", "info" : { - "title" : "selc-ms-core", + "title" : "institution-ms", "version" : "1.0-SNAPSHOT" }, "servers" : [ { @@ -33,9 +33,6 @@ }, { "name" : "Onboarding", "description" : "Onboarding Controller" - }, { - "name" : "kafka", - "description" : "Queue Notification Controller" } ], "paths" : { "/delegations" : { @@ -222,7 +219,7 @@ }, "/delegations/from-taxcode" : { "post" : { - "tags" : [ "Delegation" ], + "tags" : [ "Delegation", "internal-v1" ], "summary" : "Create an association between institution and technical partner using taxCode for both instead of internal id. It is useful when we don't know institution's internal id.", "description" : "Create an association between institution and technical partner using taxCode for both instead of internal id. It is useful when we don't know institution's internal id.", "operationId" : "createDelegationFromInstitutionsTaxCodeUsingPOST", @@ -340,7 +337,7 @@ }, "/v2/delegations" : { "get" : { - "tags" : [ "Delegation", "external-v2", "support" ], + "tags" : [ "Delegation" ], "summary" : "Retrieve institution's delegations with pagination", "description" : "Retrieve institution's delegations with pagination", "operationId" : "getDelegationsUsingGET_1", @@ -514,68 +511,6 @@ } ] } }, - "/external/institutions/pn-pg" : { - "post" : { - "tags" : [ "External" ], - "summary" : "create an institution (PG) using external institution id fetching data from info-camere", - "description" : "create an institution (PG) using external institution id fetching data from info-camere", - "operationId" : "createPnPgInstitutionUsingPOST", - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/CreatePnPgInstitutionRequest" - } - } - } - }, - "responses" : { - "201" : { - "description" : "Created", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/InstitutionPnPgResponse" - } - } - } - }, - "400" : { - "description" : "Bad Request", - "content" : { - "application/problem+json" : { - "schema" : { - "$ref" : "#/components/schemas/Problem" - } - } - } - }, - "404" : { - "description" : "Not Found", - "content" : { - "application/problem+json" : { - "schema" : { - "$ref" : "#/components/schemas/Problem" - } - } - } - }, - "409" : { - "description" : "Conflict", - "content" : { - "application/problem+json" : { - "schema" : { - "$ref" : "#/components/schemas/Problem" - } - } - } - } - }, - "security" : [ { - "bearerAuth" : [ "global" ] - } ] - } - }, "/external/institutions/{externalId}" : { "get" : { "tags" : [ "External" ], @@ -813,7 +748,7 @@ }, "/institutions" : { "get" : { - "tags" : [ "Institution", "external-v2", "support" ], + "tags" : [ "Institution", "external-v2", "support", "support-pnpg" ], "summary" : "Gets institutions filtering by taxCode and/or subunitCode", "description" : "Gets institutions filtering by taxCode and/or subunitCode", "operationId" : "getInstitutionsUsingGET", @@ -1613,7 +1548,7 @@ }, "/institutions/{id}" : { "get" : { - "tags" : [ "Institution", "external-v2" ], + "tags" : [ "Institution", "external-pnpg", "external-v2", "internal-v1" ], "summary" : "Gets the corresponding institution using internal institution id", "description" : "Gets the corresponding institution using internal institution id", "operationId" : "retrieveInstitutionByIdUsingGET", @@ -1816,6 +1751,16 @@ } }, "responses" : { + "200" : { + "description" : "User already exists an onboarding in status ACTIVE or SUSPENDED with that productId", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InstitutionResponse" + } + } + } + }, "201" : { "description" : "Created", "content" : { @@ -1926,9 +1871,74 @@ } ] } }, - "/institutions/{institutionId}/createdAt" : { - "put" : { + "/institutions/{id}/products/{productId}" : { + "delete" : { "tags" : [ "Institution" ], + "summary" : "The service set DELETE status on onboarding association with the product and institutionId", + "description" : "The service set DELETE status on onboarding association with the product and institutionId", + "operationId" : "deleteOnboardedInstitutionUsingDELETE", + "parameters" : [ { + "name" : "productId", + "in" : "path", + "description" : "productId", + "required" : true, + "style" : "simple", + "schema" : { + "type" : "string" + } + }, { + "name" : "id", + "in" : "path", + "description" : "id", + "required" : true, + "style" : "simple", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "204" : { + "description" : "No Content" + }, + "400" : { + "description" : "Bad Request", + "content" : { + "application/problem+json" : { + "schema" : { + "$ref" : "#/components/schemas/Problem" + } + } + } + }, + "404" : { + "description" : "Not Found", + "content" : { + "application/problem+json" : { + "schema" : { + "$ref" : "#/components/schemas/Problem" + } + } + } + }, + "409" : { + "description" : "Conflict", + "content" : { + "application/problem+json" : { + "schema" : { + "$ref" : "#/components/schemas/Problem" + } + } + } + } + }, + "security" : [ { + "bearerAuth" : [ "global" ] + } ] + } + }, + "/institutions/{institutionId}/created-at" : { + "put" : { + "tags" : [ "Institution", "internal-v1" ], "summary" : "The service updates the createdAt field for the institution-product pair", "description" : "The service updates the createdAt field for the institution-product pair", "operationId" : "updateCreatedAtUsingPUT", @@ -2076,7 +2086,7 @@ "style" : "simple", "schema" : { "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PRV", "PSP", "PT", "REC", "SA", "SCP" ] } } ], "responses" : { @@ -2390,71 +2400,6 @@ "bearerAuth" : [ "global" ] } ] } - }, - "/notification-event/contracts" : { - "put" : { - "tags" : [ "kafka" ], - "summary" : "resendContractsByInstitutionIdAndTokenId", - "description" : "Function to send a specific onboarding using institutionId and tokenId ", - "operationId" : "resendContractsByInstitutionIdAndTokenIdUsingPUT", - "parameters" : [ { - "name" : "tokenId", - "in" : "query", - "description" : "tokenId", - "required" : true, - "style" : "form", - "schema" : { - "type" : "string" - } - }, { - "name" : "institutionId", - "in" : "query", - "description" : "institutionId", - "required" : true, - "style" : "form", - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "OK" - }, - "400" : { - "description" : "Bad Request", - "content" : { - "application/problem+json" : { - "schema" : { - "$ref" : "#/components/schemas/Problem" - } - } - } - }, - "403" : { - "description" : "Forbidden", - "content" : { - "application/problem+json" : { - "schema" : { - "$ref" : "#/components/schemas/Problem" - } - } - } - }, - "404" : { - "description" : "Not Found", - "content" : { - "application/problem+json" : { - "schema" : { - "$ref" : "#/components/schemas/Problem" - } - } - } - } - }, - "security" : [ { - "bearerAuth" : [ "global" ] - } ] - } } }, "components" : { @@ -2621,8 +2566,7 @@ "type" : "string" }, "institutionType" : { - "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "type" : "string" }, "origin" : { "type" : "string" @@ -2720,18 +2664,6 @@ } } }, - "CreatePnPgInstitutionRequest" : { - "title" : "CreatePnPgInstitutionRequest", - "type" : "object", - "properties" : { - "description" : { - "type" : "string" - }, - "taxId" : { - "type" : "string" - } - } - }, "CreatedAtRequest" : { "title" : "CreatedAtRequest", "type" : "object", @@ -2815,7 +2747,7 @@ }, "type" : { "type" : "string", - "enum" : [ "AOO", "PT" ] + "enum" : [ "AOO", "EA", "PT" ] } } }, @@ -2846,7 +2778,7 @@ }, "type" : { "type" : "string", - "enum" : [ "AOO", "PT" ] + "enum" : [ "AOO", "EA", "PT" ] } } }, @@ -2883,8 +2815,7 @@ "type" : "string" }, "institutionType" : { - "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "type" : "string" }, "productId" : { "type" : "string" @@ -2898,7 +2829,7 @@ }, "type" : { "type" : "string", - "enum" : [ "AOO", "PT" ] + "enum" : [ "AOO", "EA", "PT" ] }, "updatedAt" : { "type" : "string", @@ -2992,12 +2923,11 @@ "type" : "string" }, "institutionType" : { - "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "type" : "string" }, "origin" : { "type" : "string", - "enum" : [ "ADE", "ANAC", "INFOCAMERE", "IPA", "IVASS", "MOCK", "SELC", "UNKNOWN" ] + "enum" : [ "ADE", "ANAC", "INFOCAMERE", "IPA", "IVASS", "MOCK", "PDND_INFOCAMERE", "SELC", "UNKNOWN" ] }, "originId" : { "type" : "string" @@ -3031,7 +2961,7 @@ }, "institutionType" : { "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PRV", "PSP", "PT", "REC", "SA", "SCP" ] }, "subunitCode" : { "type" : "string" @@ -3040,6 +2970,12 @@ "type" : "string", "enum" : [ "AOO", "UO" ] }, + "supportEmail" : { + "type" : "string" + }, + "supportPhone" : { + "type" : "string" + }, "taxCode" : { "type" : "string" } @@ -3083,6 +3019,9 @@ "contractPath" : { "type" : "string" }, + "isAggregator" : { + "type" : "boolean" + }, "pricingPlan" : { "type" : "string" }, @@ -3091,12 +3030,6 @@ }, "tokenId" : { "type" : "string" - }, - "users" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Person" - } } } }, @@ -3148,8 +3081,7 @@ "type" : "boolean" }, "institutionType" : { - "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "type" : "string" }, "onboardings" : { "type" : "object", @@ -3196,15 +3128,6 @@ } } }, - "InstitutionPnPgResponse" : { - "title" : "InstitutionPnPgResponse", - "type" : "object", - "properties" : { - "id" : { - "type" : "string" - } - } - }, "InstitutionProduct" : { "title" : "InstitutionProduct", "type" : "object", @@ -3233,6 +3156,9 @@ "items" : { "type" : "string" } + }, + "parentDescription" : { + "type" : "string" } } }, @@ -3297,7 +3223,7 @@ }, "institutionType" : { "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PRV", "PSP", "PT", "REC", "SA", "SCP" ] }, "onboarding" : { "type" : "array", @@ -3398,8 +3324,13 @@ "type" : "boolean" }, "institutionType" : { - "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "type" : "string" + }, + "istatCode" : { + "type" : "string" + }, + "logo" : { + "type" : "string" }, "onboarding" : { "type" : "array", @@ -3506,11 +3437,14 @@ }, "institutionType" : { "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ] + "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PRV", "PSP", "PT", "REC", "SA", "SCP" ] }, "ivassCode" : { "type" : "string" }, + "parentDescription" : { + "type" : "string" + }, "paymentServiceProvider" : { "$ref" : "#/components/schemas/PaymentServiceProvider" }, @@ -3546,6 +3480,21 @@ } } }, + "InvalidParam" : { + "title" : "InvalidParam", + "required" : [ "name", "reason" ], + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "description" : "Invalid parameter name." + }, + "reason" : { + "type" : "string", + "description" : "Invalid parameter reason." + } + } + }, "OnboardedProductResponse" : { "title" : "OnboardedProductResponse", "type" : "object", @@ -3557,6 +3506,9 @@ "type" : "string", "format" : "date-time" }, + "isAggregator" : { + "type" : "boolean" + }, "productId" : { "type" : "string" }, @@ -3654,6 +3606,9 @@ "type" : "string", "format" : "date-time" }, + "isAggregator" : { + "type" : "boolean" + }, "pricingPlan" : { "type" : "string" }, @@ -3788,60 +3743,42 @@ } } }, - "Person" : { - "title" : "Person", + "Problem" : { + "title" : "Problem", + "required" : [ "status", "title" ], "type" : "object", "properties" : { - "email" : { - "type" : "string" - }, - "env" : { + "detail" : { "type" : "string", - "enum" : [ "COLL", "DEV", "PROD", "ROOT" ] - }, - "id" : { - "type" : "string" - }, - "name" : { - "type" : "string" - }, - "productRole" : { - "type" : "string" + "description" : "Human-readable description of this specific problem." }, - "role" : { + "instance" : { "type" : "string", - "enum" : [ "DELEGATE", "MANAGER", "OPERATOR", "SUB_DELEGATE" ] - }, - "roleLabel" : { - "type" : "string" - }, - "surname" : { - "type" : "string" + "description" : "A URI that describes where the problem occurred." }, - "taxCode" : { - "type" : "string" - } - } - }, - "Problem" : { - "title" : "Problem", - "type" : "object", - "properties" : { - "errors" : { + "invalidParams" : { "type" : "array", + "description" : "A list of invalid parameters details.", "items" : { - "$ref" : "#/components/schemas/ProblemError" + "$ref" : "#/components/schemas/InvalidParam" } }, "status" : { "type" : "integer", - "format" : "int32" + "description" : "The HTTP status code.", + "format" : "int32", + "example" : 500 + }, + "title" : { + "type" : "string", + "description" : "Short human-readable summary of the problem." + }, + "type" : { + "type" : "string", + "description" : "A URL to a page with more details regarding the problem." } - } - }, - "ProblemError" : { - "title" : "ProblemError", - "type" : "object" + }, + "description" : "A \"problem detail\" as a way to carry machine-readable details of errors (https://datatracker.ietf.org/doc/html/rfc7807)" }, "RootParentResponse" : { "title" : "RootParentResponse", @@ -3877,7 +3814,7 @@ }, "role" : { "type" : "string", - "enum" : [ "DELEGATE", "MANAGER", "OPERATOR", "SUB_DELEGATE" ] + "enum" : [ "ADMIN_EA", "DELEGATE", "MANAGER", "OPERATOR", "SUB_DELEGATE" ] }, "roleLabel" : { "type" : "string" diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/InstitutionMapper.java b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/InstitutionMapper.java index 49aab454..3cdcbcf7 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/InstitutionMapper.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/InstitutionMapper.java @@ -1,6 +1,5 @@ package it.pagopa.selfcare.dashboard.connector.rest.model.mapper; -import it.pagopa.selfcare.onboarding.common.InstitutionType; import it.pagopa.selfcare.core.generated.openapi.v1.dto.*; import it.pagopa.selfcare.dashboard.connector.model.institution.Billing; import it.pagopa.selfcare.dashboard.connector.model.institution.*; @@ -29,7 +28,7 @@ public interface InstitutionMapper { @Mapping(target = "status", expression = "java(institutionProducts.getStatus().name())") InstitutionBase toInstitutionBase(UserInstitutionRoleResponse institutionProducts); - @Mapping(target = "institutionType", expression = "java(toInstitutionType(institutionResponse.getInstitutionType()))") + @Mapping(target = "institutionType", source = "institutionResponse.institutionType") @Mapping(target = "description" , source = "institutionUpdate.description") @Mapping(target = "taxCode" , source = "institutionUpdate.taxCode") @Mapping(target = "digitalAddress" , source = "institutionUpdate.digitalAddress") @@ -60,11 +59,6 @@ public interface InstitutionMapper { @Mapping(target = "onBoardingStatus", expression = "java(toOnboardedProductState(institutionProduct.getState()))") PartyProduct toPartyProduct(InstitutionProduct institutionProduct); - @Named("toInstitutionType") - default InstitutionType toInstitutionType(InstitutionResponse.InstitutionTypeEnum institutionTypeEnum) { - return InstitutionType.valueOf(institutionTypeEnum.name()); - } - @Named("toOnboardedProductState") default ProductOnBoardingStatus toOnboardedProductState(InstitutionProduct.StateEnum stateEnum) { if(stateEnum != null){ 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 e6e68d74..34ccbfd5 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 @@ -43,8 +43,7 @@ import java.util.Optional; import java.util.function.Function; -import static it.pagopa.selfcare.commons.base.security.SelfCareAuthority.ADMIN; -import static it.pagopa.selfcare.commons.base.security.SelfCareAuthority.LIMITED; +import static it.pagopa.selfcare.commons.base.security.SelfCareAuthority.*; import static it.pagopa.selfcare.dashboard.connector.rest.CoreConnectorImpl.REQUIRED_GEOGRAPHIC_TAXONOMIES_MESSAGE; import static it.pagopa.selfcare.dashboard.connector.rest.CoreConnectorImpl.REQUIRED_INSTITUTION_ID_MESSAGE; import static org.junit.jupiter.api.Assertions.*; @@ -84,6 +83,7 @@ public void setup() { private static final Function PARTY_2_SELC_ROLE = partyRole -> switch (partyRole) { case MANAGER, DELEGATE, SUB_DELEGATE -> ADMIN; + case ADMIN_EA -> ADMIN_EA; default -> LIMITED; }; diff --git a/pom.xml b/pom.xml index 57dfb6a4..50d9d8fd 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ Self Care Dashboard Backend - 2.5.1 + 2.5.3 https://sonarcloud.io/