From cfcb5a3799737fd94b97b4a61fa7df832f3e2093 Mon Sep 17 00:00:00 2001 From: flaminiaScarciofolo <113031535+flaminiaScarciofolo@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:43:32 +0200 Subject: [PATCH] [SELC-5692] Feat: Updated selfcare onboarding openapi and related API (#354) --- app/src/main/resources/swagger/api-docs.json | 306 ++++++------------ .../model/institutions/AggregateResult.java | 27 ++ .../institutions/AggregateUserResult.java | 12 + .../model/institutions/Institution.java | 6 + .../institutions/VerifyAggregateResult.java | 2 +- .../openapi/api-selfcare-onboarding-docs.json | 238 ++++---------- .../connector/OnboardingMsConnectorImpl.java | 6 +- .../rest/mapper/OnboardingMapper.java | 6 +- .../OnboardingMsConnectorImplTest.java | 16 +- .../core/InstitutionServiceImplTest.java | 8 +- .../web/model/AggregateInstitution.java | 12 + .../web/model/VerifyAggregatesResponse.java | 4 +- 12 files changed, 234 insertions(+), 409 deletions(-) create mode 100644 connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/AggregateResult.java create mode 100644 connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/AggregateUserResult.java diff --git a/app/src/main/resources/swagger/api-docs.json b/app/src/main/resources/swagger/api-docs.json index 931dfed1..87e32396 100644 --- a/app/src/main/resources/swagger/api-docs.json +++ b/app/src/main/resources/swagger/api-docs.json @@ -2758,15 +2758,30 @@ "address" : { "type" : "string" }, + "city" : { + "type" : "string" + }, + "codeSDI" : { + "type" : "string" + }, + "county" : { + "type" : "string" + }, "description" : { "type" : "string" }, + "digitalAddress" : { + "type" : "string" + }, "geographicTaxonomies" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/GeographicTaxonomyDto" } }, + "iban" : { + "type" : "string" + }, "origin" : { "type" : "string", "enum" : [ "ADE", "ANAC", "INFOCAMERE", "IPA", "IVASS", "MOCK", "PDND_INFOCAMERE", "SELC", "UNKNOWN" ] @@ -2774,34 +2789,118 @@ "originId" : { "type" : "string" }, + "service" : { + "type" : "string" + }, "subunitCode" : { "type" : "string" }, "subunitType" : { "type" : "string" }, + "syncAsyncMode" : { + "type" : "string" + }, "taxCode" : { "type" : "string" }, + "taxCodePT" : { + "type" : "string" + }, "users" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/UserDto" } }, + "vatNumber" : { + "type" : "string" + }, "zipCode" : { "type" : "string" } } }, - "AssistanceContacts" : { - "title" : "AssistanceContacts", + "AggregateResult" : { + "title" : "AggregateResult", "type" : "object", "properties" : { - "supportEmail" : { + "address" : { "type" : "string" }, - "supportPhone" : { + "city" : { + "type" : "string" + }, + "codeSDI" : { + "type" : "string" + }, + "county" : { + "type" : "string" + }, + "description" : { + "type" : "string" + }, + "digitalAddress" : { + "type" : "string" + }, + "iban" : { + "type" : "string" + }, + "origin" : { + "type" : "string" + }, + "originId" : { + "type" : "string" + }, + "service" : { + "type" : "string" + }, + "subunitCode" : { + "type" : "string" + }, + "subunitType" : { + "type" : "string" + }, + "syncAsyncMode" : { + "type" : "string" + }, + "taxCode" : { + "type" : "string" + }, + "taxCodePT" : { + "type" : "string" + }, + "users" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/AggregateUserResult" + } + }, + "vatNumber" : { + "type" : "string" + }, + "zipCode" : { + "type" : "string" + } + } + }, + "AggregateUserResult" : { + "title" : "AggregateUserResult", + "type" : "object", + "properties" : { + "email" : { + "type" : "string" + }, + "name" : { + "type" : "string" + }, + "role" : { + "type" : "string" + }, + "surname" : { + "type" : "string" + }, + "taxCode" : { "type" : "string" } } @@ -2836,21 +2935,6 @@ } } }, - "Attribute" : { - "title" : "Attribute", - "type" : "object", - "properties" : { - "code" : { - "type" : "string" - }, - "description" : { - "type" : "string" - }, - "origin" : { - "type" : "string" - } - } - }, "BillingDataDto" : { "title" : "BillingDataDto", "required" : [ "businessName", "digitalAddress", "registeredOffice" ], @@ -2982,21 +3066,6 @@ } } }, - "CompanyInformations" : { - "title" : "CompanyInformations", - "type" : "object", - "properties" : { - "businessRegisterPlace" : { - "type" : "string" - }, - "rea" : { - "type" : "string" - }, - "shareCapital" : { - "type" : "string" - } - } - }, "CompanyInformationsDto" : { "title" : "CompanyInformationsDto", "type" : "object", @@ -3092,21 +3161,6 @@ } } }, - "DataProtectionOfficer" : { - "title" : "DataProtectionOfficer", - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "email" : { - "type" : "string" - }, - "pec" : { - "type" : "string" - } - } - }, "DpoData" : { "title" : "DpoData", "required" : [ "address", "email", "pec" ], @@ -3153,18 +3207,6 @@ } } }, - "GeographicTaxonomy" : { - "title" : "GeographicTaxonomy", - "type" : "object", - "properties" : { - "code" : { - "type" : "string" - }, - "desc" : { - "type" : "string" - } - } - }, "GeographicTaxonomyDto" : { "title" : "GeographicTaxonomyDto", "required" : [ "code", "desc" ], @@ -3194,97 +3236,6 @@ } } }, - "Institution" : { - "title" : "Institution", - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "aooParentCode" : { - "type" : "string" - }, - "assistanceContacts" : { - "$ref" : "#/components/schemas/AssistanceContacts" - }, - "attributes" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/Attribute" - } - }, - "city" : { - "type" : "string" - }, - "companyInformations" : { - "$ref" : "#/components/schemas/CompanyInformations" - }, - "country" : { - "type" : "string" - }, - "county" : { - "type" : "string" - }, - "dataProtectionOfficer" : { - "$ref" : "#/components/schemas/DataProtectionOfficer" - }, - "description" : { - "type" : "string" - }, - "digitalAddress" : { - "type" : "string" - }, - "externalId" : { - "type" : "string" - }, - "geographicTaxonomies" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/GeographicTaxonomy" - } - }, - "id" : { - "type" : "string" - }, - "institutionType" : { - "type" : "string", - "enum" : [ "AS", "CON", "GSP", "PA", "PG", "PRV", "PSP", "PT", "REC", "SA", "SCP" ] - }, - "origin" : { - "type" : "string" - }, - "originId" : { - "type" : "string" - }, - "parentDescription" : { - "type" : "string" - }, - "paymentServiceProvider" : { - "$ref" : "#/components/schemas/PaymentServiceProvider" - }, - "subunitCode" : { - "type" : "string" - }, - "subunitType" : { - "type" : "string" - }, - "taxCode" : { - "type" : "string" - }, - "users" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/User" - } - }, - "vatNumber" : { - "type" : "string" - }, - "zipCode" : { - "type" : "string" - } - } - }, "InstitutionData" : { "title" : "InstitutionData", "type" : "object", @@ -3755,27 +3706,6 @@ } } }, - "PaymentServiceProvider" : { - "title" : "PaymentServiceProvider", - "type" : "object", - "properties" : { - "abiCode" : { - "type" : "string" - }, - "businessRegisterNumber" : { - "type" : "string" - }, - "legalRegisterName" : { - "type" : "string" - }, - "legalRegisterNumber" : { - "type" : "string" - }, - "vatNumberGroup" : { - "type" : "boolean" - } - } - }, "Problem" : { "title" : "Problem", "required" : [ "status", "title" ], @@ -3930,34 +3860,6 @@ } } }, - "User" : { - "title" : "User", - "type" : "object", - "properties" : { - "email" : { - "type" : "string" - }, - "id" : { - "type" : "string" - }, - "name" : { - "type" : "string" - }, - "productRole" : { - "type" : "string" - }, - "role" : { - "type" : "string", - "enum" : [ "ADMIN_EA", "DELEGATE", "MANAGER", "OPERATOR", "SUB_DELEGATE" ] - }, - "surname" : { - "type" : "string" - }, - "taxCode" : { - "type" : "string" - } - } - }, "UserDataValidationDto" : { "title" : "UserDataValidationDto", "required" : [ "taxCode" ], @@ -4063,7 +3965,7 @@ "aggregates" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Institution" + "$ref" : "#/components/schemas/AggregateResult" } }, "errors" : { diff --git a/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/AggregateResult.java b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/AggregateResult.java new file mode 100644 index 00000000..1342654c --- /dev/null +++ b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/AggregateResult.java @@ -0,0 +1,27 @@ +package it.pagopa.selfcare.onboarding.connector.model.institutions; + +import lombok.Data; + +import java.util.List; + +@Data +public class AggregateResult { + private String subunitCode; + private String subunitType; + private String description; + private String codeSDI; + private String digitalAddress; + private String taxCode; + private String vatNumber; + private String address; + private String city; + private String county; + private String zipCode; + private String originId; + private String origin; + private String taxCodePT; + private String iban; + private String service; + private String syncAsyncMode; + private List users = null; +} diff --git a/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/AggregateUserResult.java b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/AggregateUserResult.java new file mode 100644 index 00000000..16ba228e --- /dev/null +++ b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/AggregateUserResult.java @@ -0,0 +1,12 @@ +package it.pagopa.selfcare.onboarding.connector.model.institutions; + +import lombok.Data; + +@Data +public class AggregateUserResult { + private String name; + private String surname; + private String taxCode; + private String email; + private String role; +} diff --git a/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/Institution.java b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/Institution.java index 878810a4..03c66ab2 100644 --- a/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/Institution.java +++ b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/Institution.java @@ -37,4 +37,10 @@ public class Institution { private CompanyInformations companyInformations; private AssistanceContacts assistanceContacts; private List users; + + private String taxCodePT; + private String iban; + private String service; + private String syncAsyncMode; + private String codeSDI; } diff --git a/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/VerifyAggregateResult.java b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/VerifyAggregateResult.java index 8c530539..80f438e9 100644 --- a/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/VerifyAggregateResult.java +++ b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/model/institutions/VerifyAggregateResult.java @@ -6,6 +6,6 @@ @Data public class VerifyAggregateResult { - private List aggregates ; + private List aggregates ; private List errors; } diff --git a/connector/rest/docs/openapi/api-selfcare-onboarding-docs.json b/connector/rest/docs/openapi/api-selfcare-onboarding-docs.json index 543bbc55..220fe5b2 100644 --- a/connector/rest/docs/openapi/api-selfcare-onboarding-docs.json +++ b/connector/rest/docs/openapi/api-selfcare-onboarding-docs.json @@ -53,7 +53,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/VerifyAggregateAppIoResponse" + "$ref" : "#/components/schemas/VerifyAggregateResponse" } } } @@ -143,7 +143,7 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/VerifyAggregateSendResponse" + "$ref" : "#/components/schemas/VerifyAggregateResponse" } } } @@ -481,7 +481,8 @@ }, "security" : [ { "SecurityScheme" : [ ] - } ] + } ], + "x-legacy-api" : "true" } }, "/v1/onboarding/completion" : { @@ -582,7 +583,8 @@ }, "security" : [ { "SecurityScheme" : [ ] - } ] + } ], + "x-legacy-api" : "true" } }, "/v1/onboarding/pa" : { @@ -1110,7 +1112,8 @@ }, "security" : [ { "SecurityScheme" : [ ] - } ] + } ], + "x-legacy-api" : "true" } }, "/v1/onboarding/{onboardingId}/consume" : { @@ -1323,7 +1326,8 @@ }, "security" : [ { "SecurityScheme" : [ ] - } ] + } ], + "x-legacy-api" : "true" } }, "/v1/tokens" : { @@ -1438,7 +1442,7 @@ } } }, - "AggregateAppIo" : { + "Aggregate" : { "type" : "object", "properties" : { "subunitCode" : { @@ -1450,6 +1454,9 @@ "description" : { "type" : "string" }, + "codeSDI" : { + "type" : "string" + }, "digitalAddress" : { "type" : "string" }, @@ -1462,11 +1469,42 @@ "address" : { "type" : "string" }, + "city" : { + "type" : "string" + }, + "county" : { + "type" : "string" + }, + "zipCode" : { + "type" : "string" + }, "originId" : { "type" : "string" }, "origin" : { "type" : "string" + }, + "taxCodePT" : { + "type" : "string" + }, + "iban" : { + "type" : "string" + }, + "service" : { + "type" : "string" + }, + "syncAsyncMode" : { + "type" : "string" + }, + "users" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/AggregateUser" + } + }, + "rowNumber" : { + "format" : "int32", + "type" : "integer" } } }, @@ -1512,47 +1550,30 @@ "items" : { "$ref" : "#/components/schemas/UserRequest" } - } - } - }, - "AggregateSend" : { - "type" : "object", - "properties" : { - "description" : { - "type" : "string" }, - "pec" : { - "type" : "string" - }, - "taxCode" : { + "codeSDI" : { "type" : "string" }, - "vatNumber" : { + "digitalAddress" : { "type" : "string" }, - "codeSDI" : { + "city" : { "type" : "string" }, - "address" : { + "county" : { "type" : "string" }, - "city" : { + "taxCodePT" : { "type" : "string" }, - "province" : { + "iban" : { "type" : "string" }, - "subunitType" : { + "service" : { "type" : "string" }, - "subunitCode" : { + "syncAsyncMode" : { "type" : "string" - }, - "users" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/AggregateUser" - } } } }, @@ -1621,20 +1642,6 @@ } } }, - "DataProtectionOfficer" : { - "type" : "object", - "properties" : { - "address" : { - "type" : "string" - }, - "email" : { - "type" : "string" - }, - "pec" : { - "type" : "string" - } - } - }, "DataProtectionOfficerRequest" : { "type" : "object", "properties" : { @@ -1671,89 +1678,6 @@ } } }, - "Institution" : { - "type" : "object", - "properties" : { - "id" : { - "type" : "string" - }, - "institutionType" : { - "$ref" : "#/components/schemas/InstitutionType" - }, - "taxCode" : { - "type" : "string" - }, - "subunitCode" : { - "type" : "string" - }, - "subunitType" : { - "$ref" : "#/components/schemas/InstitutionPaSubunitType" - }, - "origin" : { - "$ref" : "#/components/schemas/Origin" - }, - "originId" : { - "type" : "string" - }, - "city" : { - "type" : "string" - }, - "country" : { - "type" : "string" - }, - "county" : { - "type" : "string" - }, - "istatCode" : { - "type" : "string" - }, - "description" : { - "type" : "string" - }, - "digitalAddress" : { - "type" : "string" - }, - "address" : { - "type" : "string" - }, - "zipCode" : { - "type" : "string" - }, - "geographicTaxonomies" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/GeographicTaxonomy" - } - }, - "rea" : { - "type" : "string" - }, - "shareCapital" : { - "type" : "string" - }, - "businessRegisterPlace" : { - "type" : "string" - }, - "supportEmail" : { - "type" : "string" - }, - "supportPhone" : { - "type" : "string" - }, - "imported" : { - "type" : "boolean" - }, - "paymentServiceProvider" : { - "$ref" : "#/components/schemas/PaymentServiceProvider" - }, - "dataProtectionOfficer" : { - "$ref" : "#/components/schemas/DataProtectionOfficer" - }, - "parentDescription" : { - "type" : "string" - } - } - }, "InstitutionBaseRequest" : { "required" : [ "institutionType", "digitalAddress" ], "type" : "object", @@ -2445,26 +2369,6 @@ "enum" : [ "MANAGER", "DELEGATE", "SUB_DELEGATE", "OPERATOR", "ADMIN_EA" ], "type" : "string" }, - "PaymentServiceProvider" : { - "type" : "object", - "properties" : { - "abiCode" : { - "type" : "string" - }, - "businessRegisterNumber" : { - "type" : "string" - }, - "legalRegisterNumber" : { - "type" : "string" - }, - "legalRegisterName" : { - "type" : "string" - }, - "vatNumberGroup" : { - "type" : "boolean" - } - } - }, "PaymentServiceProviderRequest" : { "type" : "object", "properties" : { @@ -2618,47 +2522,13 @@ } } }, - "VerifyAggregateAppIoResponse" : { - "type" : "object", - "properties" : { - "aggregates" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/AggregateAppIo" - } - }, - "errors" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/RowError" - } - } - } - }, "VerifyAggregateResponse" : { "type" : "object", "properties" : { "aggregates" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Institution" - } - }, - "errors" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/RowError" - } - } - } - }, - "VerifyAggregateSendResponse" : { - "type" : "object", - "properties" : { - "aggregates" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/AggregateSend" + "$ref" : "#/components/schemas/Aggregate" } }, "errors" : { diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImpl.java b/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImpl.java index a480d000..9ea78bc0 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImpl.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImpl.java @@ -70,13 +70,13 @@ public VerifyAggregateResult aggregatesVerification(MultipartFile file, String p log.info("validateAggregatesCsv for product: {}", productId); switch (productId) { case PROD_IO -> { - return onboardingMapper.toVerifyAggregateAppIoResult(msOnboardingAggregatesApiClient._verifyAppIoAggregatesCsv(file).getBody()); + return onboardingMapper.toVerifyAggregateResult(msOnboardingAggregatesApiClient._verifyAppIoAggregatesCsv(file).getBody()); } case PROD_PAGOPA -> { - return onboardingMapper.toVerifyAggregatePagoPaResult(msOnboardingAggregatesApiClient._verifyPagoPaAggregatesCsv(file).getBody()); + return onboardingMapper.toVerifyAggregateResult(msOnboardingAggregatesApiClient._verifyPagoPaAggregatesCsv(file).getBody()); } case PROD_PN -> { - return onboardingMapper.toVerifyAggregateSendResponse(msOnboardingAggregatesApiClient._verifySendAggregatesCsv(file).getBody()); + return onboardingMapper.toVerifyAggregateResult(msOnboardingAggregatesApiClient._verifySendAggregatesCsv(file).getBody()); } default -> { log.error("Unsupported productId: {}", productId); diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/rest/mapper/OnboardingMapper.java b/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/rest/mapper/OnboardingMapper.java index be04f675..c4191512 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/rest/mapper/OnboardingMapper.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/rest/mapper/OnboardingMapper.java @@ -133,11 +133,7 @@ default String setOrigin(Origin origin) { @Mapping(target = "institution", source = ".", qualifiedByName = "toInstitutionBase") OnboardingPaRequest toOnboardingPaAggregationRequest(OnboardingData onboardingData); - VerifyAggregateResult toVerifyAggregateAppIoResult(VerifyAggregateAppIoResponse body); - - VerifyAggregateResult toVerifyAggregatePagoPaResult(VerifyAggregateResponse body); - - VerifyAggregateResult toVerifyAggregateSendResponse(VerifyAggregateSendResponse body); + VerifyAggregateResult toVerifyAggregateResult(VerifyAggregateResponse body); RecipientCodeStatusResult toRecipientCodeStatusResult(RecipientCodeStatus recipientCodeStatus); } diff --git a/connector/rest/src/test/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImplTest.java b/connector/rest/src/test/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImplTest.java index b6f4a6a0..dd7e454b 100644 --- a/connector/rest/src/test/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImplTest.java +++ b/connector/rest/src/test/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImplTest.java @@ -136,11 +136,11 @@ void onboarding_institutionPsp() { void aggregatesVerification_withProdIO_shouldReturnValidResult() { // given MockMultipartFile file = new MockMultipartFile("file", "content".getBytes()); - VerifyAggregateAppIoResponse verifyAggregateAppIoResponse = new VerifyAggregateAppIoResponse(); + VerifyAggregateResponse verifyAggregateAppIoResponse = new VerifyAggregateResponse(); VerifyAggregateResult expectedResult = new VerifyAggregateResult(); when(msOnboardingAggregatesApiClient._verifyAppIoAggregatesCsv(file)) .thenReturn(ResponseEntity.ok(verifyAggregateAppIoResponse)); - when(onboardingMapper.toVerifyAggregateAppIoResult(eq(verifyAggregateAppIoResponse))).thenReturn(expectedResult); + when(onboardingMapper.toVerifyAggregateResult(eq(verifyAggregateAppIoResponse))).thenReturn(expectedResult); // when VerifyAggregateResult result = onboardingMsConnector.aggregatesVerification(file, "prod-io"); @@ -148,7 +148,7 @@ void aggregatesVerification_withProdIO_shouldReturnValidResult() { // then assertEquals(expectedResult, result); verify(msOnboardingAggregatesApiClient, times(1))._verifyAppIoAggregatesCsv(file); - verify(onboardingMapper, times(1)).toVerifyAggregateAppIoResult(eq(verifyAggregateAppIoResponse)); + verify(onboardingMapper, times(1)).toVerifyAggregateResult(eq(verifyAggregateAppIoResponse)); } @Test @@ -159,7 +159,7 @@ void aggregatesVerification_withProdPagoPa_shouldReturnValidResult() { VerifyAggregateResponse verifyAggregateResponse = new VerifyAggregateResponse(); when(msOnboardingAggregatesApiClient._verifyPagoPaAggregatesCsv(file)) .thenReturn(ResponseEntity.ok(new VerifyAggregateResponse())); - when(onboardingMapper.toVerifyAggregatePagoPaResult(eq(verifyAggregateResponse))).thenReturn(expectedResult); + when(onboardingMapper.toVerifyAggregateResult(eq(verifyAggregateResponse))).thenReturn(expectedResult); // when VerifyAggregateResult result = onboardingMsConnector.aggregatesVerification(file, "prod-pagopa"); @@ -167,7 +167,7 @@ void aggregatesVerification_withProdPagoPa_shouldReturnValidResult() { // then assertEquals(expectedResult, result); verify(msOnboardingAggregatesApiClient, times(1))._verifyPagoPaAggregatesCsv(file); - verify(onboardingMapper, times(1)).toVerifyAggregatePagoPaResult(eq(verifyAggregateResponse)); + verify(onboardingMapper, times(1)).toVerifyAggregateResult(eq(verifyAggregateResponse)); } @Test @@ -176,8 +176,8 @@ void aggregatesVerification_withProdPN_shouldReturnValidResult() { MockMultipartFile file = new MockMultipartFile("file", "content".getBytes()); VerifyAggregateResult expectedResult = new VerifyAggregateResult(); when(msOnboardingAggregatesApiClient._verifySendAggregatesCsv(file)) - .thenReturn(ResponseEntity.ok(new VerifyAggregateSendResponse())); - when(onboardingMapper.toVerifyAggregateSendResponse(any())).thenReturn(expectedResult); + .thenReturn(ResponseEntity.ok(new VerifyAggregateResponse())); + when(onboardingMapper.toVerifyAggregateResult(any())).thenReturn(expectedResult); // when VerifyAggregateResult result = onboardingMsConnector.aggregatesVerification(file, "prod-pn"); @@ -185,7 +185,7 @@ void aggregatesVerification_withProdPN_shouldReturnValidResult() { // then assertEquals(expectedResult, result); verify(msOnboardingAggregatesApiClient, times(1))._verifySendAggregatesCsv(file); - verify(onboardingMapper, times(1)).toVerifyAggregateSendResponse(any()); + verify(onboardingMapper, times(1)).toVerifyAggregateResult(any()); } @Test diff --git a/core/src/test/java/it/pagopa/selfcare/onboarding/core/InstitutionServiceImplTest.java b/core/src/test/java/it/pagopa/selfcare/onboarding/core/InstitutionServiceImplTest.java index 930b4999..ddab7593 100644 --- a/core/src/test/java/it/pagopa/selfcare/onboarding/core/InstitutionServiceImplTest.java +++ b/core/src/test/java/it/pagopa/selfcare/onboarding/core/InstitutionServiceImplTest.java @@ -1803,7 +1803,7 @@ void getInstitutionOnboardingData() { void validateAggregatesCsvReturnsValidResultWhenNoErrorsAndProductIdIsPROD_IO() { MultipartFile file = new MockMultipartFile("file", "hello.txt", MediaType.TEXT_PLAIN_VALUE, "Hello, World!".getBytes()); VerifyAggregateResult expected = new VerifyAggregateResult(); - expected.setAggregates(Arrays.asList(new Institution(), new Institution())); + expected.setAggregates(Arrays.asList(new AggregateResult(), new AggregateResult())); expected.setErrors(Collections.emptyList()); when(onboardingMsConnector.aggregatesVerification(any(MultipartFile.class), eq("prod-io"))).thenReturn(expected); @@ -1820,7 +1820,7 @@ void validateAggregatesCsvReturnsValidResultWhenNoErrorsAndProductIdIsPROD_IO() void validateAggregatesCsvReturnsValidResultWhenNoErrorsAndProductIdIsPROD_PAGOPA() { MultipartFile file = new MockMultipartFile("file", "hello.txt", MediaType.TEXT_PLAIN_VALUE, "Hello, World!".getBytes()); VerifyAggregateResult expected = new VerifyAggregateResult(); - expected.setAggregates(Arrays.asList(new Institution(), new Institution())); + expected.setAggregates(Arrays.asList(new AggregateResult(), new AggregateResult())); expected.setErrors(Collections.emptyList()); when(onboardingMsConnector.aggregatesVerification(any(MultipartFile.class), eq("prod-pagopa"))).thenReturn(expected); @@ -1837,7 +1837,7 @@ void validateAggregatesCsvReturnsValidResultWhenNoErrorsAndProductIdIsPROD_PAGOP void validateAggregatesCsvReturnsValidResultWhenNoErrorsAndProductIdIsPROD_PN() { MultipartFile file = new MockMultipartFile("file", "hello.txt", MediaType.TEXT_PLAIN_VALUE, "Hello, World!".getBytes()); VerifyAggregateResult expected = new VerifyAggregateResult(); - expected.setAggregates(Arrays.asList(new Institution(), new Institution())); + expected.setAggregates(Arrays.asList(new AggregateResult(), new AggregateResult())); expected.setErrors(Collections.emptyList()); when(onboardingMsConnector.aggregatesVerification(any(MultipartFile.class), eq("prod-pn"))).thenReturn(expected); @@ -1854,7 +1854,7 @@ void validateAggregatesCsvReturnsValidResultWhenNoErrorsAndProductIdIsPROD_PN() void validateAggregatesCsvReturnsValidResultWhenNoErrorsAndProductIdIsDifferentCase() { MultipartFile file = new MockMultipartFile("file", "hello.txt", MediaType.TEXT_PLAIN_VALUE, "Hello, World!".getBytes()); VerifyAggregateResult expected = new VerifyAggregateResult(); - expected.setAggregates(Arrays.asList(new Institution(), new Institution())); + expected.setAggregates(Arrays.asList(new AggregateResult(), new AggregateResult())); expected.setErrors(Collections.emptyList()); when(onboardingMsConnector.aggregatesVerification(any(MultipartFile.class), eq("prod-fd"))).thenReturn(expected); diff --git a/web/src/main/java/it/pagopa/selfcare/onboarding/web/model/AggregateInstitution.java b/web/src/main/java/it/pagopa/selfcare/onboarding/web/model/AggregateInstitution.java index 98f1cd42..55a1e4f1 100644 --- a/web/src/main/java/it/pagopa/selfcare/onboarding/web/model/AggregateInstitution.java +++ b/web/src/main/java/it/pagopa/selfcare/onboarding/web/model/AggregateInstitution.java @@ -24,4 +24,16 @@ public class AggregateInstitution { private Origin origin; private List users; + private String taxCodePT; + private String iban; + private String service; + private String syncAsyncMode; + private String codeSDI; + private String vatNumber; + private String digitalAddress; + private String city; + private String county; + + + } diff --git a/web/src/main/java/it/pagopa/selfcare/onboarding/web/model/VerifyAggregatesResponse.java b/web/src/main/java/it/pagopa/selfcare/onboarding/web/model/VerifyAggregatesResponse.java index 327ea3fa..db3b9016 100644 --- a/web/src/main/java/it/pagopa/selfcare/onboarding/web/model/VerifyAggregatesResponse.java +++ b/web/src/main/java/it/pagopa/selfcare/onboarding/web/model/VerifyAggregatesResponse.java @@ -1,12 +1,12 @@ package it.pagopa.selfcare.onboarding.web.model; -import it.pagopa.selfcare.onboarding.connector.model.institutions.Institution; +import it.pagopa.selfcare.onboarding.connector.model.institutions.AggregateResult; import lombok.Data; import java.util.List; @Data public class VerifyAggregatesResponse { - private List aggregates ; + private List aggregates ; private List errors; }