Skip to content

Commit

Permalink
[SELC-5075] Feat: Added isAggregator and aggregates fields in Onboard…
Browse files Browse the repository at this point in the history
…ingProductDto (#316)
  • Loading branch information
flaminiaScarciofolo authored Jun 20, 2024
1 parent 6855391 commit 0c68553
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 0 deletions.
62 changes: 62 additions & 0 deletions app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2210,6 +2210,44 @@
}
}
},
"AggregateInstitution" : {
"title" : "AggregateInstitution",
"required" : [ "description", "taxCode" ],
"type" : "object",
"properties" : {
"address" : {
"type" : "string"
},
"description" : {
"type" : "string"
},
"geographicTaxonomies" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/GeographicTaxonomy"
}
},
"origin" : {
"type" : "string",
"enum" : [ "ADE", "ANAC", "INFOCAMERE", "IPA", "IVASS", "MOCK", "SELC", "UNKNOWN" ]
},
"originId" : {
"type" : "string"
},
"subunitCode" : {
"type" : "string"
},
"subunitType" : {
"type" : "string"
},
"taxCode" : {
"type" : "string"
},
"zipCode" : {
"type" : "string"
}
}
},
"AssistanceContactsDto" : {
"title" : "AssistanceContactsDto",
"type" : "object",
Expand Down Expand Up @@ -2512,6 +2550,18 @@
}
}
},
"GeographicTaxonomy" : {
"title" : "GeographicTaxonomy",
"type" : "object",
"properties" : {
"code" : {
"type" : "string"
},
"desc" : {
"type" : "string"
}
}
},
"GeographicTaxonomyDto" : {
"title" : "GeographicTaxonomyDto",
"required" : [ "code", "desc" ],
Expand Down Expand Up @@ -2825,6 +2875,13 @@
"description" : "GSP institution's additional informations",
"$ref" : "#/components/schemas/AdditionalInformationsDto"
},
"aggregates" : {
"type" : "array",
"description" : "List of Aggregate Institutions, not empty only if isAggregator field's value is True",
"items" : {
"$ref" : "#/components/schemas/AggregateInstitution"
}
},
"assistanceContacts" : {
"description" : "Institution's assistance contacts",
"$ref" : "#/components/schemas/AssistanceContactsDto"
Expand Down Expand Up @@ -2853,6 +2910,11 @@
"description" : "Institution's type",
"enum" : [ "AS", "CON", "GSP", "PA", "PG", "PSP", "PT", "REC", "SA", "SCP" ]
},
"isAggregator" : {
"type" : "boolean",
"description" : "specified if given institution is an Aggregator",
"example" : false
},
"origin" : {
"type" : "string",
"description" : "Institution data origin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package it.pagopa.selfcare.onboarding.web.model;

import it.pagopa.selfcare.onboarding.common.Origin;
import it.pagopa.selfcare.onboarding.connector.model.onboarding.GeographicTaxonomy;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.List;

@Data
public class AggregateInstitution {

@NotNull(message = "taxCode is required")
private String taxCode;

@NotNull(message = "description is required")
private String description;

private String subunitCode;
private String subunitType;
private List<GeographicTaxonomy> geographicTaxonomies;
private String address;
private String zipCode;
private String originId;
private Origin origin;

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ public class OnboardingProductDto {

@ApiModelProperty(value = "${swagger.onboarding.institutions.model.additionalInformations}")
private AdditionalInformationsDto additionalInformations;

@ApiModelProperty(value = "${swagger.onboarding.institutions.model.isAggregator}")
private Boolean isAggregator;

@ApiModelProperty(value = "${swagger.onboarding.institutions.model.aggregates}")
private List<AggregateInstitution> aggregates;
}
3 changes: 3 additions & 0 deletions web/src/main/resources/swagger/swagger_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,7 @@ swagger.onboarding.institutions.model.additionalInformations.agentOfPublicServic
swagger.onboarding.institutions.model.additionalInformations.agentOfPublicServiceNote=agentOfPublicService Note
swagger.onboarding.institutions.model.additionalInformations.otherNote=Other note
swagger.onboarding.institutions.model.aggregates=List of Aggregate Institutions, not empty only if isAggregator field's value is True
swagger.onboarding.institutions.model.isAggregator=specified if given institution is an Aggregator


Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,25 @@ void onboardingProductAsync(@Value("classpath:stubs/onboardingProductsDtoWithout
verifyNoMoreInteractions(institutionServiceMock);
}

@Test
void onboardingProductForAggregatorAsync(@Value("classpath:stubs/onboardingProductsDtoWithAggregates.json") Resource onboardingDto) throws Exception {
// given
String institutionId = "institutionId";
String productId = "productId";
// when
mvc.perform(MockMvcRequestBuilders
.post(BASE_URL + "/onboarding", institutionId, productId)
.content(onboardingDto.getInputStream().readAllBytes())
.contentType(APPLICATION_JSON_VALUE)
.accept(APPLICATION_JSON_VALUE))
.andExpect(status().isCreated())
.andExpect(content().string(emptyString()));
// then
verify(institutionServiceMock, times(1))
.onboardingProductV2(any(OnboardingData.class));
verifyNoMoreInteractions(institutionServiceMock);
}


@Test
void onboardingCompany(@Value("classpath:stubs/onboardingCompanyDto.json") Resource onboardingDto) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"billingData": {
"businessName": "string",
"digitalAddress": "string",
"publicServices": false,
"recipientCode": "string",
"registeredOffice": "string",
"taxCode": "string",
"vatNumber": "string",
"zipCode": "string"
},
"institutionType": "PA",
"origin": "string",
"pricingPlan": "string",
"taxCode": "string",
"subunitCode": "string",
"subunitType": "AOO",
"productId": "prod-io",
"users": [
{
"email": "email@example.com",
"name": "string",
"role": "DELEGATE",
"surname": "string",
"taxCode": "string"
}
],
"isAggregate": true,
"aggregates": [
{
"taxCode": "taxCode",
"subunitCode": "152652",
"subunitType": "AOO",
"description": "description"
}
]
}

0 comments on commit 0c68553

Please sign in to comment.