From 279cf0f0ddc498dc7ac9986fc72092b0d4eca632 Mon Sep 17 00:00:00 2001 From: giomella Date: Tue, 10 Sep 2024 14:15:15 +0200 Subject: [PATCH 1/3] [PPANTT-118] updated station models with new OdP fields. Updated openapi and unit tests --- openapi/openapi.json | 8 +- .../ConvertStationDetailsToStazioni.java | 99 ++++---- .../ConvertStazioniToStationDetails.java | 2 + .../creditorinstitution/StationDetails.java | 230 +++++++++--------- .../PaStazionePaRepositoryTest.java | 1 + 5 files changed, 181 insertions(+), 159 deletions(-) diff --git a/openapi/openapi.json b/openapi/openapi.json index 634405455..4bd4e3c1a 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -18716,6 +18716,12 @@ "type": "integer", "description": "Primitive number version", "format": "int32" + }, + "verify_payment_option_enabled": { + "type": "boolean" + }, + "verify_payment_option_endpoint": { + "type": "string" } } }, @@ -20956,4 +20962,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStationDetailsToStazioni.java b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStationDetailsToStazioni.java index 2ae5e375e..97531e044 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStationDetailsToStazioni.java +++ b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStationDetailsToStazioni.java @@ -4,58 +4,61 @@ import it.gov.pagopa.apiconfig.core.model.creditorinstitution.StationDetails; import it.gov.pagopa.apiconfig.starter.entity.IntermediariPa; import it.gov.pagopa.apiconfig.starter.entity.Stazioni; -import javax.validation.Valid; import org.modelmapper.Converter; import org.modelmapper.spi.MappingContext; +import javax.validation.Valid; + public class ConvertStationDetailsToStazioni implements Converter { - @Override - public Stazioni convert(MappingContext context) { - @Valid StationDetails source = context.getSource(); - return Stazioni.builder() - .idStazione(source.getStationCode()) - .enabled(source.getEnabled()) - .versione(source.getVersion()) - .password(source.getPassword()) - .protocollo(getProtocol(source.getProtocol())) - .ip(source.getIp()) - .porta(source.getPort()) - .servizio(source.getService()) - .servizioPof(source.getPofService()) - .intermediarioPa(IntermediariPa.builder().objId(source.getBrokerObjId()).build()) - .protocollo4Mod(getProtocol(source.getProtocol4Mod())) - .ip4Mod(source.getIp4Mod()) - .porta4Mod(source.getPort4Mod()) - .servizio4Mod(source.getService4Mod()) - .redirectProtocollo(getProtocol(source.getRedirectProtocol())) - .redirectIp(source.getRedirectIp()) - .redirectPorta(source.getRedirectPort()) - .redirectPath(source.getRedirectPath()) - .redirectQueryString(source.getRedirectQueryString()) - .proxyEnabled(source.getProxyEnabled()) - .proxyHost(source.getProxyHost()) - .proxyPort(source.getProxyPort()) - .proxyUsername(source.getProxyUsername()) - .proxyPassword(source.getProxyPassword()) - .targetHost(source.getTargetHost()) - .targetPort(source.getTargetPort()) - .targetPath(source.getTargetPath()) - .targetHostPof(source.getTargetHostPof()) - .targetPortPof(source.getTargetPortPof()) - .targetPathPof(source.getTargetPathPof()) - .flagOnline(source.getFlagOnline()) - .numThread(source.getThreadNumber()) - .timeoutA(source.getTimeoutA()) - .timeoutB(source.getTimeoutB()) - .timeoutC(source.getTimeoutC()) - .rtEnabled(true) - .invioRtIstantaneo(source.getRtInstantaneousDispatch()) - .versionePrimitive(source.getPrimitiveVersion()) - .build(); - } + @Override + public Stazioni convert(MappingContext context) { + @Valid StationDetails source = context.getSource(); + return Stazioni.builder() + .idStazione(source.getStationCode()) + .enabled(source.getEnabled()) + .versione(source.getVersion()) + .password(source.getPassword()) + .protocollo(getProtocol(source.getProtocol())) + .ip(source.getIp()) + .porta(source.getPort()) + .servizio(source.getService()) + .servizioPof(source.getPofService()) + .intermediarioPa(IntermediariPa.builder().objId(source.getBrokerObjId()).build()) + .protocollo4Mod(getProtocol(source.getProtocol4Mod())) + .ip4Mod(source.getIp4Mod()) + .porta4Mod(source.getPort4Mod()) + .servizio4Mod(source.getService4Mod()) + .redirectProtocollo(getProtocol(source.getRedirectProtocol())) + .redirectIp(source.getRedirectIp()) + .redirectPorta(source.getRedirectPort()) + .redirectPath(source.getRedirectPath()) + .redirectQueryString(source.getRedirectQueryString()) + .proxyEnabled(source.getProxyEnabled()) + .proxyHost(source.getProxyHost()) + .proxyPort(source.getProxyPort()) + .proxyUsername(source.getProxyUsername()) + .proxyPassword(source.getProxyPassword()) + .targetHost(source.getTargetHost()) + .targetPort(source.getTargetPort()) + .targetPath(source.getTargetPath()) + .targetHostPof(source.getTargetHostPof()) + .targetPortPof(source.getTargetPortPof()) + .targetPathPof(source.getTargetPathPof()) + .flagOnline(source.getFlagOnline()) + .numThread(source.getThreadNumber()) + .timeoutA(source.getTimeoutA()) + .timeoutB(source.getTimeoutB()) + .timeoutC(source.getTimeoutC()) + .rtEnabled(true) + .invioRtIstantaneo(source.getRtInstantaneousDispatch()) + .versionePrimitive(source.getPrimitiveVersion()) + .verifyPaymentOptionEnabled(source.getVerifyPaymentOptionEnabled()) + .verifyPaymentOptionEndpoint(source.getVerifyPaymentOptionEndpoint()) + .build(); + } - private String getProtocol(Protocol source) { - return source != null ? source.name() : null; - } + private String getProtocol(Protocol source) { + return source != null ? source.name() : null; + } } diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStazioniToStationDetails.java b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStazioniToStationDetails.java index 65161aaf9..549b43c06 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStazioniToStationDetails.java +++ b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStazioniToStationDetails.java @@ -61,6 +61,8 @@ public StationDetails convert(MappingContext context) .rtInstantaneousDispatch(source.getInvioRtIstantaneo()) .primitiveVersion(source.getVersionePrimitive()) .isConnectionSync(isConnectionSync(source)) + .verifyPaymentOptionEnabled(source.getVerifyPaymentOptionEnabled()) + .verifyPaymentOptionEndpoint(source.getVerifyPaymentOptionEndpoint()) .build(); } } diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/StationDetails.java b/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/StationDetails.java index b19133071..7f520b246 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/StationDetails.java +++ b/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/StationDetails.java @@ -4,10 +4,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -16,7 +12,14 @@ import lombok.ToString; import lombok.experimental.SuperBuilder; -/** StationDetails */ +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * StationDetails + */ @EqualsAndHashCode(callSuper = true) @Data @SuperBuilder(toBuilder = true) @@ -26,141 +29,148 @@ @JsonIgnoreProperties(ignoreUnknown = true) public class StationDetails extends Station { - @JsonProperty("ip") - private String ip; - - @ToString.Exclude - @JsonProperty("password") - private String password; - - @Min(1) - @Max(65535) - @JsonProperty("port") - @Schema(required = true) - @NotNull - private Long port; + @JsonProperty("ip") + private String ip; + + @ToString.Exclude + @JsonProperty("password") + private String password; + + @Min(1) + @Max(65535) + @JsonProperty("port") + @Schema(required = true) + @NotNull + private Long port; + + @JsonProperty("protocol") + @Schema(required = true) + @NotNull + private Protocol protocol; + + @JsonProperty("redirect_ip") + private String redirectIp; - @JsonProperty("protocol") - @Schema(required = true) - @NotNull - private Protocol protocol; + @JsonProperty("redirect_path") + private String redirectPath; - @JsonProperty("redirect_ip") - private String redirectIp; + @Min(1) + @Max(65535) + @JsonProperty("redirect_port") + private Long redirectPort; - @JsonProperty("redirect_path") - private String redirectPath; + @JsonProperty("redirect_query_string") + private String redirectQueryString; - @Min(1) - @Max(65535) - @JsonProperty("redirect_port") - private Long redirectPort; + @JsonProperty("redirect_protocol") + private Protocol redirectProtocol; - @JsonProperty("redirect_query_string") - private String redirectQueryString; + @JsonProperty("service") + private String service; - @JsonProperty("redirect_protocol") - private Protocol redirectProtocol; + @JsonProperty("pof_service") + private String pofService; - @JsonProperty("service") - private String service; + @JsonProperty("broker_code") + @Schema(required = true) + @NotBlank + private String brokerCode; - @JsonProperty("pof_service") - private String pofService; + @JsonProperty("protocol_4mod") + private Protocol protocol4Mod; - @JsonProperty("broker_code") - @Schema(required = true) - @NotBlank - private String brokerCode; + @JsonProperty("ip_4mod") + private String ip4Mod; - @JsonProperty("protocol_4mod") - private Protocol protocol4Mod; + @Min(1) + @Max(65535) + @JsonProperty("port_4mod") + private Long port4Mod; - @JsonProperty("ip_4mod") - private String ip4Mod; + @JsonProperty("service_4mod") + private String service4Mod; - @Min(1) - @Max(65535) - @JsonProperty("port_4mod") - private Long port4Mod; + @JsonProperty("proxy_enabled") + private Boolean proxyEnabled; - @JsonProperty("service_4mod") - private String service4Mod; + @JsonProperty("proxy_host") + private String proxyHost; - @JsonProperty("proxy_enabled") - private Boolean proxyEnabled; + @Min(1) + @Max(65535) + @JsonProperty("proxy_port") + private Long proxyPort; - @JsonProperty("proxy_host") - private String proxyHost; + @JsonProperty("proxy_username") + private String proxyUsername; - @Min(1) - @Max(65535) - @JsonProperty("proxy_port") - private Long proxyPort; + @ToString.Exclude + @JsonProperty("proxy_password") + private String proxyPassword; - @JsonProperty("proxy_username") - private String proxyUsername; + @Min(1) + @JsonProperty("thread_number") + @NotNull + private Long threadNumber; - @ToString.Exclude - @JsonProperty("proxy_password") - private String proxyPassword; + @Min(0) + @JsonProperty("timeout_a") + @Schema(required = true) + @NotNull + @Builder.Default + private Long timeoutA = 15L; - @Min(1) - @JsonProperty("thread_number") - @NotNull - private Long threadNumber; + @Min(0) + @JsonProperty("timeout_b") + @Schema(required = true) + @NotNull + @Builder.Default + private Long timeoutB = 30L; - @Min(0) - @JsonProperty("timeout_a") - @Schema(required = true) - @NotNull - @Builder.Default - private Long timeoutA = 15L; + @Min(0) + @JsonProperty("timeout_c") + @Schema(required = true) + @NotNull + @Builder.Default + private Long timeoutC = 120L; - @Min(0) - @JsonProperty("timeout_b") - @Schema(required = true) - @NotNull - @Builder.Default - private Long timeoutB = 30L; + @JsonProperty("flag_online") + private Boolean flagOnline; - @Min(0) - @JsonProperty("timeout_c") - @Schema(required = true) - @NotNull - @Builder.Default - private Long timeoutC = 120L; + @JsonIgnore + private Long brokerObjId; - @JsonProperty("flag_online") - private Boolean flagOnline; + @JsonProperty("invio_rt_istantaneo") + private Boolean rtInstantaneousDispatch; - @JsonIgnore private Long brokerObjId; + @JsonProperty("target_host") + private String targetHost; - @JsonProperty("invio_rt_istantaneo") - private Boolean rtInstantaneousDispatch; + @JsonProperty("target_port") + private Long targetPort; - @JsonProperty("target_host") - private String targetHost; + @JsonProperty("target_path") + private String targetPath; - @JsonProperty("target_port") - private Long targetPort; + @JsonProperty("target_host_pof") + private String targetHostPof; - @JsonProperty("target_path") - private String targetPath; + @JsonProperty("target_port_pof") + private Long targetPortPof; - @JsonProperty("target_host_pof") - private String targetHostPof; + @JsonProperty("target_path_pof") + private String targetPathPof; - @JsonProperty("target_port_pof") - private Long targetPortPof; + @Min(1) + @Max(2) + @NotNull + @Schema(required = true, description = "Primitive number version") + @JsonProperty("primitive_version") + private Integer primitiveVersion; - @JsonProperty("target_path_pof") - private String targetPathPof; + @JsonProperty("verify_payment_option_enabled") + private Boolean verifyPaymentOptionEnabled = false; - @Min(1) - @Max(2) - @NotNull - @Schema(required = true, description = "Primitive number version") - @JsonProperty("primitive_version") - private Integer primitiveVersion; + @JsonProperty("verify_payment_option_endpoint") + private String verifyPaymentOptionEndpoint; } diff --git a/src/test/java/it/gov/pagopa/apiconfig/core/repository/PaStazionePaRepositoryTest.java b/src/test/java/it/gov/pagopa/apiconfig/core/repository/PaStazionePaRepositoryTest.java index 250f746d6..5eb3efdde 100644 --- a/src/test/java/it/gov/pagopa/apiconfig/core/repository/PaStazionePaRepositoryTest.java +++ b/src/test/java/it/gov/pagopa/apiconfig/core/repository/PaStazionePaRepositoryTest.java @@ -47,6 +47,7 @@ void setup() { Stazioni stazioni = TestUtil.getMockStazioni(); stazioni.setObjId(1L); stazioni.setIntermediarioPa(inter); + stazioni.setVerifyPaymentOptionEnabled(false); stazione = stazioniRepository.save(stazioni); PaStazionePa entity = TestUtil.getMockPaStazionePa(); From 5936099e78f4b14fa6d412565e6da0b44b85e34d Mon Sep 17 00:00:00 2001 From: giomella Date: Tue, 10 Sep 2024 16:45:30 +0200 Subject: [PATCH 2/3] [PPANTT-118] updated field names --- openapi/openapi.json | 4 ++-- .../core/mapper/ConvertStationDetailsToStazioni.java | 4 ++-- .../core/mapper/ConvertStazioniToStationDetails.java | 4 ++-- .../core/model/creditorinstitution/StationDetails.java | 8 ++++---- .../core/repository/PaStazionePaRepositoryTest.java | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openapi/openapi.json b/openapi/openapi.json index 4bd4e3c1a..b1f39b465 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -18717,10 +18717,10 @@ "description": "Primitive number version", "format": "int32" }, - "verify_payment_option_enabled": { + "is_payment_options_enabled": { "type": "boolean" }, - "verify_payment_option_endpoint": { + "rest_endpoint": { "type": "string" } } diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStationDetailsToStazioni.java b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStationDetailsToStazioni.java index 97531e044..0acc8cb19 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStationDetailsToStazioni.java +++ b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStationDetailsToStazioni.java @@ -53,8 +53,8 @@ public Stazioni convert(MappingContext context) { .rtEnabled(true) .invioRtIstantaneo(source.getRtInstantaneousDispatch()) .versionePrimitive(source.getPrimitiveVersion()) - .verifyPaymentOptionEnabled(source.getVerifyPaymentOptionEnabled()) - .verifyPaymentOptionEndpoint(source.getVerifyPaymentOptionEndpoint()) + .isPaymentOptionsEnabled(source.getIsPaymentOptionsEnabled()) + .restEndpoint(source.getRestEndpoint()) .build(); } diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStazioniToStationDetails.java b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStazioniToStationDetails.java index 549b43c06..2584e0a0f 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStazioniToStationDetails.java +++ b/src/main/java/it/gov/pagopa/apiconfig/core/mapper/ConvertStazioniToStationDetails.java @@ -61,8 +61,8 @@ public StationDetails convert(MappingContext context) .rtInstantaneousDispatch(source.getInvioRtIstantaneo()) .primitiveVersion(source.getVersionePrimitive()) .isConnectionSync(isConnectionSync(source)) - .verifyPaymentOptionEnabled(source.getVerifyPaymentOptionEnabled()) - .verifyPaymentOptionEndpoint(source.getVerifyPaymentOptionEndpoint()) + .isPaymentOptionsEnabled(source.getIsPaymentOptionsEnabled()) + .restEndpoint(source.getRestEndpoint()) .build(); } } diff --git a/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/StationDetails.java b/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/StationDetails.java index 7f520b246..825bb4e7a 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/StationDetails.java +++ b/src/main/java/it/gov/pagopa/apiconfig/core/model/creditorinstitution/StationDetails.java @@ -168,9 +168,9 @@ public class StationDetails extends Station { @JsonProperty("primitive_version") private Integer primitiveVersion; - @JsonProperty("verify_payment_option_enabled") - private Boolean verifyPaymentOptionEnabled = false; + @JsonProperty("is_payment_options_enabled") + private Boolean isPaymentOptionsEnabled = false; - @JsonProperty("verify_payment_option_endpoint") - private String verifyPaymentOptionEndpoint; + @JsonProperty("rest_endpoint") + private String restEndpoint; } diff --git a/src/test/java/it/gov/pagopa/apiconfig/core/repository/PaStazionePaRepositoryTest.java b/src/test/java/it/gov/pagopa/apiconfig/core/repository/PaStazionePaRepositoryTest.java index 5eb3efdde..d78dd2e87 100644 --- a/src/test/java/it/gov/pagopa/apiconfig/core/repository/PaStazionePaRepositoryTest.java +++ b/src/test/java/it/gov/pagopa/apiconfig/core/repository/PaStazionePaRepositoryTest.java @@ -47,7 +47,7 @@ void setup() { Stazioni stazioni = TestUtil.getMockStazioni(); stazioni.setObjId(1L); stazioni.setIntermediarioPa(inter); - stazioni.setVerifyPaymentOptionEnabled(false); + stazioni.setIsPaymentOptionsEnabled(false); stazione = stazioniRepository.save(stazioni); PaStazionePa entity = TestUtil.getMockPaStazionePa(); From 06b7ca9f19f0645a0d1759d19978c6ef27bf5eab Mon Sep 17 00:00:00 2001 From: giomella Date: Wed, 18 Sep 2024 10:36:38 +0200 Subject: [PATCH 3/3] [PPANTT-118] bump starter dependency --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 337c0aca3..6648d47d9 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ 42.5.5 8.6.6 1.17.6 - 1.22.2 + 1.23.0