From bce7dfbffa9b112daaa35510f7a07bad45634753 Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Tue, 23 Jan 2024 11:33:08 +0100 Subject: [PATCH 01/11] NOD-642 Storicizzazione FDR --- helm/values-dev.yaml | 5 + pom.xml | 4 + .../java/it/gov/pagopa/fdr/AppStartup.java | 11 ++ .../fdr/repository/fdr/FdrPublishEntity.java | 5 + .../fdr/service/history/HistoryService.java | 179 ++++++++++++++++++ .../history/constants/HistoryConstants.java | 49 +++++ .../history/mapper/HistoryServiceMapper.java | 28 +++ .../history/model/FdrHistoryEntity.java | 58 ++++++ .../history/model/FdrHistoryMongoEntity.java | 40 ++++ .../model/FdrHistoryPaymentEntity.java | 64 +++++++ .../pagopa/fdr/service/psps/PspsService.java | 19 +- .../fdr/service/re/model/BlobHttpBody.java | 7 + src/main/resources/application.properties | 15 ++ .../pagopa/fdr/test/util/AzuriteResource.java | 2 + 14 files changed, 480 insertions(+), 6 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryEntity.java create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryPaymentEntity.java diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 3701481e..8630de1d 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -28,6 +28,9 @@ microservice-chart: QUEUE_CONVERSION_NAME: "flowidsendqueue" EVENT_HUB_RE_NAME: "fdr-re" BLOB_RE_CONTAINER_NAME: "payload" + BLOB_HISTORY_CONTAINER_NAME: "fdrhistory" + TABLE_HISTORY_FDR_PUBLISH_TABLE: "fdrpublish" + TABLE_HISTORY_FDR_PAYMENT_PUBLISH_TABLE: "fdrpaymentpublish" envFieldRef: APP_NAME: "metadata.labels['app.kubernetes.io/instance']" APP_VERSION: "metadata.labels['app.kubernetes.io/version']" @@ -40,6 +43,8 @@ microservice-chart: QUEUE_CONVERSION_CONNECTION_STRING: "fdr-sa-connection-string" EVENT_HUB_RE_CONNECTION_STRING: "azure-event-hub-re-connection-string" BLOB_RE_CONNECTION_STRING: "fdr-re-sa-connection-string" + BLOB_HISTORY_CONNECTION_STRING: "fdr-history-sa-connection-string" + TABLE_HISTORY_CONNECTION_STRING: "fdr-history-sa-connection-string" keyvault: name: "pagopa-d-fdr-kv" tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d" diff --git a/pom.xml b/pom.xml index 6655b875..778ab580 100644 --- a/pom.xml +++ b/pom.xml @@ -155,6 +155,10 @@ com.azure azure-storage-blob + + com.azure + azure-data-tables + com.google.code.gson gson diff --git a/src/main/java/it/gov/pagopa/fdr/AppStartup.java b/src/main/java/it/gov/pagopa/fdr/AppStartup.java index 194066ce..8bf289bd 100644 --- a/src/main/java/it/gov/pagopa/fdr/AppStartup.java +++ b/src/main/java/it/gov/pagopa/fdr/AppStartup.java @@ -2,6 +2,7 @@ import io.quarkus.runtime.Startup; import it.gov.pagopa.fdr.service.conversion.ConversionService; +import it.gov.pagopa.fdr.service.history.HistoryService; import it.gov.pagopa.fdr.service.re.ReService; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.ApplicationScoped; @@ -22,6 +23,8 @@ public class AppStartup { @ConfigProperty(name = "eHub.re.enabled") boolean eHubReEnabled; + @ConfigProperty(name = "history.enabled") + boolean historyEnabled; @Inject Logger log; @Inject Config config; @@ -29,6 +32,7 @@ public class AppStartup { @Inject ConversionService conversionQueue; @Inject ReService reService; + @Inject HistoryService historyService; @PostConstruct public void init() { @@ -52,5 +56,12 @@ public void init() { } else { log.info("Start EventHub Re and blob DISABLED"); } + + if (historyEnabled) { + log.info("History ENABLED"); + historyService.init(); + } else { + log.info("History DISABLED"); + } } } diff --git a/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java b/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java index 651e9d8e..47a1f9ec 100644 --- a/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java +++ b/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java @@ -10,6 +10,8 @@ import it.gov.pagopa.fdr.repository.fdr.model.ReceiverEntity; import it.gov.pagopa.fdr.repository.fdr.model.SenderEntity; import java.time.Instant; + +import it.gov.pagopa.fdr.service.re.model.BlobHttpBody; import lombok.Data; import lombok.EqualsAndHashCode; import org.bson.codecs.pojo.annotations.BsonProperty; @@ -58,6 +60,9 @@ public class FdrPublishEntity extends PanacheMongoEntity { @BsonProperty("sum_payments") private Double sumPayments; + @BsonProperty("ref_json") + private BlobHttpBody refJson; + public static PanacheQuery findByFdrAndRevAndPspIdAndOrganizationId( String fdr, Long rev, String pspId, String organizationId) { return find( diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java new file mode 100644 index 00000000..b431c96d --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java @@ -0,0 +1,179 @@ +package it.gov.pagopa.fdr.service.history; + +import com.azure.core.util.BinaryData; +import com.azure.data.tables.TableClient; +import com.azure.data.tables.TableServiceClient; +import com.azure.data.tables.TableServiceClientBuilder; +import com.azure.data.tables.models.TableEntity; +import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.BlobContainerClient; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import it.gov.pagopa.fdr.exception.AppErrorCodeMessageEnum; +import it.gov.pagopa.fdr.exception.AppException; +import it.gov.pagopa.fdr.repository.fdr.FdrPaymentPublishEntity; +import it.gov.pagopa.fdr.repository.fdr.FdrPublishEntity; +import it.gov.pagopa.fdr.service.history.constants.HistoryConstants; +import it.gov.pagopa.fdr.service.history.mapper.HistoryServiceMapper; +import it.gov.pagopa.fdr.service.history.model.FdrHistoryEntity; +import it.gov.pagopa.fdr.service.history.model.FdrHistoryMongoEntity; +import it.gov.pagopa.fdr.service.history.model.FdrHistoryPaymentEntity; +import it.gov.pagopa.fdr.service.re.model.BlobHttpBody; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import org.eclipse.microprofile.config.inject.ConfigProperty; +import org.jboss.logging.Logger; + +import java.time.Instant; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +@ApplicationScoped +public class HistoryService { + @Inject HistoryServiceMapper mapper; + @Inject Logger logger; + @Inject ObjectMapper objMapper; + @ConfigProperty(name = "blob.history.connect-str") + String blobConnectionsStr; + @ConfigProperty(name = "blob.history.containername") + String blobContainerName; + @ConfigProperty(name = "table.history.connect-str") + String tableStorageConnString; + @ConfigProperty(name = "table.history.tablename.fdrpublish") + String tableNameFdrPublish; + @ConfigProperty(name = "table.history.tablename.fdrpaymentpublish") + String tableNameFdrPaymentPublish; + private BlobContainerClient blobContainerClient; + private TableServiceClient tableServiceClient; + + public void init() { + logger.infof( + "Blob Storage HistoryService service init. Container name [%s]", + blobContainerName + ); + BlobServiceClient blobServiceClient = new BlobServiceClientBuilder().connectionString(blobConnectionsStr).buildClient(); + this.blobContainerClient = blobServiceClient.createBlobContainerIfNotExists(blobContainerName); + this.tableServiceClient = new TableServiceClientBuilder() + .connectionString(tableStorageConnString) + .buildClient(); + this.tableServiceClient.createTableIfNotExists(tableNameFdrPublish); + this.tableServiceClient.createTableIfNotExists(tableNameFdrPaymentPublish); + } + public void saveOnStorage(FdrPublishEntity fdrEntity, List paymentsList) { + if(blobContainerClient != null){ + try { + String partitionKey = createPartitionKey(fdrEntity.getPublished()); + saveFdrOnTableStorage(fdrEntity, partitionKey); + saveFdrPaymentsOnTableStorage(paymentsList, partitionKey); + } catch (JsonProcessingException e) { + logger.error("Error processing fdrHistoryEntity as Bytes", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + } catch (Exception e) { + logger.error("Exception while uploading FDR History", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + } + } + } + + public BlobHttpBody saveJsonFile(FdrPublishEntity fdrEntity, List paymentsList){ + FdrHistoryEntity fdrHistoryEntity = mapper.toFdrHistoryEntity(fdrEntity); + List fdrHistoryPaymentEntityList = mapper.toFdrHistoryPaymentEntityList(paymentsList); + fdrHistoryEntity.setPaymentList(fdrHistoryPaymentEntityList); + String fileName = String.format("%s_%s_%s.json", fdrEntity.getFdr(), fdrEntity.getSender().getPspId(), fdrEntity.getRevision()); + try{ + byte[] jsonBytes = objMapper.writeValueAsBytes(fdrHistoryEntity); + BinaryData jsonFile = BinaryData.fromBytes(jsonBytes); + + BlobClient blobClient = blobContainerClient.getBlobClient(fileName); + blobClient.upload(jsonFile); + + return BlobHttpBody.builder() + .storageAccount(blobContainerClient.getAccountName()) + .containerName(blobContainerName) + .fileName(fileName) + .fileLength(jsonFile.getLength()) + .build(); + }catch (JsonProcessingException e) { + logger.error("Error processing fdrHistoryEntity as Bytes", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + }catch (Exception e){ + logger.error("Error while uploading blob", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + } + } + private String createPartitionKey(Instant publishTime){ + return publishTime.toString().substring(0,10); + } + private void saveFdrOnTableStorage(FdrPublishEntity fdrPublishEntity, String partitionKey) throws JsonProcessingException { + Map fdrPublishMap = new LinkedHashMap<>(); + String id = String.valueOf(fdrPublishEntity.id); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_ID, id); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_REVISION, fdrPublishEntity.getRevision()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_CREATED, fdrPublishEntity.getCreated()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_UPDATED, fdrPublishEntity.getUpdated()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_PUBLISHED, fdrPublishEntity.getPublished()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR, fdrPublishEntity.getFdr()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_DATE, fdrPublishEntity.getFdrDate()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_CONTAINER_NAME, fdrPublishEntity.getRefJson().getContainerName()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_FILE_LENGTH, fdrPublishEntity.getRefJson().getFileLength()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_FILE_NAME, fdrPublishEntity.getRefJson().getFileName()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_STORAGE_ACCOUNT, fdrPublishEntity.getRefJson().getStorageAccount()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_TYPE, fdrPublishEntity.getSender().getType()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_ID, fdrPublishEntity.getSender().getId()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_PSP_ID, fdrPublishEntity.getSender().getPspId()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_PSP_NAME, fdrPublishEntity.getSender().getPspName()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_PSP_BROKER_ID, fdrPublishEntity.getSender().getPspBrokerId()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_CHANNEL_ID, fdrPublishEntity.getSender().getChannelId()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_PASSWORD, fdrPublishEntity.getSender().getPassword()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_RECEIVER_ID, fdrPublishEntity.getReceiver().getId()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_RECEIVER_ORGANIZATION_ID, fdrPublishEntity.getReceiver().getOrganizationId()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_RECEIVER_ORGANIZATION_NAME, fdrPublishEntity.getReceiver().getOrganizationName()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_REGULATION, fdrPublishEntity.getRegulation()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_REGULATION_DATE, fdrPublishEntity.getRegulationDate()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_BIC_CODE_POURING_BANK, fdrPublishEntity.getBicCodePouringBank()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_STATUS, fdrPublishEntity.getStatus()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_COMPUTED_TOT_PAYMENTS, fdrPublishEntity.getComputedTotPayments()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_COMPUTED_SUM_PAYMENTS, fdrPublishEntity.getComputedSumPayments()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_TOT_PAYMENTS, fdrPublishEntity.getTotPayments()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SUM_PAYMENTS, fdrPublishEntity.getSumPayments()); + + + logger.info("Send to "+tableNameFdrPublish+" record with "+HistoryConstants.FDR_PUBLISH_ID+"="+id); + TableClient tableClient = this.tableServiceClient.getTableClient(tableNameFdrPublish); + TableEntity entity = new TableEntity(partitionKey, id); + entity.setProperties(fdrPublishMap); + tableClient.createEntity(entity); + } + + private void saveFdrPaymentsOnTableStorage(List paymentsList, String partitionKey) throws JsonProcessingException { + paymentsList.forEach(payment -> { + Map paymentMap = new LinkedHashMap<>(); + String id = String.valueOf(payment.id); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_ID, id); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REVISION, payment.getRevision()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_ID, String.valueOf(payment.getRefFdrId())); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_CREATED, payment.getCreated()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_UPDATED, payment.getUpdated()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_IUV, payment.getIuv()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_IUR, payment.getIur()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_INDEX, payment.getIndex()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY, payment.getPay()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY_STATUS, payment.getPayStatus()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY_DATE, payment.getPayDate()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR, payment.getRefFdr()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_SENDER_PSP_ID, payment.getRefFdrSenderPspId()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_REVISION, payment.getRefFdrRevision()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_RECEIVER_ORGANIZATION_ID, payment.getRefFdrReceiverOrganizationId()); + + + logger.info("Send to "+tableNameFdrPaymentPublish+" record with "+HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_ID+"="+id); + TableClient tableClient = this.tableServiceClient.getTableClient(tableNameFdrPaymentPublish); + TableEntity entity = new TableEntity(partitionKey, id+"-"+payment.getIndex()); + entity.setProperties(paymentMap); + tableClient.createEntity(entity); + }); + } +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java b/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java new file mode 100644 index 00000000..ce3bf6a8 --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java @@ -0,0 +1,49 @@ +package it.gov.pagopa.fdr.service.history.constants; + +public class HistoryConstants { + public static final String FDR_PUBLISH_ID = "id"; + public static final String FDR_PUBLISH_REVISION = "revision"; + public static final String FDR_PUBLISH_CREATED = "created"; + public static final String FDR_PUBLISH_UPDATED = "updated"; + public static final String FDR_PUBLISH_PUBLISHED = "published"; + public static final String FDR_PUBLISH_FDR = "fdr"; + public static final String FDR_PUBLISH_FDR_DATE = "fdr_date"; + public static final String FDR_PUBLISH_FDR_REF_JSON_CONTAINER_NAME = "ref_json.container_name"; + public static final String FDR_PUBLISH_FDR_REF_JSON_FILE_LENGTH = "ref_json.file_length"; + public static final String FDR_PUBLISH_FDR_REF_JSON_FILE_NAME = "ref_json.file_name"; + public static final String FDR_PUBLISH_FDR_REF_JSON_STORAGE_ACCOUNT = "ref_json.storage_account"; + public static final String FDR_PUBLISH_SENDER_TYPE = "sender.type"; + public static final String FDR_PUBLISH_SENDER_ID = "sender.id"; + public static final String FDR_PUBLISH_SENDER_PSP_ID = "sender.psp_id"; + public static final String FDR_PUBLISH_SENDER_PSP_NAME = "sender.psp_name"; + public static final String FDR_PUBLISH_SENDER_PSP_BROKER_ID = "sender.psp_broker_id"; + public static final String FDR_PUBLISH_SENDER_CHANNEL_ID = "sender.channel_id"; + public static final String FDR_PUBLISH_SENDER_PASSWORD = "sender.password"; + public static final String FDR_PUBLISH_RECEIVER_ID = "receiver.id"; + public static final String FDR_PUBLISH_RECEIVER_ORGANIZATION_ID = "receiver.organization_id"; + public static final String FDR_PUBLISH_RECEIVER_ORGANIZATION_NAME = "receiver.organization_name"; + public static final String FDR_PUBLISH_REGULATION = "regulation"; + public static final String FDR_PUBLISH_REGULATION_DATE = "regulation_date"; + public static final String FDR_PUBLISH_BIC_CODE_POURING_BANK = "bic_code_pouring_bank"; + public static final String FDR_PUBLISH_STATUS = "status"; + public static final String FDR_PUBLISH_COMPUTED_TOT_PAYMENTS = "computed_tot_payments"; + public static final String FDR_PUBLISH_COMPUTED_SUM_PAYMENTS = "computed_sum_payments"; + public static final String FDR_PUBLISH_TOT_PAYMENTS = "tot_payments"; + public static final String FDR_PUBLISH_SUM_PAYMENTS = "sum_payments"; + + public static final String FDR_PAYMENT_PUBLISH_ID = "id"; + public static final String FDR_PAYMENT_PUBLISH_REVISION = "revision"; + public static final String FDR_PAYMENT_PUBLISH_CREATED = "created"; + public static final String FDR_PAYMENT_PUBLISH_UPDATED = "updated"; + public static final String FDR_PAYMENT_PUBLISH_IUV = "iuv"; + public static final String FDR_PAYMENT_PUBLISH_IUR = "iur"; + public static final String FDR_PAYMENT_PUBLISH_INDEX = "index"; + public static final String FDR_PAYMENT_PUBLISH_PAY = "pay"; + public static final String FDR_PAYMENT_PUBLISH_PAY_STATUS = "pay_status"; + public static final String FDR_PAYMENT_PUBLISH_PAY_DATE = "pay_date"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR_ID = "ref_fdr_id"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR = "ref_fdr"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR_SENDER_PSP_ID = "ref_fdr_sender_psp_id"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR_REVISION = "ref_fdr_revision"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR_RECEIVER_ORGANIZATION_ID = "ref_fdr_receiver_organization_id"; +} diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java b/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java new file mode 100644 index 00000000..42e93209 --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java @@ -0,0 +1,28 @@ +package it.gov.pagopa.fdr.service.history.mapper; + +import it.gov.pagopa.fdr.repository.fdr.FdrInsertEntity; +import it.gov.pagopa.fdr.repository.fdr.FdrPaymentInsertEntity; +import it.gov.pagopa.fdr.repository.fdr.FdrPaymentPublishEntity; +import it.gov.pagopa.fdr.repository.fdr.FdrPublishEntity; +import it.gov.pagopa.fdr.service.history.model.FdrHistoryEntity; +import it.gov.pagopa.fdr.service.history.model.FdrHistoryMongoEntity; +import it.gov.pagopa.fdr.service.history.model.FdrHistoryPaymentEntity; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingConstants.ComponentModel; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper(componentModel = ComponentModel.JAKARTA) +public interface HistoryServiceMapper { + + HistoryServiceMapper INSTANCE = Mappers.getMapper(HistoryServiceMapper.class); + @Mapping(target = "paymentList", ignore = true) + FdrHistoryEntity toFdrHistoryEntity(FdrPublishEntity fdrEntity); + + FdrHistoryPaymentEntity toFdrHistoryPaymentEntity(FdrPaymentPublishEntity fdrPaymentPublishEntity); + List toFdrHistoryPaymentEntityList(List fdrPaymentPublishEntities); + + FdrHistoryMongoEntity toFdrHistoryMongoEntity(FdrHistoryEntity fdrHistoryEntity); +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryEntity.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryEntity.java new file mode 100644 index 00000000..cfdbd78b --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryEntity.java @@ -0,0 +1,58 @@ +package it.gov.pagopa.fdr.service.history.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import it.gov.pagopa.fdr.repository.fdr.FdrPaymentInsertEntity; +import it.gov.pagopa.fdr.repository.fdr.model.FdrStatusEnumEntity; +import it.gov.pagopa.fdr.repository.fdr.model.ReceiverEntity; +import it.gov.pagopa.fdr.repository.fdr.model.SenderEntity; +import lombok.*; +import org.bson.codecs.pojo.annotations.BsonProperty; +import java.time.Instant; +import java.util.List; + +@Data +@Builder +public class FdrHistoryEntity { + + private FdrStatusEnumEntity status; + + private Long revision; + + private Instant created; + + private Instant updated; + + private String fdr; + + @BsonProperty("fdr_date") + private Instant fdrDate; + + private String regulation; + + @BsonProperty("regulation_date") + private Instant regulationDate; + + @BsonProperty("bic_code_pouring_bank") + private String bicCodePouringBank; + + private SenderEntity sender; + + private ReceiverEntity receiver; + + private Instant published; + + @BsonProperty("computed_tot_payments") + private Long computedTotPayments; + + @BsonProperty("computed_sum_payments") + private Double computedSumPayments; + + @BsonProperty("tot_payments") + private Long totPayments; + + @BsonProperty("sum_payments") + private Double sumPayments; + + @Setter + private List paymentList; +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java new file mode 100644 index 00000000..9def4216 --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java @@ -0,0 +1,40 @@ +package it.gov.pagopa.fdr.service.history.model; + +import io.quarkus.mongodb.panache.PanacheMongoEntity; +import io.quarkus.mongodb.panache.common.MongoEntity; +import it.gov.pagopa.fdr.repository.fdr.model.FdrStatusEnumEntity; +import it.gov.pagopa.fdr.repository.fdr.model.ReceiverEntity; +import it.gov.pagopa.fdr.repository.fdr.model.SenderEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.bson.codecs.pojo.annotations.BsonProperty; +import java.time.Instant; + +@Data +@EqualsAndHashCode(callSuper = true) +@MongoEntity(collection = "fdr_history") +public class FdrHistoryMongoEntity extends PanacheMongoEntity { + + private Long revision; + + private Instant created; + + private Instant updated; + + private Instant published; + + private String fdr; + + @BsonProperty("fdr_date") + private Instant fdrDate; + + private SenderEntity sender; + + private ReceiverEntity receiver; + + private String bicCodePouringBank; + + private FdrStatusEnumEntity status; + + private FdrHistoryEntity jsonFile; +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryPaymentEntity.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryPaymentEntity.java new file mode 100644 index 00000000..a304106c --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryPaymentEntity.java @@ -0,0 +1,64 @@ +package it.gov.pagopa.fdr.service.history.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.quarkus.mongodb.panache.PanacheMongoEntity; +import io.quarkus.mongodb.panache.PanacheMongoEntityBase; +import io.quarkus.mongodb.panache.PanacheQuery; +import io.quarkus.mongodb.panache.common.MongoEntity; +import io.quarkus.panache.common.Parameters; +import io.quarkus.panache.common.Sort; +import it.gov.pagopa.fdr.repository.fdr.model.PaymentStatusEnumEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.bson.codecs.pojo.annotations.BsonProperty; +import org.bson.types.ObjectId; + +import java.time.Instant; +import java.util.List; + +@Data +public class FdrHistoryPaymentEntity { + + private String iuv; + + private String iur; + + private Long index; + + private Double pay; + + @JsonIgnore + private Long revision; + + @JsonIgnore + private Instant created; + + @JsonIgnore + private Instant updated; + + @BsonProperty("pay_status") + private PaymentStatusEnumEntity payStatus; + + @BsonProperty("pay_date") + private Instant payDate; + + @JsonIgnore + @BsonProperty("ref_fdr_id") + private ObjectId refFdrId; + + @JsonIgnore + @BsonProperty("ref_fdr") + private String refFdr; + + @JsonIgnore + @BsonProperty("ref_fdr_sender_psp_id") + private String refFdrSenderPspId; + + @JsonIgnore + @BsonProperty("ref_fdr_revision") + private Long refFdrRevision; + + @JsonIgnore + @BsonProperty("ref_fdr_receiver_organization_id") + private String refFdrReceiverOrganizationId; +} diff --git a/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java b/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java index 52b7bac3..687a4dea 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java @@ -21,18 +21,16 @@ import it.gov.pagopa.fdr.service.conversion.ConversionService; import it.gov.pagopa.fdr.service.conversion.message.FdrMessage; import it.gov.pagopa.fdr.service.dto.*; +import it.gov.pagopa.fdr.service.history.HistoryService; import it.gov.pagopa.fdr.service.psps.mapper.PspsServiceServiceMapper; import it.gov.pagopa.fdr.service.re.ReService; -import it.gov.pagopa.fdr.service.re.model.AppVersionEnum; -import it.gov.pagopa.fdr.service.re.model.EventTypeEnum; -import it.gov.pagopa.fdr.service.re.model.FdrActionEnum; -import it.gov.pagopa.fdr.service.re.model.FdrStatusEnum; -import it.gov.pagopa.fdr.service.re.model.ReInternal; +import it.gov.pagopa.fdr.service.re.model.*; import it.gov.pagopa.fdr.util.AppDBUtil; import it.gov.pagopa.fdr.util.AppMessageUtil; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import java.math.BigDecimal; +import java.sql.Blob; import java.time.Instant; import java.util.ArrayList; import java.util.List; @@ -53,6 +51,8 @@ public class PspsService { @Inject ReService reService; + @Inject HistoryService historyService; + @WithSpan(kind = SERVER) public void save(String action, FdrDto fdrDto) { log.infof(AppMessageUtil.logExecute(action)); @@ -300,16 +300,23 @@ public void publishByFdr(String action, String pspId, String fdr, boolean intern .project(FdrPaymentInsertEntity.class) .list(); + FdrPublishEntity fdrPublishEntity = mapper.toFdrPublishEntity(fdrEntity); Instant now = Instant.now(); fdrPublishEntity.setUpdated(now); fdrPublishEntity.setPublished(now); fdrPublishEntity.setStatus(FdrStatusEnumEntity.PUBLISHED); - fdrPublishEntity.persistEntity(); List fdrPaymentPublishEntities = mapper.toFdrPaymentPublishEntityList(paymentInsertEntities); FdrPaymentPublishEntity.persistFdrPaymentPublishEntities(fdrPaymentPublishEntities); + // salva su storage dello storico + BlobHttpBody body = historyService.saveJsonFile(fdrPublishEntity, fdrPaymentPublishEntities); + fdrPublishEntity.setRefJson(body); + fdrPublishEntity.persistEntity(); + + historyService.saveOnStorage(fdrPublishEntity, fdrPaymentPublishEntities); + log.debug("Delete FdrInsertEntity"); fdrEntity.delete(); log.debugf( diff --git a/src/main/java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java b/src/main/java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java index a21b55a1..c3cee712 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java +++ b/src/main/java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java @@ -2,14 +2,21 @@ import lombok.Builder; import lombok.Data; +import org.bson.codecs.pojo.annotations.BsonProperty; @Data @Builder public class BlobHttpBody { + @BsonProperty("storage_account") private String storageAccount; + + @BsonProperty("container_name") private String containerName; + + @BsonProperty("file_name") private String fileName; + @BsonProperty("file_length") private long fileLength; } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d20f2f2a..90edadbf 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -164,6 +164,21 @@ blob.re.containername=${BLOB_RE_CONTAINER_NAME:${mockserver.azurite.container-na %openapi_psp.blob.re.containername=na %openapi_organization.blob.re.containername=na +################### +## BLOB HISTORY +################### +history.enabled=true +blob.history.connect-str=${BLOB_HISTORY_CONNECTION_STRING:${mockserver.azurite.connection-string}} +%dev.blob.history.connect-str=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1; +blob.history.containername=${BLOB_HISTORY_CONTAINER_NAME:${mockserver.azurite.history.container-name}} +%dev.blob.history.containername=fdrhistory + +table.history.connect-str=${TABLE_HISTORY_CONNECTION_STRING:${mockserver.azurite.connection-string}} +%dev.table.history.connect-str=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1; +table.history.tablename.fdrpublish=${TABLE_HISTORY_FDR_PUBLISH_TABLE:${mockserver.azurite.table.fdrpublish}} +%dev.table.history.tablename.fdrpublish=fdrpublish +table.history.tablename.fdrpaymentpublish=${TABLE_HISTORY_FDR_PAYMENT_PUBLISH_TABLE:${mockserver.azurite.table.fdrpaymentpublish}} +%dev.table.history.tablename.fdrpaymentpublish=fdrpaymentpublish ################### ## OPENAPI FILTER diff --git a/src/test/java/it/gov/pagopa/fdr/test/util/AzuriteResource.java b/src/test/java/it/gov/pagopa/fdr/test/util/AzuriteResource.java index 4dbc8de8..e2c041e8 100644 --- a/src/test/java/it/gov/pagopa/fdr/test/util/AzuriteResource.java +++ b/src/test/java/it/gov/pagopa/fdr/test/util/AzuriteResource.java @@ -29,11 +29,13 @@ public Map start() { + "/devstoreaccount1;"; String queueName = "queueconversionTest"; String containerName = "blobContainerReTest"; + String historyContainerName = "blobContainerHistoryTest"; Map conf = new HashMap<>(); conf.put("mockserver.azurite.connection-string", connectStr); conf.put("mockserver.azurite.queue-name", queueName); conf.put("mockserver.azurite.container-name", containerName); + conf.put("mockserver.azurite.history.container-name", historyContainerName); return conf; } From b28ffb2c1ceb5d660bf5e0fcaa5c9393f87ae279 Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Tue, 23 Jan 2024 11:40:44 +0100 Subject: [PATCH 02/11] WIP --- .../java/it/gov/pagopa/fdr/service/history/HistoryService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java index b431c96d..6fa2067b 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java @@ -141,6 +141,7 @@ private void saveFdrOnTableStorage(FdrPublishEntity fdrPublishEntity, String par fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SUM_PAYMENTS, fdrPublishEntity.getSumPayments()); + logger.info("Send to "+tableNameFdrPublish+" record with "+HistoryConstants.FDR_PUBLISH_ID+"="+id); TableClient tableClient = this.tableServiceClient.getTableClient(tableNameFdrPublish); TableEntity entity = new TableEntity(partitionKey, id); From d0cf80ff0dbcdb52723eea553f91a5ce77df6fb9 Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Tue, 23 Jan 2024 12:16:47 +0100 Subject: [PATCH 03/11] NOD-642 Format code --- .../java/it/gov/pagopa/fdr/AppStartup.java | 1 + .../fdr/repository/fdr/FdrPublishEntity.java | 3 +- .../fdr/service/history/HistoryService.java | 348 ++++++++++-------- .../history/constants/HistoryConstants.java | 89 ++--- .../history/mapper/HistoryServiceMapper.java | 23 +- .../history/model/FdrHistoryEntity.java | 11 +- .../history/model/FdrHistoryMongoEntity.java | 4 +- .../model/FdrHistoryPaymentEntity.java | 20 +- .../pagopa/fdr/service/psps/PspsService.java | 2 - 9 files changed, 273 insertions(+), 228 deletions(-) diff --git a/src/main/java/it/gov/pagopa/fdr/AppStartup.java b/src/main/java/it/gov/pagopa/fdr/AppStartup.java index 8bf289bd..f59f0c08 100644 --- a/src/main/java/it/gov/pagopa/fdr/AppStartup.java +++ b/src/main/java/it/gov/pagopa/fdr/AppStartup.java @@ -25,6 +25,7 @@ public class AppStartup { @ConfigProperty(name = "history.enabled") boolean historyEnabled; + @Inject Logger log; @Inject Config config; diff --git a/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java b/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java index 47a1f9ec..0a72ab1b 100644 --- a/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java +++ b/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java @@ -9,9 +9,8 @@ import it.gov.pagopa.fdr.repository.fdr.model.FdrStatusEnumEntity; import it.gov.pagopa.fdr.repository.fdr.model.ReceiverEntity; import it.gov.pagopa.fdr.repository.fdr.model.SenderEntity; -import java.time.Instant; - import it.gov.pagopa.fdr.service.re.model.BlobHttpBody; +import java.time.Instant; import lombok.Data; import lombok.EqualsAndHashCode; import org.bson.codecs.pojo.annotations.BsonProperty; diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java index 6fa2067b..c37ca223 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java @@ -18,163 +18,223 @@ import it.gov.pagopa.fdr.service.history.constants.HistoryConstants; import it.gov.pagopa.fdr.service.history.mapper.HistoryServiceMapper; import it.gov.pagopa.fdr.service.history.model.FdrHistoryEntity; -import it.gov.pagopa.fdr.service.history.model.FdrHistoryMongoEntity; import it.gov.pagopa.fdr.service.history.model.FdrHistoryPaymentEntity; import it.gov.pagopa.fdr.service.re.model.BlobHttpBody; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import org.eclipse.microprofile.config.inject.ConfigProperty; -import org.jboss.logging.Logger; - import java.time.Instant; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.eclipse.microprofile.config.inject.ConfigProperty; +import org.jboss.logging.Logger; @ApplicationScoped public class HistoryService { - @Inject HistoryServiceMapper mapper; - @Inject Logger logger; - @Inject ObjectMapper objMapper; - @ConfigProperty(name = "blob.history.connect-str") - String blobConnectionsStr; - @ConfigProperty(name = "blob.history.containername") - String blobContainerName; - @ConfigProperty(name = "table.history.connect-str") - String tableStorageConnString; - @ConfigProperty(name = "table.history.tablename.fdrpublish") - String tableNameFdrPublish; - @ConfigProperty(name = "table.history.tablename.fdrpaymentpublish") - String tableNameFdrPaymentPublish; - private BlobContainerClient blobContainerClient; - private TableServiceClient tableServiceClient; - - public void init() { - logger.infof( - "Blob Storage HistoryService service init. Container name [%s]", - blobContainerName - ); - BlobServiceClient blobServiceClient = new BlobServiceClientBuilder().connectionString(blobConnectionsStr).buildClient(); - this.blobContainerClient = blobServiceClient.createBlobContainerIfNotExists(blobContainerName); - this.tableServiceClient = new TableServiceClientBuilder() - .connectionString(tableStorageConnString) - .buildClient(); - this.tableServiceClient.createTableIfNotExists(tableNameFdrPublish); - this.tableServiceClient.createTableIfNotExists(tableNameFdrPaymentPublish); - } - public void saveOnStorage(FdrPublishEntity fdrEntity, List paymentsList) { - if(blobContainerClient != null){ - try { - String partitionKey = createPartitionKey(fdrEntity.getPublished()); - saveFdrOnTableStorage(fdrEntity, partitionKey); - saveFdrPaymentsOnTableStorage(paymentsList, partitionKey); - } catch (JsonProcessingException e) { - logger.error("Error processing fdrHistoryEntity as Bytes", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); - } catch (Exception e) { - logger.error("Exception while uploading FDR History", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); - } - } - } + @Inject HistoryServiceMapper mapper; + @Inject Logger logger; + @Inject ObjectMapper objMapper; - public BlobHttpBody saveJsonFile(FdrPublishEntity fdrEntity, List paymentsList){ - FdrHistoryEntity fdrHistoryEntity = mapper.toFdrHistoryEntity(fdrEntity); - List fdrHistoryPaymentEntityList = mapper.toFdrHistoryPaymentEntityList(paymentsList); - fdrHistoryEntity.setPaymentList(fdrHistoryPaymentEntityList); - String fileName = String.format("%s_%s_%s.json", fdrEntity.getFdr(), fdrEntity.getSender().getPspId(), fdrEntity.getRevision()); - try{ - byte[] jsonBytes = objMapper.writeValueAsBytes(fdrHistoryEntity); - BinaryData jsonFile = BinaryData.fromBytes(jsonBytes); - - BlobClient blobClient = blobContainerClient.getBlobClient(fileName); - blobClient.upload(jsonFile); - - return BlobHttpBody.builder() - .storageAccount(blobContainerClient.getAccountName()) - .containerName(blobContainerName) - .fileName(fileName) - .fileLength(jsonFile.getLength()) - .build(); - }catch (JsonProcessingException e) { - logger.error("Error processing fdrHistoryEntity as Bytes", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); - }catch (Exception e){ - logger.error("Error while uploading blob", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); - } - } - private String createPartitionKey(Instant publishTime){ - return publishTime.toString().substring(0,10); + @ConfigProperty(name = "blob.history.connect-str") + String blobConnectionsStr; + + @ConfigProperty(name = "blob.history.containername") + String blobContainerName; + + @ConfigProperty(name = "table.history.connect-str") + String tableStorageConnString; + + @ConfigProperty(name = "table.history.tablename.fdrpublish") + String tableNameFdrPublish; + + @ConfigProperty(name = "table.history.tablename.fdrpaymentpublish") + String tableNameFdrPaymentPublish; + + private BlobContainerClient blobContainerClient; + private TableServiceClient tableServiceClient; + + public void init() { + logger.infof( + "Blob Storage HistoryService service init. Container name [%s]", blobContainerName); + BlobServiceClient blobServiceClient = + new BlobServiceClientBuilder().connectionString(blobConnectionsStr).buildClient(); + this.blobContainerClient = blobServiceClient.createBlobContainerIfNotExists(blobContainerName); + this.tableServiceClient = + new TableServiceClientBuilder().connectionString(tableStorageConnString).buildClient(); + this.tableServiceClient.createTableIfNotExists(tableNameFdrPublish); + this.tableServiceClient.createTableIfNotExists(tableNameFdrPaymentPublish); + } + + public void saveOnStorage( + FdrPublishEntity fdrEntity, List paymentsList) { + if (blobContainerClient != null) { + try { + String partitionKey = createPartitionKey(fdrEntity.getPublished()); + saveFdrOnTableStorage(fdrEntity, partitionKey); + saveFdrPaymentsOnTableStorage(paymentsList, partitionKey); + } catch (JsonProcessingException e) { + logger.error("Error processing fdrHistoryEntity as Bytes", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + } catch (Exception e) { + logger.error("Exception while uploading FDR History", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + } } - private void saveFdrOnTableStorage(FdrPublishEntity fdrPublishEntity, String partitionKey) throws JsonProcessingException { - Map fdrPublishMap = new LinkedHashMap<>(); - String id = String.valueOf(fdrPublishEntity.id); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_ID, id); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_REVISION, fdrPublishEntity.getRevision()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_CREATED, fdrPublishEntity.getCreated()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_UPDATED, fdrPublishEntity.getUpdated()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_PUBLISHED, fdrPublishEntity.getPublished()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR, fdrPublishEntity.getFdr()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_DATE, fdrPublishEntity.getFdrDate()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_CONTAINER_NAME, fdrPublishEntity.getRefJson().getContainerName()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_FILE_LENGTH, fdrPublishEntity.getRefJson().getFileLength()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_FILE_NAME, fdrPublishEntity.getRefJson().getFileName()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_STORAGE_ACCOUNT, fdrPublishEntity.getRefJson().getStorageAccount()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_TYPE, fdrPublishEntity.getSender().getType()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_ID, fdrPublishEntity.getSender().getId()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_PSP_ID, fdrPublishEntity.getSender().getPspId()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_PSP_NAME, fdrPublishEntity.getSender().getPspName()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_PSP_BROKER_ID, fdrPublishEntity.getSender().getPspBrokerId()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_CHANNEL_ID, fdrPublishEntity.getSender().getChannelId()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_PASSWORD, fdrPublishEntity.getSender().getPassword()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_RECEIVER_ID, fdrPublishEntity.getReceiver().getId()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_RECEIVER_ORGANIZATION_ID, fdrPublishEntity.getReceiver().getOrganizationId()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_RECEIVER_ORGANIZATION_NAME, fdrPublishEntity.getReceiver().getOrganizationName()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_REGULATION, fdrPublishEntity.getRegulation()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_REGULATION_DATE, fdrPublishEntity.getRegulationDate()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_BIC_CODE_POURING_BANK, fdrPublishEntity.getBicCodePouringBank()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_STATUS, fdrPublishEntity.getStatus()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_COMPUTED_TOT_PAYMENTS, fdrPublishEntity.getComputedTotPayments()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_COMPUTED_SUM_PAYMENTS, fdrPublishEntity.getComputedSumPayments()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_TOT_PAYMENTS, fdrPublishEntity.getTotPayments()); - fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SUM_PAYMENTS, fdrPublishEntity.getSumPayments()); - - - - logger.info("Send to "+tableNameFdrPublish+" record with "+HistoryConstants.FDR_PUBLISH_ID+"="+id); - TableClient tableClient = this.tableServiceClient.getTableClient(tableNameFdrPublish); - TableEntity entity = new TableEntity(partitionKey, id); - entity.setProperties(fdrPublishMap); - tableClient.createEntity(entity); + } + + public BlobHttpBody saveJsonFile( + FdrPublishEntity fdrEntity, List paymentsList) { + FdrHistoryEntity fdrHistoryEntity = mapper.toFdrHistoryEntity(fdrEntity); + List fdrHistoryPaymentEntityList = + mapper.toFdrHistoryPaymentEntityList(paymentsList); + fdrHistoryEntity.setPaymentList(fdrHistoryPaymentEntityList); + String fileName = + String.format( + "%s_%s_%s.json", + fdrEntity.getFdr(), fdrEntity.getSender().getPspId(), fdrEntity.getRevision()); + try { + byte[] jsonBytes = objMapper.writeValueAsBytes(fdrHistoryEntity); + BinaryData jsonFile = BinaryData.fromBytes(jsonBytes); + + BlobClient blobClient = blobContainerClient.getBlobClient(fileName); + blobClient.upload(jsonFile); + + return BlobHttpBody.builder() + .storageAccount(blobContainerClient.getAccountName()) + .containerName(blobContainerName) + .fileName(fileName) + .fileLength(jsonFile.getLength()) + .build(); + } catch (JsonProcessingException e) { + logger.error("Error processing fdrHistoryEntity as Bytes", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + } catch (Exception e) { + logger.error("Error while uploading blob", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); } + } - private void saveFdrPaymentsOnTableStorage(List paymentsList, String partitionKey) throws JsonProcessingException { - paymentsList.forEach(payment -> { - Map paymentMap = new LinkedHashMap<>(); - String id = String.valueOf(payment.id); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_ID, id); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REVISION, payment.getRevision()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_ID, String.valueOf(payment.getRefFdrId())); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_CREATED, payment.getCreated()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_UPDATED, payment.getUpdated()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_IUV, payment.getIuv()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_IUR, payment.getIur()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_INDEX, payment.getIndex()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY, payment.getPay()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY_STATUS, payment.getPayStatus()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY_DATE, payment.getPayDate()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR, payment.getRefFdr()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_SENDER_PSP_ID, payment.getRefFdrSenderPspId()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_REVISION, payment.getRefFdrRevision()); - paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_RECEIVER_ORGANIZATION_ID, payment.getRefFdrReceiverOrganizationId()); - - - logger.info("Send to "+tableNameFdrPaymentPublish+" record with "+HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_ID+"="+id); - TableClient tableClient = this.tableServiceClient.getTableClient(tableNameFdrPaymentPublish); - TableEntity entity = new TableEntity(partitionKey, id+"-"+payment.getIndex()); - entity.setProperties(paymentMap); - tableClient.createEntity(entity); + private String createPartitionKey(Instant publishTime) { + return publishTime.toString().substring(0, 10); + } + + private void saveFdrOnTableStorage(FdrPublishEntity fdrPublishEntity, String partitionKey) + throws JsonProcessingException { + Map fdrPublishMap = new LinkedHashMap<>(); + String id = String.valueOf(fdrPublishEntity.id); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_ID, id); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_REVISION, fdrPublishEntity.getRevision()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_CREATED, fdrPublishEntity.getCreated()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_UPDATED, fdrPublishEntity.getUpdated()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_PUBLISHED, fdrPublishEntity.getPublished()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR, fdrPublishEntity.getFdr()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_FDR_DATE, fdrPublishEntity.getFdrDate()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_CONTAINER_NAME, + fdrPublishEntity.getRefJson().getContainerName()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_FILE_LENGTH, + fdrPublishEntity.getRefJson().getFileLength()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_FILE_NAME, + fdrPublishEntity.getRefJson().getFileName()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_STORAGE_ACCOUNT, + fdrPublishEntity.getRefJson().getStorageAccount()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_SENDER_TYPE, fdrPublishEntity.getSender().getType()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_ID, fdrPublishEntity.getSender().getId()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_SENDER_PSP_ID, fdrPublishEntity.getSender().getPspId()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_SENDER_PSP_NAME, fdrPublishEntity.getSender().getPspName()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_SENDER_PSP_BROKER_ID, + fdrPublishEntity.getSender().getPspBrokerId()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_SENDER_CHANNEL_ID, + fdrPublishEntity.getSender().getChannelId()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_SENDER_PASSWORD, fdrPublishEntity.getSender().getPassword()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_RECEIVER_ID, fdrPublishEntity.getReceiver().getId()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_RECEIVER_ORGANIZATION_ID, + fdrPublishEntity.getReceiver().getOrganizationId()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_RECEIVER_ORGANIZATION_NAME, + fdrPublishEntity.getReceiver().getOrganizationName()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_REGULATION, fdrPublishEntity.getRegulation()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_REGULATION_DATE, fdrPublishEntity.getRegulationDate()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_BIC_CODE_POURING_BANK, + fdrPublishEntity.getBicCodePouringBank()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_STATUS, fdrPublishEntity.getStatus()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_COMPUTED_TOT_PAYMENTS, + fdrPublishEntity.getComputedTotPayments()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_COMPUTED_SUM_PAYMENTS, + fdrPublishEntity.getComputedSumPayments()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_TOT_PAYMENTS, fdrPublishEntity.getTotPayments()); + fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SUM_PAYMENTS, fdrPublishEntity.getSumPayments()); + + logger.info( + "Send to " + + tableNameFdrPublish + + " record with " + + HistoryConstants.FDR_PUBLISH_ID + + "=" + + id); + TableClient tableClient = this.tableServiceClient.getTableClient(tableNameFdrPublish); + TableEntity entity = new TableEntity(partitionKey, id); + entity.setProperties(fdrPublishMap); + tableClient.createEntity(entity); + } + + private void saveFdrPaymentsOnTableStorage( + List paymentsList, String partitionKey) + throws JsonProcessingException { + paymentsList.forEach( + payment -> { + Map paymentMap = new LinkedHashMap<>(); + String id = String.valueOf(payment.id); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_ID, id); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REVISION, payment.getRevision()); + paymentMap.put( + HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_ID, + String.valueOf(payment.getRefFdrId())); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_CREATED, payment.getCreated()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_UPDATED, payment.getUpdated()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_IUV, payment.getIuv()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_IUR, payment.getIur()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_INDEX, payment.getIndex()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY, payment.getPay()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY_STATUS, payment.getPayStatus()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_PAY_DATE, payment.getPayDate()); + paymentMap.put(HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR, payment.getRefFdr()); + paymentMap.put( + HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_SENDER_PSP_ID, + payment.getRefFdrSenderPspId()); + paymentMap.put( + HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_REVISION, payment.getRefFdrRevision()); + paymentMap.put( + HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_RECEIVER_ORGANIZATION_ID, + payment.getRefFdrReceiverOrganizationId()); + + logger.info( + "Send to " + + tableNameFdrPaymentPublish + + " record with " + + HistoryConstants.FDR_PAYMENT_PUBLISH_REF_FDR_ID + + "=" + + id); + TableClient tableClient = + this.tableServiceClient.getTableClient(tableNameFdrPaymentPublish); + TableEntity entity = new TableEntity(partitionKey, id + "-" + payment.getIndex()); + entity.setProperties(paymentMap); + tableClient.createEntity(entity); }); - } -} \ No newline at end of file + } +} diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java b/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java index ce3bf6a8..6f0cbdca 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java @@ -1,49 +1,50 @@ package it.gov.pagopa.fdr.service.history.constants; public class HistoryConstants { - public static final String FDR_PUBLISH_ID = "id"; - public static final String FDR_PUBLISH_REVISION = "revision"; - public static final String FDR_PUBLISH_CREATED = "created"; - public static final String FDR_PUBLISH_UPDATED = "updated"; - public static final String FDR_PUBLISH_PUBLISHED = "published"; - public static final String FDR_PUBLISH_FDR = "fdr"; - public static final String FDR_PUBLISH_FDR_DATE = "fdr_date"; - public static final String FDR_PUBLISH_FDR_REF_JSON_CONTAINER_NAME = "ref_json.container_name"; - public static final String FDR_PUBLISH_FDR_REF_JSON_FILE_LENGTH = "ref_json.file_length"; - public static final String FDR_PUBLISH_FDR_REF_JSON_FILE_NAME = "ref_json.file_name"; - public static final String FDR_PUBLISH_FDR_REF_JSON_STORAGE_ACCOUNT = "ref_json.storage_account"; - public static final String FDR_PUBLISH_SENDER_TYPE = "sender.type"; - public static final String FDR_PUBLISH_SENDER_ID = "sender.id"; - public static final String FDR_PUBLISH_SENDER_PSP_ID = "sender.psp_id"; - public static final String FDR_PUBLISH_SENDER_PSP_NAME = "sender.psp_name"; - public static final String FDR_PUBLISH_SENDER_PSP_BROKER_ID = "sender.psp_broker_id"; - public static final String FDR_PUBLISH_SENDER_CHANNEL_ID = "sender.channel_id"; - public static final String FDR_PUBLISH_SENDER_PASSWORD = "sender.password"; - public static final String FDR_PUBLISH_RECEIVER_ID = "receiver.id"; - public static final String FDR_PUBLISH_RECEIVER_ORGANIZATION_ID = "receiver.organization_id"; - public static final String FDR_PUBLISH_RECEIVER_ORGANIZATION_NAME = "receiver.organization_name"; - public static final String FDR_PUBLISH_REGULATION = "regulation"; - public static final String FDR_PUBLISH_REGULATION_DATE = "regulation_date"; - public static final String FDR_PUBLISH_BIC_CODE_POURING_BANK = "bic_code_pouring_bank"; - public static final String FDR_PUBLISH_STATUS = "status"; - public static final String FDR_PUBLISH_COMPUTED_TOT_PAYMENTS = "computed_tot_payments"; - public static final String FDR_PUBLISH_COMPUTED_SUM_PAYMENTS = "computed_sum_payments"; - public static final String FDR_PUBLISH_TOT_PAYMENTS = "tot_payments"; - public static final String FDR_PUBLISH_SUM_PAYMENTS = "sum_payments"; + public static final String FDR_PUBLISH_ID = "id"; + public static final String FDR_PUBLISH_REVISION = "revision"; + public static final String FDR_PUBLISH_CREATED = "created"; + public static final String FDR_PUBLISH_UPDATED = "updated"; + public static final String FDR_PUBLISH_PUBLISHED = "published"; + public static final String FDR_PUBLISH_FDR = "fdr"; + public static final String FDR_PUBLISH_FDR_DATE = "fdr_date"; + public static final String FDR_PUBLISH_FDR_REF_JSON_CONTAINER_NAME = "ref_json.container_name"; + public static final String FDR_PUBLISH_FDR_REF_JSON_FILE_LENGTH = "ref_json.file_length"; + public static final String FDR_PUBLISH_FDR_REF_JSON_FILE_NAME = "ref_json.file_name"; + public static final String FDR_PUBLISH_FDR_REF_JSON_STORAGE_ACCOUNT = "ref_json.storage_account"; + public static final String FDR_PUBLISH_SENDER_TYPE = "sender.type"; + public static final String FDR_PUBLISH_SENDER_ID = "sender.id"; + public static final String FDR_PUBLISH_SENDER_PSP_ID = "sender.psp_id"; + public static final String FDR_PUBLISH_SENDER_PSP_NAME = "sender.psp_name"; + public static final String FDR_PUBLISH_SENDER_PSP_BROKER_ID = "sender.psp_broker_id"; + public static final String FDR_PUBLISH_SENDER_CHANNEL_ID = "sender.channel_id"; + public static final String FDR_PUBLISH_SENDER_PASSWORD = "sender.password"; + public static final String FDR_PUBLISH_RECEIVER_ID = "receiver.id"; + public static final String FDR_PUBLISH_RECEIVER_ORGANIZATION_ID = "receiver.organization_id"; + public static final String FDR_PUBLISH_RECEIVER_ORGANIZATION_NAME = "receiver.organization_name"; + public static final String FDR_PUBLISH_REGULATION = "regulation"; + public static final String FDR_PUBLISH_REGULATION_DATE = "regulation_date"; + public static final String FDR_PUBLISH_BIC_CODE_POURING_BANK = "bic_code_pouring_bank"; + public static final String FDR_PUBLISH_STATUS = "status"; + public static final String FDR_PUBLISH_COMPUTED_TOT_PAYMENTS = "computed_tot_payments"; + public static final String FDR_PUBLISH_COMPUTED_SUM_PAYMENTS = "computed_sum_payments"; + public static final String FDR_PUBLISH_TOT_PAYMENTS = "tot_payments"; + public static final String FDR_PUBLISH_SUM_PAYMENTS = "sum_payments"; - public static final String FDR_PAYMENT_PUBLISH_ID = "id"; - public static final String FDR_PAYMENT_PUBLISH_REVISION = "revision"; - public static final String FDR_PAYMENT_PUBLISH_CREATED = "created"; - public static final String FDR_PAYMENT_PUBLISH_UPDATED = "updated"; - public static final String FDR_PAYMENT_PUBLISH_IUV = "iuv"; - public static final String FDR_PAYMENT_PUBLISH_IUR = "iur"; - public static final String FDR_PAYMENT_PUBLISH_INDEX = "index"; - public static final String FDR_PAYMENT_PUBLISH_PAY = "pay"; - public static final String FDR_PAYMENT_PUBLISH_PAY_STATUS = "pay_status"; - public static final String FDR_PAYMENT_PUBLISH_PAY_DATE = "pay_date"; - public static final String FDR_PAYMENT_PUBLISH_REF_FDR_ID = "ref_fdr_id"; - public static final String FDR_PAYMENT_PUBLISH_REF_FDR = "ref_fdr"; - public static final String FDR_PAYMENT_PUBLISH_REF_FDR_SENDER_PSP_ID = "ref_fdr_sender_psp_id"; - public static final String FDR_PAYMENT_PUBLISH_REF_FDR_REVISION = "ref_fdr_revision"; - public static final String FDR_PAYMENT_PUBLISH_REF_FDR_RECEIVER_ORGANIZATION_ID = "ref_fdr_receiver_organization_id"; + public static final String FDR_PAYMENT_PUBLISH_ID = "id"; + public static final String FDR_PAYMENT_PUBLISH_REVISION = "revision"; + public static final String FDR_PAYMENT_PUBLISH_CREATED = "created"; + public static final String FDR_PAYMENT_PUBLISH_UPDATED = "updated"; + public static final String FDR_PAYMENT_PUBLISH_IUV = "iuv"; + public static final String FDR_PAYMENT_PUBLISH_IUR = "iur"; + public static final String FDR_PAYMENT_PUBLISH_INDEX = "index"; + public static final String FDR_PAYMENT_PUBLISH_PAY = "pay"; + public static final String FDR_PAYMENT_PUBLISH_PAY_STATUS = "pay_status"; + public static final String FDR_PAYMENT_PUBLISH_PAY_DATE = "pay_date"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR_ID = "ref_fdr_id"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR = "ref_fdr"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR_SENDER_PSP_ID = "ref_fdr_sender_psp_id"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR_REVISION = "ref_fdr_revision"; + public static final String FDR_PAYMENT_PUBLISH_REF_FDR_RECEIVER_ORGANIZATION_ID = + "ref_fdr_receiver_organization_id"; } diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java b/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java index 42e93209..31ddb92d 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java @@ -1,28 +1,29 @@ package it.gov.pagopa.fdr.service.history.mapper; -import it.gov.pagopa.fdr.repository.fdr.FdrInsertEntity; -import it.gov.pagopa.fdr.repository.fdr.FdrPaymentInsertEntity; import it.gov.pagopa.fdr.repository.fdr.FdrPaymentPublishEntity; import it.gov.pagopa.fdr.repository.fdr.FdrPublishEntity; import it.gov.pagopa.fdr.service.history.model.FdrHistoryEntity; import it.gov.pagopa.fdr.service.history.model.FdrHistoryMongoEntity; import it.gov.pagopa.fdr.service.history.model.FdrHistoryPaymentEntity; +import java.util.List; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.MappingConstants.ComponentModel; import org.mapstruct.factory.Mappers; -import java.util.List; - @Mapper(componentModel = ComponentModel.JAKARTA) public interface HistoryServiceMapper { - HistoryServiceMapper INSTANCE = Mappers.getMapper(HistoryServiceMapper.class); - @Mapping(target = "paymentList", ignore = true) - FdrHistoryEntity toFdrHistoryEntity(FdrPublishEntity fdrEntity); + HistoryServiceMapper INSTANCE = Mappers.getMapper(HistoryServiceMapper.class); + + @Mapping(target = "paymentList", ignore = true) + FdrHistoryEntity toFdrHistoryEntity(FdrPublishEntity fdrEntity); + + FdrHistoryPaymentEntity toFdrHistoryPaymentEntity( + FdrPaymentPublishEntity fdrPaymentPublishEntity); - FdrHistoryPaymentEntity toFdrHistoryPaymentEntity(FdrPaymentPublishEntity fdrPaymentPublishEntity); - List toFdrHistoryPaymentEntityList(List fdrPaymentPublishEntities); + List toFdrHistoryPaymentEntityList( + List fdrPaymentPublishEntities); - FdrHistoryMongoEntity toFdrHistoryMongoEntity(FdrHistoryEntity fdrHistoryEntity); -} \ No newline at end of file + FdrHistoryMongoEntity toFdrHistoryMongoEntity(FdrHistoryEntity fdrHistoryEntity); +} diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryEntity.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryEntity.java index cfdbd78b..9098e997 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryEntity.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryEntity.java @@ -1,14 +1,12 @@ package it.gov.pagopa.fdr.service.history.model; -import com.fasterxml.jackson.annotation.JsonIgnore; -import it.gov.pagopa.fdr.repository.fdr.FdrPaymentInsertEntity; import it.gov.pagopa.fdr.repository.fdr.model.FdrStatusEnumEntity; import it.gov.pagopa.fdr.repository.fdr.model.ReceiverEntity; import it.gov.pagopa.fdr.repository.fdr.model.SenderEntity; -import lombok.*; -import org.bson.codecs.pojo.annotations.BsonProperty; import java.time.Instant; import java.util.List; +import lombok.*; +import org.bson.codecs.pojo.annotations.BsonProperty; @Data @Builder @@ -53,6 +51,5 @@ public class FdrHistoryEntity { @BsonProperty("sum_payments") private Double sumPayments; - @Setter - private List paymentList; -} \ No newline at end of file + @Setter private List paymentList; +} diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java index 9def4216..f4eef0ae 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java @@ -5,10 +5,10 @@ import it.gov.pagopa.fdr.repository.fdr.model.FdrStatusEnumEntity; import it.gov.pagopa.fdr.repository.fdr.model.ReceiverEntity; import it.gov.pagopa.fdr.repository.fdr.model.SenderEntity; +import java.time.Instant; import lombok.Data; import lombok.EqualsAndHashCode; import org.bson.codecs.pojo.annotations.BsonProperty; -import java.time.Instant; @Data @EqualsAndHashCode(callSuper = true) @@ -37,4 +37,4 @@ public class FdrHistoryMongoEntity extends PanacheMongoEntity { private FdrStatusEnumEntity status; private FdrHistoryEntity jsonFile; -} \ No newline at end of file +} diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryPaymentEntity.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryPaymentEntity.java index a304106c..23b58dfc 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryPaymentEntity.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryPaymentEntity.java @@ -1,21 +1,12 @@ package it.gov.pagopa.fdr.service.history.model; import com.fasterxml.jackson.annotation.JsonIgnore; -import io.quarkus.mongodb.panache.PanacheMongoEntity; -import io.quarkus.mongodb.panache.PanacheMongoEntityBase; -import io.quarkus.mongodb.panache.PanacheQuery; -import io.quarkus.mongodb.panache.common.MongoEntity; -import io.quarkus.panache.common.Parameters; -import io.quarkus.panache.common.Sort; import it.gov.pagopa.fdr.repository.fdr.model.PaymentStatusEnumEntity; +import java.time.Instant; import lombok.Data; -import lombok.EqualsAndHashCode; import org.bson.codecs.pojo.annotations.BsonProperty; import org.bson.types.ObjectId; -import java.time.Instant; -import java.util.List; - @Data public class FdrHistoryPaymentEntity { @@ -27,14 +18,11 @@ public class FdrHistoryPaymentEntity { private Double pay; - @JsonIgnore - private Long revision; + @JsonIgnore private Long revision; - @JsonIgnore - private Instant created; + @JsonIgnore private Instant created; - @JsonIgnore - private Instant updated; + @JsonIgnore private Instant updated; @BsonProperty("pay_status") private PaymentStatusEnumEntity payStatus; diff --git a/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java b/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java index 687a4dea..6cc683a6 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java @@ -30,7 +30,6 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import java.math.BigDecimal; -import java.sql.Blob; import java.time.Instant; import java.util.ArrayList; import java.util.List; @@ -300,7 +299,6 @@ public void publishByFdr(String action, String pspId, String fdr, boolean intern .project(FdrPaymentInsertEntity.class) .list(); - FdrPublishEntity fdrPublishEntity = mapper.toFdrPublishEntity(fdrEntity); Instant now = Instant.now(); fdrPublishEntity.setUpdated(now); From 3973916536d2bdfca9f61f69f22bd0f45f393aff Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Tue, 23 Jan 2024 13:05:13 +0100 Subject: [PATCH 04/11] NOD-642 Fix test --- .../fdr/service/history/HistoryService.java | 62 +++++++++++-------- .../service/history/StorageFdrService.java | 14 +++++ .../pagopa/fdr/test/util/AzuriteResource.java | 6 +- 3 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/StorageFdrService.java diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java index c37ca223..28887620 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java @@ -79,38 +79,46 @@ public void saveOnStorage( logger.error("Exception while uploading FDR History", e); throw new AppException(AppErrorCodeMessageEnum.ERROR); } + } else { + logger.debugf("Blob container [%s] NOT INITIALIZED", blobContainerName); } } public BlobHttpBody saveJsonFile( FdrPublishEntity fdrEntity, List paymentsList) { - FdrHistoryEntity fdrHistoryEntity = mapper.toFdrHistoryEntity(fdrEntity); - List fdrHistoryPaymentEntityList = - mapper.toFdrHistoryPaymentEntityList(paymentsList); - fdrHistoryEntity.setPaymentList(fdrHistoryPaymentEntityList); - String fileName = - String.format( - "%s_%s_%s.json", - fdrEntity.getFdr(), fdrEntity.getSender().getPspId(), fdrEntity.getRevision()); - try { - byte[] jsonBytes = objMapper.writeValueAsBytes(fdrHistoryEntity); - BinaryData jsonFile = BinaryData.fromBytes(jsonBytes); - - BlobClient blobClient = blobContainerClient.getBlobClient(fileName); - blobClient.upload(jsonFile); - - return BlobHttpBody.builder() - .storageAccount(blobContainerClient.getAccountName()) - .containerName(blobContainerName) - .fileName(fileName) - .fileLength(jsonFile.getLength()) - .build(); - } catch (JsonProcessingException e) { - logger.error("Error processing fdrHistoryEntity as Bytes", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); - } catch (Exception e) { - logger.error("Error while uploading blob", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); + if (blobContainerClient != null) { + FdrHistoryEntity fdrHistoryEntity = mapper.toFdrHistoryEntity(fdrEntity); + List fdrHistoryPaymentEntityList = + mapper.toFdrHistoryPaymentEntityList(paymentsList); + fdrHistoryEntity.setPaymentList(fdrHistoryPaymentEntityList); + String fileName = + String.format( + "%s_%s_%s.json", + fdrEntity.getFdr(), fdrEntity.getSender().getPspId(), fdrEntity.getRevision()); + + try { + byte[] jsonBytes = objMapper.writeValueAsBytes(fdrHistoryEntity); + BinaryData jsonFile = BinaryData.fromBytes(jsonBytes); + + BlobClient blobClient = blobContainerClient.getBlobClient(fileName); + blobClient.upload(jsonFile); + + return BlobHttpBody.builder() + .storageAccount(blobContainerClient.getAccountName()) + .containerName(blobContainerName) + .fileName(fileName) + .fileLength(jsonFile.getLength()) + .build(); + } catch (JsonProcessingException e) { + logger.error("Error processing fdrHistoryEntity as Bytes", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + } catch (Exception e) { + logger.error("Error while uploading blob", e); + throw new AppException(AppErrorCodeMessageEnum.ERROR); + } + } else { + logger.debugf("Blob container [%s] NOT INITIALIZED", blobContainerName); + return null; } } diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/StorageFdrService.java b/src/main/java/it/gov/pagopa/fdr/service/history/StorageFdrService.java new file mode 100644 index 00000000..8ccb161a --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/StorageFdrService.java @@ -0,0 +1,14 @@ +package it.gov.pagopa.fdr.service.history; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.gov.pagopa.fdr.service.history.mapper.HistoryServiceMapper; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import org.jboss.logging.Logger; + +@ApplicationScoped +public class StorageFdrService { + @Inject HistoryServiceMapper mapper; + @Inject Logger logger; + @Inject ObjectMapper objMapper; +} diff --git a/src/test/java/it/gov/pagopa/fdr/test/util/AzuriteResource.java b/src/test/java/it/gov/pagopa/fdr/test/util/AzuriteResource.java index e2c041e8..55ad81d1 100644 --- a/src/test/java/it/gov/pagopa/fdr/test/util/AzuriteResource.java +++ b/src/test/java/it/gov/pagopa/fdr/test/util/AzuriteResource.java @@ -29,13 +29,17 @@ public Map start() { + "/devstoreaccount1;"; String queueName = "queueconversionTest"; String containerName = "blobContainerReTest"; - String historyContainerName = "blobContainerHistoryTest"; + String historyContainerName = "fdrhistory"; + String historyPublishTable = "fdrpublish"; + String historyPaymentPublishTable = "fdrpaymentpublish"; Map conf = new HashMap<>(); conf.put("mockserver.azurite.connection-string", connectStr); conf.put("mockserver.azurite.queue-name", queueName); conf.put("mockserver.azurite.container-name", containerName); conf.put("mockserver.azurite.history.container-name", historyContainerName); + conf.put("mockserver.azurite.table.fdrpublish", historyPublishTable); + conf.put("mockserver.azurite.table.fdrpaymentpublish", historyPaymentPublishTable); return conf; } From 62c8556daec778c83272f73694ca118e361ab7f1 Mon Sep 17 00:00:00 2001 From: maxsca <130107847+maxsca@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:39:20 +0100 Subject: [PATCH 05/11] NOD-642 wip --- openapi/openapi_internal.json | 3358 ++++++++++----------- openapi/openapi_organization.json | 1960 ++++++------ openapi/openapi_psp.json | 2708 ++++++++--------- src/main/resources/application.properties | 24 + 4 files changed, 3782 insertions(+), 4268 deletions(-) diff --git a/openapi/openapi_internal.json b/openapi/openapi_internal.json index d4e24939..8efaa35c 100644 --- a/openapi/openapi_internal.json +++ b/openapi/openapi_internal.json @@ -1,98 +1,81 @@ { - "openapi": "3.0.3", - "info": { - "title": "FDR - Flussi di rendicontazione (local)", - "description": "Manage FDR ( aka \"Flussi di Rendicontazione\" ) exchanged between PSP and EC", - "termsOfService": "https://www.pagopa.gov.it/", - "version": "1.0.6" + "openapi" : "3.0.3", + "info" : { + "title" : "FDR - Flussi di rendicontazione (local)", + "description" : "Manage FDR ( aka \"Flussi di Rendicontazione\" ) exchanged between PSP and EC", + "termsOfService" : "https://www.pagopa.gov.it/", + "version" : "0.0.0-SNAPSHOT" }, - "servers": [ - { - "url": "http://localhost:8080/" - } - ], - "security": [ - { - "api_key": [] - } - ], - "tags": [ - { - "name": "Info", - "description": "Info operations" - }, - { - "name": "Internal Organizations", - "description": "Organizations operations" - }, - { - "name": "Internal PSP", - "description": "PSP operations" - }, - { - "name": "Organizations", - "description": "Organizations operations" - }, - { - "name": "PSP", - "description": "PSP operations" - }, - { - "name": "Support", - "description": "Support operations" - } - ], - "paths": { - "/internal/psps/{pspId}/created/fdrs/{fdr}/organizations/{organizationId}": { - "get": { - "tags": [ - "Internal PSP" - ], - "summary": "Get created fdr", - "description": "Get created fdr", - "operationId": "internalGetCreated", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "servers" : [ { + "url" : "http://localhost:8080/" + } ], + "security" : [ { + "api_key" : [ ] + } ], + "tags" : [ { + "name" : "Info", + "description" : "Info operations" + }, { + "name" : "Internal Organizations", + "description" : "Organizations operations" + }, { + "name" : "Internal PSP", + "description" : "PSP operations" + }, { + "name" : "Organizations", + "description" : "Organizations operations" + }, { + "name" : "PSP", + "description" : "PSP operations" + }, { + "name" : "Support", + "description" : "Support operations" + } ], + "paths" : { + "/internal/psps/{pspId}/created/fdrs/{fdr}/organizations/{organizationId}" : { + "get" : { + "tags" : [ "Internal PSP" ], + "summary" : "Get created fdr", + "description" : "Get created fdr", + "operationId" : "internalGetCreated", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetCreatedResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetCreatedResponse" } } } @@ -100,57 +83,52 @@ } } }, - "/internal/psps/{pspId}/fdrs/{fdr}/payments/add": { - "put": { - "tags": [ - "Internal PSP" - ], - "summary": "Add payments to fdr", - "description": "Add payments to fdr", - "operationId": "internalAddPayment", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "/internal/psps/{pspId}/fdrs/{fdr}/payments/add" : { + "put" : { + "tags" : [ "Internal PSP" ], + "summary" : "Add payments to fdr", + "description" : "Add payments to fdr", + "operationId" : "internalAddPayment", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AddPaymentRequest" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/AddPaymentRequest" } } } }, - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } @@ -158,65 +136,58 @@ } } }, - "/internal/psps/{pspId}/published/fdrs/{fdr}/revisions/{revision}/organizations/{organizationId}": { - "get": { - "tags": [ - "Internal PSP" - ], - "summary": "Get internal fdr Published", - "description": "Get internal fdr Published", - "operationId": "internalGetPublishedByPsp", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "revision", - "in": "path", - "required": true, - "schema": { - "format": "int64", - "type": "integer" - } + "/internal/psps/{pspId}/published/fdrs/{fdr}/revisions/{revision}/organizations/{organizationId}" : { + "get" : { + "tags" : [ "Internal PSP" ], + "summary" : "Get internal fdr Published", + "description" : "Get internal fdr Published", + "operationId" : "internalGetPublishedByPsp", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "revision", + "in" : "path", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetResponse" } } } @@ -224,75 +195,67 @@ } } }, - "/internal/psps/{pspId}/published": { - "get": { - "tags": [ - "Internal PSP" - ], - "summary": "Get all internal fdr published", - "description": "Get all internal fdr published", - "operationId": "internalGetAllPublishedByPsp", - "parameters": [ - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "query", - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "publishedGt", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/internal/psps/{pspId}/published" : { + "get" : { + "tags" : [ "Internal PSP" ], + "summary" : "Get all internal fdr published", + "description" : "Get all internal fdr published", + "operationId" : "internalGetAllPublishedByPsp", + "parameters" : [ { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllPublishedResponse" + }, { + "name" : "organizationId", + "in" : "query", + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "publishedGt", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetAllPublishedResponse" } } } @@ -300,76 +263,68 @@ } } }, - "/internal/psps/{pspId}/created/fdrs/{fdr}/organizations/{organizationId}/payments": { - "get": { - "tags": [ - "Internal PSP" - ], - "summary": "Get internal created payments of fdr", - "description": "Get internal created payments of fdr", - "operationId": "internalGetCreatedPayment", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/internal/psps/{pspId}/created/fdrs/{fdr}/organizations/{organizationId}/payments" : { + "get" : { + "tags" : [ "Internal PSP" ], + "summary" : "Get internal created payments of fdr", + "description" : "Get internal created payments of fdr", + "operationId" : "internalGetCreatedPayment", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetPaymentResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetPaymentResponse" } } } @@ -377,76 +332,68 @@ } } }, - "/internal/organizations/{organizationId}/fdrs": { - "get": { - "tags": [ - "Internal Organizations" - ], - "summary": "Get all fdr published", - "description": "Get all fdr published", - "operationId": "internalGetAllPublished", - "parameters": [ - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "pspId", - "in": "query", - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "publishedGt", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/internal/organizations/{organizationId}/fdrs" : { + "get" : { + "tags" : [ "Internal Organizations" ], + "summary" : "Get all fdr published", + "description" : "Get all fdr published", + "operationId" : "internalGetAllPublished", + "parameters" : [ { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllResponse" + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "pspId", + "in" : "query", + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" + } + }, { + "name" : "publishedGt", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetAllResponse" } } } @@ -454,48 +401,43 @@ } } }, - "/internal/psps/{pspId}/fdrs/{fdr}/publish": { - "post": { - "tags": [ - "Internal PSP" - ], - "summary": "Publish fdr", - "description": "Publish fdr", - "operationId": "internalPublish", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "/internal/psps/{pspId}/fdrs/{fdr}/publish" : { + "post" : { + "tags" : [ "Internal PSP" ], + "summary" : "Publish fdr", + "description" : "Publish fdr", + "operationId" : "internalPublish", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } @@ -503,84 +445,75 @@ } } }, - "/internal/psps/{pspId}/iuv/{iuv}": { - "get": { - "tags": [ - "Support" - ], - "summary": "Get all payments by psp id and iuv", - "description": "Get all payments by psp id and iuv", - "operationId": "getByIuv", - "parameters": [ - { - "name": "iuv", - "in": "path", - "required": true, - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "createdFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "createdTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/internal/psps/{pspId}/iuv/{iuv}" : { + "get" : { + "tags" : [ "Support" ], + "summary" : "Get all payments by psp id and iuv", + "description" : "Get all payments by psp id and iuv", + "operationId" : "getByIuv", + "parameters" : [ { + "name" : "iuv", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FdrByPspIdIuvIurResponse" + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" + } + }, { + "name" : "createdFrom", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "createdTo", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/FdrByPspIdIuvIurResponse" } } } @@ -588,66 +521,59 @@ } } }, - "/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}": { - "get": { - "tags": [ - "Internal Organizations" - ], - "summary": "Get fdr", - "description": "Get fdr by id but not payments", - "operationId": "internalGet", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "revision", - "in": "path", - "required": true, - "schema": { - "format": "int64", - "type": "integer" - } + "/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}" : { + "get" : { + "tags" : [ "Internal Organizations" ], + "summary" : "Get fdr", + "description" : "Get fdr by id but not payments", + "operationId" : "internalGet", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "revision", + "in" : "path", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetResponse" } } } @@ -655,57 +581,52 @@ } } }, - "/internal/psps/{pspId}/fdrs/{fdr}/payments/del": { - "put": { - "tags": [ - "Internal PSP" - ], - "summary": "Delete payments to fdr", - "description": "Delete payments to fdr", - "operationId": "internalDeletePayment", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "/internal/psps/{pspId}/fdrs/{fdr}/payments/del" : { + "put" : { + "tags" : [ "Internal PSP" ], + "summary" : "Delete payments to fdr", + "description" : "Delete payments to fdr", + "operationId" : "internalDeletePayment", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeletePaymentRequest" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/DeletePaymentRequest" } } } }, - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } @@ -713,105 +634,95 @@ } } }, - "/internal/psps/{pspId}/fdrs/{fdr}": { - "post": { - "tags": [ - "Internal PSP" - ], - "summary": "Create fdr", - "description": "Create fdr", - "operationId": "internalCreate", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "pattern": "[a-zA-Z0-9\\-_]{1,35}", - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "/internal/psps/{pspId}/fdrs/{fdr}" : { + "post" : { + "tags" : [ "Internal PSP" ], + "summary" : "Create fdr", + "description" : "Create fdr", + "operationId" : "internalCreate", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "[a-zA-Z0-9\\-_]{1,35}", + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateRequest" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CreateRequest" } } } }, - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "201": { - "description": "Created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "201" : { + "description" : "Created", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } } } }, - "delete": { - "tags": [ - "Internal PSP" - ], - "summary": "Delete fdr", - "description": "Delete fdr", - "operationId": "internalDelete", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "delete" : { + "tags" : [ "Internal PSP" ], + "summary" : "Delete fdr", + "description" : "Delete fdr", + "operationId" : "internalDelete", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } @@ -819,84 +730,75 @@ } } }, - "/internal/psps/{pspId}/iur/{iur}": { - "get": { - "tags": [ - "Support" - ], - "summary": "Get all payments by psp id and iur", - "description": "Get all payments by psp id and iur", - "operationId": "getByIur", - "parameters": [ - { - "name": "iur", - "in": "path", - "required": true, - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "createdFrom", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "createdTo", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/internal/psps/{pspId}/iur/{iur}" : { + "get" : { + "tags" : [ "Support" ], + "summary" : "Get all payments by psp id and iur", + "description" : "Get all payments by psp id and iur", + "operationId" : "getByIur", + "parameters" : [ { + "name" : "iur", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FdrByPspIdIuvIurResponse" + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" + } + }, { + "name" : "createdFrom", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "createdTo", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/FdrByPspIdIuvIurResponse" } } } @@ -904,85 +806,76 @@ } } }, - "/internal/psps/{pspId}/published/fdrs/{fdr}/revisions/{revision}/organizations/{organizationId}/payments": { - "get": { - "tags": [ - "Internal PSP" - ], - "summary": "Get internal payments of fdr Published", - "description": "Get internal payments of fdr Published", - "operationId": "internalGetPaymentPublishedByPSp", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "revision", - "in": "path", - "required": true, - "schema": { - "format": "int64", - "type": "integer" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/internal/psps/{pspId}/published/fdrs/{fdr}/revisions/{revision}/organizations/{organizationId}/payments" : { + "get" : { + "tags" : [ "Internal PSP" ], + "summary" : "Get internal payments of fdr Published", + "description" : "Get internal payments of fdr Published", + "operationId" : "internalGetPaymentPublishedByPSp", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetPaymentResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "revision", + "in" : "path", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetPaymentResponse" } } } @@ -990,86 +883,77 @@ } } }, - "/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments": { - "get": { - "tags": [ - "Internal Organizations" - ], - "summary": "Get payments of fdr", - "description": "Get payments of fdr", - "operationId": "internalGetPayment", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "revision", - "in": "path", - "required": true, - "schema": { - "format": "int64", - "type": "integer" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/internal/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments" : { + "get" : { + "tags" : [ "Internal Organizations" ], + "summary" : "Get payments of fdr", + "description" : "Get payments of fdr", + "operationId" : "internalGetPayment", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetPaymentResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "revision", + "in" : "path", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetPaymentResponse" } } } @@ -1077,67 +961,60 @@ } } }, - "/internal/psps/{pspId}/created": { - "get": { - "tags": [ - "Internal PSP" - ], - "summary": "Get all fdr inserted", - "description": "Get all fdr inserted", - "operationId": "internalGetAllCreated", - "parameters": [ - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "createdGt", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/internal/psps/{pspId}/created" : { + "get" : { + "tags" : [ "Internal PSP" ], + "summary" : "Get all fdr inserted", + "description" : "Get all fdr inserted", + "operationId" : "internalGetAllCreated", + "parameters" : [ { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllCreatedResponse" + }, { + "name" : "createdGt", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetAllCreatedResponse" } } } @@ -1146,893 +1023,804 @@ } } }, - "components": { - "schemas": { - "AddPaymentRequest": { - "required": [ - "payments" - ], - "type": "object", - "properties": { - "payments": { - "maxItems": 1000, - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/Payment" + "components" : { + "schemas" : { + "AddPaymentRequest" : { + "required" : [ "payments" ], + "type" : "object", + "properties" : { + "payments" : { + "maxItems" : 1000, + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Payment" } } } }, - "CreateRequest": { - "required": [ - "fdr", - "fdrDate", - "sender", - "receiver", - "regulation", - "regulationDate", - "totPayments", - "sumPayments" - ], - "type": "object", - "properties": { - "fdr": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoFlusso]", - "pattern": "[a-zA-Z0-9\\-_]{1,35}", - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "description": "[XML NodoInviaFlussoRendicontazione]=[dataOraFlusso]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "regulation": { - "description": "[XML FlussoRiversamento]=[identificativoUnivocoRegolamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "description": "[XML FlussoRiversamento]=[dataRegolamento]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "description": "[XML FlussoRiversamento]=[codiceBicBancaDiRiversamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "UNCRITMMXXX" - }, - "totPayments": { - "format": "int64", - "description": "[XML FlussoRiversamento]=[numeroTotalePagamenti]", - "minimum": 1, - "type": "integer", - "example": 1 - }, - "sumPayments": { - "format": "double", - "description": "[XML FlussoRiversamento]=[importoTotalePagamenti]", - "minimum": 0, - "exclusiveMinimum": true, - "pattern": "^\\d{1,2147483647}([.]\\d{1,2})?$", - "type": "number", - "example": 0.01 + "CreateRequest" : { + "required" : [ "fdr", "fdrDate", "sender", "receiver", "regulation", "regulationDate", "totPayments", "sumPayments" ], + "type" : "object", + "properties" : { + "fdr" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoFlusso]", + "pattern" : "[a-zA-Z0-9\\-_]{1,35}", + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[dataOraFlusso]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "regulation" : { + "description" : "[XML FlussoRiversamento]=[identificativoUnivocoRegolamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "description" : "[XML FlussoRiversamento]=[dataRegolamento]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "description" : "[XML FlussoRiversamento]=[codiceBicBancaDiRiversamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "totPayments" : { + "format" : "int64", + "description" : "[XML FlussoRiversamento]=[numeroTotalePagamenti]", + "minimum" : 1, + "type" : "integer", + "example" : 1 + }, + "sumPayments" : { + "format" : "double", + "description" : "[XML FlussoRiversamento]=[importoTotalePagamenti]", + "minimum" : 0, + "exclusiveMinimum" : true, + "pattern" : "^\\d{1,2147483647}([.]\\d{1,2})?$", + "type" : "number", + "example" : 0.01 } } }, - "DeletePaymentRequest": { - "required": [ - "indexList" - ], - "type": "object", - "properties": { - "indexList": { - "maxItems": 1000, - "minItems": 1, - "type": "array", - "items": { - "format": "int64", - "type": "integer" + "DeletePaymentRequest" : { + "required" : [ "indexList" ], + "type" : "object", + "properties" : { + "indexList" : { + "maxItems" : 1000, + "minItems" : 1, + "type" : "array", + "items" : { + "format" : "int64", + "type" : "integer" } } } }, - "ErrorCode": { - "type": "object", - "properties": { - "code": { - "type": "string", - "example": "FDR-0500" - }, - "description": { - "type": "string", - "example": "An unexpected error has occurred. Please contact support." - }, - "statusCode": { - "format": "int32", - "type": "integer", - "example": 500 + "ErrorCode" : { + "type" : "object", + "properties" : { + "code" : { + "type" : "string", + "example" : "FDR-0500" + }, + "description" : { + "type" : "string", + "example" : "An unexpected error has occurred. Please contact support." + }, + "statusCode" : { + "format" : "int32", + "type" : "integer", + "example" : 500 } } }, - "ErrorMessage": { - "type": "object", - "properties": { - "path": { - "type": "string", - "example": "demo.test" - }, - "message": { - "type": "string", - "example": "An unexpected error has occurred. Please contact support." + "ErrorMessage" : { + "type" : "object", + "properties" : { + "path" : { + "type" : "string", + "example" : "demo.test" + }, + "message" : { + "type" : "string", + "example" : "An unexpected error has occurred. Please contact support." } } }, - "ErrorResponse": { - "type": "object", - "properties": { - "errorId": { - "type": "string", - "example": "50905466-1881-457b-b42f-fb7b2bfb1610" - }, - "httpStatusCode": { - "format": "int32", - "type": "integer", - "example": 500 - }, - "httpStatusDescription": { - "type": "string", - "example": "Internal Server Error" - }, - "appErrorCode": { - "type": "string", - "example": "FDR-500" - }, - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ErrorMessage" + "ErrorResponse" : { + "type" : "object", + "properties" : { + "errorId" : { + "type" : "string", + "example" : "50905466-1881-457b-b42f-fb7b2bfb1610" + }, + "httpStatusCode" : { + "format" : "int32", + "type" : "integer", + "example" : 500 + }, + "httpStatusDescription" : { + "type" : "string", + "example" : "Internal Server Error" + }, + "appErrorCode" : { + "type" : "string", + "example" : "FDR-500" + }, + "errors" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorMessage" } } } }, - "Fdr": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "pspId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "Fdr" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "pspId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "FdrByPspIdIuvIurBase": { - "type": "object", - "properties": { - "pspId": { - "type": "string" + "FdrByPspIdIuvIurBase" : { + "type" : "object", + "properties" : { + "pspId" : { + "type" : "string" }, - "organizationId": { - "type": "string" + "organizationId" : { + "type" : "string" }, - "fdr": { - "type": "string" + "fdr" : { + "type" : "string" }, - "revision": { - "format": "int64", - "type": "integer" + "revision" : { + "format" : "int64", + "type" : "integer" }, - "created": { - "$ref": "#/components/schemas/Instant" + "created" : { + "$ref" : "#/components/schemas/Instant" } } }, - "FdrByPspIdIuvIurResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrByPspIdIuvIurBase" + "FdrByPspIdIuvIurResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrByPspIdIuvIurBase" } } } }, - "FdrInserted": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "organizationId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "FdrInserted" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "organizationId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "FdrPublished": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "organizationId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "FdrPublished" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "organizationId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "GenericResponse": { - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Success" + "GenericResponse" : { + "type" : "object", + "properties" : { + "message" : { + "type" : "string", + "example" : "Success" } } }, - "GetAllCreatedResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrInserted" + "GetAllCreatedResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrInserted" } } } }, - "GetAllPublishedResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrPublished" + "GetAllPublishedResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrPublished" } } } }, - "GetAllResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Fdr" + "GetAllResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Fdr" } } } }, - "GetCreatedResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/ReportingFlowStatusEnum" - } - ], - "example": "CREATED" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 4 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "updated": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "fdr": { - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "regulation": { - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "type": "string", - "example": "UNCRITMMXXX" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "computedTotPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "computedSumPayments": { - "format": "double", - "type": "number", - "example": 100.9 - }, - "totPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "sumPayments": { - "format": "double", - "type": "number", - "example": 100.9 + "GetCreatedResponse" : { + "type" : "object", + "properties" : { + "status" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/ReportingFlowStatusEnum" + } ], + "example" : "CREATED" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 4 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "updated" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "fdr" : { + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "regulation" : { + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "computedTotPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "computedSumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 + }, + "totPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "sumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 } } }, - "GetPaymentResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Payment" + "GetPaymentResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Payment" } } } }, - "GetResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/ReportingFlowStatusEnum" - } - ], - "example": "CREATED" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 4 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "updated": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "fdr": { - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "regulation": { - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "type": "string", - "example": "UNCRITMMXXX" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "computedTotPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "computedSumPayments": { - "format": "double", - "type": "number", - "example": 100.9 - }, - "totPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "sumPayments": { - "format": "double", - "type": "number", - "example": 100.9 + "GetResponse" : { + "type" : "object", + "properties" : { + "status" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/ReportingFlowStatusEnum" + } ], + "example" : "CREATED" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 4 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "updated" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "fdr" : { + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "regulation" : { + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "computedTotPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "computedSumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 + }, + "totPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "sumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 } } }, - "InfoResponse": { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "pagopa-fdr" - }, - "version": { - "type": "string", - "example": "1.2.3" - }, - "environment": { - "type": "string", - "example": "dev" - }, - "description": { - "type": "string", - "example": "FDR - Flussi di rendicontazione" - }, - "errorCodes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ErrorCode" + "InfoResponse" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "example" : "pagopa-fdr" + }, + "version" : { + "type" : "string", + "example" : "1.2.3" + }, + "environment" : { + "type" : "string", + "example" : "dev" + }, + "description" : { + "type" : "string", + "example" : "FDR - Flussi di rendicontazione" + }, + "errorCodes" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorCode" } } } }, - "Instant": { - "format": "date-time", - "type": "string", - "example": "2022-03-10T16:15:50Z" + "Instant" : { + "format" : "date-time", + "type" : "string", + "example" : "2022-03-10T16:15:50Z" }, - "Metadata": { - "type": "object", - "properties": { - "pageSize": { - "format": "int32", - "type": "integer", - "example": 25 - }, - "pageNumber": { - "format": "int32", - "type": "integer", - "example": 1 - }, - "totPage": { - "format": "int32", - "type": "integer", - "example": 3 + "Metadata" : { + "type" : "object", + "properties" : { + "pageSize" : { + "format" : "int32", + "type" : "integer", + "example" : 25 + }, + "pageNumber" : { + "format" : "int32", + "type" : "integer", + "example" : 1 + }, + "totPage" : { + "format" : "int32", + "type" : "integer", + "example" : 3 } } }, - "Payment": { - "required": [ - "iuv", - "iur", - "index", - "pay", - "payStatus", - "payDate" - ], - "type": "object", - "properties": { - "iuv": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoVersamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "abcdefg" - }, - "iur": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoRiscossione]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "abcdefg" - }, - "index": { - "format": "int64", - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.indiceDatiSingoloPagamento]", - "minimum": 1, - "type": "integer", - "example": 1 - }, - "pay": { - "format": "double", - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.singoloImportoPagato]", - "minimum": 0, - "exclusiveMinimum": true, - "pattern": "^\\d{1,2147483647}([.]\\d{1,2})?$", - "type": "number", - "example": 0.01 - }, - "payStatus": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.codiceEsitoSingoloPagamento] \n0 -> EXECUTED\n3 -> REVOKED\n9 -> NO_RPT", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/PaymentStatusEnum" - } - ], - "example": "EXECUTED" - }, - "payDate": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.dataEsitoSingoloPagamento]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-02-03T12:00:30.900000Z" + "Payment" : { + "required" : [ "iuv", "iur", "index", "pay", "payStatus", "payDate" ], + "type" : "object", + "properties" : { + "iuv" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoVersamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "abcdefg" + }, + "iur" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoRiscossione]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "abcdefg" + }, + "index" : { + "format" : "int64", + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.indiceDatiSingoloPagamento]", + "minimum" : 1, + "type" : "integer", + "example" : 1 + }, + "pay" : { + "format" : "double", + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.singoloImportoPagato]", + "minimum" : 0, + "exclusiveMinimum" : true, + "pattern" : "^\\d{1,2147483647}([.]\\d{1,2})?$", + "type" : "number", + "example" : 0.01 + }, + "payStatus" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.codiceEsitoSingoloPagamento] \n0 -> EXECUTED\n3 -> REVOKED\n9 -> NO_RPT", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentStatusEnum" + } ], + "example" : "EXECUTED" + }, + "payDate" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.dataEsitoSingoloPagamento]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-02-03T12:00:30.900000Z" } } }, - "PaymentStatusEnum": { - "enum": [ - "EXECUTED", - "REVOKED", - "NO_RPT" - ], - "type": "string" + "PaymentStatusEnum" : { + "enum" : [ "EXECUTED", "REVOKED", "NO_RPT" ], + "type" : "string" }, - "Receiver": { - "required": [ - "id", - "organizationId", - "organizationName" - ], - "type": "object", - "properties": { - "id": { - "description": "[XML FlussoRiversamento]=[istitutoRicevente.identificativoUnivocoRicevente.codiceIdentificativoUnivoco]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "APPBIT2B" - }, - "organizationId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoDominio]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "20000000001" - }, - "organizationName": { - "description": "[XML FlussoRiversamento]=[istitutoRicevente.denominazioneRicevente]", - "pattern": "^(.{1,140})$", - "type": "string", - "example": "Comune di xyz" + "Receiver" : { + "required" : [ "id", "organizationId", "organizationName" ], + "type" : "object", + "properties" : { + "id" : { + "description" : "[XML FlussoRiversamento]=[istitutoRicevente.identificativoUnivocoRicevente.codiceIdentificativoUnivoco]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "APPBIT2B" + }, + "organizationId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoDominio]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "20000000001" + }, + "organizationName" : { + "description" : "[XML FlussoRiversamento]=[istitutoRicevente.denominazioneRicevente]", + "pattern" : "^(.{1,140})$", + "type" : "string", + "example" : "Comune di xyz" } } }, - "ReportingFlowStatusEnum": { - "enum": [ - "CREATED", - "INSERTED", - "PUBLISHED" - ], - "type": "string" + "ReportingFlowStatusEnum" : { + "enum" : [ "CREATED", "INSERTED", "PUBLISHED" ], + "type" : "string" }, - "Sender": { - "required": [ - "type", - "id", - "pspId", - "pspName", - "pspBrokerId", - "channelId" - ], - "type": "object", - "properties": { - "type": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.tipoIdentificativoUnivoco] \nG -> LEGAL_PERSON\nA -> ABI_CODE\nB -> BIC_CODE", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/SenderTypeEnum" - } - ], - "example": "LEGAL_PERSON" - }, - "id": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.codiceIdentificativoUnivoco]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "SELBIT2B" - }, - "pspId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoPSP]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "60000000001" - }, - "pspName": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.denominazioneMittente]", - "pattern": "^(.{3,70})$", - "type": "string", - "example": "Bank" - }, - "pspBrokerId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoIntermediarioPSP]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "70000000001" - }, - "channelId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoCanale]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "80000000001" - }, - "password": { - "description": "[XML NodoInviaFlussoRendicontazione]=[password]", - "pattern": "^(\\w{8,15})$", - "type": "string", - "example": "1234567890", - "deprecated": true + "Sender" : { + "required" : [ "type", "id", "pspId", "pspName", "pspBrokerId", "channelId" ], + "type" : "object", + "properties" : { + "type" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.tipoIdentificativoUnivoco] \nG -> LEGAL_PERSON\nA -> ABI_CODE\nB -> BIC_CODE", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/SenderTypeEnum" + } ], + "example" : "LEGAL_PERSON" + }, + "id" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.codiceIdentificativoUnivoco]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "SELBIT2B" + }, + "pspId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoPSP]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "60000000001" + }, + "pspName" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.denominazioneMittente]", + "pattern" : "^(.{3,70})$", + "type" : "string", + "example" : "Bank" + }, + "pspBrokerId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoIntermediarioPSP]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "70000000001" + }, + "channelId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoCanale]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "80000000001" + }, + "password" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[password]", + "pattern" : "^(\\w{8,15})$", + "type" : "string", + "example" : "1234567890", + "deprecated" : true } } }, - "SenderTypeEnum": { - "enum": [ - "LEGAL_PERSON", - "ABI_CODE", - "BIC_CODE" - ], - "type": "string" + "SenderTypeEnum" : { + "enum" : [ "LEGAL_PERSON", "ABI_CODE", "BIC_CODE" ], + "type" : "string" } }, - "responses": { - "AppException400": { - "description": "Default app exception for status 400", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "responses" : { + "AppException400" : { + "description" : "Default app exception for status 400", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "examples": { - "Error": { - "value": { - "httpStatusCode": 400, - "httpStatusDescription": "Bad Request", - "appErrorCode": "FDR-0702", - "errors": [ - { - "message": "Reporting Fdr [] is invalid" - } - ] + "examples" : { + "Error" : { + "value" : { + "httpStatusCode" : 400, + "httpStatusDescription" : "Bad Request", + "appErrorCode" : "FDR-0702", + "errors" : [ { + "message" : "Reporting Fdr [] is invalid" + } ] } }, - "Errors with path": { - "value": { - "httpStatusCode": 400, - "httpStatusDescription": "Bad Request", - "appErrorCode": "FDR-0702", - "errors": [ - { - "path": "", - "message": "" - } - ] + "Errors with path" : { + "value" : { + "httpStatusCode" : 400, + "httpStatusDescription" : "Bad Request", + "appErrorCode" : "FDR-0702", + "errors" : [ { + "path" : "", + "message" : "" + } ] } } } } } }, - "AppException404": { - "description": "Default app exception for status 404", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "AppException404" : { + "description" : "Default app exception for status 404", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "example": { - "httpStatusCode": 404, - "httpStatusDescription": "Not Found", - "appErrorCode": "FDR-0701", - "errors": [ - { - "message": "Reporting Fdr [] not found" - } - ] + "example" : { + "httpStatusCode" : 404, + "httpStatusDescription" : "Not Found", + "appErrorCode" : "FDR-0701", + "errors" : [ { + "message" : "Reporting Fdr [] not found" + } ] } } } }, - "InternalServerError": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "InternalServerError" : { + "description" : "Internal Server Error", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "example": { - "errorId": "50905466-1881-457b-b42f-fb7b2bfb1610", - "httpStatusCode": 500, - "httpStatusDescription": "Internal Server Error", - "appErrorCode": "FDR-0500", - "errors": [ - { - "message": "An unexpected error has occurred. Please contact support." - } - ] + "example" : { + "errorId" : "50905466-1881-457b-b42f-fb7b2bfb1610", + "httpStatusCode" : 500, + "httpStatusDescription" : "Internal Server Error", + "appErrorCode" : "FDR-0500", + "errors" : [ { + "message" : "An unexpected error has occurred. Please contact support." + } ] } } } } }, - "securitySchemes": { - "api_key": { - "type": "apiKey", - "name": "Ocp-Apim-Subscription-Key", - "in": "header" + "securitySchemes" : { + "api_key" : { + "type" : "apiKey", + "name" : "Ocp-Apim-Subscription-Key", + "in" : "header" }, - "SecurityScheme": { - "type": "http", - "description": "Authentication", - "scheme": "basic" + "SecurityScheme" : { + "type" : "http", + "description" : "Authentication", + "scheme" : "basic" } } } -} +} \ No newline at end of file diff --git a/openapi/openapi_organization.json b/openapi/openapi_organization.json index 1fa487d0..640e01fc 100644 --- a/openapi/openapi_organization.json +++ b/openapi/openapi_organization.json @@ -1,107 +1,89 @@ { - "openapi": "3.0.3", - "info": { - "title": "FDR - Flussi di rendicontazione (local)", - "description": "Manage FDR ( aka \"Flussi di Rendicontazione\" ) exchanged between PSP and EC", - "termsOfService": "https://www.pagopa.gov.it/", - "version": "1.0.6" + "openapi" : "3.0.3", + "info" : { + "title" : "FDR - Flussi di rendicontazione (local)", + "description" : "Manage FDR ( aka \"Flussi di Rendicontazione\" ) exchanged between PSP and EC", + "termsOfService" : "https://www.pagopa.gov.it/", + "version" : "0.0.0-SNAPSHOT" }, - "servers": [ - { - "url": "http://localhost:8080/" - } - ], - "security": [ - { - "api_key": [] - } - ], - "tags": [ - { - "name": "Info", - "description": "Info operations" - }, - { - "name": "Internal Organizations", - "description": "Organizations operations" - }, - { - "name": "Internal PSP", - "description": "PSP operations" - }, - { - "name": "Organizations", - "description": "Organizations operations" - }, - { - "name": "PSP", - "description": "PSP operations" - }, - { - "name": "Support", - "description": "Support operations" - } - ], - "paths": { - "/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}": { - "get": { - "tags": [ - "Organizations" - ], - "summary": "Get fdr", - "description": "Get fdr", - "operationId": "get", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "revision", - "in": "path", - "required": true, - "schema": { - "format": "int64", - "type": "integer" - } + "servers" : [ { + "url" : "http://localhost:8080/" + } ], + "security" : [ { + "api_key" : [ ] + } ], + "tags" : [ { + "name" : "Info", + "description" : "Info operations" + }, { + "name" : "Internal Organizations", + "description" : "Organizations operations" + }, { + "name" : "Internal PSP", + "description" : "PSP operations" + }, { + "name" : "Organizations", + "description" : "Organizations operations" + }, { + "name" : "PSP", + "description" : "PSP operations" + }, { + "name" : "Support", + "description" : "Support operations" + } ], + "paths" : { + "/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}" : { + "get" : { + "tags" : [ "Organizations" ], + "summary" : "Get fdr", + "description" : "Get fdr", + "operationId" : "get", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "revision", + "in" : "path", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetResponse" + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetResponse" } } } @@ -109,85 +91,76 @@ } } }, - "/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments": { - "get": { - "tags": [ - "Organizations" - ], - "summary": "Get payments of fdr", - "description": "Get payments of fdr", - "operationId": "getPayment", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "revision", - "in": "path", - "required": true, - "schema": { - "format": "int64", - "type": "integer" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/organizations/{organizationId}/fdrs/{fdr}/revisions/{revision}/psps/{pspId}/payments" : { + "get" : { + "tags" : [ "Organizations" ], + "summary" : "Get payments of fdr", + "description" : "Get payments of fdr", + "operationId" : "getPayment", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "revision", + "in" : "path", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetPaymentResponse" + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetPaymentResponse" } } } @@ -195,22 +168,20 @@ } } }, - "/info": { - "get": { - "tags": [ - "Info" - ], - "summary": "Get info of FDR", - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InfoResponse" + "/info" : { + "get" : { + "tags" : [ "Info" ], + "summary" : "Get info of FDR", + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InfoResponse" } } } @@ -218,76 +189,68 @@ } } }, - "/organizations/{organizationId}/fdrs": { - "get": { - "tags": [ - "Organizations" - ], - "summary": "Get all fdr published", - "description": "Get all fdr published", - "operationId": "getAllPublished", - "parameters": [ - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "pspId", - "in": "query", - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "publishedGt", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/organizations/{organizationId}/fdrs" : { + "get" : { + "tags" : [ "Organizations" ], + "summary" : "Get all fdr published", + "description" : "Get all fdr published", + "operationId" : "getAllPublished", + "parameters" : [ { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "pspId", + "in" : "query", + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllResponse" + }, { + "name" : "publishedGt", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetAllResponse" } } } @@ -296,893 +259,804 @@ } } }, - "components": { - "schemas": { - "AddPaymentRequest": { - "required": [ - "payments" - ], - "type": "object", - "properties": { - "payments": { - "maxItems": 1000, - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/Payment" + "components" : { + "schemas" : { + "AddPaymentRequest" : { + "required" : [ "payments" ], + "type" : "object", + "properties" : { + "payments" : { + "maxItems" : 1000, + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Payment" } } } }, - "CreateRequest": { - "required": [ - "fdr", - "fdrDate", - "sender", - "receiver", - "regulation", - "regulationDate", - "totPayments", - "sumPayments" - ], - "type": "object", - "properties": { - "fdr": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoFlusso]", - "pattern": "[a-zA-Z0-9\\-_]{1,35}", - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "description": "[XML NodoInviaFlussoRendicontazione]=[dataOraFlusso]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "regulation": { - "description": "[XML FlussoRiversamento]=[identificativoUnivocoRegolamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "description": "[XML FlussoRiversamento]=[dataRegolamento]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "description": "[XML FlussoRiversamento]=[codiceBicBancaDiRiversamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "UNCRITMMXXX" - }, - "totPayments": { - "format": "int64", - "description": "[XML FlussoRiversamento]=[numeroTotalePagamenti]", - "minimum": 1, - "type": "integer", - "example": 1 - }, - "sumPayments": { - "format": "double", - "description": "[XML FlussoRiversamento]=[importoTotalePagamenti]", - "minimum": 0, - "exclusiveMinimum": true, - "pattern": "^\\d{1,2147483647}([.]\\d{1,2})?$", - "type": "number", - "example": 0.01 + "CreateRequest" : { + "required" : [ "fdr", "fdrDate", "sender", "receiver", "regulation", "regulationDate", "totPayments", "sumPayments" ], + "type" : "object", + "properties" : { + "fdr" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoFlusso]", + "pattern" : "[a-zA-Z0-9\\-_]{1,35}", + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[dataOraFlusso]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "regulation" : { + "description" : "[XML FlussoRiversamento]=[identificativoUnivocoRegolamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "description" : "[XML FlussoRiversamento]=[dataRegolamento]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "description" : "[XML FlussoRiversamento]=[codiceBicBancaDiRiversamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "totPayments" : { + "format" : "int64", + "description" : "[XML FlussoRiversamento]=[numeroTotalePagamenti]", + "minimum" : 1, + "type" : "integer", + "example" : 1 + }, + "sumPayments" : { + "format" : "double", + "description" : "[XML FlussoRiversamento]=[importoTotalePagamenti]", + "minimum" : 0, + "exclusiveMinimum" : true, + "pattern" : "^\\d{1,2147483647}([.]\\d{1,2})?$", + "type" : "number", + "example" : 0.01 } } }, - "DeletePaymentRequest": { - "required": [ - "indexList" - ], - "type": "object", - "properties": { - "indexList": { - "maxItems": 1000, - "minItems": 1, - "type": "array", - "items": { - "format": "int64", - "type": "integer" + "DeletePaymentRequest" : { + "required" : [ "indexList" ], + "type" : "object", + "properties" : { + "indexList" : { + "maxItems" : 1000, + "minItems" : 1, + "type" : "array", + "items" : { + "format" : "int64", + "type" : "integer" } } } }, - "ErrorCode": { - "type": "object", - "properties": { - "code": { - "type": "string", - "example": "FDR-0500" - }, - "description": { - "type": "string", - "example": "An unexpected error has occurred. Please contact support." - }, - "statusCode": { - "format": "int32", - "type": "integer", - "example": 500 + "ErrorCode" : { + "type" : "object", + "properties" : { + "code" : { + "type" : "string", + "example" : "FDR-0500" + }, + "description" : { + "type" : "string", + "example" : "An unexpected error has occurred. Please contact support." + }, + "statusCode" : { + "format" : "int32", + "type" : "integer", + "example" : 500 } } }, - "ErrorMessage": { - "type": "object", - "properties": { - "path": { - "type": "string", - "example": "demo.test" - }, - "message": { - "type": "string", - "example": "An unexpected error has occurred. Please contact support." + "ErrorMessage" : { + "type" : "object", + "properties" : { + "path" : { + "type" : "string", + "example" : "demo.test" + }, + "message" : { + "type" : "string", + "example" : "An unexpected error has occurred. Please contact support." } } }, - "ErrorResponse": { - "type": "object", - "properties": { - "errorId": { - "type": "string", - "example": "50905466-1881-457b-b42f-fb7b2bfb1610" - }, - "httpStatusCode": { - "format": "int32", - "type": "integer", - "example": 500 - }, - "httpStatusDescription": { - "type": "string", - "example": "Internal Server Error" - }, - "appErrorCode": { - "type": "string", - "example": "FDR-500" - }, - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ErrorMessage" + "ErrorResponse" : { + "type" : "object", + "properties" : { + "errorId" : { + "type" : "string", + "example" : "50905466-1881-457b-b42f-fb7b2bfb1610" + }, + "httpStatusCode" : { + "format" : "int32", + "type" : "integer", + "example" : 500 + }, + "httpStatusDescription" : { + "type" : "string", + "example" : "Internal Server Error" + }, + "appErrorCode" : { + "type" : "string", + "example" : "FDR-500" + }, + "errors" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorMessage" } } } }, - "Fdr": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "pspId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "Fdr" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "pspId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "FdrByPspIdIuvIurBase": { - "type": "object", - "properties": { - "pspId": { - "type": "string" + "FdrByPspIdIuvIurBase" : { + "type" : "object", + "properties" : { + "pspId" : { + "type" : "string" }, - "organizationId": { - "type": "string" + "organizationId" : { + "type" : "string" }, - "fdr": { - "type": "string" + "fdr" : { + "type" : "string" }, - "revision": { - "format": "int64", - "type": "integer" + "revision" : { + "format" : "int64", + "type" : "integer" }, - "created": { - "$ref": "#/components/schemas/Instant" + "created" : { + "$ref" : "#/components/schemas/Instant" } } }, - "FdrByPspIdIuvIurResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrByPspIdIuvIurBase" + "FdrByPspIdIuvIurResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrByPspIdIuvIurBase" } } } }, - "FdrInserted": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "organizationId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "FdrInserted" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "organizationId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "FdrPublished": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "organizationId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "FdrPublished" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "organizationId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "GenericResponse": { - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Success" + "GenericResponse" : { + "type" : "object", + "properties" : { + "message" : { + "type" : "string", + "example" : "Success" } } }, - "GetAllCreatedResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrInserted" + "GetAllCreatedResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrInserted" } } } }, - "GetAllPublishedResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrPublished" + "GetAllPublishedResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrPublished" } } } }, - "GetAllResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Fdr" + "GetAllResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Fdr" } } } }, - "GetCreatedResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/ReportingFlowStatusEnum" - } - ], - "example": "CREATED" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 4 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "updated": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "fdr": { - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "regulation": { - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "type": "string", - "example": "UNCRITMMXXX" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "computedTotPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "computedSumPayments": { - "format": "double", - "type": "number", - "example": 100.9 - }, - "totPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "sumPayments": { - "format": "double", - "type": "number", - "example": 100.9 + "GetCreatedResponse" : { + "type" : "object", + "properties" : { + "status" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/ReportingFlowStatusEnum" + } ], + "example" : "CREATED" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 4 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "updated" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "fdr" : { + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "regulation" : { + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "computedTotPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "computedSumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 + }, + "totPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "sumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 } } }, - "GetPaymentResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Payment" + "GetPaymentResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Payment" } } } }, - "GetResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/ReportingFlowStatusEnum" - } - ], - "example": "CREATED" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 4 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "updated": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "fdr": { - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "regulation": { - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "type": "string", - "example": "UNCRITMMXXX" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "computedTotPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "computedSumPayments": { - "format": "double", - "type": "number", - "example": 100.9 - }, - "totPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "sumPayments": { - "format": "double", - "type": "number", - "example": 100.9 + "GetResponse" : { + "type" : "object", + "properties" : { + "status" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/ReportingFlowStatusEnum" + } ], + "example" : "CREATED" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 4 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "updated" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "fdr" : { + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "regulation" : { + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "computedTotPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "computedSumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 + }, + "totPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "sumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 } } }, - "InfoResponse": { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "pagopa-fdr" - }, - "version": { - "type": "string", - "example": "1.2.3" - }, - "environment": { - "type": "string", - "example": "dev" - }, - "description": { - "type": "string", - "example": "FDR - Flussi di rendicontazione" - }, - "errorCodes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ErrorCode" + "InfoResponse" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "example" : "pagopa-fdr" + }, + "version" : { + "type" : "string", + "example" : "1.2.3" + }, + "environment" : { + "type" : "string", + "example" : "dev" + }, + "description" : { + "type" : "string", + "example" : "FDR - Flussi di rendicontazione" + }, + "errorCodes" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorCode" } } } }, - "Instant": { - "format": "date-time", - "type": "string", - "example": "2022-03-10T16:15:50Z" + "Instant" : { + "format" : "date-time", + "type" : "string", + "example" : "2022-03-10T16:15:50Z" }, - "Metadata": { - "type": "object", - "properties": { - "pageSize": { - "format": "int32", - "type": "integer", - "example": 25 - }, - "pageNumber": { - "format": "int32", - "type": "integer", - "example": 1 - }, - "totPage": { - "format": "int32", - "type": "integer", - "example": 3 + "Metadata" : { + "type" : "object", + "properties" : { + "pageSize" : { + "format" : "int32", + "type" : "integer", + "example" : 25 + }, + "pageNumber" : { + "format" : "int32", + "type" : "integer", + "example" : 1 + }, + "totPage" : { + "format" : "int32", + "type" : "integer", + "example" : 3 } } }, - "Payment": { - "required": [ - "iuv", - "iur", - "index", - "pay", - "payStatus", - "payDate" - ], - "type": "object", - "properties": { - "iuv": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoVersamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "abcdefg" - }, - "iur": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoRiscossione]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "abcdefg" - }, - "index": { - "format": "int64", - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.indiceDatiSingoloPagamento]", - "minimum": 1, - "type": "integer", - "example": 1 - }, - "pay": { - "format": "double", - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.singoloImportoPagato]", - "minimum": 0, - "exclusiveMinimum": true, - "pattern": "^\\d{1,2147483647}([.]\\d{1,2})?$", - "type": "number", - "example": 0.01 - }, - "payStatus": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.codiceEsitoSingoloPagamento] \n0 -> EXECUTED\n3 -> REVOKED\n9 -> NO_RPT", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/PaymentStatusEnum" - } - ], - "example": "EXECUTED" - }, - "payDate": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.dataEsitoSingoloPagamento]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-02-03T12:00:30.900000Z" + "Payment" : { + "required" : [ "iuv", "iur", "index", "pay", "payStatus", "payDate" ], + "type" : "object", + "properties" : { + "iuv" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoVersamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "abcdefg" + }, + "iur" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoRiscossione]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "abcdefg" + }, + "index" : { + "format" : "int64", + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.indiceDatiSingoloPagamento]", + "minimum" : 1, + "type" : "integer", + "example" : 1 + }, + "pay" : { + "format" : "double", + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.singoloImportoPagato]", + "minimum" : 0, + "exclusiveMinimum" : true, + "pattern" : "^\\d{1,2147483647}([.]\\d{1,2})?$", + "type" : "number", + "example" : 0.01 + }, + "payStatus" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.codiceEsitoSingoloPagamento] \n0 -> EXECUTED\n3 -> REVOKED\n9 -> NO_RPT", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentStatusEnum" + } ], + "example" : "EXECUTED" + }, + "payDate" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.dataEsitoSingoloPagamento]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-02-03T12:00:30.900000Z" } } }, - "PaymentStatusEnum": { - "enum": [ - "EXECUTED", - "REVOKED", - "NO_RPT" - ], - "type": "string" + "PaymentStatusEnum" : { + "enum" : [ "EXECUTED", "REVOKED", "NO_RPT" ], + "type" : "string" }, - "Receiver": { - "required": [ - "id", - "organizationId", - "organizationName" - ], - "type": "object", - "properties": { - "id": { - "description": "[XML FlussoRiversamento]=[istitutoRicevente.identificativoUnivocoRicevente.codiceIdentificativoUnivoco]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "APPBIT2B" - }, - "organizationId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoDominio]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "20000000001" - }, - "organizationName": { - "description": "[XML FlussoRiversamento]=[istitutoRicevente.denominazioneRicevente]", - "pattern": "^(.{1,140})$", - "type": "string", - "example": "Comune di xyz" + "Receiver" : { + "required" : [ "id", "organizationId", "organizationName" ], + "type" : "object", + "properties" : { + "id" : { + "description" : "[XML FlussoRiversamento]=[istitutoRicevente.identificativoUnivocoRicevente.codiceIdentificativoUnivoco]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "APPBIT2B" + }, + "organizationId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoDominio]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "20000000001" + }, + "organizationName" : { + "description" : "[XML FlussoRiversamento]=[istitutoRicevente.denominazioneRicevente]", + "pattern" : "^(.{1,140})$", + "type" : "string", + "example" : "Comune di xyz" } } }, - "ReportingFlowStatusEnum": { - "enum": [ - "CREATED", - "INSERTED", - "PUBLISHED" - ], - "type": "string" + "ReportingFlowStatusEnum" : { + "enum" : [ "CREATED", "INSERTED", "PUBLISHED" ], + "type" : "string" }, - "Sender": { - "required": [ - "type", - "id", - "pspId", - "pspName", - "pspBrokerId", - "channelId" - ], - "type": "object", - "properties": { - "type": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.tipoIdentificativoUnivoco] \nG -> LEGAL_PERSON\nA -> ABI_CODE\nB -> BIC_CODE", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/SenderTypeEnum" - } - ], - "example": "LEGAL_PERSON" - }, - "id": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.codiceIdentificativoUnivoco]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "SELBIT2B" - }, - "pspId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoPSP]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "60000000001" - }, - "pspName": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.denominazioneMittente]", - "pattern": "^(.{3,70})$", - "type": "string", - "example": "Bank" - }, - "pspBrokerId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoIntermediarioPSP]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "70000000001" - }, - "channelId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoCanale]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "80000000001" - }, - "password": { - "description": "[XML NodoInviaFlussoRendicontazione]=[password]", - "pattern": "^(\\w{8,15})$", - "type": "string", - "example": "1234567890", - "deprecated": true + "Sender" : { + "required" : [ "type", "id", "pspId", "pspName", "pspBrokerId", "channelId" ], + "type" : "object", + "properties" : { + "type" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.tipoIdentificativoUnivoco] \nG -> LEGAL_PERSON\nA -> ABI_CODE\nB -> BIC_CODE", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/SenderTypeEnum" + } ], + "example" : "LEGAL_PERSON" + }, + "id" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.codiceIdentificativoUnivoco]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "SELBIT2B" + }, + "pspId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoPSP]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "60000000001" + }, + "pspName" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.denominazioneMittente]", + "pattern" : "^(.{3,70})$", + "type" : "string", + "example" : "Bank" + }, + "pspBrokerId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoIntermediarioPSP]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "70000000001" + }, + "channelId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoCanale]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "80000000001" + }, + "password" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[password]", + "pattern" : "^(\\w{8,15})$", + "type" : "string", + "example" : "1234567890", + "deprecated" : true } } }, - "SenderTypeEnum": { - "enum": [ - "LEGAL_PERSON", - "ABI_CODE", - "BIC_CODE" - ], - "type": "string" + "SenderTypeEnum" : { + "enum" : [ "LEGAL_PERSON", "ABI_CODE", "BIC_CODE" ], + "type" : "string" } }, - "responses": { - "AppException400": { - "description": "Default app exception for status 400", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "responses" : { + "AppException400" : { + "description" : "Default app exception for status 400", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "examples": { - "Error": { - "value": { - "httpStatusCode": 400, - "httpStatusDescription": "Bad Request", - "appErrorCode": "FDR-0702", - "errors": [ - { - "message": "Reporting Fdr [] is invalid" - } - ] + "examples" : { + "Error" : { + "value" : { + "httpStatusCode" : 400, + "httpStatusDescription" : "Bad Request", + "appErrorCode" : "FDR-0702", + "errors" : [ { + "message" : "Reporting Fdr [] is invalid" + } ] } }, - "Errors with path": { - "value": { - "httpStatusCode": 400, - "httpStatusDescription": "Bad Request", - "appErrorCode": "FDR-0702", - "errors": [ - { - "path": "", - "message": "" - } - ] + "Errors with path" : { + "value" : { + "httpStatusCode" : 400, + "httpStatusDescription" : "Bad Request", + "appErrorCode" : "FDR-0702", + "errors" : [ { + "path" : "", + "message" : "" + } ] } } } } } }, - "AppException404": { - "description": "Default app exception for status 404", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "AppException404" : { + "description" : "Default app exception for status 404", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "example": { - "httpStatusCode": 404, - "httpStatusDescription": "Not Found", - "appErrorCode": "FDR-0701", - "errors": [ - { - "message": "Reporting Fdr [] not found" - } - ] + "example" : { + "httpStatusCode" : 404, + "httpStatusDescription" : "Not Found", + "appErrorCode" : "FDR-0701", + "errors" : [ { + "message" : "Reporting Fdr [] not found" + } ] } } } }, - "InternalServerError": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "InternalServerError" : { + "description" : "Internal Server Error", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "example": { - "errorId": "50905466-1881-457b-b42f-fb7b2bfb1610", - "httpStatusCode": 500, - "httpStatusDescription": "Internal Server Error", - "appErrorCode": "FDR-0500", - "errors": [ - { - "message": "An unexpected error has occurred. Please contact support." - } - ] + "example" : { + "errorId" : "50905466-1881-457b-b42f-fb7b2bfb1610", + "httpStatusCode" : 500, + "httpStatusDescription" : "Internal Server Error", + "appErrorCode" : "FDR-0500", + "errors" : [ { + "message" : "An unexpected error has occurred. Please contact support." + } ] } } } } }, - "securitySchemes": { - "api_key": { - "type": "apiKey", - "name": "Ocp-Apim-Subscription-Key", - "in": "header" + "securitySchemes" : { + "api_key" : { + "type" : "apiKey", + "name" : "Ocp-Apim-Subscription-Key", + "in" : "header" }, - "SecurityScheme": { - "type": "http", - "description": "Authentication", - "scheme": "basic" + "SecurityScheme" : { + "type" : "http", + "description" : "Authentication", + "scheme" : "basic" } } } -} +} \ No newline at end of file diff --git a/openapi/openapi_psp.json b/openapi/openapi_psp.json index 77743d92..0e13b3ca 100644 --- a/openapi/openapi_psp.json +++ b/openapi/openapi_psp.json @@ -1,99 +1,83 @@ { - "openapi": "3.0.3", - "info": { - "title": "FDR - Flussi di rendicontazione (local)", - "description": "Manage FDR ( aka \"Flussi di Rendicontazione\" ) exchanged between PSP and EC", - "termsOfService": "https://www.pagopa.gov.it/", - "version": "1.0.6" + "openapi" : "3.0.3", + "info" : { + "title" : "FDR - Flussi di rendicontazione (local)", + "description" : "Manage FDR ( aka \"Flussi di Rendicontazione\" ) exchanged between PSP and EC", + "termsOfService" : "https://www.pagopa.gov.it/", + "version" : "0.0.0-SNAPSHOT" }, - "servers": [ - { - "url": "http://localhost:8080/" - } - ], - "security": [ - { - "api_key": [] - } - ], - "tags": [ - { - "name": "Info", - "description": "Info operations" - }, - { - "name": "Internal Organizations", - "description": "Organizations operations" - }, - { - "name": "Internal PSP", - "description": "PSP operations" - }, - { - "name": "Organizations", - "description": "Organizations operations" - }, - { - "name": "PSP", - "description": "PSP operations" - }, - { - "name": "Support", - "description": "Support operations" - } - ], - "paths": { - "/psps/{pspId}/fdrs/{fdr}/payments/add": { - "put": { - "tags": [ - "PSP" - ], - "summary": "Add payments to fdr", - "description": "Add payments to fdr", - "operationId": "addPayment", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "servers" : [ { + "url" : "http://localhost:8080/" + } ], + "security" : [ { + "api_key" : [ ] + } ], + "tags" : [ { + "name" : "Info", + "description" : "Info operations" + }, { + "name" : "Internal Organizations", + "description" : "Organizations operations" + }, { + "name" : "Internal PSP", + "description" : "PSP operations" + }, { + "name" : "Organizations", + "description" : "Organizations operations" + }, { + "name" : "PSP", + "description" : "PSP operations" + }, { + "name" : "Support", + "description" : "Support operations" + } ], + "paths" : { + "/psps/{pspId}/fdrs/{fdr}/payments/add" : { + "put" : { + "tags" : [ "PSP" ], + "summary" : "Add payments to fdr", + "description" : "Add payments to fdr", + "operationId" : "addPayment", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AddPaymentRequest" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/AddPaymentRequest" } } } }, - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } @@ -101,48 +85,43 @@ } } }, - "/psps/{pspId}/fdrs/{fdr}/publish": { - "post": { - "tags": [ - "PSP" - ], - "summary": "Publish fdr", - "description": "Publish fdr", - "operationId": "publish", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "/psps/{pspId}/fdrs/{fdr}/publish" : { + "post" : { + "tags" : [ "PSP" ], + "summary" : "Publish fdr", + "description" : "Publish fdr", + "operationId" : "publish", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } @@ -150,56 +129,50 @@ } } }, - "/psps/{pspId}/created/fdrs/{fdr}/organizations/{organizationId}": { - "get": { - "tags": [ - "PSP" - ], - "summary": "Get created fdr", - "description": "Get created fdr", - "operationId": "getCreated", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "/psps/{pspId}/created/fdrs/{fdr}/organizations/{organizationId}" : { + "get" : { + "tags" : [ "PSP" ], + "summary" : "Get created fdr", + "description" : "Get created fdr", + "operationId" : "getCreated", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetCreatedResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetCreatedResponse" } } } @@ -207,85 +180,76 @@ } } }, - "/psps/{pspId}/published/fdrs/{fdr}/revisions/{revision}/organizations/{organizationId}/payments": { - "get": { - "tags": [ - "PSP" - ], - "summary": "Get payments of fdr Published", - "description": "Get payments of fdr Published", - "operationId": "getPaymentPublishedByPsp", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "revision", - "in": "path", - "required": true, - "schema": { - "format": "int64", - "type": "integer" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/psps/{pspId}/published/fdrs/{fdr}/revisions/{revision}/organizations/{organizationId}/payments" : { + "get" : { + "tags" : [ "PSP" ], + "summary" : "Get payments of fdr Published", + "description" : "Get payments of fdr Published", + "operationId" : "getPaymentPublishedByPsp", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetPaymentResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "revision", + "in" : "path", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetPaymentResponse" } } } @@ -293,105 +257,95 @@ } } }, - "/psps/{pspId}/fdrs/{fdr}": { - "post": { - "tags": [ - "PSP" - ], - "summary": "Create fdr", - "description": "Create fdr", - "operationId": "create", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "pattern": "[a-zA-Z0-9\\-_]{1,35}", - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "/psps/{pspId}/fdrs/{fdr}" : { + "post" : { + "tags" : [ "PSP" ], + "summary" : "Create fdr", + "description" : "Create fdr", + "operationId" : "create", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "pattern" : "[a-zA-Z0-9\\-_]{1,35}", + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateRequest" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CreateRequest" } } } }, - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "201": { - "description": "Created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "201" : { + "description" : "Created", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } } } }, - "delete": { - "tags": [ - "PSP" - ], - "summary": "Delete fdr", - "description": "Delete fdr", - "operationId": "delete", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "delete" : { + "tags" : [ "PSP" ], + "summary" : "Delete fdr", + "description" : "Delete fdr", + "operationId" : "delete", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } @@ -399,65 +353,58 @@ } } }, - "/psps/{pspId}/published/fdrs/{fdr}/revisions/{revision}/organizations/{organizationId}": { - "get": { - "tags": [ - "PSP" - ], - "summary": "Get fdr Published", - "description": "Get fdr Published", - "operationId": "getPublishedByPsp", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "revision", - "in": "path", - "required": true, - "schema": { - "format": "int64", - "type": "integer" - } + "/psps/{pspId}/published/fdrs/{fdr}/revisions/{revision}/organizations/{organizationId}" : { + "get" : { + "tags" : [ "PSP" ], + "summary" : "Get fdr Published", + "description" : "Get fdr Published", + "operationId" : "getPublishedByPsp", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "revision", + "in" : "path", + "required" : true, + "schema" : { + "format" : "int64", + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetResponse" } } } @@ -465,22 +412,20 @@ } } }, - "/info": { - "get": { - "tags": [ - "Info" - ], - "summary": "Get info of FDR", - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InfoResponse" + "/info" : { + "get" : { + "tags" : [ "Info" ], + "summary" : "Get info of FDR", + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/InfoResponse" } } } @@ -488,67 +433,60 @@ } } }, - "/psps/{pspId}/created": { - "get": { - "tags": [ - "PSP" - ], - "summary": "Get all fdr created", - "description": "Get all fdr created", - "operationId": "getAllcreated", - "parameters": [ - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "createdGt", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/psps/{pspId}/created" : { + "get" : { + "tags" : [ "PSP" ], + "summary" : "Get all fdr created", + "description" : "Get all fdr created", + "operationId" : "getAllcreated", + "parameters" : [ { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllCreatedResponse" + }, { + "name" : "createdGt", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetAllCreatedResponse" } } } @@ -556,57 +494,52 @@ } } }, - "/psps/{pspId}/fdrs/{fdr}/payments/del": { - "put": { - "tags": [ - "PSP" - ], - "summary": "Delete payments to fdr", - "description": "Delete payments to fdr", - "operationId": "deletePayment", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + "/psps/{pspId}/fdrs/{fdr}/payments/del" : { + "put" : { + "tags" : [ "PSP" ], + "summary" : "Delete payments to fdr", + "description" : "Delete payments to fdr", + "operationId" : "deletePayment", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeletePaymentRequest" + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/DeletePaymentRequest" } } } }, - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GenericResponse" + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GenericResponse" } } } @@ -614,76 +547,68 @@ } } }, - "/psps/{pspId}/created/fdrs/{fdr}/organizations/{organizationId}/payments": { - "get": { - "tags": [ - "PSP" - ], - "summary": "Get created payments of fdr", - "description": "Get created payments of fdr", - "operationId": "getCreatedPayment", - "parameters": [ - { - "name": "fdr", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/psps/{pspId}/created/fdrs/{fdr}/organizations/{organizationId}/payments" : { + "get" : { + "tags" : [ "PSP" ], + "summary" : "Get created payments of fdr", + "description" : "Get created payments of fdr", + "operationId" : "getCreatedPayment", + "parameters" : [ { + "name" : "fdr", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetPaymentResponse" + }, { + "name" : "organizationId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetPaymentResponse" } } } @@ -691,75 +616,67 @@ } } }, - "/psps/{pspId}/published": { - "get": { - "tags": [ - "PSP" - ], - "summary": "Get all fdr published", - "description": "Get all fdr published", - "operationId": "getAllPublishedByPsp", - "parameters": [ - { - "name": "pspId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "organizationId", - "in": "query", - "schema": { - "pattern": "^(.{1,35})$", - "type": "string" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int64", - "default": 1, - "minimum": 1, - "type": "integer" - } - }, - { - "name": "publishedGt", - "in": "query", - "schema": { - "$ref": "#/components/schemas/Instant" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int64", - "default": 1000, - "minimum": 1, - "type": "integer" - } + "/psps/{pspId}/published" : { + "get" : { + "tags" : [ "PSP" ], + "summary" : "Get all fdr published", + "description" : "Get all fdr published", + "operationId" : "getAllPublishedByPsp", + "parameters" : [ { + "name" : "pspId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "400": { - "$ref": "#/components/responses/AppException400" - }, - "404": { - "$ref": "#/components/responses/AppException404" - }, - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GetAllPublishedResponse" + }, { + "name" : "organizationId", + "in" : "query", + "schema" : { + "pattern" : "^(.{1,35})$", + "type" : "string" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1, + "minimum" : 1, + "type" : "integer" + } + }, { + "name" : "publishedGt", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/Instant" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int64", + "default" : 1000, + "minimum" : 1, + "type" : "integer" + } + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/InternalServerError" + }, + "400" : { + "$ref" : "#/components/responses/AppException400" + }, + "404" : { + "$ref" : "#/components/responses/AppException404" + }, + "200" : { + "description" : "Success", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/GetAllPublishedResponse" } } } @@ -768,893 +685,804 @@ } } }, - "components": { - "schemas": { - "AddPaymentRequest": { - "required": [ - "payments" - ], - "type": "object", - "properties": { - "payments": { - "maxItems": 1000, - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/Payment" + "components" : { + "schemas" : { + "AddPaymentRequest" : { + "required" : [ "payments" ], + "type" : "object", + "properties" : { + "payments" : { + "maxItems" : 1000, + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Payment" } } } }, - "CreateRequest": { - "required": [ - "fdr", - "fdrDate", - "sender", - "receiver", - "regulation", - "regulationDate", - "totPayments", - "sumPayments" - ], - "type": "object", - "properties": { - "fdr": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoFlusso]", - "pattern": "[a-zA-Z0-9\\-_]{1,35}", - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "description": "[XML NodoInviaFlussoRendicontazione]=[dataOraFlusso]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "regulation": { - "description": "[XML FlussoRiversamento]=[identificativoUnivocoRegolamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "description": "[XML FlussoRiversamento]=[dataRegolamento]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "description": "[XML FlussoRiversamento]=[codiceBicBancaDiRiversamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "UNCRITMMXXX" - }, - "totPayments": { - "format": "int64", - "description": "[XML FlussoRiversamento]=[numeroTotalePagamenti]", - "minimum": 1, - "type": "integer", - "example": 1 - }, - "sumPayments": { - "format": "double", - "description": "[XML FlussoRiversamento]=[importoTotalePagamenti]", - "minimum": 0, - "exclusiveMinimum": true, - "pattern": "^\\d{1,2147483647}([.]\\d{1,2})?$", - "type": "number", - "example": 0.01 + "CreateRequest" : { + "required" : [ "fdr", "fdrDate", "sender", "receiver", "regulation", "regulationDate", "totPayments", "sumPayments" ], + "type" : "object", + "properties" : { + "fdr" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoFlusso]", + "pattern" : "[a-zA-Z0-9\\-_]{1,35}", + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[dataOraFlusso]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "regulation" : { + "description" : "[XML FlussoRiversamento]=[identificativoUnivocoRegolamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "description" : "[XML FlussoRiversamento]=[dataRegolamento]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "description" : "[XML FlussoRiversamento]=[codiceBicBancaDiRiversamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "totPayments" : { + "format" : "int64", + "description" : "[XML FlussoRiversamento]=[numeroTotalePagamenti]", + "minimum" : 1, + "type" : "integer", + "example" : 1 + }, + "sumPayments" : { + "format" : "double", + "description" : "[XML FlussoRiversamento]=[importoTotalePagamenti]", + "minimum" : 0, + "exclusiveMinimum" : true, + "pattern" : "^\\d{1,2147483647}([.]\\d{1,2})?$", + "type" : "number", + "example" : 0.01 } } }, - "DeletePaymentRequest": { - "required": [ - "indexList" - ], - "type": "object", - "properties": { - "indexList": { - "maxItems": 1000, - "minItems": 1, - "type": "array", - "items": { - "format": "int64", - "type": "integer" + "DeletePaymentRequest" : { + "required" : [ "indexList" ], + "type" : "object", + "properties" : { + "indexList" : { + "maxItems" : 1000, + "minItems" : 1, + "type" : "array", + "items" : { + "format" : "int64", + "type" : "integer" } } } }, - "ErrorCode": { - "type": "object", - "properties": { - "code": { - "type": "string", - "example": "FDR-0500" - }, - "description": { - "type": "string", - "example": "An unexpected error has occurred. Please contact support." - }, - "statusCode": { - "format": "int32", - "type": "integer", - "example": 500 + "ErrorCode" : { + "type" : "object", + "properties" : { + "code" : { + "type" : "string", + "example" : "FDR-0500" + }, + "description" : { + "type" : "string", + "example" : "An unexpected error has occurred. Please contact support." + }, + "statusCode" : { + "format" : "int32", + "type" : "integer", + "example" : 500 } } }, - "ErrorMessage": { - "type": "object", - "properties": { - "path": { - "type": "string", - "example": "demo.test" - }, - "message": { - "type": "string", - "example": "An unexpected error has occurred. Please contact support." + "ErrorMessage" : { + "type" : "object", + "properties" : { + "path" : { + "type" : "string", + "example" : "demo.test" + }, + "message" : { + "type" : "string", + "example" : "An unexpected error has occurred. Please contact support." } } }, - "ErrorResponse": { - "type": "object", - "properties": { - "errorId": { - "type": "string", - "example": "50905466-1881-457b-b42f-fb7b2bfb1610" - }, - "httpStatusCode": { - "format": "int32", - "type": "integer", - "example": 500 - }, - "httpStatusDescription": { - "type": "string", - "example": "Internal Server Error" - }, - "appErrorCode": { - "type": "string", - "example": "FDR-500" - }, - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ErrorMessage" + "ErrorResponse" : { + "type" : "object", + "properties" : { + "errorId" : { + "type" : "string", + "example" : "50905466-1881-457b-b42f-fb7b2bfb1610" + }, + "httpStatusCode" : { + "format" : "int32", + "type" : "integer", + "example" : 500 + }, + "httpStatusDescription" : { + "type" : "string", + "example" : "Internal Server Error" + }, + "appErrorCode" : { + "type" : "string", + "example" : "FDR-500" + }, + "errors" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorMessage" } } } }, - "Fdr": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "pspId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "Fdr" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "pspId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "FdrByPspIdIuvIurBase": { - "type": "object", - "properties": { - "pspId": { - "type": "string" + "FdrByPspIdIuvIurBase" : { + "type" : "object", + "properties" : { + "pspId" : { + "type" : "string" }, - "organizationId": { - "type": "string" + "organizationId" : { + "type" : "string" }, - "fdr": { - "type": "string" + "fdr" : { + "type" : "string" }, - "revision": { - "format": "int64", - "type": "integer" + "revision" : { + "format" : "int64", + "type" : "integer" }, - "created": { - "$ref": "#/components/schemas/Instant" + "created" : { + "$ref" : "#/components/schemas/Instant" } } }, - "FdrByPspIdIuvIurResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrByPspIdIuvIurBase" + "FdrByPspIdIuvIurResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrByPspIdIuvIurBase" } } } }, - "FdrInserted": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "organizationId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "FdrInserted" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "organizationId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "FdrPublished": { - "type": "object", - "properties": { - "fdr": { - "type": "string", - "example": "AAABBB" - }, - "organizationId": { - "type": "string", - "example": "1" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 1 - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" + "FdrPublished" : { + "type" : "object", + "properties" : { + "fdr" : { + "type" : "string", + "example" : "AAABBB" + }, + "organizationId" : { + "type" : "string", + "example" : "1" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 1 + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" } } }, - "GenericResponse": { - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Success" + "GenericResponse" : { + "type" : "object", + "properties" : { + "message" : { + "type" : "string", + "example" : "Success" } } }, - "GetAllCreatedResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrInserted" + "GetAllCreatedResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrInserted" } } } }, - "GetAllPublishedResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/FdrPublished" + "GetAllPublishedResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/FdrPublished" } } } }, - "GetAllResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Fdr" + "GetAllResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Fdr" } } } }, - "GetCreatedResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/ReportingFlowStatusEnum" - } - ], - "example": "CREATED" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 4 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "updated": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "fdr": { - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "regulation": { - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "type": "string", - "example": "UNCRITMMXXX" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "computedTotPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "computedSumPayments": { - "format": "double", - "type": "number", - "example": 100.9 - }, - "totPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "sumPayments": { - "format": "double", - "type": "number", - "example": 100.9 + "GetCreatedResponse" : { + "type" : "object", + "properties" : { + "status" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/ReportingFlowStatusEnum" + } ], + "example" : "CREATED" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 4 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "updated" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "fdr" : { + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "regulation" : { + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "computedTotPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "computedSumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 + }, + "totPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "sumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 } } }, - "GetPaymentResponse": { - "type": "object", - "properties": { - "metadata": { - "$ref": "#/components/schemas/Metadata" - }, - "count": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Payment" + "GetPaymentResponse" : { + "type" : "object", + "properties" : { + "metadata" : { + "$ref" : "#/components/schemas/Metadata" + }, + "count" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "data" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/Payment" } } } }, - "GetResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/ReportingFlowStatusEnum" - } - ], - "example": "CREATED" - }, - "revision": { - "format": "int64", - "type": "integer", - "example": 4 - }, - "created": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "updated": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "fdr": { - "type": "string", - "example": "2016-08-16pspTest-1178" - }, - "fdrDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-05T09:21:37.810000Z" - }, - "regulation": { - "type": "string", - "example": "SEPA - Bonifico xzy" - }, - "regulationDate": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "bicCodePouringBank": { - "type": "string", - "example": "UNCRITMMXXX" - }, - "sender": { - "$ref": "#/components/schemas/Sender" - }, - "receiver": { - "$ref": "#/components/schemas/Receiver" - }, - "published": { - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-04-03T12:00:30.900000Z" - }, - "computedTotPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "computedSumPayments": { - "format": "double", - "type": "number", - "example": 100.9 - }, - "totPayments": { - "format": "int64", - "type": "integer", - "example": 100 - }, - "sumPayments": { - "format": "double", - "type": "number", - "example": 100.9 + "GetResponse" : { + "type" : "object", + "properties" : { + "status" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/ReportingFlowStatusEnum" + } ], + "example" : "CREATED" + }, + "revision" : { + "format" : "int64", + "type" : "integer", + "example" : 4 + }, + "created" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "updated" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "fdr" : { + "type" : "string", + "example" : "2016-08-16pspTest-1178" + }, + "fdrDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-05T09:21:37.810000Z" + }, + "regulation" : { + "type" : "string", + "example" : "SEPA - Bonifico xzy" + }, + "regulationDate" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank" : { + "type" : "string", + "example" : "UNCRITMMXXX" + }, + "sender" : { + "$ref" : "#/components/schemas/Sender" + }, + "receiver" : { + "$ref" : "#/components/schemas/Receiver" + }, + "published" : { + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-04-03T12:00:30.900000Z" + }, + "computedTotPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "computedSumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 + }, + "totPayments" : { + "format" : "int64", + "type" : "integer", + "example" : 100 + }, + "sumPayments" : { + "format" : "double", + "type" : "number", + "example" : 100.9 } } }, - "InfoResponse": { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "pagopa-fdr" - }, - "version": { - "type": "string", - "example": "1.2.3" - }, - "environment": { - "type": "string", - "example": "dev" - }, - "description": { - "type": "string", - "example": "FDR - Flussi di rendicontazione" - }, - "errorCodes": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ErrorCode" + "InfoResponse" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string", + "example" : "pagopa-fdr" + }, + "version" : { + "type" : "string", + "example" : "1.2.3" + }, + "environment" : { + "type" : "string", + "example" : "dev" + }, + "description" : { + "type" : "string", + "example" : "FDR - Flussi di rendicontazione" + }, + "errorCodes" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorCode" } } } }, - "Instant": { - "format": "date-time", - "type": "string", - "example": "2022-03-10T16:15:50Z" + "Instant" : { + "format" : "date-time", + "type" : "string", + "example" : "2022-03-10T16:15:50Z" }, - "Metadata": { - "type": "object", - "properties": { - "pageSize": { - "format": "int32", - "type": "integer", - "example": 25 - }, - "pageNumber": { - "format": "int32", - "type": "integer", - "example": 1 - }, - "totPage": { - "format": "int32", - "type": "integer", - "example": 3 + "Metadata" : { + "type" : "object", + "properties" : { + "pageSize" : { + "format" : "int32", + "type" : "integer", + "example" : 25 + }, + "pageNumber" : { + "format" : "int32", + "type" : "integer", + "example" : 1 + }, + "totPage" : { + "format" : "int32", + "type" : "integer", + "example" : 3 } } }, - "Payment": { - "required": [ - "iuv", - "iur", - "index", - "pay", - "payStatus", - "payDate" - ], - "type": "object", - "properties": { - "iuv": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoVersamento]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "abcdefg" - }, - "iur": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoRiscossione]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "abcdefg" - }, - "index": { - "format": "int64", - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.indiceDatiSingoloPagamento]", - "minimum": 1, - "type": "integer", - "example": 1 - }, - "pay": { - "format": "double", - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.singoloImportoPagato]", - "minimum": 0, - "exclusiveMinimum": true, - "pattern": "^\\d{1,2147483647}([.]\\d{1,2})?$", - "type": "number", - "example": 0.01 - }, - "payStatus": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.codiceEsitoSingoloPagamento] \n0 -> EXECUTED\n3 -> REVOKED\n9 -> NO_RPT", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/PaymentStatusEnum" - } - ], - "example": "EXECUTED" - }, - "payDate": { - "description": "[XML FlussoRiversamento]=[datiSingoliPagamenti.dataEsitoSingoloPagamento]", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/Instant" - } - ], - "example": "2023-02-03T12:00:30.900000Z" + "Payment" : { + "required" : [ "iuv", "iur", "index", "pay", "payStatus", "payDate" ], + "type" : "object", + "properties" : { + "iuv" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoVersamento]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "abcdefg" + }, + "iur" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.identificativoUnivocoRiscossione]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "abcdefg" + }, + "index" : { + "format" : "int64", + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.indiceDatiSingoloPagamento]", + "minimum" : 1, + "type" : "integer", + "example" : 1 + }, + "pay" : { + "format" : "double", + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.singoloImportoPagato]", + "minimum" : 0, + "exclusiveMinimum" : true, + "pattern" : "^\\d{1,2147483647}([.]\\d{1,2})?$", + "type" : "number", + "example" : 0.01 + }, + "payStatus" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.codiceEsitoSingoloPagamento] \n0 -> EXECUTED\n3 -> REVOKED\n9 -> NO_RPT", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/PaymentStatusEnum" + } ], + "example" : "EXECUTED" + }, + "payDate" : { + "description" : "[XML FlussoRiversamento]=[datiSingoliPagamenti.dataEsitoSingoloPagamento]", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/Instant" + } ], + "example" : "2023-02-03T12:00:30.900000Z" } } }, - "PaymentStatusEnum": { - "enum": [ - "EXECUTED", - "REVOKED", - "NO_RPT" - ], - "type": "string" + "PaymentStatusEnum" : { + "enum" : [ "EXECUTED", "REVOKED", "NO_RPT" ], + "type" : "string" }, - "Receiver": { - "required": [ - "id", - "organizationId", - "organizationName" - ], - "type": "object", - "properties": { - "id": { - "description": "[XML FlussoRiversamento]=[istitutoRicevente.identificativoUnivocoRicevente.codiceIdentificativoUnivoco]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "APPBIT2B" - }, - "organizationId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoDominio]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "20000000001" - }, - "organizationName": { - "description": "[XML FlussoRiversamento]=[istitutoRicevente.denominazioneRicevente]", - "pattern": "^(.{1,140})$", - "type": "string", - "example": "Comune di xyz" + "Receiver" : { + "required" : [ "id", "organizationId", "organizationName" ], + "type" : "object", + "properties" : { + "id" : { + "description" : "[XML FlussoRiversamento]=[istitutoRicevente.identificativoUnivocoRicevente.codiceIdentificativoUnivoco]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "APPBIT2B" + }, + "organizationId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoDominio]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "20000000001" + }, + "organizationName" : { + "description" : "[XML FlussoRiversamento]=[istitutoRicevente.denominazioneRicevente]", + "pattern" : "^(.{1,140})$", + "type" : "string", + "example" : "Comune di xyz" } } }, - "ReportingFlowStatusEnum": { - "enum": [ - "CREATED", - "INSERTED", - "PUBLISHED" - ], - "type": "string" + "ReportingFlowStatusEnum" : { + "enum" : [ "CREATED", "INSERTED", "PUBLISHED" ], + "type" : "string" }, - "Sender": { - "required": [ - "type", - "id", - "pspId", - "pspName", - "pspBrokerId", - "channelId" - ], - "type": "object", - "properties": { - "type": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.tipoIdentificativoUnivoco] \nG -> LEGAL_PERSON\nA -> ABI_CODE\nB -> BIC_CODE", - "type": "string", - "allOf": [ - { - "$ref": "#/components/schemas/SenderTypeEnum" - } - ], - "example": "LEGAL_PERSON" - }, - "id": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.codiceIdentificativoUnivoco]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "SELBIT2B" - }, - "pspId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoPSP]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "60000000001" - }, - "pspName": { - "description": "[XML FlussoRiversamento]=[istitutoMittente.denominazioneMittente]", - "pattern": "^(.{3,70})$", - "type": "string", - "example": "Bank" - }, - "pspBrokerId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoIntermediarioPSP]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "70000000001" - }, - "channelId": { - "description": "[XML NodoInviaFlussoRendicontazione]=[identificativoCanale]", - "pattern": "^(.{1,35})$", - "type": "string", - "example": "80000000001" - }, - "password": { - "description": "[XML NodoInviaFlussoRendicontazione]=[password]", - "pattern": "^(\\w{8,15})$", - "type": "string", - "example": "1234567890", - "deprecated": true + "Sender" : { + "required" : [ "type", "id", "pspId", "pspName", "pspBrokerId", "channelId" ], + "type" : "object", + "properties" : { + "type" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.tipoIdentificativoUnivoco] \nG -> LEGAL_PERSON\nA -> ABI_CODE\nB -> BIC_CODE", + "type" : "string", + "allOf" : [ { + "$ref" : "#/components/schemas/SenderTypeEnum" + } ], + "example" : "LEGAL_PERSON" + }, + "id" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.identificativoUnivocoMittente.codiceIdentificativoUnivoco]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "SELBIT2B" + }, + "pspId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoPSP]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "60000000001" + }, + "pspName" : { + "description" : "[XML FlussoRiversamento]=[istitutoMittente.denominazioneMittente]", + "pattern" : "^(.{3,70})$", + "type" : "string", + "example" : "Bank" + }, + "pspBrokerId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoIntermediarioPSP]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "70000000001" + }, + "channelId" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[identificativoCanale]", + "pattern" : "^(.{1,35})$", + "type" : "string", + "example" : "80000000001" + }, + "password" : { + "description" : "[XML NodoInviaFlussoRendicontazione]=[password]", + "pattern" : "^(\\w{8,15})$", + "type" : "string", + "example" : "1234567890", + "deprecated" : true } } }, - "SenderTypeEnum": { - "enum": [ - "LEGAL_PERSON", - "ABI_CODE", - "BIC_CODE" - ], - "type": "string" + "SenderTypeEnum" : { + "enum" : [ "LEGAL_PERSON", "ABI_CODE", "BIC_CODE" ], + "type" : "string" } }, - "responses": { - "AppException400": { - "description": "Default app exception for status 400", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "responses" : { + "AppException400" : { + "description" : "Default app exception for status 400", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "examples": { - "Error": { - "value": { - "httpStatusCode": 400, - "httpStatusDescription": "Bad Request", - "appErrorCode": "FDR-0702", - "errors": [ - { - "message": "Reporting Fdr [] is invalid" - } - ] + "examples" : { + "Error" : { + "value" : { + "httpStatusCode" : 400, + "httpStatusDescription" : "Bad Request", + "appErrorCode" : "FDR-0702", + "errors" : [ { + "message" : "Reporting Fdr [] is invalid" + } ] } }, - "Errors with path": { - "value": { - "httpStatusCode": 400, - "httpStatusDescription": "Bad Request", - "appErrorCode": "FDR-0702", - "errors": [ - { - "path": "", - "message": "" - } - ] + "Errors with path" : { + "value" : { + "httpStatusCode" : 400, + "httpStatusDescription" : "Bad Request", + "appErrorCode" : "FDR-0702", + "errors" : [ { + "path" : "", + "message" : "" + } ] } } } } } }, - "AppException404": { - "description": "Default app exception for status 404", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "AppException404" : { + "description" : "Default app exception for status 404", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "example": { - "httpStatusCode": 404, - "httpStatusDescription": "Not Found", - "appErrorCode": "FDR-0701", - "errors": [ - { - "message": "Reporting Fdr [] not found" - } - ] + "example" : { + "httpStatusCode" : 404, + "httpStatusDescription" : "Not Found", + "appErrorCode" : "FDR-0701", + "errors" : [ { + "message" : "Reporting Fdr [] not found" + } ] } } } }, - "InternalServerError": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "InternalServerError" : { + "description" : "Internal Server Error", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" }, - "example": { - "errorId": "50905466-1881-457b-b42f-fb7b2bfb1610", - "httpStatusCode": 500, - "httpStatusDescription": "Internal Server Error", - "appErrorCode": "FDR-0500", - "errors": [ - { - "message": "An unexpected error has occurred. Please contact support." - } - ] + "example" : { + "errorId" : "50905466-1881-457b-b42f-fb7b2bfb1610", + "httpStatusCode" : 500, + "httpStatusDescription" : "Internal Server Error", + "appErrorCode" : "FDR-0500", + "errors" : [ { + "message" : "An unexpected error has occurred. Please contact support." + } ] } } } } }, - "securitySchemes": { - "api_key": { - "type": "apiKey", - "name": "Ocp-Apim-Subscription-Key", - "in": "header" + "securitySchemes" : { + "api_key" : { + "type" : "apiKey", + "name" : "Ocp-Apim-Subscription-Key", + "in" : "header" }, - "SecurityScheme": { - "type": "http", - "description": "Authentication", - "scheme": "basic" + "SecurityScheme" : { + "type" : "http", + "description" : "Authentication", + "scheme" : "basic" } } } -} +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 90edadbf..28f00e32 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -168,17 +168,41 @@ blob.re.containername=${BLOB_RE_CONTAINER_NAME:${mockserver.azurite.container-na ## BLOB HISTORY ################### history.enabled=true +%dev.history.enabled=true +%test.history.enabled=true +%openapi_internal.history.enabled=false +%openapi_psp.history.enabled=false +%openapi_organization.history.enabled=false + blob.history.connect-str=${BLOB_HISTORY_CONNECTION_STRING:${mockserver.azurite.connection-string}} %dev.blob.history.connect-str=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1; +%openapi_internal.blob.history.connect-str=na +%openapi_psp.blob.history.connect-str=na +%openapi_organization.blob.history.connect-str=na + blob.history.containername=${BLOB_HISTORY_CONTAINER_NAME:${mockserver.azurite.history.container-name}} %dev.blob.history.containername=fdrhistory +%openapi_internal.blob.history.containername=na +%openapi_psp.blob.history.containername=na +%openapi_organization.blob.history.containername=na table.history.connect-str=${TABLE_HISTORY_CONNECTION_STRING:${mockserver.azurite.connection-string}} %dev.table.history.connect-str=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1; +%openapi_internal.table.history.connect-str=na +%openapi_psp.table.history.connect-str=na +%openapi_organization.table.history.connect-str=na + table.history.tablename.fdrpublish=${TABLE_HISTORY_FDR_PUBLISH_TABLE:${mockserver.azurite.table.fdrpublish}} %dev.table.history.tablename.fdrpublish=fdrpublish +%openapi_internal.table.history.tablename.fdrpublish=na +%openapi_psp.table.history.tablename.fdrpublish=na +%openapi_organization.table.history.tablename.fdrpublish=na + table.history.tablename.fdrpaymentpublish=${TABLE_HISTORY_FDR_PAYMENT_PUBLISH_TABLE:${mockserver.azurite.table.fdrpaymentpublish}} %dev.table.history.tablename.fdrpaymentpublish=fdrpaymentpublish +%openapi_internal.table.history.tablename.fdrpaymentpublish=na +%openapi_psp.table.history.tablename.fdrpaymentpublish=na +%openapi_organization.table.history.tablename.fdrpaymentpublish=na ################### ## OPENAPI FILTER From b7fd669af4802120e825fdc9f1362d5f7fde5b2d Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Tue, 23 Jan 2024 14:42:15 +0100 Subject: [PATCH 06/11] NOD-642 Fix test --- .../java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java b/src/main/java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java index c3cee712..a52132b9 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java +++ b/src/main/java/it/gov/pagopa/fdr/service/re/model/BlobHttpBody.java @@ -1,11 +1,15 @@ package it.gov.pagopa.fdr.service.re.model; +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import org.bson.codecs.pojo.annotations.BsonProperty; @Data @Builder +@AllArgsConstructor +@NoArgsConstructor public class BlobHttpBody { @BsonProperty("storage_account") From 24eac9941978f7637d72f29422dd505beafa2e3e Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Tue, 23 Jan 2024 17:34:50 +0100 Subject: [PATCH 07/11] NOD-642 - Fix Smells --- .../java/it/gov/pagopa/fdr/AppStartup.java | 24 ++++++++--- src/main/java/it/gov/pagopa/fdr/Config.java | 10 +++-- .../exceptionmapper/ExceptionMappers.java | 7 +++- .../pagopa/fdr/rest/filter/RequestFilter.java | 10 +++-- .../fdr/rest/filter/ResponseFilter.java | 13 ++++-- .../pagopa/fdr/rest/info/InfoResource.java | 7 +++- .../BaseOrganizationsResource.java | 34 +++++++++++----- .../InternalOrganizationsResource.java | 16 ++++++++ .../organizations/OrganizationsResource.java | 16 ++++++++ ...nternalOrganizationsValidationService.java | 7 +++- .../OrganizationsValidationService.java | 7 +++- .../pagopa/fdr/rest/psps/BasePspResource.java | 28 +++++++++---- .../fdr/rest/psps/InternalPspsResource.java | 16 ++++++++ .../pagopa/fdr/rest/psps/PspsResource.java | 16 ++++++++ .../InternalPspValidationService.java | 7 +++- .../validation/PspsValidationService.java | 7 +++- .../fdr/rest/support/SupportResource.java | 10 +++-- .../service/conversion/ConversionService.java | 10 +++-- .../fdr/service/history/HistoryService.java | 24 +++++------ .../service/history/StorageFdrService.java | 14 ------- .../history/constants/HistoryConstants.java | 4 ++ .../history/mapper/HistoryServiceMapper.java | 3 -- .../history/model/FdrHistoryMongoEntity.java | 40 ------------------- .../organizations/OrganizationsService.java | 10 +++-- .../pagopa/fdr/service/psps/PspsService.java | 24 ++++++++--- .../gov/pagopa/fdr/service/re/ReService.java | 10 +++-- .../fdr/service/support/SupportService.java | 13 ++++-- .../pagopa/fdr/service/re/ReServiceTest.java | 7 +++- 28 files changed, 256 insertions(+), 138 deletions(-) delete mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/StorageFdrService.java delete mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java diff --git a/src/main/java/it/gov/pagopa/fdr/AppStartup.java b/src/main/java/it/gov/pagopa/fdr/AppStartup.java index f59f0c08..f776a90a 100644 --- a/src/main/java/it/gov/pagopa/fdr/AppStartup.java +++ b/src/main/java/it/gov/pagopa/fdr/AppStartup.java @@ -6,7 +6,6 @@ import it.gov.pagopa.fdr.service.re.ReService; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.jboss.logging.Logger; @@ -26,14 +25,27 @@ public class AppStartup { @ConfigProperty(name = "history.enabled") boolean historyEnabled; - @Inject Logger log; + private final Logger log; - @Inject Config config; + private final Config config; - @Inject ConversionService conversionQueue; + private final ConversionService conversionQueue; - @Inject ReService reService; - @Inject HistoryService historyService; + private final ReService reService; + private final HistoryService historyService; + + public AppStartup( + Logger log, + Config config, + ConversionService conversionQueue, + ReService reService, + HistoryService historyService) { + this.log = log; + this.config = config; + this.conversionQueue = conversionQueue; + this.reService = reService; + this.historyService = historyService; + } @PostConstruct public void init() { diff --git a/src/main/java/it/gov/pagopa/fdr/Config.java b/src/main/java/it/gov/pagopa/fdr/Config.java index 1a8aed67..74cccad0 100644 --- a/src/main/java/it/gov/pagopa/fdr/Config.java +++ b/src/main/java/it/gov/pagopa/fdr/Config.java @@ -4,7 +4,6 @@ import io.quarkus.scheduler.Scheduled; import io.quarkus.scheduler.ScheduledExecution; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import jakarta.ws.rs.client.ClientRequestFilter; import java.net.URI; import java.util.Collections; @@ -29,6 +28,11 @@ public class Config { private FdrCacheApi nodeCacheApi; + public Config(ObjectMapper objectMapper, Logger log) { + this.objectMapper = objectMapper; + this.log = log; + } + // @PostConstruct @SneakyThrows public void init() { @@ -48,7 +52,7 @@ public void init() { this.cache = newCache; } - @Inject ObjectMapper objectMapper; + private final ObjectMapper objectMapper; ConfigDataV1 cache; @@ -63,7 +67,7 @@ public ConfigDataV1 getClonedCache() { } } - @Inject Logger log; + private final Logger log; @Scheduled(cron = "{api_config_cache.cron.expr}") void cronJobApiconfigCache(ScheduledExecution execution) { diff --git a/src/main/java/it/gov/pagopa/fdr/rest/exceptionmapper/ExceptionMappers.java b/src/main/java/it/gov/pagopa/fdr/rest/exceptionmapper/ExceptionMappers.java index 458b469e..e8060826 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/exceptionmapper/ExceptionMappers.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/exceptionmapper/ExceptionMappers.java @@ -12,7 +12,6 @@ import it.gov.pagopa.fdr.exception.AppErrorCodeMessageInterface; import it.gov.pagopa.fdr.exception.AppException; import it.gov.pagopa.fdr.util.AppMessageUtil; -import jakarta.inject.Inject; import jakarta.validation.ConstraintViolationException; import jakarta.validation.UnexpectedTypeException; import jakarta.ws.rs.WebApplicationException; @@ -29,7 +28,11 @@ public class ExceptionMappers { - @Inject Logger log; + private final Logger log; + + public ExceptionMappers(Logger log) { + this.log = log; + } @ServerExceptionMapper public Response mapWebApplicationException(WebApplicationException webApplicationException) { diff --git a/src/main/java/it/gov/pagopa/fdr/rest/filter/RequestFilter.java b/src/main/java/it/gov/pagopa/fdr/rest/filter/RequestFilter.java index 0684e2f3..a5900054 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/filter/RequestFilter.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/filter/RequestFilter.java @@ -6,7 +6,6 @@ import it.gov.pagopa.fdr.service.re.model.*; import it.gov.pagopa.fdr.util.AppConstant; import it.gov.pagopa.fdr.util.AppReUtil; -import jakarta.inject.Inject; import jakarta.ws.rs.container.ContainerRequestContext; import jakarta.ws.rs.container.ContainerRequestFilter; import jakarta.ws.rs.core.MultivaluedMap; @@ -26,9 +25,14 @@ @Provider public class RequestFilter implements ContainerRequestFilter { - @Inject Logger log; + private final Logger log; - @Inject ReService reService; + private final ReService reService; + + public RequestFilter(Logger log, ReService reService) { + this.log = log; + this.reService = reService; + } @Override public void filter(ContainerRequestContext containerRequestContext) throws IOException { diff --git a/src/main/java/it/gov/pagopa/fdr/rest/filter/ResponseFilter.java b/src/main/java/it/gov/pagopa/fdr/rest/filter/ResponseFilter.java index b680be56..b8f3e95d 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/filter/ResponseFilter.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/filter/ResponseFilter.java @@ -13,7 +13,6 @@ import it.gov.pagopa.fdr.util.AppConstant; import it.gov.pagopa.fdr.util.AppReUtil; import it.gov.pagopa.fdr.util.MDCKeys; -import jakarta.inject.Inject; import jakarta.ws.rs.container.ContainerRequestContext; import jakarta.ws.rs.container.ContainerResponseContext; import jakarta.ws.rs.container.ContainerResponseFilter; @@ -33,11 +32,17 @@ @Provider public class ResponseFilter implements ContainerResponseFilter { - @Inject Logger log; + private final Logger log; - @Inject ReService reService; + private final ReService reService; - @Inject ObjectMapper objectMapper; + private final ObjectMapper objectMapper; + + public ResponseFilter(Logger log, ReService reService, ObjectMapper objectMapper) { + this.log = log; + this.reService = reService; + this.objectMapper = objectMapper; + } @Override public void filter( diff --git a/src/main/java/it/gov/pagopa/fdr/rest/info/InfoResource.java b/src/main/java/it/gov/pagopa/fdr/rest/info/InfoResource.java index af556c61..fd4427a7 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/info/InfoResource.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/info/InfoResource.java @@ -5,7 +5,6 @@ import it.gov.pagopa.fdr.service.re.model.FdrActionEnum; import it.gov.pagopa.fdr.util.AppMessageUtil; import it.gov.pagopa.fdr.util.Re; -import jakarta.inject.Inject; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; @@ -24,7 +23,7 @@ @Tag(name = "Info", description = "Info operations") public class InfoResource { - @Inject Logger log; + private final Logger log; @ConfigProperty(name = "app.name", defaultValue = "app") String name; @@ -35,6 +34,10 @@ public class InfoResource { @ConfigProperty(name = "app.environment", defaultValue = "local") String environment; + public InfoResource(Logger log) { + this.log = log; + } + @Operation(summary = "Get info of FDR") @APIResponses( value = { diff --git a/src/main/java/it/gov/pagopa/fdr/rest/organizations/BaseOrganizationsResource.java b/src/main/java/it/gov/pagopa/fdr/rest/organizations/BaseOrganizationsResource.java index 81e2f438..3ce42341 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/organizations/BaseOrganizationsResource.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/organizations/BaseOrganizationsResource.java @@ -15,7 +15,6 @@ import it.gov.pagopa.fdr.service.organizations.OrganizationsService; import it.gov.pagopa.fdr.service.re.model.EventTypeEnum; import it.gov.pagopa.fdr.util.AppMessageUtil; -import jakarta.inject.Inject; import java.time.Instant; import org.jboss.logging.Logger; import org.jboss.logging.MDC; @@ -23,15 +22,30 @@ public abstract class BaseOrganizationsResource { - @Inject Config config; - @Inject Logger log; - - @Inject OrganizationsValidationService validator; - @Inject InternalOrganizationsValidationService internalValidator; - - @Inject OrganizationsResourceServiceMapper mapper; - - @Inject OrganizationsService service; + private final Config config; + private final Logger log; + + private final OrganizationsValidationService validator; + private final InternalOrganizationsValidationService internalValidator; + + private final OrganizationsResourceServiceMapper mapper; + + private final OrganizationsService service; + + protected BaseOrganizationsResource( + Config config, + Logger log, + OrganizationsValidationService validator, + InternalOrganizationsValidationService internalValidator, + OrganizationsResourceServiceMapper mapper, + OrganizationsService service) { + this.config = config; + this.log = log; + this.validator = validator; + this.internalValidator = internalValidator; + this.mapper = mapper; + this.service = service; + } protected GetAllResponse baseGetAll( String organizationId, diff --git a/src/main/java/it/gov/pagopa/fdr/rest/organizations/InternalOrganizationsResource.java b/src/main/java/it/gov/pagopa/fdr/rest/organizations/InternalOrganizationsResource.java index fa23390b..e0625b26 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/organizations/InternalOrganizationsResource.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/organizations/InternalOrganizationsResource.java @@ -1,8 +1,13 @@ package it.gov.pagopa.fdr.rest.organizations; +import it.gov.pagopa.fdr.Config; +import it.gov.pagopa.fdr.rest.organizations.mapper.OrganizationsResourceServiceMapper; import it.gov.pagopa.fdr.rest.organizations.response.GetAllResponse; import it.gov.pagopa.fdr.rest.organizations.response.GetPaymentResponse; import it.gov.pagopa.fdr.rest.organizations.response.GetResponse; +import it.gov.pagopa.fdr.rest.organizations.validation.InternalOrganizationsValidationService; +import it.gov.pagopa.fdr.rest.organizations.validation.OrganizationsValidationService; +import it.gov.pagopa.fdr.service.organizations.OrganizationsService; import it.gov.pagopa.fdr.service.re.model.FdrActionEnum; import it.gov.pagopa.fdr.util.AppConstant; import it.gov.pagopa.fdr.util.Re; @@ -23,6 +28,7 @@ import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; import org.eclipse.microprofile.openapi.annotations.tags.Tag; +import org.jboss.logging.Logger; @Tag(name = "Internal Organizations", description = "Organizations operations") @Path("/internal/organizations/{" + AppConstant.ORGANIZATION + "}/fdrs") @@ -30,6 +36,16 @@ @Produces("application/json") public class InternalOrganizationsResource extends BaseOrganizationsResource { + protected InternalOrganizationsResource( + Config config, + Logger log, + OrganizationsValidationService validator, + InternalOrganizationsValidationService internalValidator, + OrganizationsResourceServiceMapper mapper, + OrganizationsService service) { + super(config, log, validator, internalValidator, mapper, service); + } + @Operation( operationId = "internalGetAllPublished", summary = "Get all fdr published", diff --git a/src/main/java/it/gov/pagopa/fdr/rest/organizations/OrganizationsResource.java b/src/main/java/it/gov/pagopa/fdr/rest/organizations/OrganizationsResource.java index 14eba995..a2803622 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/organizations/OrganizationsResource.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/organizations/OrganizationsResource.java @@ -1,8 +1,13 @@ package it.gov.pagopa.fdr.rest.organizations; +import it.gov.pagopa.fdr.Config; +import it.gov.pagopa.fdr.rest.organizations.mapper.OrganizationsResourceServiceMapper; import it.gov.pagopa.fdr.rest.organizations.response.GetAllResponse; import it.gov.pagopa.fdr.rest.organizations.response.GetPaymentResponse; import it.gov.pagopa.fdr.rest.organizations.response.GetResponse; +import it.gov.pagopa.fdr.rest.organizations.validation.InternalOrganizationsValidationService; +import it.gov.pagopa.fdr.rest.organizations.validation.OrganizationsValidationService; +import it.gov.pagopa.fdr.service.organizations.OrganizationsService; import it.gov.pagopa.fdr.service.re.model.FdrActionEnum; import it.gov.pagopa.fdr.util.AppConstant; import it.gov.pagopa.fdr.util.Re; @@ -23,6 +28,7 @@ import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; import org.eclipse.microprofile.openapi.annotations.tags.Tag; +import org.jboss.logging.Logger; @Tag(name = "Organizations", description = "Organizations operations") @Path("/organizations/{" + AppConstant.ORGANIZATION + "}/fdrs") @@ -30,6 +36,16 @@ @Produces("application/json") public class OrganizationsResource extends BaseOrganizationsResource { + protected OrganizationsResource( + Config config, + Logger log, + OrganizationsValidationService validator, + InternalOrganizationsValidationService internalValidator, + OrganizationsResourceServiceMapper mapper, + OrganizationsService service) { + super(config, log, validator, internalValidator, mapper, service); + } + @Operation( operationId = "getAllPublished", summary = "Get all fdr published", diff --git a/src/main/java/it/gov/pagopa/fdr/rest/organizations/validation/InternalOrganizationsValidationService.java b/src/main/java/it/gov/pagopa/fdr/rest/organizations/validation/InternalOrganizationsValidationService.java index 6727fa30..f457a7b1 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/organizations/validation/InternalOrganizationsValidationService.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/organizations/validation/InternalOrganizationsValidationService.java @@ -6,14 +6,17 @@ import it.gov.pagopa.fdr.rest.validation.CommonValidationService; import it.gov.pagopa.fdr.util.AppMessageUtil; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import org.jboss.logging.Logger; import org.openapi.quarkus.api_config_cache_json.model.ConfigDataV1; @ApplicationScoped public class InternalOrganizationsValidationService extends CommonValidationService { - @Inject Logger log; + private final Logger log; + + public InternalOrganizationsValidationService(Logger log) { + this.log = log; + } @WithSpan(kind = SERVER) public void validateGetAllInternal(String action, String pspId, ConfigDataV1 configData) { diff --git a/src/main/java/it/gov/pagopa/fdr/rest/organizations/validation/OrganizationsValidationService.java b/src/main/java/it/gov/pagopa/fdr/rest/organizations/validation/OrganizationsValidationService.java index 1b1b4ce7..798c94e5 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/organizations/validation/OrganizationsValidationService.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/organizations/validation/OrganizationsValidationService.java @@ -6,14 +6,17 @@ import it.gov.pagopa.fdr.rest.validation.CommonValidationService; import it.gov.pagopa.fdr.util.AppMessageUtil; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import org.jboss.logging.Logger; import org.openapi.quarkus.api_config_cache_json.model.ConfigDataV1; @ApplicationScoped public class OrganizationsValidationService extends CommonValidationService { - @Inject Logger log; + private final Logger log; + + public OrganizationsValidationService(Logger log) { + this.log = log; + } @WithSpan(kind = SERVER) public void validateGetAllByEc( diff --git a/src/main/java/it/gov/pagopa/fdr/rest/psps/BasePspResource.java b/src/main/java/it/gov/pagopa/fdr/rest/psps/BasePspResource.java index 01873c63..95b6cebe 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/psps/BasePspResource.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/psps/BasePspResource.java @@ -19,7 +19,6 @@ import it.gov.pagopa.fdr.service.psps.PspsService; import it.gov.pagopa.fdr.service.re.model.EventTypeEnum; import it.gov.pagopa.fdr.util.AppMessageUtil; -import jakarta.inject.Inject; import jakarta.ws.rs.core.Response.Status; import java.time.Instant; import org.jboss.logging.Logger; @@ -31,17 +30,32 @@ public abstract class BasePspResource { public static final String S_BY_PSP_S_WITH_FDR_S = "%s by psp:[%s] with fdr:[%s]"; - @Inject Logger log; + private final Logger log; - @Inject Config config; + private final Config config; - @Inject PspsValidationService validator; + private final PspsValidationService validator; - @Inject InternalPspValidationService internalValidator; + private final InternalPspValidationService internalValidator; - @Inject PspsResourceServiceMapper mapper; + private final PspsResourceServiceMapper mapper; - @Inject PspsService service; + private final PspsService service; + + protected BasePspResource( + Logger log, + Config config, + PspsValidationService validator, + InternalPspValidationService internalValidator, + PspsResourceServiceMapper mapper, + PspsService service) { + this.log = log; + this.config = config; + this.validator = validator; + this.internalValidator = internalValidator; + this.mapper = mapper; + this.service = service; + } protected RestResponse baseCreate( String pspId, String fdr, CreateRequest createRequest) { diff --git a/src/main/java/it/gov/pagopa/fdr/rest/psps/InternalPspsResource.java b/src/main/java/it/gov/pagopa/fdr/rest/psps/InternalPspsResource.java index e8a168ea..fdef585b 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/psps/InternalPspsResource.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/psps/InternalPspsResource.java @@ -1,14 +1,19 @@ package it.gov.pagopa.fdr.rest.psps; +import it.gov.pagopa.fdr.Config; import it.gov.pagopa.fdr.rest.model.GenericResponse; import it.gov.pagopa.fdr.rest.organizations.response.GetPaymentResponse; import it.gov.pagopa.fdr.rest.organizations.response.GetResponse; +import it.gov.pagopa.fdr.rest.psps.mapper.PspsResourceServiceMapper; import it.gov.pagopa.fdr.rest.psps.request.AddPaymentRequest; import it.gov.pagopa.fdr.rest.psps.request.CreateRequest; import it.gov.pagopa.fdr.rest.psps.request.DeletePaymentRequest; import it.gov.pagopa.fdr.rest.psps.response.GetAllCreatedResponse; import it.gov.pagopa.fdr.rest.psps.response.GetAllPublishedResponse; import it.gov.pagopa.fdr.rest.psps.response.GetCreatedResponse; +import it.gov.pagopa.fdr.rest.psps.validation.InternalPspValidationService; +import it.gov.pagopa.fdr.rest.psps.validation.PspsValidationService; +import it.gov.pagopa.fdr.service.psps.PspsService; import it.gov.pagopa.fdr.service.re.model.FdrActionEnum; import it.gov.pagopa.fdr.util.AppConstant; import it.gov.pagopa.fdr.util.Re; @@ -35,6 +40,7 @@ import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; import org.eclipse.microprofile.openapi.annotations.tags.Tag; +import org.jboss.logging.Logger; import org.jboss.resteasy.reactive.RestResponse; @Tag(name = "Internal PSP", description = "PSP operations") @@ -43,6 +49,16 @@ @Produces("application/json") public class InternalPspsResource extends BasePspResource { + protected InternalPspsResource( + Logger log, + Config config, + PspsValidationService validator, + InternalPspValidationService internalValidator, + PspsResourceServiceMapper mapper, + PspsService service) { + super(log, config, validator, internalValidator, mapper, service); + } + @Operation(operationId = "internalCreate", summary = "Create fdr", description = "Create fdr") @RequestBody(content = @Content(schema = @Schema(implementation = CreateRequest.class))) @APIResponses( diff --git a/src/main/java/it/gov/pagopa/fdr/rest/psps/PspsResource.java b/src/main/java/it/gov/pagopa/fdr/rest/psps/PspsResource.java index 3b7c6974..c5d0c57a 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/psps/PspsResource.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/psps/PspsResource.java @@ -1,14 +1,19 @@ package it.gov.pagopa.fdr.rest.psps; +import it.gov.pagopa.fdr.Config; import it.gov.pagopa.fdr.rest.model.GenericResponse; import it.gov.pagopa.fdr.rest.organizations.response.GetPaymentResponse; import it.gov.pagopa.fdr.rest.organizations.response.GetResponse; +import it.gov.pagopa.fdr.rest.psps.mapper.PspsResourceServiceMapper; import it.gov.pagopa.fdr.rest.psps.request.AddPaymentRequest; import it.gov.pagopa.fdr.rest.psps.request.CreateRequest; import it.gov.pagopa.fdr.rest.psps.request.DeletePaymentRequest; import it.gov.pagopa.fdr.rest.psps.response.GetAllCreatedResponse; import it.gov.pagopa.fdr.rest.psps.response.GetAllPublishedResponse; import it.gov.pagopa.fdr.rest.psps.response.GetCreatedResponse; +import it.gov.pagopa.fdr.rest.psps.validation.InternalPspValidationService; +import it.gov.pagopa.fdr.rest.psps.validation.PspsValidationService; +import it.gov.pagopa.fdr.service.psps.PspsService; import it.gov.pagopa.fdr.service.re.model.FdrActionEnum; import it.gov.pagopa.fdr.util.AppConstant; import it.gov.pagopa.fdr.util.Re; @@ -26,6 +31,7 @@ import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; import org.eclipse.microprofile.openapi.annotations.tags.Tag; +import org.jboss.logging.Logger; import org.jboss.resteasy.reactive.RestResponse; @Tag(name = "PSP", description = "PSP operations") @@ -34,6 +40,16 @@ @Produces("application/json") public class PspsResource extends BasePspResource { + protected PspsResource( + Logger log, + Config config, + PspsValidationService validator, + InternalPspValidationService internalValidator, + PspsResourceServiceMapper mapper, + PspsService service) { + super(log, config, validator, internalValidator, mapper, service); + } + @Operation(operationId = "create", summary = "Create fdr", description = "Create fdr") @RequestBody(content = @Content(schema = @Schema(implementation = CreateRequest.class))) @APIResponses( diff --git a/src/main/java/it/gov/pagopa/fdr/rest/psps/validation/InternalPspValidationService.java b/src/main/java/it/gov/pagopa/fdr/rest/psps/validation/InternalPspValidationService.java index fd130641..646251cb 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/psps/validation/InternalPspValidationService.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/psps/validation/InternalPspValidationService.java @@ -6,14 +6,17 @@ import it.gov.pagopa.fdr.rest.validation.CommonValidationService; import it.gov.pagopa.fdr.util.AppMessageUtil; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import org.jboss.logging.Logger; import org.openapi.quarkus.api_config_cache_json.model.ConfigDataV1; @ApplicationScoped public class InternalPspValidationService extends CommonValidationService { - @Inject Logger log; + private final Logger log; + + public InternalPspValidationService(Logger log) { + this.log = log; + } @WithSpan(kind = SERVER) public void validateGetAllInternal(String action, String pspId, ConfigDataV1 configData) { diff --git a/src/main/java/it/gov/pagopa/fdr/rest/psps/validation/PspsValidationService.java b/src/main/java/it/gov/pagopa/fdr/rest/psps/validation/PspsValidationService.java index 88bf6fb9..a8d8beaa 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/psps/validation/PspsValidationService.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/psps/validation/PspsValidationService.java @@ -7,7 +7,6 @@ import it.gov.pagopa.fdr.rest.validation.CommonValidationService; import it.gov.pagopa.fdr.util.AppMessageUtil; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import org.jboss.logging.Logger; import org.openapi.quarkus.api_config_cache_json.model.BrokerPsp; import org.openapi.quarkus.api_config_cache_json.model.Channel; @@ -17,7 +16,11 @@ @ApplicationScoped public class PspsValidationService extends CommonValidationService { - @Inject Logger log; + private final Logger log; + + public PspsValidationService(Logger log) { + this.log = log; + } @WithSpan(kind = SERVER) public void validateCreateFlow( diff --git a/src/main/java/it/gov/pagopa/fdr/rest/support/SupportResource.java b/src/main/java/it/gov/pagopa/fdr/rest/support/SupportResource.java index 8ba45a07..2c307e5e 100644 --- a/src/main/java/it/gov/pagopa/fdr/rest/support/SupportResource.java +++ b/src/main/java/it/gov/pagopa/fdr/rest/support/SupportResource.java @@ -11,7 +11,6 @@ import it.gov.pagopa.fdr.service.support.SupportService; import it.gov.pagopa.fdr.util.AppConstant; import it.gov.pagopa.fdr.util.Re; -import jakarta.inject.Inject; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Pattern; import jakarta.ws.rs.Consumes; @@ -37,8 +36,13 @@ @Produces("application/json") public class SupportResource { - @Inject SupportResourceServiceMapper mapper; - @Inject SupportService service; + private final SupportResourceServiceMapper mapper; + private final SupportService service; + + public SupportResource(SupportResourceServiceMapper mapper, SupportService service) { + this.mapper = mapper; + this.service = service; + } @Operation( operationId = "getByIuv", diff --git a/src/main/java/it/gov/pagopa/fdr/service/conversion/ConversionService.java b/src/main/java/it/gov/pagopa/fdr/service/conversion/ConversionService.java index 07ac0c87..23674d6d 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/conversion/ConversionService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/conversion/ConversionService.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import it.gov.pagopa.fdr.service.conversion.message.FdrMessage; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import java.nio.charset.StandardCharsets; import java.util.Base64; import lombok.SneakyThrows; @@ -23,11 +22,16 @@ public class ConversionService { @ConfigProperty(name = "queue.conversion.name") String queueName; - @Inject Logger log; + private final Logger log; private QueueClient queue; - @Inject ObjectMapper objectMapper; + private final ObjectMapper objectMapper; + + public ConversionService(Logger log, ObjectMapper objectMapper) { + this.log = log; + this.objectMapper = objectMapper; + } @SneakyThrows public void init() { diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java index 28887620..dbab3e1f 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java @@ -21,7 +21,6 @@ import it.gov.pagopa.fdr.service.history.model.FdrHistoryPaymentEntity; import it.gov.pagopa.fdr.service.re.model.BlobHttpBody; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import java.time.Instant; import java.util.LinkedHashMap; import java.util.List; @@ -31,9 +30,9 @@ @ApplicationScoped public class HistoryService { - @Inject HistoryServiceMapper mapper; - @Inject Logger logger; - @Inject ObjectMapper objMapper; + private final HistoryServiceMapper mapper; + private final Logger logger; + private final ObjectMapper objMapper; @ConfigProperty(name = "blob.history.connect-str") String blobConnectionsStr; @@ -53,6 +52,12 @@ public class HistoryService { private BlobContainerClient blobContainerClient; private TableServiceClient tableServiceClient; + public HistoryService(HistoryServiceMapper mapper, Logger logger, ObjectMapper objMapper) { + this.mapper = mapper; + this.logger = logger; + this.objMapper = objMapper; + } + public void init() { logger.infof( "Blob Storage HistoryService service init. Container name [%s]", blobContainerName); @@ -72,9 +77,6 @@ public void saveOnStorage( String partitionKey = createPartitionKey(fdrEntity.getPublished()); saveFdrOnTableStorage(fdrEntity, partitionKey); saveFdrPaymentsOnTableStorage(paymentsList, partitionKey); - } catch (JsonProcessingException e) { - logger.error("Error processing fdrHistoryEntity as Bytes", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); } catch (Exception e) { logger.error("Exception while uploading FDR History", e); throw new AppException(AppErrorCodeMessageEnum.ERROR); @@ -126,8 +128,7 @@ private String createPartitionKey(Instant publishTime) { return publishTime.toString().substring(0, 10); } - private void saveFdrOnTableStorage(FdrPublishEntity fdrPublishEntity, String partitionKey) - throws JsonProcessingException { + private void saveFdrOnTableStorage(FdrPublishEntity fdrPublishEntity, String partitionKey) { Map fdrPublishMap = new LinkedHashMap<>(); String id = String.valueOf(fdrPublishEntity.id); fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_ID, id); @@ -202,8 +203,7 @@ private void saveFdrOnTableStorage(FdrPublishEntity fdrPublishEntity, String par } private void saveFdrPaymentsOnTableStorage( - List paymentsList, String partitionKey) - throws JsonProcessingException { + List paymentsList, String partitionKey) { paymentsList.forEach( payment -> { Map paymentMap = new LinkedHashMap<>(); @@ -240,7 +240,7 @@ private void saveFdrPaymentsOnTableStorage( + id); TableClient tableClient = this.tableServiceClient.getTableClient(tableNameFdrPaymentPublish); - TableEntity entity = new TableEntity(partitionKey, id + "-" + payment.getIndex()); + TableEntity entity = new TableEntity(partitionKey, id); entity.setProperties(paymentMap); tableClient.createEntity(entity); }); diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/StorageFdrService.java b/src/main/java/it/gov/pagopa/fdr/service/history/StorageFdrService.java deleted file mode 100644 index 8ccb161a..00000000 --- a/src/main/java/it/gov/pagopa/fdr/service/history/StorageFdrService.java +++ /dev/null @@ -1,14 +0,0 @@ -package it.gov.pagopa.fdr.service.history; - -import com.fasterxml.jackson.databind.ObjectMapper; -import it.gov.pagopa.fdr.service.history.mapper.HistoryServiceMapper; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import org.jboss.logging.Logger; - -@ApplicationScoped -public class StorageFdrService { - @Inject HistoryServiceMapper mapper; - @Inject Logger logger; - @Inject ObjectMapper objMapper; -} diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java b/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java index 6f0cbdca..88dfadc7 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java @@ -1,6 +1,10 @@ package it.gov.pagopa.fdr.service.history.constants; public class HistoryConstants { + private HistoryConstants() { + throw new IllegalStateException("Utility Class"); + } + public static final String FDR_PUBLISH_ID = "id"; public static final String FDR_PUBLISH_REVISION = "revision"; public static final String FDR_PUBLISH_CREATED = "created"; diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java b/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java index 31ddb92d..45cc34a6 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/mapper/HistoryServiceMapper.java @@ -3,7 +3,6 @@ import it.gov.pagopa.fdr.repository.fdr.FdrPaymentPublishEntity; import it.gov.pagopa.fdr.repository.fdr.FdrPublishEntity; import it.gov.pagopa.fdr.service.history.model.FdrHistoryEntity; -import it.gov.pagopa.fdr.service.history.model.FdrHistoryMongoEntity; import it.gov.pagopa.fdr.service.history.model.FdrHistoryPaymentEntity; import java.util.List; import org.mapstruct.Mapper; @@ -24,6 +23,4 @@ FdrHistoryPaymentEntity toFdrHistoryPaymentEntity( List toFdrHistoryPaymentEntityList( List fdrPaymentPublishEntities); - - FdrHistoryMongoEntity toFdrHistoryMongoEntity(FdrHistoryEntity fdrHistoryEntity); } diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java deleted file mode 100644 index f4eef0ae..00000000 --- a/src/main/java/it/gov/pagopa/fdr/service/history/model/FdrHistoryMongoEntity.java +++ /dev/null @@ -1,40 +0,0 @@ -package it.gov.pagopa.fdr.service.history.model; - -import io.quarkus.mongodb.panache.PanacheMongoEntity; -import io.quarkus.mongodb.panache.common.MongoEntity; -import it.gov.pagopa.fdr.repository.fdr.model.FdrStatusEnumEntity; -import it.gov.pagopa.fdr.repository.fdr.model.ReceiverEntity; -import it.gov.pagopa.fdr.repository.fdr.model.SenderEntity; -import java.time.Instant; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.bson.codecs.pojo.annotations.BsonProperty; - -@Data -@EqualsAndHashCode(callSuper = true) -@MongoEntity(collection = "fdr_history") -public class FdrHistoryMongoEntity extends PanacheMongoEntity { - - private Long revision; - - private Instant created; - - private Instant updated; - - private Instant published; - - private String fdr; - - @BsonProperty("fdr_date") - private Instant fdrDate; - - private SenderEntity sender; - - private ReceiverEntity receiver; - - private String bicCodePouringBank; - - private FdrStatusEnumEntity status; - - private FdrHistoryEntity jsonFile; -} diff --git a/src/main/java/it/gov/pagopa/fdr/service/organizations/OrganizationsService.java b/src/main/java/it/gov/pagopa/fdr/service/organizations/OrganizationsService.java index 69331f8c..ca52694f 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/organizations/OrganizationsService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/organizations/OrganizationsService.java @@ -22,7 +22,6 @@ import it.gov.pagopa.fdr.util.AppDBUtil; import it.gov.pagopa.fdr.util.AppMessageUtil; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import java.time.Instant; import java.util.ArrayList; import java.util.List; @@ -32,9 +31,14 @@ @ApplicationScoped public class OrganizationsService { - @Inject OrganizationsServiceServiceMapper mapper; + private final OrganizationsServiceServiceMapper mapper; - @Inject Logger log; + private final Logger log; + + public OrganizationsService(OrganizationsServiceServiceMapper mapper, Logger log) { + this.mapper = mapper; + this.log = log; + } @WithSpan(kind = SERVER) public FdrAllDto find( diff --git a/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java b/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java index 6cc683a6..81f725ea 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java @@ -28,7 +28,6 @@ import it.gov.pagopa.fdr.util.AppDBUtil; import it.gov.pagopa.fdr.util.AppMessageUtil; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import java.math.BigDecimal; import java.time.Instant; import java.util.ArrayList; @@ -42,15 +41,28 @@ @ApplicationScoped public class PspsService { - @Inject PspsServiceServiceMapper mapper; + private final PspsServiceServiceMapper mapper; - @Inject Logger log; + private final Logger log; - @Inject ConversionService conversionQueue; + private final ConversionService conversionQueue; - @Inject ReService reService; + private final ReService reService; - @Inject HistoryService historyService; + private final HistoryService historyService; + + public PspsService( + PspsServiceServiceMapper mapper, + Logger log, + ConversionService conversionQueue, + ReService reService, + HistoryService historyService) { + this.mapper = mapper; + this.log = log; + this.conversionQueue = conversionQueue; + this.reService = reService; + this.historyService = historyService; + } @WithSpan(kind = SERVER) public void save(String action, FdrDto fdrDto) { diff --git a/src/main/java/it/gov/pagopa/fdr/service/re/ReService.java b/src/main/java/it/gov/pagopa/fdr/service/re/ReService.java index 986a61f5..7af8d1df 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/re/ReService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/re/ReService.java @@ -18,7 +18,6 @@ import it.gov.pagopa.fdr.service.re.model.ReInterface; import it.gov.pagopa.fdr.util.AppConstant; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import java.time.ZoneId; @@ -31,7 +30,7 @@ @ApplicationScoped public class ReService { - @Inject Logger log; + private final Logger log; @ConfigProperty(name = "ehub.re.connect-str") String eHubConnectStr; @@ -49,7 +48,12 @@ public class ReService { private BlobContainerClient blobContainerClient; - @Inject ObjectMapper objectMapper; + private final ObjectMapper objectMapper; + + public ReService(Logger log, ObjectMapper objectMapper) { + this.log = log; + this.objectMapper = objectMapper; + } public void init() { log.infof( diff --git a/src/main/java/it/gov/pagopa/fdr/service/support/SupportService.java b/src/main/java/it/gov/pagopa/fdr/service/support/SupportService.java index 7bd26532..a94fd463 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/support/SupportService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/support/SupportService.java @@ -17,7 +17,6 @@ import it.gov.pagopa.fdr.util.AppDBUtil; import it.gov.pagopa.fdr.util.AppMessageUtil; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; import java.util.List; import java.util.Optional; import org.jboss.logging.Logger; @@ -25,11 +24,17 @@ @ApplicationScoped public class SupportService { - @Inject Config config; + private final Config config; - @Inject SupportServiceServiceMapper mapper; + private final SupportServiceServiceMapper mapper; - @Inject Logger log; + private final Logger log; + + public SupportService(Config config, SupportServiceServiceMapper mapper, Logger log) { + this.config = config; + this.mapper = mapper; + this.log = log; + } @WithSpan(kind = SERVER) public PaymentGetByPspIdIuvIurDTO findPaymentsByPspIdAndIuvIur( diff --git a/src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java b/src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java index 3a58ca18..0e85aa52 100644 --- a/src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java +++ b/src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java @@ -18,7 +18,6 @@ import it.gov.pagopa.fdr.exception.AppException; import it.gov.pagopa.fdr.service.re.model.*; import it.gov.pagopa.fdr.test.util.AzuriteResource; -import jakarta.inject.Inject; import java.lang.reflect.Field; import java.time.Instant; import java.util.ArrayList; @@ -35,7 +34,7 @@ @QuarkusTestResource(AzuriteResource.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) class ReServiceTest { - @Inject ObjectMapper objectMapper; + private final ObjectMapper objectMapper; @InjectMock ReService reServiceMock; @ConfigProperty(name = "blob.re.connect-str") @@ -52,6 +51,10 @@ class ReServiceTest { Field blobContainerClientField; Field objectMapperField; + ReServiceTest(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + @BeforeAll void init() throws NoSuchFieldException, IllegalAccessException { producerField = ReService.class.getDeclaredField("producer"); From 6ca63f7f0f450710dbd901cd29860699e5f07f2f Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Tue, 23 Jan 2024 17:56:06 +0100 Subject: [PATCH 08/11] NOD-642 - Fix Test --- src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java b/src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java index 0e85aa52..120750b9 100644 --- a/src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java +++ b/src/test/java/it/gov/pagopa/fdr/service/re/ReServiceTest.java @@ -74,7 +74,9 @@ void init() throws NoSuchFieldException, IllegalAccessException { eHubNameField.set(reServiceMock, "eventHub"); Field logField = ReService.class.getDeclaredField("log"); + logField.setAccessible(true); objectMapperField = ReService.class.getDeclaredField("objectMapper"); + objectMapperField.setAccessible(true); logField.set(reServiceMock, Logger.getLogger(ReService.class)); } From 65f29856f9d948d0dd8a8d51cc8f0430396d5002 Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Tue, 23 Jan 2024 18:07:42 +0100 Subject: [PATCH 09/11] NOD-642 - Fix Smell --- .../it/gov/pagopa/fdr/service/support/SupportService.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/it/gov/pagopa/fdr/service/support/SupportService.java b/src/main/java/it/gov/pagopa/fdr/service/support/SupportService.java index a94fd463..1a5a2f39 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/support/SupportService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/support/SupportService.java @@ -9,7 +9,6 @@ import io.quarkus.mongodb.panache.PanacheQuery; import io.quarkus.panache.common.Page; import io.quarkus.panache.common.Sort; -import it.gov.pagopa.fdr.Config; import it.gov.pagopa.fdr.repository.fdr.FdrPaymentPublishEntity; import it.gov.pagopa.fdr.service.dto.MetadataDto; import it.gov.pagopa.fdr.service.dto.PaymentGetByPspIdIuvIurDTO; @@ -24,14 +23,11 @@ @ApplicationScoped public class SupportService { - private final Config config; - private final SupportServiceServiceMapper mapper; private final Logger log; - public SupportService(Config config, SupportServiceServiceMapper mapper, Logger log) { - this.config = config; + public SupportService(SupportServiceServiceMapper mapper, Logger log) { this.mapper = mapper; this.log = log; } From 5ba838f1df2bfe21b4f76a9cc5f1bc381ddfd1e3 Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Fri, 26 Jan 2024 10:17:01 +0100 Subject: [PATCH 10/11] NOD-642 - Added test --- pom.xml | 11 +- .../exception/AppErrorCodeMessageEnum.java | 10 +- .../fdr/repository/fdr/FdrPublishEntity.java | 4 +- .../fdr/service/history/HistoryService.java | 75 +++++-- .../history/constants/HistoryConstants.java | 3 +- .../history/model/HistoryBlobBody.java | 29 +++ .../history/model/JsonSchemaVersionEnum.java | 5 + .../pagopa/fdr/service/psps/PspsService.java | 3 +- .../java/it/gov/pagopa/fdr/util/FileUtil.java | 42 ++++ src/main/resources/application.properties | 2 + src/main/resources/messages.properties | 5 + .../schema-json/fdr_history_schema_v1.json | 187 ++++++++++++++++++ .../service/history/HistoryServiceTest.java | 155 +++++++++++++++ 13 files changed, 507 insertions(+), 24 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/model/HistoryBlobBody.java create mode 100644 src/main/java/it/gov/pagopa/fdr/service/history/model/JsonSchemaVersionEnum.java create mode 100644 src/main/java/it/gov/pagopa/fdr/util/FileUtil.java create mode 100644 src/main/resources/schema-json/fdr_history_schema_v1.json create mode 100644 src/test/java/it/gov/pagopa/fdr/service/history/HistoryServiceTest.java diff --git a/pom.xml b/pom.xml index 778ab580..67b369dd 100644 --- a/pom.xml +++ b/pom.xml @@ -165,7 +165,16 @@ 2.10.1 test - + + + + + + + com.networknt + json-schema-validator + 1.0.87 + io.netty diff --git a/src/main/java/it/gov/pagopa/fdr/exception/AppErrorCodeMessageEnum.java b/src/main/java/it/gov/pagopa/fdr/exception/AppErrorCodeMessageEnum.java index 4b0db54c..eafa7212 100644 --- a/src/main/java/it/gov/pagopa/fdr/exception/AppErrorCodeMessageEnum.java +++ b/src/main/java/it/gov/pagopa/fdr/exception/AppErrorCodeMessageEnum.java @@ -50,7 +50,15 @@ public enum AppErrorCodeMessageEnum implements AppErrorCodeMessageInterface { EVENT_HUB_RE_TOO_LARGE("0722", "eHub.re.tooLarge", Status.INTERNAL_SERVER_ERROR), REPORTING_FLOW_WRONG_TOT_PAYMENT("0723", "fdr.wrongTotPayment", RestResponse.Status.BAD_REQUEST), - REPORTING_FLOW_WRONG_SUM_PAYMENT("0724", "fdr.wrongSumPayment", RestResponse.Status.BAD_REQUEST); + REPORTING_FLOW_WRONG_SUM_PAYMENT("0724", "fdr.wrongSumPayment", RestResponse.Status.BAD_REQUEST), + FDR_HISTORY_VALID_JSON_ERROR( + "0725", "fdr.fdrHistoryJsonValidationError", Status.INTERNAL_SERVER_ERROR), + FDR_HISTORY_UPLOAD_JSON_BLOB_ERROR( + "0726", "fdr.fdrHistoryUploadJsonError", Status.INTERNAL_SERVER_ERROR), + FDR_HISTORY_JSON_PROCESSING_ERROR( + "0727", "fdr.fdrHistoryJsonProcessingError", Status.INTERNAL_SERVER_ERROR), + FDR_HISTORY_SAVE_TABLE_STORAGE_ERROR( + "0728", "fdr.fdrHistorySaveOnTableStorageError", Status.INTERNAL_SERVER_ERROR); private final String errorCode; private final String errorMessageKey; private final RestResponse.Status httpStatus; diff --git a/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java b/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java index 0a72ab1b..bf3854e3 100644 --- a/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java +++ b/src/main/java/it/gov/pagopa/fdr/repository/fdr/FdrPublishEntity.java @@ -9,7 +9,7 @@ import it.gov.pagopa.fdr.repository.fdr.model.FdrStatusEnumEntity; import it.gov.pagopa.fdr.repository.fdr.model.ReceiverEntity; import it.gov.pagopa.fdr.repository.fdr.model.SenderEntity; -import it.gov.pagopa.fdr.service.re.model.BlobHttpBody; +import it.gov.pagopa.fdr.service.history.model.HistoryBlobBody; import java.time.Instant; import lombok.Data; import lombok.EqualsAndHashCode; @@ -60,7 +60,7 @@ public class FdrPublishEntity extends PanacheMongoEntity { private Double sumPayments; @BsonProperty("ref_json") - private BlobHttpBody refJson; + private HistoryBlobBody refJson; public static PanacheQuery findByFdrAndRevAndPspIdAndOrganizationId( String fdr, Long rev, String pspId, String organizationId) { diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java index dbab3e1f..b1796d41 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java @@ -10,7 +10,12 @@ import com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.BlobServiceClientBuilder; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.networknt.schema.JsonSchema; +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import com.networknt.schema.ValidationMessage; import it.gov.pagopa.fdr.exception.AppErrorCodeMessageEnum; import it.gov.pagopa.fdr.exception.AppException; import it.gov.pagopa.fdr.repository.fdr.FdrPaymentPublishEntity; @@ -19,12 +24,13 @@ import it.gov.pagopa.fdr.service.history.mapper.HistoryServiceMapper; import it.gov.pagopa.fdr.service.history.model.FdrHistoryEntity; import it.gov.pagopa.fdr.service.history.model.FdrHistoryPaymentEntity; -import it.gov.pagopa.fdr.service.re.model.BlobHttpBody; +import it.gov.pagopa.fdr.service.history.model.HistoryBlobBody; +import it.gov.pagopa.fdr.service.history.model.JsonSchemaVersionEnum; +import it.gov.pagopa.fdr.util.FileUtil; import jakarta.enterprise.context.ApplicationScoped; import java.time.Instant; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.jboss.logging.Logger; @@ -34,6 +40,8 @@ public class HistoryService { private final Logger logger; private final ObjectMapper objMapper; + private final FileUtil fileUtil; + @ConfigProperty(name = "blob.history.connect-str") String blobConnectionsStr; @@ -49,13 +57,19 @@ public class HistoryService { @ConfigProperty(name = "table.history.tablename.fdrpaymentpublish") String tableNameFdrPaymentPublish; + @ConfigProperty(name = "json.schema.version") + String jsonSchemaVersion; + private BlobContainerClient blobContainerClient; private TableServiceClient tableServiceClient; + private String jsonSchema; - public HistoryService(HistoryServiceMapper mapper, Logger logger, ObjectMapper objMapper) { + public HistoryService( + HistoryServiceMapper mapper, Logger logger, ObjectMapper objMapper, FileUtil fileUtil) { this.mapper = mapper; this.logger = logger; this.objMapper = objMapper; + this.fileUtil = fileUtil; } public void init() { @@ -68,6 +82,10 @@ public void init() { new TableServiceClientBuilder().connectionString(tableStorageConnString).buildClient(); this.tableServiceClient.createTableIfNotExists(tableNameFdrPublish); this.tableServiceClient.createTableIfNotExists(tableNameFdrPaymentPublish); + this.jsonSchema = + fileUtil.convertToString( + fileUtil.getFileFromResourceAsStream( + "/schema-json/fdr_history_schema_" + jsonSchemaVersion.toLowerCase() + ".json")); } public void saveOnStorage( @@ -78,15 +96,15 @@ public void saveOnStorage( saveFdrOnTableStorage(fdrEntity, partitionKey); saveFdrPaymentsOnTableStorage(paymentsList, partitionKey); } catch (Exception e) { - logger.error("Exception while uploading FDR History", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); + logger.error("Error while uploading FDR History on Table Storage", e); + throw new AppException(AppErrorCodeMessageEnum.FDR_HISTORY_SAVE_TABLE_STORAGE_ERROR); } } else { logger.debugf("Blob container [%s] NOT INITIALIZED", blobContainerName); } } - public BlobHttpBody saveJsonFile( + public HistoryBlobBody saveJsonFile( FdrPublishEntity fdrEntity, List paymentsList) { if (blobContainerClient != null) { FdrHistoryEntity fdrHistoryEntity = mapper.toFdrHistoryEntity(fdrEntity); @@ -99,24 +117,28 @@ public BlobHttpBody saveJsonFile( fdrEntity.getFdr(), fdrEntity.getSender().getPspId(), fdrEntity.getRevision()); try { - byte[] jsonBytes = objMapper.writeValueAsBytes(fdrHistoryEntity); - BinaryData jsonFile = BinaryData.fromBytes(jsonBytes); + String fdrHistoryEntityJson = objMapper.writeValueAsString(fdrHistoryEntity); - BlobClient blobClient = blobContainerClient.getBlobClient(fileName); - blobClient.upload(jsonFile); + isJsonValid(fdrHistoryEntityJson, jsonSchema); + BinaryData jsonFile = BinaryData.fromString(fdrHistoryEntityJson); - return BlobHttpBody.builder() + try { + BlobClient blobClient = blobContainerClient.getBlobClient(fileName); + blobClient.upload(jsonFile); + } catch (Exception e) { + logger.error("Error uploading history JSON blob", e); + throw new AppException(AppErrorCodeMessageEnum.FDR_HISTORY_UPLOAD_JSON_BLOB_ERROR); + } + return HistoryBlobBody.builder() .storageAccount(blobContainerClient.getAccountName()) .containerName(blobContainerName) .fileName(fileName) .fileLength(jsonFile.getLength()) + .jsonSchemaVersion(JsonSchemaVersionEnum.valueOf(jsonSchemaVersion)) .build(); } catch (JsonProcessingException e) { - logger.error("Error processing fdrHistoryEntity as Bytes", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); - } catch (Exception e) { - logger.error("Error while uploading blob", e); - throw new AppException(AppErrorCodeMessageEnum.ERROR); + logger.error("Error processing fdrHistoryEntity", e); + throw new AppException(AppErrorCodeMessageEnum.FDR_HISTORY_JSON_PROCESSING_ERROR); } } else { logger.debugf("Blob container [%s] NOT INITIALIZED", blobContainerName); @@ -124,6 +146,20 @@ public BlobHttpBody saveJsonFile( } } + public void isJsonValid(String jsonString, String jsonSchema) throws JsonProcessingException { + // jsonString = jsonString.replace("\"created\":", "\"pippo\":"); + JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V202012); + JsonSchema schema = factory.getSchema(jsonSchema); + JsonNode jsonNode = objMapper.readTree(jsonString); + Set errors = schema.validate(jsonNode); + if (!errors.isEmpty()) { + logger.errorf( + "History JSON validation failed. [%s]", + errors.stream().map(e -> e.getMessage()).collect(Collectors.joining(", "))); + throw new AppException(AppErrorCodeMessageEnum.FDR_HISTORY_VALID_JSON_ERROR); + } + } + private String createPartitionKey(Instant publishTime) { return publishTime.toString().substring(0, 10); } @@ -150,6 +186,9 @@ private void saveFdrOnTableStorage(FdrPublishEntity fdrPublishEntity, String par fdrPublishMap.put( HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_STORAGE_ACCOUNT, fdrPublishEntity.getRefJson().getStorageAccount()); + fdrPublishMap.put( + HistoryConstants.FDR_PUBLISH_FDR_REF_JSON_JSON_SCHEMA_VERSION, + fdrPublishEntity.getRefJson().getJsonSchemaVersion()); fdrPublishMap.put( HistoryConstants.FDR_PUBLISH_SENDER_TYPE, fdrPublishEntity.getSender().getType()); fdrPublishMap.put(HistoryConstants.FDR_PUBLISH_SENDER_ID, fdrPublishEntity.getSender().getId()); diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java b/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java index 88dfadc7..2f4099ba 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/constants/HistoryConstants.java @@ -16,6 +16,8 @@ private HistoryConstants() { public static final String FDR_PUBLISH_FDR_REF_JSON_FILE_LENGTH = "ref_json.file_length"; public static final String FDR_PUBLISH_FDR_REF_JSON_FILE_NAME = "ref_json.file_name"; public static final String FDR_PUBLISH_FDR_REF_JSON_STORAGE_ACCOUNT = "ref_json.storage_account"; + public static final String FDR_PUBLISH_FDR_REF_JSON_JSON_SCHEMA_VERSION = + "ref_json.json_schema_version"; public static final String FDR_PUBLISH_SENDER_TYPE = "sender.type"; public static final String FDR_PUBLISH_SENDER_ID = "sender.id"; public static final String FDR_PUBLISH_SENDER_PSP_ID = "sender.psp_id"; @@ -34,7 +36,6 @@ private HistoryConstants() { public static final String FDR_PUBLISH_COMPUTED_SUM_PAYMENTS = "computed_sum_payments"; public static final String FDR_PUBLISH_TOT_PAYMENTS = "tot_payments"; public static final String FDR_PUBLISH_SUM_PAYMENTS = "sum_payments"; - public static final String FDR_PAYMENT_PUBLISH_ID = "id"; public static final String FDR_PAYMENT_PUBLISH_REVISION = "revision"; public static final String FDR_PAYMENT_PUBLISH_CREATED = "created"; diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/HistoryBlobBody.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/HistoryBlobBody.java new file mode 100644 index 00000000..d8a6509e --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/model/HistoryBlobBody.java @@ -0,0 +1,29 @@ +package it.gov.pagopa.fdr.service.history.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.bson.codecs.pojo.annotations.BsonProperty; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class HistoryBlobBody { + + @BsonProperty("storage_account") + private String storageAccount; + + @BsonProperty("container_name") + private String containerName; + + @BsonProperty("file_name") + private String fileName; + + @BsonProperty("file_length") + private long fileLength; + + @BsonProperty("json_schema_version") + private JsonSchemaVersionEnum jsonSchemaVersion; +} diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/model/JsonSchemaVersionEnum.java b/src/main/java/it/gov/pagopa/fdr/service/history/model/JsonSchemaVersionEnum.java new file mode 100644 index 00000000..f646a0d0 --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/service/history/model/JsonSchemaVersionEnum.java @@ -0,0 +1,5 @@ +package it.gov.pagopa.fdr.service.history.model; + +public enum JsonSchemaVersionEnum { + V1; +} diff --git a/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java b/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java index 81f725ea..f31a33e1 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/psps/PspsService.java @@ -22,6 +22,7 @@ import it.gov.pagopa.fdr.service.conversion.message.FdrMessage; import it.gov.pagopa.fdr.service.dto.*; import it.gov.pagopa.fdr.service.history.HistoryService; +import it.gov.pagopa.fdr.service.history.model.HistoryBlobBody; import it.gov.pagopa.fdr.service.psps.mapper.PspsServiceServiceMapper; import it.gov.pagopa.fdr.service.re.ReService; import it.gov.pagopa.fdr.service.re.model.*; @@ -321,7 +322,7 @@ public void publishByFdr(String action, String pspId, String fdr, boolean intern FdrPaymentPublishEntity.persistFdrPaymentPublishEntities(fdrPaymentPublishEntities); // salva su storage dello storico - BlobHttpBody body = historyService.saveJsonFile(fdrPublishEntity, fdrPaymentPublishEntities); + HistoryBlobBody body = historyService.saveJsonFile(fdrPublishEntity, fdrPaymentPublishEntities); fdrPublishEntity.setRefJson(body); fdrPublishEntity.persistEntity(); diff --git a/src/main/java/it/gov/pagopa/fdr/util/FileUtil.java b/src/main/java/it/gov/pagopa/fdr/util/FileUtil.java new file mode 100644 index 00000000..85106ad7 --- /dev/null +++ b/src/main/java/it/gov/pagopa/fdr/util/FileUtil.java @@ -0,0 +1,42 @@ +package it.gov.pagopa.fdr.util; + +import jakarta.enterprise.context.ApplicationScoped; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import org.apache.commons.io.IOUtils; +import org.jboss.logging.Logger; + +@ApplicationScoped +public class FileUtil { + private final Logger log; + + public FileUtil(Logger log) { + this.log = log; + } + + public InputStream getFileFromResourceAsStream(String fileName) { + // The class loader that loaded the class + ClassLoader classLoader = getClass().getClassLoader(); + InputStream inputStream = classLoader.getResourceAsStream(fileName); + // the stream holding the file content + if (inputStream == null) { + log.errorf("Error reading file: [%s]", fileName); + throw new IllegalArgumentException("file not found! " + fileName); + } else { + return inputStream; + } + } + + public String convertToString(InputStream is) { + try (InputStreamReader streamReader = new InputStreamReader(is, StandardCharsets.UTF_8); + BufferedReader reader = new BufferedReader(streamReader)) { + return IOUtils.toString(reader); + } catch (IOException e) { + log.error("Error converting InputStream to String", e); + throw new RuntimeException(e); + } + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 28f00e32..713ee1c6 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -204,6 +204,8 @@ table.history.tablename.fdrpaymentpublish=${TABLE_HISTORY_FDR_PAYMENT_PUBLISH_TA %openapi_psp.table.history.tablename.fdrpaymentpublish=na %openapi_organization.table.history.tablename.fdrpaymentpublish=na +json.schema.version=V1 + ################### ## OPENAPI FILTER ################### diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index c372b6e8..1dbba179 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -23,6 +23,11 @@ fdr.noMatchIndex=Index of payment not match with index loaded on fdr [{0}] fdr.wrongTotPayment=Fdr [{0}] send tot payment [{1}] but computed [{2}] fdr.wrongSumPayment=Fdr [{0}] send sum payment [{1}] but computed [{2}] +fdr.fdrHistoryJsonValidationError=Fdr History JSON validation failed +fdr.fdrHistoryUploadJsonError=Error uploading Fdr history JSON blob +fdr.fdrHistoryJsonProcessingError=Error processing Fdr history JSON +fdr.fdrHistorySaveOnTableStorageError=Error uploading Fdr history to Table Storage + pspId.unknown=Psp [{0}] unknown pspId.notEnabled=Psp [{0}] not enabled brokerId.unknown=Broker [{0}] unknown diff --git a/src/main/resources/schema-json/fdr_history_schema_v1.json b/src/main/resources/schema-json/fdr_history_schema_v1.json new file mode 100644 index 00000000..f9fac9cf --- /dev/null +++ b/src/main/resources/schema-json/fdr_history_schema_v1.json @@ -0,0 +1,187 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://localhost/v1/fdr_history_schema.json", + "title": "FDR", + "description": "Flusso di rendicontazione", + "type": "object", + "required": ["fdr", "fdrDate", "sender", "receiver", "regulation", "regulationDate", "totPayments", "sumPayments"], + "properties": { + "revision": { + "description": "Revisione FDR", + "type": "integer" + }, + "created": { + "description": "Data creazione FDR", + "type": "string" + }, + "updated": { + "description": "Data aggiornamento FDR", + "type": "string" + }, + "fdr": { + "description": "Identificativo flusso", + "type": "string", + "pattern": "[a-zA-Z0-9\\-_]{1,35}", + "example": "2016-08-16pspTest-1178" + }, + "fdrDate": { + "description": "Data flusso", + "type": "string", + "example": "2023-04-05T09:21:37.810000Z" + }, + "sender": { + "description": "Mittente", + "type": "object", + "required": ["type", "id", "pspId", "pspName", "pspBrokerId", "channelId"], + "properties": { + "type": { + "description": "Tipo mittente", + "type": "string", + "example": "LEGAL_PERSON", + "enum": ["LEGAL_PERSON", "ABI_CODE", "BIC_CODE"] + }, + "id": { + "description": "ID Mittente", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "SELBIT2B" + }, + "pspId": { + "description": "ID Psp", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "60000000001" + }, + "pspName": { + "description": "Nome Psp", + "type": "string", + "pattern": "^(.{3,70})$", + "example": "Bank" + }, + "pspBrokerId": { + "description": "ID broker Psp", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "70000000001" + }, + "channelId": { + "description": "ID canale", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "80000000001" + }, + "password": { + "description": "Password", + "type": "string" + } + } + }, + "receiver": { + "description": "Destinatario", + "type": "object", + "required": ["id", "organizationId", "organizationName"], + "properties": { + "id": { + "description": "ID Destinatario", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "APPBIT2B" + }, + "organizationId": { + "description": "ID Organizzazione", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "20000000001" + }, + "organizationName": { + "description": "Nome Organizzazione", + "type": "string", + "pattern": "^(.{1,140})$", + "example": "Comune di xyz" + } + } + }, + "regulation": { + "description": "Regolamento", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "SEPA - Bonifico xzy" + }, + "regulationDate": { + "description": "Data regolamento", + "type": "string", + "example": "2023-04-03T12:00:30.900000Z" + }, + "bicCodePouringBank": { + "description": "Bic", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "UNCRITMMXXX" + }, + "status": { + "description": "Stato FDR", + "type": "string", + "example": "CREATED", + "enum": ["CREATED", "INSERTED", "PUBLISHED"] + }, + "totPayments": { + "description": "Numero pagamenti del flusso", + "type": "integer", + "example": 100 + }, + "sumPayments": { + "description": "Importo totale dei pagamenti", + "type": "number", + "pattern": "^\\d{1,2147483647}([.]\\d{1,2})?$", + "example": 0.01, + "exclusiveMinimum": 0 + }, + "paymentList": { + "description": "Lista dei pagamenti", + "type": "array", + "items": { + "type": "object", + "properties": { + "iuv": { + "description": "IUV", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "abcdefg" + }, + "iur": { + "description": "IUR", + "type": "string", + "pattern": "^(.{1,35})$", + "example": "abcdefg" + }, + "index": { + "description": "Indice del pagamento", + "type": "integer", + "minimum": 1, + "example": 1 + }, + "pay": { + "description": "Importo pagamento", + "type": "number", + "pattern": "^\\d{1,2147483647}([.]\\d{1,2})?$", + "example": 0.01, + "exclusiveMinimum": 0 + }, + "payStatus": { + "description": "Stato del pagamento", + "type": "string", + "example": "EXECUTED", + "enum": ["EXECUTED", "REVOKED", "NO_RPT"] + }, + "payDate": { + "description": "Data pagamento", + "type": "string", + "example": "2023-02-03T12:00:30.900000Z" + } + } + }, + "minItems": 1, + "maxItems": 1000 + } + } +} \ No newline at end of file diff --git a/src/test/java/it/gov/pagopa/fdr/service/history/HistoryServiceTest.java b/src/test/java/it/gov/pagopa/fdr/service/history/HistoryServiceTest.java new file mode 100644 index 00000000..8e78d4e5 --- /dev/null +++ b/src/test/java/it/gov/pagopa/fdr/service/history/HistoryServiceTest.java @@ -0,0 +1,155 @@ +package it.gov.pagopa.fdr.service.history; + +import io.quarkus.test.junit.QuarkusTest; +import it.gov.pagopa.fdr.exception.AppException; +import it.gov.pagopa.fdr.util.FileUtil; +import jakarta.inject.Inject; +import org.eclipse.microprofile.config.inject.ConfigProperty; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +@QuarkusTest +class HistoryServiceTest { + @Inject HistoryService historyService; + @Inject FileUtil fileUtil; + + @ConfigProperty(name = "json.schema.version") + String jsonSchemaVersion; + + @Test + void testHistoryJsonValidation_OK() { + String jsonSchema = + fileUtil.convertToString( + fileUtil.getFileFromResourceAsStream( + "/schema-json/fdr_history_schema_" + jsonSchemaVersion.toLowerCase() + ".json")); + String jsonString = + """ + { + "status": "PUBLISHED", + "revision": 1, + "created": "2024-01-26T08:42:17.708Z", + "updated": "2024-01-26T08:42:21.788414200Z", + "fdr": "2024-01-2660000000001-17062585352", + "fdrDate": "2024-01-26T08:42:15.242Z", + "regulation": "SEPA - Bonifico xzy", + "regulationDate": "2024-01-26T08:42:15.242Z", + "bicCodePouringBank": "UNCRITMMXXX", + "sender": { + "type": "LEGAL_PERSON", + "id": "SELBIT2B", + "pspId": "60000000001", + "pspName": "Bank", + "pspBrokerId": "60000000001", + "channelId": "15376371009_04", + "password": "PLACEHOLDER" + }, + "receiver": { + "id": "APPBIT2B", + "organizationId": "15376371009", + "organizationName": "Comune di xyz" + }, + "published": "2024-01-26T08:42:21.788414200Z", + "computedTotPayments": 3, + "computedSumPayments": 0.03, + "totPayments": 3, + "sumPayments": 0.03, + "paymentList": [ + { + "iuv": "84100314577508a", + "iur": "6208035415a", + "index": 1, + "pay": 0.01, + "payStatus": "EXECUTED", + "payDate": "2023-02-03T12:00:30.900Z" + }, + { + "iuv": "84100314577508b", + "iur": "6208035415b", + "index": 2, + "pay": 0.01, + "payStatus": "EXECUTED", + "payDate": "2023-02-03T12:00:30.900Z" + }, + { + "iuv": "84100314577508c", + "iur": "6208035415c", + "index": 3, + "pay": 0.01, + "payStatus": "EXECUTED", + "payDate": "2023-02-03T12:00:30.900Z" + } + ] + } + """; + Assertions.assertDoesNotThrow(() -> historyService.isJsonValid(jsonString, jsonSchema)); + } + + @Test + void testHistoryJsonValidation_Error() { + String jsonSchema = + fileUtil.convertToString( + fileUtil.getFileFromResourceAsStream( + "/schema-json/fdr_history_schema_" + jsonSchemaVersion.toLowerCase() + ".json")); + String jsonString = + """ + { + "status": "PUBLISHED", + "revision": "1", + "created": "2024-01-26T08:42:17.708Z", + "updated": "2024-01-26T08:42:21.788414200Z", + "fdr": "2024-01-2660000000001-17062585352", + "fdrDate": "2024-01-26T08:42:15.242Z", + "regulation": "SEPA - Bonifico xzy", + "regulationDate": "2024-01-26T08:42:15.242Z", + "bicCodePouringBank": "UNCRITMMXXX", + "sender": { + "type": "LEGAL_PERSON", + "id": "SELBIT2B", + "pspId": "60000000001", + "pspName": "Bank", + "pspBrokerId": "60000000001", + "channelId": "15376371009_04", + "password": "PLACEHOLDER" + }, + "receiver": { + "id": "APPBIT2B", + "organizationId": "15376371009", + "organizationName": "Comune di xyz" + }, + "published": "2024-01-26T08:42:21.788414200Z", + "computedTotPayments": 3, + "computedSumPayments": 0.03, + "totPayments": 3, + "sumPayments": 0.03, + "paymentList": [ + { + "iuv": "84100314577508a", + "iur": "6208035415a", + "index": 1, + "pay": 0.01, + "payStatus": "EXECUTED", + "payDate": "2023-02-03T12:00:30.900Z" + }, + { + "iuv": "84100314577508b", + "iur": "6208035415b", + "index": 2, + "pay": 0.01, + "payStatus": "EXECUTED", + "payDate": "2023-02-03T12:00:30.900Z" + }, + { + "iuv": "84100314577508c", + "iur": "6208035415c", + "index": 3, + "pay": 0.01, + "payStatus": "EXECUTED", + "payDate": "2023-02-03T12:00:30.900Z" + } + ] + } + """; + Assertions.assertThrows( + AppException.class, () -> historyService.isJsonValid(jsonString, jsonSchema)); + } +} From 27a72393ecc9149c487ab392adecb1f72ef77dd8 Mon Sep 17 00:00:00 2001 From: andrea-barchi Date: Fri, 26 Jan 2024 10:26:54 +0100 Subject: [PATCH 11/11] NOD-642 - Fix smells --- pom.xml | 5 ----- .../exception/AppErrorCodeMessageEnum.java | 4 +++- .../fdr/service/history/HistoryService.java | 19 +++++++++++-------- .../java/it/gov/pagopa/fdr/util/FileUtil.java | 6 ++++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 67b369dd..4925e0b9 100644 --- a/pom.xml +++ b/pom.xml @@ -165,11 +165,6 @@ 2.10.1 test - - - - - com.networknt json-schema-validator diff --git a/src/main/java/it/gov/pagopa/fdr/exception/AppErrorCodeMessageEnum.java b/src/main/java/it/gov/pagopa/fdr/exception/AppErrorCodeMessageEnum.java index eafa7212..067b441e 100644 --- a/src/main/java/it/gov/pagopa/fdr/exception/AppErrorCodeMessageEnum.java +++ b/src/main/java/it/gov/pagopa/fdr/exception/AppErrorCodeMessageEnum.java @@ -58,7 +58,9 @@ public enum AppErrorCodeMessageEnum implements AppErrorCodeMessageInterface { FDR_HISTORY_JSON_PROCESSING_ERROR( "0727", "fdr.fdrHistoryJsonProcessingError", Status.INTERNAL_SERVER_ERROR), FDR_HISTORY_SAVE_TABLE_STORAGE_ERROR( - "0728", "fdr.fdrHistorySaveOnTableStorageError", Status.INTERNAL_SERVER_ERROR); + "0728", "fdr.fdrHistorySaveOnTableStorageError", Status.INTERNAL_SERVER_ERROR), + FILE_UTILS_CONVERSION_ERROR("0729", "fdr.fileUtilsConversionError", Status.INTERNAL_SERVER_ERROR), + FILE_UTILS_FILE_NOT_FOUND("0730", "fdr.fileUtilsFileNotFound", Status.INTERNAL_SERVER_ERROR); private final String errorCode; private final String errorMessageKey; private final RestResponse.Status httpStatus; diff --git a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java index b1796d41..99abc5c1 100644 --- a/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java +++ b/src/main/java/it/gov/pagopa/fdr/service/history/HistoryService.java @@ -122,13 +122,7 @@ public HistoryBlobBody saveJsonFile( isJsonValid(fdrHistoryEntityJson, jsonSchema); BinaryData jsonFile = BinaryData.fromString(fdrHistoryEntityJson); - try { - BlobClient blobClient = blobContainerClient.getBlobClient(fileName); - blobClient.upload(jsonFile); - } catch (Exception e) { - logger.error("Error uploading history JSON blob", e); - throw new AppException(AppErrorCodeMessageEnum.FDR_HISTORY_UPLOAD_JSON_BLOB_ERROR); - } + uploadBlob(fileName, jsonFile); return HistoryBlobBody.builder() .storageAccount(blobContainerClient.getAccountName()) .containerName(blobContainerName) @@ -146,8 +140,17 @@ public HistoryBlobBody saveJsonFile( } } + private void uploadBlob(String fileName, BinaryData jsonFile) { + try { + BlobClient blobClient = blobContainerClient.getBlobClient(fileName); + blobClient.upload(jsonFile); + } catch (Exception e) { + logger.error("Error uploading history JSON blob", e); + throw new AppException(AppErrorCodeMessageEnum.FDR_HISTORY_UPLOAD_JSON_BLOB_ERROR); + } + } + public void isJsonValid(String jsonString, String jsonSchema) throws JsonProcessingException { - // jsonString = jsonString.replace("\"created\":", "\"pippo\":"); JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V202012); JsonSchema schema = factory.getSchema(jsonSchema); JsonNode jsonNode = objMapper.readTree(jsonString); diff --git a/src/main/java/it/gov/pagopa/fdr/util/FileUtil.java b/src/main/java/it/gov/pagopa/fdr/util/FileUtil.java index 85106ad7..7ca4a595 100644 --- a/src/main/java/it/gov/pagopa/fdr/util/FileUtil.java +++ b/src/main/java/it/gov/pagopa/fdr/util/FileUtil.java @@ -1,5 +1,7 @@ package it.gov.pagopa.fdr.util; +import it.gov.pagopa.fdr.exception.AppErrorCodeMessageEnum; +import it.gov.pagopa.fdr.exception.AppException; import jakarta.enterprise.context.ApplicationScoped; import java.io.BufferedReader; import java.io.IOException; @@ -24,7 +26,7 @@ public InputStream getFileFromResourceAsStream(String fileName) { // the stream holding the file content if (inputStream == null) { log.errorf("Error reading file: [%s]", fileName); - throw new IllegalArgumentException("file not found! " + fileName); + throw new AppException(AppErrorCodeMessageEnum.FILE_UTILS_FILE_NOT_FOUND); } else { return inputStream; } @@ -36,7 +38,7 @@ public String convertToString(InputStream is) { return IOUtils.toString(reader); } catch (IOException e) { log.error("Error converting InputStream to String", e); - throw new RuntimeException(e); + throw new AppException(AppErrorCodeMessageEnum.FILE_UTILS_CONVERSION_ERROR); } } }