Skip to content

Commit

Permalink
[SELC-5413] feat: add logo field in InstitutionResponse (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
giulia-tremolada authored Aug 26, 2024
1 parent a09acb0 commit dc871a8
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 7 deletions.
3 changes: 3 additions & 0 deletions apps/institution-ms/app/src/main/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,9 @@
"istatCode" : {
"type" : "string"
},
"logo" : {
"type" : "string"
},
"onboarding" : {
"type" : "array",
"items" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mscore.port=8080

mscore.logoPath = ${PAGOPA_LOGO_URL:resources/logo.png}
mscore.logoUrl = ${LOGO_URL}
mscore.infoCamereEnable = ${INFOCAMERE_ENABLE:false}
mscore.sender-mail = ${MAIL_SENDER_ADDRESS:[email protected]}
mscore.destination-mails = ${DESTINATION_MAILS:}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
public class CoreConfig {

private String logoPath;
private String logoUrl;
private String senderMail;
private List<String> destinationMails;
private String institutionAlternativeEmail;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ public interface InstitutionService {

List<Institution> getInstitutionBrokers(String productId, InstitutionType type);

String getLogo(String institutionId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,9 @@ public void checkIfAlreadyExists(String externalId) {
public List<Institution> getInstitutionBrokers(String productId, InstitutionType type) {
return institutionConnector.findBrokers(productId, type);
}

@Override
public String getLogo(String institutionId) {
return coreConfig.getLogoUrl().concat(institutionId).concat("/logo.png");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1098,5 +1098,15 @@ void getInstitutionsByTaxCode() {

}

@Test
void getLogoTest() {
String institutionId = "institutionId";
String expectedUrl = "https://test.it/institutions/institutionId/logo.png";
String baseUrl = "https://test.it/institutions/";
when(coreConfig.getLogoUrl()).thenReturn(baseUrl);
String actual = institutionServiceImpl.getLogo(institutionId);
assertEquals(expectedUrl, actual);
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ public ResponseEntity<InstitutionResponse> retrieveInstitutionById(@ApiParam("${
@PathVariable("id") String id) {
CustomExceptionMessage.setCustomMessage(GenericError.GET_INSTITUTION_BY_ID_ERROR);
Institution institution = institutionService.retrieveInstitutionById(id);
return ResponseEntity.ok().body(institutionResourceMapper.toInstitutionResponse(institution));
InstitutionResponse institutionResponse = institutionResourceMapper.toInstitutionResponse(institution);
institutionResponse.setLogo(institutionService.getLogo(id));
return ResponseEntity.ok().body(institutionResponse);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ public class InstitutionResponse {
private OffsetDateTime createdAt;
private OffsetDateTime updatedAt;
private boolean delegation;
private String logo;

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package it.pagopa.selfcare.mscore.web.model.mapper;


import it.pagopa.selfcare.mscore.model.institution.Billing;
import it.pagopa.selfcare.mscore.model.institution.Institution;
import it.pagopa.selfcare.mscore.model.institution.InstitutionGeographicTaxonomies;
import it.pagopa.selfcare.mscore.web.model.institution.BillingRequest;
import it.pagopa.selfcare.mscore.web.model.institution.GeoTaxonomies;
import it.pagopa.selfcare.mscore.web.model.institution.InstitutionResponse;
import it.pagopa.selfcare.mscore.web.model.institution.RootParentResponse;
Expand All @@ -31,10 +29,6 @@ static RootParentResponse setRootParent(Institution institution) {
return null;
}


Billing billingRequestToBilling(BillingRequest billingRequest);

InstitutionGeographicTaxonomies toInstitutionGeographicTaxonomies(GeoTaxonomies geoTaxonomies);


}
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ void retrieveInstitutionById() throws Exception {
SecurityContext securityContext = Mockito.mock(SecurityContext.class);
SecurityContextHolder.setContext(securityContext);
when(institutionService.retrieveInstitutionById("42")).thenReturn(staticInstitution);
when(institutionService.getLogo("42")).thenReturn("logoUrl");
staticInstitution.setId("id");
MockHttpServletRequestBuilder requestBuilder = get("/institutions/{id}", "42");
ResultActions actualPerformResult = MockMvcBuilders.standaloneSetup(institutionController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ app_settings = [
name = "SELFCARE_URL"
value = "https://selfcare.pagopa.it"
},
{
name = "LOGO_URL"
value = "https://pnpg.dev.selfcare.pagopa.it/institutions/"
},
{
name = "MAIL_TEMPLATE_DELEGATION_NOTIFICATION_PATH"
value = "contracts/template/mail/delegation-notification/1.0.0.json"
Expand Down
4 changes: 4 additions & 0 deletions infra/container_apps/institution-ms/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ app_settings = [
name = "SELFCARE_URL"
value = "https://selfcare.pagopa.it"
},
{
name = "LOGO_URL"
value = "https://dev.selfcare.pagopa.it/institutions/"
},
{
name = "MAIL_TEMPLATE_DELEGATION_NOTIFICATION_PATH"
value = "contracts/template/mail/delegation-notification/1.0.0.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ app_settings = [
name = "SELFCARE_URL"
value = "https://selfcare.pagopa.it"
},
{
name = "LOGO_URL"
value = "https://pnpg.selfcare.pagopa.it/institutions/"
},
{
name = "MAIL_TEMPLATE_DELEGATION_NOTIFICATION_PATH"
value = "contracts/template/mail/delegation-notification/1.0.0.json"
Expand Down
4 changes: 4 additions & 0 deletions infra/container_apps/institution-ms/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ app_settings = [
name = "SELFCARE_URL"
value = "https://selfcare.pagopa.it"
},
{
name = "LOGO_URL"
value = "https://selfcare.pagopa.it/institutions/"
},
{
name = "MAIL_TEMPLATE_DELEGATION_NOTIFICATION_PATH"
value = "contracts/template/mail/delegation-notification/1.0.0.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ app_settings = [
name = "SELFCARE_URL"
value = "https://selfcare.pagopa.it"
},
{
name = "LOGO_URL"
value = "https://pnpg.uat.selfcare.pagopa.it/institutions/"
},
{
name = "MAIL_TEMPLATE_DELEGATION_NOTIFICATION_PATH"
value = "contracts/template/mail/delegation-notification/1.0.0.json"
Expand Down
4 changes: 4 additions & 0 deletions infra/container_apps/institution-ms/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ app_settings = [
name = "SELFCARE_URL"
value = "https://selfcare.pagopa.it"
},
{
name = "LOGO_URL"
value = "https://uat.selfcare.pagopa.it/institutions/"
},
{
name = "MAIL_TEMPLATE_DELEGATION_NOTIFICATION_PATH"
value = "contracts/template/mail/delegation-notification/1.0.0.json"
Expand Down

0 comments on commit dc871a8

Please sign in to comment.