From 37e1c756e77f9e7bb7c3139fa6feef3f6617a0ac Mon Sep 17 00:00:00 2001 From: gioelemella <128155546+gioelemella@users.noreply.github.com> Date: Mon, 8 Apr 2024 11:08:12 +0200 Subject: [PATCH] [PAGOPA-691] chore: Add station enabled field (#292) * [PAGOPA-691] added station enabled field to getCreditorInstitutionView API * [PAGOPA-691] updated openapi --------- Co-authored-by: giomella --- openapi/openapi.json | 5 ++- ...PaStazionePaToCreditorInstitutionView.java | 34 ++++++++++--------- .../CreditorInstitutionView.java | 3 ++ ...get_creditorinstitutionserviceview_ok.json | 3 +- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/openapi/openapi.json b/openapi/openapi.json index c41c9f76..64fb189d 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -19389,6 +19389,9 @@ }, "mod4": { "type": "boolean" + }, + "station_enabled": { + "type": "boolean" } } }, @@ -19797,4 +19800,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertPaStazionePaToCreditorInstitutionView.java b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertPaStazionePaToCreditorInstitutionView.java index 14890440..48f7e08b 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertPaStazionePaToCreditorInstitutionView.java +++ b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertPaStazionePaToCreditorInstitutionView.java @@ -2,25 +2,27 @@ import it.gov.pagopa.apiconfig.core.model.creditorinstitution.CreditorInstitutionView; import it.gov.pagopa.apiconfig.starter.entity.PaStazionePa; -import javax.validation.Valid; import org.modelmapper.Converter; import org.modelmapper.spi.MappingContext; +import javax.validation.Valid; + public class ConvertPaStazionePaToCreditorInstitutionView - implements Converter { + implements Converter { - @Override - public CreditorInstitutionView convert( - MappingContext context) { - @Valid PaStazionePa source = context.getSource(); - return CreditorInstitutionView.builder() - .idDominio(source.getPa().getIdDominio()) - .idIntermediarioPa(source.getFkStazione().getIntermediarioPa().getIdIntermediarioPa()) - .idStazione(source.getFkStazione().getIdStazione()) - .auxDigit(source.getAuxDigit()) - .progressivo(source.getProgressivo()) - .segregazione(source.getSegregazione()) - .quartoModello(source.getQuartoModello()) - .build(); - } + @Override + public CreditorInstitutionView convert( + MappingContext context) { + @Valid PaStazionePa source = context.getSource(); + return CreditorInstitutionView.builder() + .idDominio(source.getPa().getIdDominio()) + .idIntermediarioPa(source.getFkStazione().getIntermediarioPa().getIdIntermediarioPa()) + .idStazione(source.getFkStazione().getIdStazione()) + .auxDigit(source.getAuxDigit()) + .progressivo(source.getProgressivo()) + .segregazione(source.getSegregazione()) + .quartoModello(source.getQuartoModello()) + .stationEnabled(source.getFkStazione().getEnabled()) + .build(); + } } diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/CreditorInstitutionView.java b/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/CreditorInstitutionView.java index e8d451dd..1ef1d904 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/CreditorInstitutionView.java +++ b/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/CreditorInstitutionView.java @@ -52,4 +52,7 @@ public class CreditorInstitutionView { @JsonProperty("mod4") private Boolean quartoModello; + + @JsonProperty("station_enabled") + private Boolean stationEnabled; } diff --git a/src/test/resources/response/get_creditorinstitutionserviceview_ok.json b/src/test/resources/response/get_creditorinstitutionserviceview_ok.json index 656056c4..815a225a 100644 --- a/src/test/resources/response/get_creditorinstitutionserviceview_ok.json +++ b/src/test/resources/response/get_creditorinstitutionserviceview_ok.json @@ -7,7 +7,8 @@ "aux_digit": 1, "application_code": 2, "segregation_code": 3, - "mod4": true + "mod4": true, + "station_enabled": true } ], "page_info": {