diff --git a/pom.xml b/pom.xml
index 75c516e1..087a81b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -136,6 +136,7 @@
logback-ecs-encoder
${java-ecs-logging.version}
+
diff --git a/src/main/java/it/gov/pagopa/wispconverter/repository/ReEventRepository.java b/src/main/java/it/gov/pagopa/wispconverter/repository/ReEventRepository.java
new file mode 100644
index 00000000..5de66df6
--- /dev/null
+++ b/src/main/java/it/gov/pagopa/wispconverter/repository/ReEventRepository.java
@@ -0,0 +1,12 @@
+package it.gov.pagopa.wispconverter.repository;
+
+import com.azure.spring.data.cosmos.repository.CosmosRepository;
+import it.gov.pagopa.wispconverter.repository.model.ReEventEntity;
+import org.springframework.stereotype.Repository;
+
+import java.util.Optional;
+
+@Repository
+public interface ReEventRepository extends CosmosRepository {
+
+}
\ No newline at end of file
diff --git a/src/main/java/it/gov/pagopa/wispconverter/repository/model/ReEventEntity.java b/src/main/java/it/gov/pagopa/wispconverter/repository/model/ReEventEntity.java
new file mode 100644
index 00000000..1616f351
--- /dev/null
+++ b/src/main/java/it/gov/pagopa/wispconverter/repository/model/ReEventEntity.java
@@ -0,0 +1,87 @@
+package it.gov.pagopa.wispconverter.repository.model;
+
+import com.azure.spring.data.cosmos.core.mapping.Container;
+import com.azure.spring.data.cosmos.core.mapping.PartitionKey;
+
+import lombok.*;
+import org.springframework.data.annotation.Id;
+import it.gov.pagopa.wispconverter.repository.model.enumz.*;
+
+import java.time.Instant;
+
+@Container(containerName = "re")
+@Data
+@Builder(toBuilder = true)
+public class ReEventEntity {
+ //// START KEY
+ @Id
+ private String id;
+
+ @PartitionKey
+ private String partitionKey;
+ //// END KEY
+
+ //// START LOGICAL REF
+ private String requestId; //gruppo, tutte le chiamate fatte con lo stesso X-Request-ID
+ private String operationId; //id operation associato a un requestId
+ private String clientOperationId; //id client operation associato a un operationId
+ private ComponenteEnum componente; //componente che scrive l'evento
+ private Instant insertedTimestamp; //ora di inserimento evento
+ //// END LOGICAL REF
+
+ //// START FIELD FOR INTERFACE AND INTERN CHANGE
+ private CategoriaEventoEnum categoriaEvento;
+ private SottoTipoEventoEnum sottoTipoEvento;
+ //// END FIELD FOR INTERFACE AND INTERN CHANGE
+
+ //// START FIELD FOR INTERFACE
+ private CallTypeEnum callType;
+
+ private String fruitore;
+ private String fruitoreDescr;
+ private String erogatore;
+ private String erogatoreDescr;
+
+ private EsitoEnum esito;
+
+ private String httpMethod;
+ private String httpUri;
+ private String httpHeaders;
+ private String httpCallRemoteAddress;
+
+ private Integer httpStatusCode;
+ private Long executionTimeMs;
+
+ private String compressedPayload; //zip+Base64
+ private Integer compressedPayloadLength;
+
+ private String businessProcess;
+
+ private String operationStatus; //dettaglio response in uscita
+ private String operationErrorTitle; //dettaglio response in uscita
+ private String operationErrorDetail; //dettaglio response in uscita
+ private String operationErrorCode; //dettaglio response in uscita
+ //// END FIELD FOR INTERFACE
+
+ //// START FIELD FOR INTERN CHANGE
+ private String idDominio;
+ private String iuv;
+ private String ccp;
+ private String psp;
+ private String tipoVersamento;
+ private String tipoEvento;
+ private String stazione;
+ private String canale;
+ private String parametriSpecificiInterfaccia;
+ private String status;
+ private String info;
+
+ private String pspDescr;
+ private String noticeNumber;
+ private String creditorReferenceId;
+ private String paymentToken;
+ private String sessionIdOriginal;
+ private Boolean standIn;
+ //// END FIELD FOR INTERN CHANGE
+
+}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/CallTypeEnum.java b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/CallTypeEnum.java
new file mode 100644
index 00000000..25431b2e
--- /dev/null
+++ b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/CallTypeEnum.java
@@ -0,0 +1,6 @@
+package it.gov.pagopa.wispconverter.repository.model.enumz;
+
+public enum CallTypeEnum {
+ SERVER,
+ CLIENT;
+}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/CategoriaEventoEnum.java b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/CategoriaEventoEnum.java
new file mode 100644
index 00000000..93c42b8b
--- /dev/null
+++ b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/CategoriaEventoEnum.java
@@ -0,0 +1,6 @@
+package it.gov.pagopa.wispconverter.repository.model.enumz;
+
+public enum CategoriaEventoEnum {
+ INTERFACCIA,
+ INTERNO;
+}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/ComponenteEnum.java b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/ComponenteEnum.java
new file mode 100644
index 00000000..dfc5b9f2
--- /dev/null
+++ b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/ComponenteEnum.java
@@ -0,0 +1,7 @@
+package it.gov.pagopa.wispconverter.repository.model.enumz;
+
+public enum ComponenteEnum {
+// FESP,
+ WISP_SOAP_CONVERTER,
+ WISP_CONVERTER;
+}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/EsitoEnum.java b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/EsitoEnum.java
new file mode 100644
index 00000000..c05ac4f1
--- /dev/null
+++ b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/EsitoEnum.java
@@ -0,0 +1,5 @@
+package it.gov.pagopa.wispconverter.repository.model.enumz;
+
+public enum EsitoEnum {
+ INVIATA, INVIATA_KO, RICEVUTA, RICEVUTA_KO, NO_RICEVUTA, CAMBIO_STATO;
+}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/SottoTipoEventoEnum.java b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/SottoTipoEventoEnum.java
new file mode 100644
index 00000000..1784b349
--- /dev/null
+++ b/src/main/java/it/gov/pagopa/wispconverter/repository/model/enumz/SottoTipoEventoEnum.java
@@ -0,0 +1,7 @@
+package it.gov.pagopa.wispconverter.repository.model.enumz;
+
+public enum SottoTipoEventoEnum {
+ REQ,
+ RESP,
+ INTERN;
+}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/service/ReService.java b/src/main/java/it/gov/pagopa/wispconverter/service/ReService.java
index 465a27f0..933643b4 100644
--- a/src/main/java/it/gov/pagopa/wispconverter/service/ReService.java
+++ b/src/main/java/it/gov/pagopa/wispconverter/service/ReService.java
@@ -2,6 +2,9 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import it.gov.pagopa.wispconverter.repository.ReEventRepository;
+import it.gov.pagopa.wispconverter.repository.model.ReEventEntity;
+import it.gov.pagopa.wispconverter.service.mapper.ReEventMapper;
import it.gov.pagopa.wispconverter.service.model.re.ReEventDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -12,18 +15,22 @@
@RequiredArgsConstructor
public class ReService {
- private final ObjectMapper objectMapper;
+ private final ReEventRepository reEventRepository;
+ private final ReEventMapper reEventMapper;
+// private final ObjectMapper objectMapper;
public void addRe(ReEventDto reEventDto) {
- try {
- log.info("\n" +
- "#################\n" +
- "# RE "+reEventDto.getCategoriaEvento()+"/"+reEventDto.getCallType()+"/"+reEventDto.getSottoTipoEvento()+" \n" +
- objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(reEventDto) + "\n" +
- "#################");
- } catch (JsonProcessingException e) {
- throw new RuntimeException(e);
- }
+// try {
+// log.info("\n" +
+// "#################\n" +
+// "# RE "+reEventDto.getCategoriaEvento()+"/"+reEventDto.getCallType()+"/"+reEventDto.getSottoTipoEvento()+" \n" +
+// objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(reEventDto) + "\n" +
+// "#################");
+ ReEventEntity reEventEntity = reEventMapper.toReEventEntity(reEventDto);
+ reEventRepository.save(reEventEntity);
+// } catch (JsonProcessingException e) {
+// throw new RuntimeException(e);
+// }
}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/service/mapper/ReEventMapper.java b/src/main/java/it/gov/pagopa/wispconverter/service/mapper/ReEventMapper.java
new file mode 100644
index 00000000..af01c43c
--- /dev/null
+++ b/src/main/java/it/gov/pagopa/wispconverter/service/mapper/ReEventMapper.java
@@ -0,0 +1,31 @@
+package it.gov.pagopa.wispconverter.service.mapper;
+
+import it.gov.pagopa.wispconverter.repository.model.ReEventEntity;
+import it.gov.pagopa.wispconverter.service.model.CommonRPTFieldsDTO;
+import it.gov.pagopa.wispconverter.service.model.PaymentNoticeContentDTO;
+import it.gov.pagopa.wispconverter.service.model.re.ReEventDto;
+import org.mapstruct.*;
+
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.TimeZone;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
+public interface ReEventMapper {
+
+ static final String PATTERN_FORMAT = "yyyy-MM-dd";
+
+ @Mapping(source = "insertedTimestamp", target = "partitionKey", qualifiedByName = "partitionKeyFromInstant")
+ ReEventEntity toReEventEntity(ReEventDto reEventDto);
+
+ @Named("partitionKeyFromInstant")
+ public static String partitionKeyFromInstant(Instant insertedTimestamp) {
+ return insertedTimestamp == null ? null : DateTimeFormatter
+ .ofPattern(PATTERN_FORMAT)
+ .withZone(ZoneId.systemDefault())
+ .format(insertedTimestamp);
+ }
+
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index d7edcd63..6cdae6e2 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -63,7 +63,7 @@ client.gpd.api-key=${CLIENT_GPD_SUBKEY:none}
# IUV generator client configuration
client.iuvgenerator.read-timeout=${CLIENT_IUVGENERATOR_READ_TIMEOUT:5000}
client.iuvgenerator.connect-timeout=${CLIENT_IUVGENERATOR_READ_TIMEOUT:5000}
-client.iuvgenerator.base-path=${CLIENT_IUVGENERATOR_HOST:https://api.devvo.platform.pagopa.it/shared/iuv-generator-service/v1}
+client.iuvgenerator.base-path=${CLIENT_IUVGENERATOR_HOST:https://api.dev.platform.pagopa.it/shared/iuv-generator-service/v1}
client.iuvgenerator.api-key=${CLIENT_IUVGENERATOR_SUBKEY:none}