From 4bb96caf96f96c5f8ac431a8fdf5d62fa0b95141 Mon Sep 17 00:00:00 2001 From: FedericoRuzzier <49512050+FedericoRuzzier@users.noreply.github.com> Date: Fri, 31 May 2024 17:13:37 +0200 Subject: [PATCH 1/5] fixing mapping to new model --- .../config/MappingsConfiguration.java | 7 +- .../ConvertIbanMasterToIbanDetailsTemp.java | 41 +++++++ .../model/iban/IbanDetailsTemp.java | 100 ++++++++++++++++++ .../model/iban/IbansListTemp.java | 2 +- .../service/IbansService.java | 7 +- .../selfcareintegration/util/Constants.java | 7 ++ .../util/OffsetDateTimeDeserializer.java | 40 +++++++ 7 files changed, 196 insertions(+), 8 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertIbanMasterToIbanDetailsTemp.java create mode 100644 src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanDetailsTemp.java create mode 100644 src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/util/OffsetDateTimeDeserializer.java diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/config/MappingsConfiguration.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/config/MappingsConfiguration.java index 55f2899b..ddb7227a 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/config/MappingsConfiguration.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/config/MappingsConfiguration.java @@ -1,13 +1,11 @@ package it.gov.pagopa.apiconfig.selfcareintegration.config; -import it.gov.pagopa.apiconfig.selfcareintegration.mapper.ConvertCanaliToChannelDetails; -import it.gov.pagopa.apiconfig.selfcareintegration.mapper.ConvertIbanMasterToIbanDetail; -import it.gov.pagopa.apiconfig.selfcareintegration.mapper.ConvertPaStazionePaToCreditorInstitutionDetail; -import it.gov.pagopa.apiconfig.selfcareintegration.mapper.ConvertPaToCreditorInstitutionInfo; +import it.gov.pagopa.apiconfig.selfcareintegration.mapper.*; import it.gov.pagopa.apiconfig.selfcareintegration.model.channel.ChannelDetails; import it.gov.pagopa.apiconfig.selfcareintegration.model.creditorinstitution.CreditorInstitutionDetail; import it.gov.pagopa.apiconfig.selfcareintegration.model.creditorinstitution.CreditorInstitutionInfo; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetails; +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetailsTemp; import it.gov.pagopa.apiconfig.starter.entity.Canali; import it.gov.pagopa.apiconfig.starter.entity.IbanMaster; import it.gov.pagopa.apiconfig.starter.entity.Pa; @@ -35,6 +33,7 @@ ModelMapper modelMapper() { .setConverter(new ConvertPaStazionePaToCreditorInstitutionDetail()); mapper.createTypeMap(Pa.class, CreditorInstitutionInfo.class).setConverter(new ConvertPaToCreditorInstitutionInfo()); + mapper.createTypeMap(IbanMaster.class, IbanDetailsTemp.class).setConverter(new ConvertIbanMasterToIbanDetailsTemp()); return mapper; } diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertIbanMasterToIbanDetailsTemp.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertIbanMasterToIbanDetailsTemp.java new file mode 100644 index 00000000..707410b8 --- /dev/null +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertIbanMasterToIbanDetailsTemp.java @@ -0,0 +1,41 @@ +package it.gov.pagopa.apiconfig.selfcareintegration.mapper; + +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetailsTemp; +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanLabel; +import it.gov.pagopa.apiconfig.starter.entity.Iban; +import it.gov.pagopa.apiconfig.starter.entity.IbanAttributeMaster; +import it.gov.pagopa.apiconfig.starter.entity.IbanMaster; +import org.modelmapper.Converter; +import org.modelmapper.spi.MappingContext; + +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.util.List; + +public class ConvertIbanMasterToIbanDetailsTemp implements Converter { + + @Override + public IbanDetailsTemp convert(MappingContext context) { + IbanMaster src = context.getSource(); + + List labels = src.getIbanAttributesMasters().stream() + .map(IbanAttributeMaster::getIbanAttribute) + .map(label -> IbanLabel.builder() + .name(label.getAttributeName()) + .description(label.getAttributeDescription()) + .build()) + .toList(); + + Iban iban = src.getIban(); + return IbanDetailsTemp.builder() + .ciOwnerFiscalCode(src.getPa().getIdDominio()) + .companyName(src.getPa().getRagioneSociale()) + .ibanValue(iban.getIban()) + .publicationDate(OffsetDateTime.ofInstant(src.getInsertedDate().toInstant(), ZoneId.of("UTC"))) + .validityDate(OffsetDateTime.ofInstant(src.getValidityDate().toInstant(), ZoneId.of("UTC"))) + .dueDate(OffsetDateTime.ofInstant(iban.getDueDate().toInstant(), ZoneId.of("UTC"))) + .description(src.getDescription()) + .labels(labels) + .build(); + } +} diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanDetailsTemp.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanDetailsTemp.java new file mode 100644 index 00000000..3dc4ff5d --- /dev/null +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanDetailsTemp.java @@ -0,0 +1,100 @@ +package it.gov.pagopa.apiconfig.selfcareintegration.model.iban; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.datatype.jsr310.ser.OffsetDateTimeSerializer; +import io.swagger.v3.oas.annotations.media.Schema; +import it.gov.pagopa.apiconfig.selfcareintegration.util.Constants; +import it.gov.pagopa.apiconfig.selfcareintegration.util.OffsetDateTimeDeserializer; +import lombok.*; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Iban detail + */ +@Data +@Builder(toBuilder = true) +@NoArgsConstructor +@AllArgsConstructor +@ToString +public class IbanDetailsTemp { + + @JsonProperty("iban") + @Schema(example = "IT99C0222211111000000000000", required = true, description = "The iban code") + @Pattern(regexp = "[a-zA-Z]{2}\\d{2}[a-zA-Z0-9]{1,30}", message = "IBAN code not valid") + @Size(max = 35) + @NotNull + private String ibanValue; + + @JsonProperty(value = "ci_owner", access = JsonProperty.Access.READ_ONLY) + @Schema( + example = "77777777777", + required = true, + description = "Fiscal code of the Creditor Institution who owns the iban") + @Size(max = 11) + private String ciOwnerFiscalCode; + + @JsonProperty(value = "company_name", access = JsonProperty.Access.READ_ONLY) + @Schema(example = "Comune di Firenze", description = "The Creditor Institution company name") + @Size(max = 100) + private String companyName; + + @JsonProperty("description") + @Schema( + example = "Riscossione Tributi", + required = false, + description = "The description the Creditor Institution gives to the iban about its usage") + @Size(max = 300) + private String description; + + @JsonProperty("is_active") + @Schema(example = "true", required = true, description = "True if the iban is active") + @NotNull + private boolean isActive; + + @JsonProperty("validity_date") + @JsonFormat(pattern = Constants.DateTimeFormat.DATE_TIME_FORMAT) + @JsonSerialize(using = OffsetDateTimeSerializer.class) + @JsonDeserialize(using = OffsetDateTimeDeserializer.class) + @Schema( + example = "2023-04-01T13:49:19.897Z", + required = true, + description = "The date the Creditor Institution wants the iban to be used for its payments") + @NotNull + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime validityDate; + + @JsonProperty(value = "publication_date", access = JsonProperty.Access.READ_ONLY) + @JsonFormat(pattern = Constants.DateTimeFormat.DATE_TIME_FORMAT) + @JsonSerialize(using = OffsetDateTimeSerializer.class) + @Schema( + example = "2023-06-01T23:59:59.999Z", + required = true, + description = "The date on which the iban has been inserted in the system") + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime publicationDate; + + @JsonProperty(value = "due_date") + @JsonFormat(pattern = Constants.DateTimeFormat.DATE_TIME_FORMAT) + @JsonSerialize(using = OffsetDateTimeSerializer.class) + @JsonDeserialize(using = OffsetDateTimeDeserializer.class) + @Schema( + example = "2023-12-31T23:59:59.999Z", + required = true, + description = "The date on which the iban will expire") + @NotNull + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) + private OffsetDateTime dueDate; + + @JsonProperty("labels") + @Schema(description = "The labels array associated with the iban") + private List labels; +} diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansListTemp.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansListTemp.java index c4b6f04f..2dd33b39 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansListTemp.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansListTemp.java @@ -18,6 +18,6 @@ public class IbansListTemp { @JsonProperty("ibans") @NotNull @Schema(description = "List of IBANs associated to the passed creditor institutions") - private List ibans; + private List ibans; } diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java index 193a03ab..1dbdd5c1 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java @@ -3,6 +3,7 @@ import it.gov.pagopa.apiconfig.selfcareintegration.exception.AppError; import it.gov.pagopa.apiconfig.selfcareintegration.exception.AppException; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetails; +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetailsTemp; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbansList; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbansListTemp; import it.gov.pagopa.apiconfig.selfcareintegration.repository.ExtendedIbanMasterRepository; @@ -63,14 +64,14 @@ public IbansListTemp getIbansList(@NotNull String organizationFiscalCode, String ibanMasters = extendedIbanMasterRepository.findByFkPaAndLabel(pa.getObjId(), label); } - List ibanDetailsList = ibanMasters.stream() - .map(elem -> modelMapper.map(elem, IbanDetails.class)) + List ibanDetailsList = ibanMasters.stream() + .map(elem -> modelMapper.map(elem, IbanDetailsTemp.class)) .collect(Collectors.toList()); if(ibanDetailsList.isEmpty() && (("ACA").equals(label) || ("0201138TS").equals(label))) { IbanMaster lastPublishedIban = getLastPublishedIban(pa); if(lastPublishedIban != null) { - ibanDetailsList.add(modelMapper.map(lastPublishedIban, IbanDetails.class)); + ibanDetailsList.add(modelMapper.map(lastPublishedIban, IbanDetailsTemp.class)); } } diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/util/Constants.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/util/Constants.java index 6c257cec..8692f9e2 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/util/Constants.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/util/Constants.java @@ -1,7 +1,14 @@ package it.gov.pagopa.apiconfig.selfcareintegration.util; +import lombok.experimental.UtilityClass; + public class Constants { + @UtilityClass + public static class DateTimeFormat { + public static final String DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; + } + public static final String HEADER_REQUEST_ID = "X-Request-Id"; public static final String DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/util/OffsetDateTimeDeserializer.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/util/OffsetDateTimeDeserializer.java new file mode 100644 index 00000000..eacbc2f2 --- /dev/null +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/util/OffsetDateTimeDeserializer.java @@ -0,0 +1,40 @@ +package it.gov.pagopa.apiconfig.selfcareintegration.util; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; + +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeFormatterBuilder; + +/** + * This class permits to deserialize a date, encapsulated in {@code OffsetDateTime} object, from a + * JSON body request using Jackson deserializer. + */ +public class OffsetDateTimeDeserializer extends JsonDeserializer { + + private final DateTimeFormatter dateFormatter = + new DateTimeFormatterBuilder() + .append(DateTimeFormatter.ISO_LOCAL_DATE_TIME) + .optionalStart() + .appendOffset("+HH:MM", "+00:00") + .optionalEnd() // for '+00:00' offset + .optionalStart() + .appendOffset("+HHMM", "+0000") + .optionalEnd() // for '+0000' offset + .optionalStart() + .appendOffset("+HH", "+00") + .optionalEnd() // for '+00' offset + .optionalStart() + .appendPattern("X") + .optionalEnd() // for 'Z' offset + .toFormatter(); + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) + throws IOException { + return OffsetDateTime.parse(parser.getText(), dateFormatter); + } +} From 128672f7fc223e3989102d73920c872c2efa3298 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Fri, 31 May 2024 15:15:48 +0000 Subject: [PATCH 2/5] Bump to version 1.10.13-1-fix-iban-list-model [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index be49e983..96d13240 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-api-config-selfcare-integration description: Microservice that manages requests from selfcare type: application -version: 1.87.0 -appVersion: 1.10.13 +version: 1.88.0 +appVersion: 1.10.13-1-fix-iban-list-model dependencies: - name: microservice-chart version: 2.8.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index eeb4c811..843f44ad 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -27,7 +27,7 @@ microservice-chart: µservice-chart envSecret: {} image: repository: ghcr.io/pagopa/pagopa-api-config-selfcare-integration - tag: "1.10.13" + tag: "1.10.13-1-fix-iban-list-model" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 836b44f8..1dd6eebb 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -27,7 +27,7 @@ microservice-chart: µservice-chart envSecret: {} image: repository: ghcr.io/pagopa/pagopa-api-config-selfcare-integration - tag: "1.10.13" + tag: "1.10.13-1-fix-iban-list-model" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 9192e522..8e9714e8 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -27,7 +27,7 @@ microservice-chart: µservice-chart envSecret: {} image: repository: ghcr.io/pagopa/pagopa-api-config-selfcare-integration - tag: "1.10.13" + tag: "1.10.13-1-fix-iban-list-model" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 15971e10..13cb0077 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config - SelfCare Integration", "description": "Spring application exposes APIs for SelfCare", "termsOfService": "https://www.pagopa.gov.it/", - "version": "1.10.13" + "version": "1.10.13-1-fix-iban-list-model" }, "servers": [ { diff --git a/pom.xml b/pom.xml index f5b581ae..7cc735f6 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config selfcareintegration - 1.10.13 + 1.10.13-1-fix-iban-list-model API-Config - SelfCare Integration Spring application exposes APIs for SelfCare From f8bf7bf7747c85f3f7f4445d3b89519e68e62df0 Mon Sep 17 00:00:00 2001 From: FedericoRuzzier <49512050+FedericoRuzzier@users.noreply.github.com> Date: Fri, 31 May 2024 17:47:06 +0200 Subject: [PATCH 3/5] ibanEnhanced --- .../config/MappingsConfiguration.java | 4 ++-- .../controller/IbanController.java | 6 +++--- .../mapper/ConvertIbanMasterToIbanDetailsTemp.java | 8 ++++---- .../{IbanDetailsTemp.java => IbanEnhanced.java} | 2 +- .../{IbansListTemp.java => IbansEnhanced.java} | 4 ++-- .../selfcareintegration/service/IbansService.java | 14 +++++++------- 6 files changed, 19 insertions(+), 19 deletions(-) rename src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/{IbanDetailsTemp.java => IbanEnhanced.java} (99%) rename src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/{IbansListTemp.java => IbansEnhanced.java} (87%) diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/config/MappingsConfiguration.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/config/MappingsConfiguration.java index ddb7227a..dc825c30 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/config/MappingsConfiguration.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/config/MappingsConfiguration.java @@ -5,7 +5,7 @@ import it.gov.pagopa.apiconfig.selfcareintegration.model.creditorinstitution.CreditorInstitutionDetail; import it.gov.pagopa.apiconfig.selfcareintegration.model.creditorinstitution.CreditorInstitutionInfo; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetails; -import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetailsTemp; +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanEnhanced; import it.gov.pagopa.apiconfig.starter.entity.Canali; import it.gov.pagopa.apiconfig.starter.entity.IbanMaster; import it.gov.pagopa.apiconfig.starter.entity.Pa; @@ -33,7 +33,7 @@ ModelMapper modelMapper() { .setConverter(new ConvertPaStazionePaToCreditorInstitutionDetail()); mapper.createTypeMap(Pa.class, CreditorInstitutionInfo.class).setConverter(new ConvertPaToCreditorInstitutionInfo()); - mapper.createTypeMap(IbanMaster.class, IbanDetailsTemp.class).setConverter(new ConvertIbanMasterToIbanDetailsTemp()); + mapper.createTypeMap(IbanMaster.class, IbanEnhanced.class).setConverter(new ConvertIbanMasterToIbanDetailsTemp()); return mapper; } diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/controller/IbanController.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/controller/IbanController.java index 4eb4466b..b0d53aec 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/controller/IbanController.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/controller/IbanController.java @@ -10,7 +10,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import it.gov.pagopa.apiconfig.selfcareintegration.model.ProblemJson; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbansList; -import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbansListTemp; +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbansEnhanced; import it.gov.pagopa.apiconfig.selfcareintegration.service.IbansService; import java.util.List; import javax.validation.Valid; @@ -139,7 +139,7 @@ public ResponseEntity getIbans( content = @Content( mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = IbansListTemp.class))), + schema = @Schema(implementation = IbansEnhanced.class))), @ApiResponse( responseCode = "400", description = "Bad Request", @@ -174,7 +174,7 @@ public ResponseEntity getIbans( @GetMapping( value = "/{creditorinstitutioncode}/list", produces = {MediaType.APPLICATION_JSON_VALUE}) - public ResponseEntity getIbans( + public ResponseEntity getIbans( @Size(max = 50) @Parameter( description = "The fiscal code of the Organization.", diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertIbanMasterToIbanDetailsTemp.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertIbanMasterToIbanDetailsTemp.java index 707410b8..9b3dfa37 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertIbanMasterToIbanDetailsTemp.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/mapper/ConvertIbanMasterToIbanDetailsTemp.java @@ -1,6 +1,6 @@ package it.gov.pagopa.apiconfig.selfcareintegration.mapper; -import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetailsTemp; +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanEnhanced; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanLabel; import it.gov.pagopa.apiconfig.starter.entity.Iban; import it.gov.pagopa.apiconfig.starter.entity.IbanAttributeMaster; @@ -12,10 +12,10 @@ import java.time.ZoneId; import java.util.List; -public class ConvertIbanMasterToIbanDetailsTemp implements Converter { +public class ConvertIbanMasterToIbanDetailsTemp implements Converter { @Override - public IbanDetailsTemp convert(MappingContext context) { + public IbanEnhanced convert(MappingContext context) { IbanMaster src = context.getSource(); List labels = src.getIbanAttributesMasters().stream() @@ -27,7 +27,7 @@ public IbanDetailsTemp convert(MappingContext conte .toList(); Iban iban = src.getIban(); - return IbanDetailsTemp.builder() + return IbanEnhanced.builder() .ciOwnerFiscalCode(src.getPa().getIdDominio()) .companyName(src.getPa().getRagioneSociale()) .ibanValue(iban.getIban()) diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanDetailsTemp.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanEnhanced.java similarity index 99% rename from src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanDetailsTemp.java rename to src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanEnhanced.java index 3dc4ff5d..7a5e7f87 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanDetailsTemp.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbanEnhanced.java @@ -25,7 +25,7 @@ @NoArgsConstructor @AllArgsConstructor @ToString -public class IbanDetailsTemp { +public class IbanEnhanced { @JsonProperty("iban") @Schema(example = "IT99C0222211111000000000000", required = true, description = "The iban code") diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansListTemp.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansEnhanced.java similarity index 87% rename from src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansListTemp.java rename to src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansEnhanced.java index 2dd33b39..5b92ee80 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansListTemp.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansEnhanced.java @@ -13,11 +13,11 @@ @NoArgsConstructor @AllArgsConstructor @ToString -public class IbansListTemp { +public class IbansEnhanced { @JsonProperty("ibans") @NotNull @Schema(description = "List of IBANs associated to the passed creditor institutions") - private List ibans; + private List ibans; } diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java index 1dbdd5c1..4ccedde9 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java @@ -3,9 +3,9 @@ import it.gov.pagopa.apiconfig.selfcareintegration.exception.AppError; import it.gov.pagopa.apiconfig.selfcareintegration.exception.AppException; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetails; -import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanDetailsTemp; +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbanEnhanced; import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbansList; -import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbansListTemp; +import it.gov.pagopa.apiconfig.selfcareintegration.model.iban.IbansEnhanced; import it.gov.pagopa.apiconfig.selfcareintegration.repository.ExtendedIbanMasterRepository; import it.gov.pagopa.apiconfig.selfcareintegration.util.Utility; import it.gov.pagopa.apiconfig.starter.entity.IbanMaster; @@ -54,7 +54,7 @@ public IbansList getIbans(@NotEmpty List creditorInstitutions, @NotNull .build(); } - public IbansListTemp getIbansList(@NotNull String organizationFiscalCode, String label) { + public IbansEnhanced getIbansList(@NotNull String organizationFiscalCode, String label) { Pa pa = getPaIfExists(organizationFiscalCode); List ibanMasters; @@ -64,18 +64,18 @@ public IbansListTemp getIbansList(@NotNull String organizationFiscalCode, String ibanMasters = extendedIbanMasterRepository.findByFkPaAndLabel(pa.getObjId(), label); } - List ibanDetailsList = ibanMasters.stream() - .map(elem -> modelMapper.map(elem, IbanDetailsTemp.class)) + List ibanDetailsList = ibanMasters.stream() + .map(elem -> modelMapper.map(elem, IbanEnhanced.class)) .collect(Collectors.toList()); if(ibanDetailsList.isEmpty() && (("ACA").equals(label) || ("0201138TS").equals(label))) { IbanMaster lastPublishedIban = getLastPublishedIban(pa); if(lastPublishedIban != null) { - ibanDetailsList.add(modelMapper.map(lastPublishedIban, IbanDetailsTemp.class)); + ibanDetailsList.add(modelMapper.map(lastPublishedIban, IbanEnhanced.class)); } } - return IbansListTemp.builder() + return IbansEnhanced.builder() .ibans(ibanDetailsList) .build(); } From 6bad93764f2336ecb25d00e4526c024795a25372 Mon Sep 17 00:00:00 2001 From: FedericoRuzzier <49512050+FedericoRuzzier@users.noreply.github.com> Date: Fri, 31 May 2024 17:50:22 +0200 Subject: [PATCH 4/5] ibanEnhanced --- .../selfcareintegration/model/iban/IbansEnhanced.java | 4 ++-- .../apiconfig/selfcareintegration/service/IbansService.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansEnhanced.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansEnhanced.java index 5b92ee80..d854005c 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansEnhanced.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/model/iban/IbansEnhanced.java @@ -15,9 +15,9 @@ @ToString public class IbansEnhanced { - @JsonProperty("ibans") + @JsonProperty("ibans_enhanced") @NotNull @Schema(description = "List of IBANs associated to the passed creditor institutions") - private List ibans; + private List ibanEnhancedList; } diff --git a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java index 4ccedde9..573d10be 100644 --- a/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java +++ b/src/main/java/it/gov/pagopa/apiconfig/selfcareintegration/service/IbansService.java @@ -76,7 +76,7 @@ public IbansEnhanced getIbansList(@NotNull String organizationFiscalCode, String } return IbansEnhanced.builder() - .ibans(ibanDetailsList) + .ibanEnhancedList(ibanDetailsList) .build(); } From 8edd24dc333e10a179b3b095f07132805b80fbf8 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Fri, 31 May 2024 15:51:31 +0000 Subject: [PATCH 5/5] Bump to version 1.10.13-2-fix-iban-list-model [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 96d13240..de6aac6b 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-api-config-selfcare-integration description: Microservice that manages requests from selfcare type: application -version: 1.88.0 -appVersion: 1.10.13-1-fix-iban-list-model +version: 1.89.0 +appVersion: 1.10.13-2-fix-iban-list-model dependencies: - name: microservice-chart version: 2.8.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 843f44ad..bf616d19 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -27,7 +27,7 @@ microservice-chart: µservice-chart envSecret: {} image: repository: ghcr.io/pagopa/pagopa-api-config-selfcare-integration - tag: "1.10.13-1-fix-iban-list-model" + tag: "1.10.13-2-fix-iban-list-model" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 1dd6eebb..357aafe5 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -27,7 +27,7 @@ microservice-chart: µservice-chart envSecret: {} image: repository: ghcr.io/pagopa/pagopa-api-config-selfcare-integration - tag: "1.10.13-1-fix-iban-list-model" + tag: "1.10.13-2-fix-iban-list-model" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 8e9714e8..070b07ae 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -27,7 +27,7 @@ microservice-chart: µservice-chart envSecret: {} image: repository: ghcr.io/pagopa/pagopa-api-config-selfcare-integration - tag: "1.10.13-1-fix-iban-list-model" + tag: "1.10.13-2-fix-iban-list-model" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 13cb0077..e138ece0 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "API-Config - SelfCare Integration", "description": "Spring application exposes APIs for SelfCare", "termsOfService": "https://www.pagopa.gov.it/", - "version": "1.10.13-1-fix-iban-list-model" + "version": "1.10.13-2-fix-iban-list-model" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 7cc735f6..994312e5 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ it.gov.pagopa.api-config selfcareintegration - 1.10.13-1-fix-iban-list-model + 1.10.13-2-fix-iban-list-model API-Config - SelfCare Integration Spring application exposes APIs for SelfCare