From 1d0000679b33d7c867c32e9391063ee4cab6f637 Mon Sep 17 00:00:00 2001 From: "antonio.torre" <antonio.torre@pagopa.it> Date: Wed, 29 Jan 2025 15:53:34 +0100 Subject: [PATCH] fix: transferIndex as integer --- openapi/generated.openapi.json | 542 +++++++++--------- openapi/p4pa-debt-position.openapi.yaml | 2 +- .../pu/debtpositions/model/Transfer.java | 2 +- .../ValidateDebtPositionServiceImplTest.java | 2 +- .../util/faker/TransferFaker.java | 4 +- 5 files changed, 276 insertions(+), 276 deletions(-) diff --git a/openapi/generated.openapi.json b/openapi/generated.openapi.json index d84136a4..d71f4e46 100644 --- a/openapi/generated.openapi.json +++ b/openapi/generated.openapi.json @@ -3715,7 +3715,21 @@ } } }, - "DebtPositionType" : { + "Stamp" : { + "type" : "object", + "properties" : { + "stampType" : { + "type" : "string" + }, + "stampHashDocument" : { + "type" : "string" + }, + "stampProvincialResidence" : { + "type" : "string" + } + } + }, + "Transfer" : { "type" : "object", "properties" : { "creationDate" : { @@ -3729,47 +3743,43 @@ "updateOperatorExternalId" : { "type" : "string" }, - "debtPositionTypeId" : { + "transferId" : { "type" : "integer", "format" : "int64" }, - "brokerId" : { + "installmentId" : { "type" : "integer", "format" : "int64" }, - "code" : { + "orgFiscalCode" : { "type" : "string" }, - "description" : { + "orgName" : { "type" : "string" }, - "orgType" : { - "type" : "string" + "amountCents" : { + "type" : "integer", + "format" : "int64" }, - "macroArea" : { + "remittanceInformation" : { "type" : "string" }, - "serviceType" : { - "type" : "string" + "stamp" : { + "$ref" : "#/components/schemas/Stamp" }, - "collectingReason" : { + "iban" : { "type" : "string" }, - "taxonomyCode" : { + "postalIban" : { "type" : "string" }, - "flagAnonymousFiscalCode" : { - "type" : "boolean" - }, - "flagMandatoryDueDate" : { - "type" : "boolean" - }, - "flagNotifyIo" : { - "type" : "boolean" - }, - "ioTemplateMessage" : { + "category" : { "type" : "string" }, + "transferIndex" : { + "type" : "integer", + "format" : "int32" + }, "_links" : { "$ref" : "#/components/schemas/Links" } @@ -3796,16 +3806,16 @@ } } }, - "PagedModelDebtPositionType" : { + "PagedModelTransfer" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "debtPositionTypes" : { + "transfers" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/DebtPositionType" + "$ref" : "#/components/schemas/Transfer" } } } @@ -3818,7 +3828,7 @@ } } }, - "DebtPositionTypeOrgOperators" : { + "DebtPositionType" : { "type" : "object", "properties" : { "creationDate" : { @@ -3832,15 +3842,45 @@ "updateOperatorExternalId" : { "type" : "string" }, - "debtPositionTypeOrgOperatorId" : { + "debtPositionTypeId" : { "type" : "integer", "format" : "int64" }, - "debtPositionTypeOrgId" : { + "brokerId" : { "type" : "integer", "format" : "int64" }, - "operatorExternalUserId" : { + "code" : { + "type" : "string" + }, + "description" : { + "type" : "string" + }, + "orgType" : { + "type" : "string" + }, + "macroArea" : { + "type" : "string" + }, + "serviceType" : { + "type" : "string" + }, + "collectingReason" : { + "type" : "string" + }, + "taxonomyCode" : { + "type" : "string" + }, + "flagAnonymousFiscalCode" : { + "type" : "boolean" + }, + "flagMandatoryDueDate" : { + "type" : "boolean" + }, + "flagNotifyIo" : { + "type" : "boolean" + }, + "ioTemplateMessage" : { "type" : "string" }, "_links" : { @@ -3848,16 +3888,16 @@ } } }, - "PagedModelDebtPositionTypeOrgOperators" : { + "PagedModelDebtPositionType" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "debtPositionTypeOrgOperatorses" : { + "debtPositionTypes" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/DebtPositionTypeOrgOperators" + "$ref" : "#/components/schemas/DebtPositionType" } } } @@ -3884,21 +3924,7 @@ } } }, - "Stamp" : { - "type" : "object", - "properties" : { - "stampType" : { - "type" : "string" - }, - "stampHashDocument" : { - "type" : "string" - }, - "stampProvincialResidence" : { - "type" : "string" - } - } - }, - "DebtPosition" : { + "InstallmentNoPII" : { "type" : "object", "properties" : { "creationDate" : { @@ -3912,197 +3938,134 @@ "updateOperatorExternalId" : { "type" : "string" }, - "debtPositionId" : { + "installmentId" : { "type" : "integer", "format" : "int64" }, - "iupdOrg" : { + "paymentOptionId" : { + "type" : "integer", + "format" : "int64" + }, + "status" : { + "type" : "string", + "enum" : [ "TO_SYNC", "REPORTED", "PAID", "CANCELLED", "INVALID", "EXPIRED", "UNPAID", "DRAFT" ] + }, + "iupdPagopa" : { "type" : "string" }, - "description" : { + "iud" : { "type" : "string" }, - "status" : { - "type" : "string", - "enum" : [ "TO_SYNC", "REPORTED", "PAID", "PARTIALLY_PAID", "CANCELLED", "EXPIRED", "UNPAID", "DRAFT" ] + "iuv" : { + "type" : "string" }, - "debtPositionOrigin" : { + "iur" : { + "type" : "string" + }, + "iuf" : { + "type" : "string" + }, + "nav" : { + "type" : "string" + }, + "dueDate" : { "type" : "string", - "enum" : [ "ORDINARY", "SPONTANEOUS", "SECONDARY_ORG", "RECEIPT_FILE", "RECEIPT_PAGOPA", "REPORTING_PAGOPA" ] + "format" : "date-time" }, - "ingestionFlowFileId" : { - "type" : "integer", - "format" : "int64" + "paymentTypeCode" : { + "type" : "string" }, - "ingestionFlowFileLineNumber" : { + "amountCents" : { "type" : "integer", "format" : "int64" }, - "organizationId" : { + "notificationFeeCents" : { "type" : "integer", "format" : "int64" }, - "debtPositionTypeOrgId" : { + "remittanceInformation" : { + "type" : "string" + }, + "humanFriendlyRemittanceInformation" : { + "type" : "string" + }, + "balance" : { + "type" : "string" + }, + "legacyPaymentMetadata" : { + "type" : "string" + }, + "personalDataId" : { "type" : "integer", "format" : "int64" }, - "notificationDate" : { + "debtorEntityType" : { "type" : "string", - "format" : "date-time" + "enum" : [ "F", "G" ] }, - "validityDate" : { + "debtorFiscalCodeHash" : { "type" : "string", - "format" : "date-time" - }, - "flagIuvVolatile" : { - "type" : "boolean" - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, - "PagedModelDebtPosition" : { - "type" : "object", - "properties" : { - "_embedded" : { - "type" : "object", - "properties" : { - "debtPositions" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/DebtPosition" - } - } - } - }, - "_links" : { - "$ref" : "#/components/schemas/Links" + "format" : "byte" }, - "page" : { - "$ref" : "#/components/schemas/PageMetadata" - } - } - }, - "CollectionModelPaymentOption" : { - "type" : "object", - "properties" : { - "_embedded" : { - "type" : "object", - "properties" : { - "paymentOptions" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PaymentOptionResponse" - } - } - } + "syncStatus" : { + "$ref" : "#/components/schemas/InstallmentSyncStatus" }, "_links" : { "$ref" : "#/components/schemas/Links" } } }, - "CollectionModelObject" : { + "PagedModelInstallmentNoPII" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "objects" : { + "installmentNoPIIs" : { "type" : "array", - "items" : { - "type" : "object" - } - } - } - }, - "_links" : { - "$ref" : "#/components/schemas/Links" - } - } - }, - "PaymentOption" : { - "type" : "object", - "properties" : { - "creationDate" : { - "type" : "string", - "format" : "date-time" - }, - "updateDate" : { - "type" : "string", - "format" : "date-time" - }, - "updateOperatorExternalId" : { - "type" : "string" - }, - "paymentOptionId" : { - "type" : "integer", - "format" : "int64" - }, - "debtPositionId" : { - "type" : "integer", - "format" : "int64" - }, - "totalAmountCents" : { - "type" : "integer", - "format" : "int64" - }, - "status" : { - "type" : "string", - "enum" : [ "TO_SYNC", "REPORTED", "PAID", "PARTIALLY_PAID", "CANCELLED", "INVALID", "EXPIRED", "UNPAID", "DRAFT" ] - }, - "multiDebtor" : { - "type" : "boolean" - }, - "dueDate" : { - "type" : "string", - "format" : "date-time" - }, - "description" : { - "type" : "string" - }, - "paymentOptionType" : { - "type" : "string", - "enum" : [ "SINGLE_INSTALLMENT", "INSTALLMENTS", "DOWN_PAYMENT" ] + "items" : { + "$ref" : "#/components/schemas/InstallmentNoPII" + } + } + } }, "_links" : { "$ref" : "#/components/schemas/Links" + }, + "page" : { + "$ref" : "#/components/schemas/PageMetadata" } } }, - "PagedModelPaymentOption" : { + "CollectionModelTransfer" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "paymentOptions" : { + "transfers" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/PaymentOption" + "$ref" : "#/components/schemas/TransferResponse" } } } }, "_links" : { "$ref" : "#/components/schemas/Links" - }, - "page" : { - "$ref" : "#/components/schemas/PageMetadata" } } }, - "CollectionModelInstallmentNoPII" : { + "CollectionModelObject" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "installmentNoPIIs" : { + "objects" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/InstallmentNoPIIResponse" + "type" : "object" } } } @@ -4373,7 +4336,7 @@ } } }, - "Transfer" : { + "PaymentOption" : { "type" : "object", "properties" : { "creationDate" : { @@ -4387,58 +4350,51 @@ "updateOperatorExternalId" : { "type" : "string" }, - "transferId" : { + "paymentOptionId" : { "type" : "integer", "format" : "int64" }, - "installmentId" : { + "debtPositionId" : { "type" : "integer", "format" : "int64" }, - "orgFiscalCode" : { - "type" : "string" - }, - "orgName" : { - "type" : "string" - }, - "amountCents" : { + "totalAmountCents" : { "type" : "integer", "format" : "int64" }, - "remittanceInformation" : { - "type" : "string" - }, - "stamp" : { - "$ref" : "#/components/schemas/Stamp" + "status" : { + "type" : "string", + "enum" : [ "TO_SYNC", "REPORTED", "PAID", "PARTIALLY_PAID", "CANCELLED", "INVALID", "EXPIRED", "UNPAID", "DRAFT" ] }, - "iban" : { - "type" : "string" + "multiDebtor" : { + "type" : "boolean" }, - "postalIban" : { - "type" : "string" + "dueDate" : { + "type" : "string", + "format" : "date-time" }, - "category" : { + "description" : { "type" : "string" }, - "transferIndex" : { - "type" : "integer", - "format" : "int64" + "paymentOptionType" : { + "type" : "string", + "enum" : [ "SINGLE_INSTALLMENT", "INSTALLMENTS", "DOWN_PAYMENT" ] }, "_links" : { "$ref" : "#/components/schemas/Links" } } }, - "PagedModelTransfer" : { + "PagedModelPaymentOption" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "transfers" : { + "paymentOptions" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/Transfer" + "$ref" : "#/components/schemas/PaymentOption" } } } @@ -4451,46 +4407,65 @@ } } }, - "DebtPositionTypeWithCount" : { + "CollectionModelInstallmentNoPII" : { "type" : "object", "properties" : { - "debtPositionTypeId" : { - "type" : "integer", - "format" : "int64" - }, - "code" : { - "type" : "string" + "_embedded" : { + "type" : "object", + "properties" : { + "installmentNoPIIs" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/InstallmentNoPIIResponse" + } + } + } }, - "description" : { - "type" : "string" + "_links" : { + "$ref" : "#/components/schemas/Links" + } + } + }, + "DebtPositionTypeOrgOperators" : { + "type" : "object", + "properties" : { + "creationDate" : { + "type" : "string", + "format" : "date-time" }, "updateDate" : { "type" : "string", "format" : "date-time" }, - "activeOrganizations" : { + "updateOperatorExternalId" : { + "type" : "string" + }, + "debtPositionTypeOrgOperatorId" : { "type" : "integer", - "format" : "int32" + "format" : "int64" }, - "brokerId" : { + "debtPositionTypeOrgId" : { "type" : "integer", "format" : "int64" }, + "operatorExternalUserId" : { + "type" : "string" + }, "_links" : { "$ref" : "#/components/schemas/Links" } } }, - "PagedModelDebtPositionTypeWithCount" : { + "PagedModelDebtPositionTypeOrgOperators" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "debtPositionTypeWithCounts" : { + "debtPositionTypeOrgOperatorses" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/DebtPositionTypeWithCount" + "$ref" : "#/components/schemas/DebtPositionTypeOrgOperators" } } } @@ -4503,7 +4478,7 @@ } } }, - "InstallmentNoPII" : { + "DebtPosition" : { "type" : "object", "properties" : { "creationDate" : { @@ -4517,93 +4492,66 @@ "updateOperatorExternalId" : { "type" : "string" }, - "installmentId" : { - "type" : "integer", - "format" : "int64" - }, - "paymentOptionId" : { + "debtPositionId" : { "type" : "integer", "format" : "int64" }, - "status" : { - "type" : "string", - "enum" : [ "TO_SYNC", "REPORTED", "PAID", "CANCELLED", "INVALID", "EXPIRED", "UNPAID", "DRAFT" ] - }, - "iupdPagopa" : { - "type" : "string" - }, - "iud" : { - "type" : "string" - }, - "iuv" : { - "type" : "string" - }, - "iur" : { - "type" : "string" - }, - "iuf" : { + "iupdOrg" : { "type" : "string" }, - "nav" : { + "description" : { "type" : "string" }, - "dueDate" : { + "status" : { "type" : "string", - "format" : "date-time" + "enum" : [ "TO_SYNC", "REPORTED", "PAID", "PARTIALLY_PAID", "CANCELLED", "EXPIRED", "UNPAID", "DRAFT" ] }, - "paymentTypeCode" : { - "type" : "string" + "debtPositionOrigin" : { + "type" : "string", + "enum" : [ "ORDINARY", "SPONTANEOUS", "SECONDARY_ORG", "RECEIPT_FILE", "RECEIPT_PAGOPA", "REPORTING_PAGOPA" ] }, - "amountCents" : { + "ingestionFlowFileId" : { "type" : "integer", "format" : "int64" }, - "notificationFeeCents" : { + "ingestionFlowFileLineNumber" : { "type" : "integer", "format" : "int64" }, - "remittanceInformation" : { - "type" : "string" - }, - "humanFriendlyRemittanceInformation" : { - "type" : "string" - }, - "balance" : { - "type" : "string" - }, - "legacyPaymentMetadata" : { - "type" : "string" + "organizationId" : { + "type" : "integer", + "format" : "int64" }, - "personalDataId" : { + "debtPositionTypeOrgId" : { "type" : "integer", "format" : "int64" }, - "debtorEntityType" : { + "notificationDate" : { "type" : "string", - "enum" : [ "F", "G" ] + "format" : "date-time" }, - "debtorFiscalCodeHash" : { + "validityDate" : { "type" : "string", - "format" : "byte" + "format" : "date-time" }, - "syncStatus" : { - "$ref" : "#/components/schemas/InstallmentSyncStatus" + "flagIuvVolatile" : { + "type" : "boolean" }, "_links" : { "$ref" : "#/components/schemas/Links" } } }, - "PagedModelInstallmentNoPII" : { + "PagedModelDebtPosition" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "installmentNoPIIs" : { + "debtPositions" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/InstallmentNoPII" + "$ref" : "#/components/schemas/DebtPosition" } } } @@ -4616,22 +4564,74 @@ } } }, - "CollectionModelTransfer" : { + "CollectionModelPaymentOption" : { "type" : "object", "properties" : { "_embedded" : { "type" : "object", "properties" : { - "transfers" : { + "paymentOptions" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/TransferResponse" + "$ref" : "#/components/schemas/PaymentOptionResponse" + } + } + } + }, + "_links" : { + "$ref" : "#/components/schemas/Links" + } + } + }, + "DebtPositionTypeWithCount" : { + "type" : "object", + "properties" : { + "debtPositionTypeId" : { + "type" : "integer", + "format" : "int64" + }, + "code" : { + "type" : "string" + }, + "description" : { + "type" : "string" + }, + "updateDate" : { + "type" : "string", + "format" : "date-time" + }, + "activeOrganizations" : { + "type" : "integer", + "format" : "int32" + }, + "brokerId" : { + "type" : "integer", + "format" : "int64" + }, + "_links" : { + "$ref" : "#/components/schemas/Links" + } + } + }, + "PagedModelDebtPositionTypeWithCount" : { + "type" : "object", + "properties" : { + "_embedded" : { + "type" : "object", + "properties" : { + "debtPositionTypeWithCounts" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/DebtPositionTypeWithCount" } } } }, "_links" : { "$ref" : "#/components/schemas/Links" + }, + "page" : { + "$ref" : "#/components/schemas/PageMetadata" } } }, @@ -5105,7 +5105,7 @@ }, "transferIndex" : { "type" : "integer", - "format" : "int64" + "format" : "int32" } } }, @@ -5292,7 +5292,7 @@ }, "transferIndex" : { "type" : "integer", - "format" : "int64" + "format" : "int32" } } }, @@ -5682,7 +5682,7 @@ }, "transferIndex" : { "type" : "integer", - "format" : "int64" + "format" : "int32" } } }, diff --git a/openapi/p4pa-debt-position.openapi.yaml b/openapi/p4pa-debt-position.openapi.yaml index cc4465ce..3caa35d9 100644 --- a/openapi/p4pa-debt-position.openapi.yaml +++ b/openapi/p4pa-debt-position.openapi.yaml @@ -386,7 +386,7 @@ components: type: string transferIndex: type: integer - format: int64 + format: int32 ReceiptDTO: type: object required: diff --git a/src/main/java/it/gov/pagopa/pu/debtpositions/model/Transfer.java b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Transfer.java index fec5c6ef..441bf638 100644 --- a/src/main/java/it/gov/pagopa/pu/debtpositions/model/Transfer.java +++ b/src/main/java/it/gov/pagopa/pu/debtpositions/model/Transfer.java @@ -34,7 +34,7 @@ public class Transfer extends BaseEntity implements Serializable, Comparable<Tra private String iban; private String postalIban; private String category; - private Long transferIndex; + private Integer transferIndex; @Override public int compareTo(@Nonnull Transfer o) { diff --git a/src/test/java/it/gov/pagopa/pu/debtpositions/service/create/ValidateDebtPositionServiceImplTest.java b/src/test/java/it/gov/pagopa/pu/debtpositions/service/create/ValidateDebtPositionServiceImplTest.java index ec03bb05..7c3ce5e1 100644 --- a/src/test/java/it/gov/pagopa/pu/debtpositions/service/create/ValidateDebtPositionServiceImplTest.java +++ b/src/test/java/it/gov/pagopa/pu/debtpositions/service/create/ValidateDebtPositionServiceImplTest.java @@ -243,7 +243,7 @@ void givenTransfersMismatchThenThrowValidationException() { DebtPositionDTO debtPositionDTO = buildDebtPositionDTO(); DebtPositionTypeOrg mockDebtPositionTypeOrg = buildDebtPositionTypeOrg(); TransferDTO secondTransfer = buildTransferDTO(); - secondTransfer.setTransferIndex(1L); + secondTransfer.setTransferIndex(1); List<TransferDTO> transfers = List.of(secondTransfer, secondTransfer); debtPositionDTO.getPaymentOptions() .getFirst() diff --git a/src/test/java/it/gov/pagopa/pu/debtpositions/util/faker/TransferFaker.java b/src/test/java/it/gov/pagopa/pu/debtpositions/util/faker/TransferFaker.java index 15c0bb6a..8f3837da 100644 --- a/src/test/java/it/gov/pagopa/pu/debtpositions/util/faker/TransferFaker.java +++ b/src/test/java/it/gov/pagopa/pu/debtpositions/util/faker/TransferFaker.java @@ -17,7 +17,7 @@ public static Transfer buildTransfer() { transfer.setIban("IT60X0542811101000000123456"); transfer.setPostalIban("123456"); transfer.setCategory("category"); - transfer.setTransferIndex(2L); + transfer.setTransferIndex(2); transfer.setStamp(new Stamp("TYPE", "HASH", "PR")); return transfer; } @@ -33,7 +33,7 @@ public static TransferDTO buildTransferDTO() { .iban("IT60X0542811101000000123456") .postalIban("123456") .category("category") - .transferIndex(2L) + .transferIndex(2) .stampType("TYPE") .stampHashDocument("HASH") .stampProvincialResidence("PR")