diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 1e0bb599..7ada83e8 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -82,6 +82,7 @@ microservice-chart: RETRY_MAX_DELAY: "10000" RETRY_MAX_ATTEMPTS: "1" CONNECTION_TIMEOUT: "10000" + PM_REFERENCE_CREATION_DATE: "1680307200000" OTEL_SERVICE_NAME: "pagopabizeventsservice" OTEL_RESOURCE_ATTRIBUTES: "service.name=pagopareceiptspdfserviceotl,deployment.environment=dev" OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317" diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 483679ae..40026c60 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -82,6 +82,7 @@ microservice-chart: RETRY_MAX_DELAY: "10000" RETRY_MAX_ATTEMPTS: "1" CONNECTION_TIMEOUT: "10000" + PM_REFERENCE_CREATION_DATE: "1680307200000" OTEL_SERVICE_NAME: "pagopabizeventsservice" OTEL_RESOURCE_ATTRIBUTES: "service.name=pagopareceiptspdfserviceotl,deployment.environment=prod" OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317" diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index f02574fb..a09db0de 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -82,6 +82,7 @@ microservice-chart: RETRY_MAX_DELAY: "10000" RETRY_MAX_ATTEMPTS: "1" CONNECTION_TIMEOUT: "10000" + PM_REFERENCE_CREATION_DATE: "1680307200000" OTEL_SERVICE_NAME: "pagopabizeventsservice" OTEL_RESOURCE_ATTRIBUTES: "service.name=pagopareceiptspdfserviceotl,deployment.environment=uat" OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317" diff --git a/openapi/openapi.json b/openapi/openapi.json index 773a25d2..8c1b39d5 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title" : "Biz-Events Service", "description" : "Microservice for exposing REST APIs about payment receipts.", "termsOfService" : "https://www.pagopa.gov.it/", - "version" : "0.1.25" + "version" : "0.1.26" }, "servers" : [ { "url" : "http://localhost", @@ -806,10 +806,10 @@ } }, "content" : { - "application/json" : { + "*/*" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } } @@ -844,7 +844,7 @@ } }, "422" : { - "description" : "Unprocessable recipt.", + "description" : "Unprocessable receipt.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -1169,6 +1169,9 @@ }, "isCart" : { "type" : "boolean" + }, + "isPayer" : { + "type" : "boolean" } } }, @@ -1538,6 +1541,10 @@ "transactionDetails" : { "$ref" : "#/components/schemas/TransactionDetails" }, + "timestamp" : { + "type" : "integer", + "format" : "int64" + }, "eventStatus" : { "type" : "string", "enum" : [ "NA", "RETRY", "FAILED", "DONE" ] @@ -1579,6 +1586,9 @@ }, "iuv" : { "type" : "string" + }, + "iur" : { + "type" : "string" } } }, @@ -1886,7 +1896,7 @@ }, "type" : { "type" : "string", - "enum" : [ "F", "G" ] + "enum" : [ "F", "G", "GUEST" ] }, "fiscalCode" : { "type" : "string" diff --git a/openapi/openapi_ec.json b/openapi/openapi_ec.json index 192fd48f..eb4a6fe7 100644 --- a/openapi/openapi_ec.json +++ b/openapi/openapi_ec.json @@ -4,7 +4,7 @@ "title" : "Biz-Events Service", "description" : "Microservice for exposing REST APIs about payment receipts.", "termsOfService" : "https://www.pagopa.gov.it/", - "version" : "0.1.25" + "version" : "0.1.26" }, "servers" : [ { "url" : "http://localhost", @@ -34,17 +34,6 @@ } } ], "responses" : { - "429" : { - "description" : "Too many requests.", - "headers" : { - "X-Request-Id" : { - "description" : "This header identifies the call", - "schema" : { - "type" : "string" - } - } - } - }, "404" : { "description" : "Not found the receipt.", "headers" : { @@ -63,8 +52,8 @@ } } }, - "200" : { - "description" : "Obtained receipt.", + "429" : { + "description" : "Too many requests.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -72,17 +61,10 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/CtReceiptModelResponse" - } - } } }, - "422" : { - "description" : "Unable to process the request.", + "500" : { + "description" : "Service unavailable.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -99,8 +81,8 @@ } } }, - "500" : { - "description" : "Service unavailable.", + "422" : { + "description" : "Unable to process the request.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -127,6 +109,24 @@ } } } + }, + "200" : { + "description" : "Obtained receipt.", + "headers" : { + "X-Request-Id" : { + "description" : "This header identifies the call", + "schema" : { + "type" : "string" + } + } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CtReceiptModelResponse" + } + } + } } }, "security" : [ { @@ -173,17 +173,6 @@ } } ], "responses" : { - "429" : { - "description" : "Too many requests.", - "headers" : { - "X-Request-Id" : { - "description" : "This header identifies the call", - "schema" : { - "type" : "string" - } - } - } - }, "404" : { "description" : "Not found the receipt.", "headers" : { @@ -202,8 +191,8 @@ } } }, - "200" : { - "description" : "Obtained receipt.", + "429" : { + "description" : "Too many requests.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -211,17 +200,10 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/CtReceiptModelResponse" - } - } } }, - "422" : { - "description" : "Unable to process the request.", + "500" : { + "description" : "Service unavailable.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -238,8 +220,8 @@ } } }, - "500" : { - "description" : "Service unavailable.", + "422" : { + "description" : "Unable to process the request.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -266,6 +248,24 @@ } } } + }, + "200" : { + "description" : "Obtained receipt.", + "headers" : { + "X-Request-Id" : { + "description" : "This header identifies the call", + "schema" : { + "type" : "string" + } + } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CtReceiptModelResponse" + } + } + } } }, "security" : [ { @@ -288,8 +288,8 @@ "description" : "Return OK if application is started", "operationId" : "healthCheck", "responses" : { - "401" : { - "description" : "Unauthorized", + "400" : { + "description" : "Bad Request", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -297,10 +297,17 @@ "type" : "string" } } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } } }, - "403" : { - "description" : "Forbidden", + "401" : { + "description" : "Unauthorized", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -310,8 +317,8 @@ } } }, - "429" : { - "description" : "Too many requests", + "403" : { + "description" : "Forbidden", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -321,8 +328,8 @@ } } }, - "400" : { - "description" : "Bad Request", + "500" : { + "description" : "Service unavailable", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -339,8 +346,8 @@ } } }, - "500" : { - "description" : "Service unavailable", + "200" : { + "description" : "OK", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -352,13 +359,13 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ProblemJson" + "$ref" : "#/components/schemas/AppInfo" } } } }, - "200" : { - "description" : "OK", + "429" : { + "description" : "Too many requests", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -366,13 +373,6 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/AppInfo" - } - } } } }, diff --git a/openapi/openapi_helpdesk.json b/openapi/openapi_helpdesk.json index 298f50e2..53f75b43 100644 --- a/openapi/openapi_helpdesk.json +++ b/openapi/openapi_helpdesk.json @@ -4,7 +4,7 @@ "title" : "Biz-Events Service", "description" : "Microservice for exposing REST APIs about payment receipts.", "termsOfService" : "https://www.pagopa.gov.it/", - "version" : "0.1.25" + "version" : "0.1.26" }, "servers" : [ { "url" : "http://localhost", @@ -18,8 +18,8 @@ "description" : "Return OK if application is started", "operationId" : "healthCheck", "responses" : { - "401" : { - "description" : "Unauthorized", + "400" : { + "description" : "Bad Request", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -27,10 +27,17 @@ "type" : "string" } } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } } }, - "403" : { - "description" : "Forbidden", + "401" : { + "description" : "Unauthorized", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -40,8 +47,8 @@ } } }, - "429" : { - "description" : "Too many requests", + "403" : { + "description" : "Forbidden", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -51,8 +58,8 @@ } } }, - "400" : { - "description" : "Bad Request", + "500" : { + "description" : "Service unavailable", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -69,8 +76,8 @@ } } }, - "500" : { - "description" : "Service unavailable", + "200" : { + "description" : "OK", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -82,13 +89,13 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ProblemJson" + "$ref" : "#/components/schemas/AppInfo" } } } }, - "200" : { - "description" : "OK", + "429" : { + "description" : "Too many requests", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -96,13 +103,6 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/AppInfo" - } - } } } }, @@ -134,17 +134,6 @@ } } ], "responses" : { - "429" : { - "description" : "Too many requests.", - "headers" : { - "X-Request-Id" : { - "description" : "This header identifies the call", - "schema" : { - "type" : "string" - } - } - } - }, "200" : { "description" : "Obtained biz-event.", "headers" : { @@ -163,8 +152,8 @@ } } }, - "404" : { - "description" : "Not found the biz-event.", + "429" : { + "description" : "Too many requests.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -172,17 +161,10 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ProblemJson" - } - } } }, - "422" : { - "description" : "Unable to process the request.", + "500" : { + "description" : "Service unavailable.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -199,8 +181,8 @@ } } }, - "500" : { - "description" : "Service unavailable.", + "422" : { + "description" : "Unable to process the request.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -227,6 +209,24 @@ } } } + }, + "404" : { + "description" : "Not found the biz-event.", + "headers" : { + "X-Request-Id" : { + "description" : "This header identifies the call", + "schema" : { + "type" : "string" + } + } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } + } } }, "security" : [ { @@ -265,17 +265,6 @@ } } ], "responses" : { - "429" : { - "description" : "Too many requests.", - "headers" : { - "X-Request-Id" : { - "description" : "This header identifies the call", - "schema" : { - "type" : "string" - } - } - } - }, "200" : { "description" : "Obtained biz-event.", "headers" : { @@ -294,8 +283,8 @@ } } }, - "404" : { - "description" : "Not found the biz-event.", + "429" : { + "description" : "Too many requests.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -303,17 +292,10 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ProblemJson" - } - } } }, - "422" : { - "description" : "Unable to process the request.", + "500" : { + "description" : "Service unavailable.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -330,8 +312,8 @@ } } }, - "500" : { - "description" : "Service unavailable.", + "422" : { + "description" : "Unable to process the request.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -358,6 +340,24 @@ } } } + }, + "404" : { + "description" : "Not found the biz-event.", + "headers" : { + "X-Request-Id" : { + "description" : "This header identifies the call", + "schema" : { + "type" : "string" + } + } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } + } } }, "security" : [ { @@ -483,6 +483,10 @@ "transactionDetails" : { "$ref" : "#/components/schemas/TransactionDetails" }, + "timestamp" : { + "type" : "integer", + "format" : "int64" + }, "eventStatus" : { "type" : "string", "enum" : [ "NA", "RETRY", "FAILED", "DONE" ] @@ -559,6 +563,9 @@ }, "iuv" : { "type" : "string" + }, + "iur" : { + "type" : "string" } } }, @@ -932,7 +939,7 @@ }, "type" : { "type" : "string", - "enum" : [ "F", "G" ] + "enum" : [ "F", "G", "GUEST" ] }, "fiscalCode" : { "type" : "string" diff --git a/openapi/openapi_io.json b/openapi/openapi_io.json index 6dcd06e9..1917dd63 100644 --- a/openapi/openapi_io.json +++ b/openapi/openapi_io.json @@ -4,7 +4,7 @@ "title" : "Biz-Events Service", "description" : "Microservice for exposing REST APIs about payment receipts.", "termsOfService" : "https://www.pagopa.gov.it/", - "version" : "0.1.25" + "version" : "0.1.26" }, "servers" : [ { "url" : "http://localhost", @@ -33,8 +33,8 @@ } } ], "responses" : { - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found the transaction.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -42,10 +42,17 @@ "type" : "string" } } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } } }, - "200" : { - "description" : "Disabled Transactions.", + "429" : { + "description" : "Too many requests.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -53,13 +60,10 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { } } }, - "404" : { - "description" : "Not found the transaction.", + "500" : { + "description" : "Service unavailable.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -76,8 +80,8 @@ } } }, - "500" : { - "description" : "Service unavailable.", + "401" : { + "description" : "Wrong or missing function key.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -85,17 +89,10 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ProblemJson" - } - } } }, - "401" : { - "description" : "Wrong or missing function key.", + "200" : { + "description" : "Disabled Transactions.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -103,6 +100,9 @@ "type" : "string" } } + }, + "content" : { + "application/json" : { } } } }, @@ -149,8 +149,8 @@ } } ], "responses" : { - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found the transaction.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -158,38 +158,28 @@ "type" : "string" } } + }, + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } } }, - "200" : { - "description" : "Obtained transaction list.", + "429" : { + "description" : "Too many requests.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", "schema" : { "type" : "string" } - }, - "x-continuation-token" : { - "description" : "continuation token for paginated query", - "style" : "simple", - "schema" : { - "type" : "string" - } - } - }, - "content" : { - "application/json" : { - "schema" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/TransactionListItem" - } - } } } }, - "404" : { - "description" : "Not found the transaction.", + "500" : { + "description" : "Service unavailable.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -199,27 +189,37 @@ } }, "content" : { - "*/*" : { + "application/json" : { "schema" : { "$ref" : "#/components/schemas/ProblemJson" } } } }, - "500" : { - "description" : "Service unavailable.", + "200" : { + "description" : "Obtained transaction list.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", "schema" : { "type" : "string" } + }, + "x-continuation-token" : { + "description" : "continuation token for paginated query", + "style" : "simple", + "schema" : { + "type" : "string" + } } }, "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ProblemJson" + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/TransactionListItem" + } } } } @@ -271,8 +271,8 @@ } } ], "responses" : { - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found the transaction.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -280,6 +280,13 @@ "type" : "string" } } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } } }, "200" : { @@ -300,8 +307,8 @@ } } }, - "404" : { - "description" : "Not found the transaction.", + "429" : { + "description" : "Too many requests.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -309,13 +316,6 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ProblemJson" - } - } } }, "500" : { @@ -383,8 +383,8 @@ } } ], "responses" : { - "429" : { - "description" : "Too many requests.", + "404" : { + "description" : "Not found the receipt.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -392,10 +392,17 @@ "type" : "string" } } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } } }, - "422" : { - "description" : "Unprocessable recipt.", + "429" : { + "description" : "Too many requests.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -403,17 +410,10 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ProblemJson" - } - } } }, - "404" : { - "description" : "Not found the receipt.", + "422" : { + "description" : "Unprocessable receipt.", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -459,10 +459,10 @@ } }, "content" : { - "application/json" : { + "*/*" : { "schema" : { "type" : "string", - "format" : "byte" + "format" : "binary" } } } @@ -499,8 +499,8 @@ "description" : "Return OK if application is started", "operationId" : "healthCheck", "responses" : { - "401" : { - "description" : "Unauthorized", + "400" : { + "description" : "Bad Request", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -508,10 +508,17 @@ "type" : "string" } } + }, + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ProblemJson" + } + } } }, - "403" : { - "description" : "Forbidden", + "401" : { + "description" : "Unauthorized", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -521,8 +528,8 @@ } } }, - "429" : { - "description" : "Too many requests", + "403" : { + "description" : "Forbidden", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -532,8 +539,8 @@ } } }, - "400" : { - "description" : "Bad Request", + "500" : { + "description" : "Service unavailable", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -550,8 +557,8 @@ } } }, - "500" : { - "description" : "Service unavailable", + "200" : { + "description" : "OK", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -563,13 +570,13 @@ "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/ProblemJson" + "$ref" : "#/components/schemas/AppInfo" } } } }, - "200" : { - "description" : "OK", + "429" : { + "description" : "Too many requests", "headers" : { "X-Request-Id" : { "description" : "This header identifies the call", @@ -577,13 +584,6 @@ "type" : "string" } } - }, - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/AppInfo" - } - } } } }, @@ -645,6 +645,9 @@ }, "isCart" : { "type" : "boolean" + }, + "isPayer" : { + "type" : "boolean" } } }, diff --git a/src/main/java/it/gov/pagopa/bizeventsservice/controller/ITransactionController.java b/src/main/java/it/gov/pagopa/bizeventsservice/controller/ITransactionController.java index a982fdc6..424eff23 100644 --- a/src/main/java/it/gov/pagopa/bizeventsservice/controller/ITransactionController.java +++ b/src/main/java/it/gov/pagopa/bizeventsservice/controller/ITransactionController.java @@ -93,11 +93,10 @@ ResponseEntity disableTransaction( @Operation(summary = "Retrieve the PDF receipt given event id.", security = { @SecurityRequirement(name = "ApiKey")}, operationId = "getPDFReceipt") @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Obtained the PDF receipt.", - content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(name = "File", implementation = Byte.class))), + @ApiResponse(responseCode = "200", description = "Obtained the PDF receipt.", content = @Content(schema = @Schema(type = "string", format = "binary"))), @ApiResponse(responseCode = "401", description = "Wrong or missing function key.", content = @Content(schema = @Schema())), @ApiResponse(responseCode = "404", description = "Not found the receipt.", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class))), - @ApiResponse(responseCode = "422", description = "Unprocessable recipt.", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class))), + @ApiResponse(responseCode = "422", description = "Unprocessable receipt.", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class))), @ApiResponse(responseCode = "429", description = "Too many requests.", content = @Content(schema = @Schema())), @ApiResponse(responseCode = "500", description = "Service unavailable.", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class)))}) @GetMapping(value = "/{event-id}/pdf") diff --git a/src/main/java/it/gov/pagopa/bizeventsservice/controller/impl/TransactionController.java b/src/main/java/it/gov/pagopa/bizeventsservice/controller/impl/TransactionController.java index b71c3a39..14800837 100644 --- a/src/main/java/it/gov/pagopa/bizeventsservice/controller/impl/TransactionController.java +++ b/src/main/java/it/gov/pagopa/bizeventsservice/controller/impl/TransactionController.java @@ -11,6 +11,7 @@ import it.gov.pagopa.bizeventsservice.service.IBizEventsService; import it.gov.pagopa.bizeventsservice.service.ITransactionService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -32,6 +33,9 @@ public class TransactionController implements ITransactionController { private final ITransactionService transactionService; private final IBizEventsService bizEventsService; private final IReceiptPDFClient receiptClient; + + @Value(value = "${pm.reference.creation.date.ms}") + private Long referenceCreationDate; @Autowired public TransactionController(ITransactionService transactionService, IBizEventsService bizEventsService, IReceiptPDFClient receiptClient) { @@ -71,7 +75,7 @@ public ResponseEntity getPDFReceipt(@NotBlank String fiscalCode, @NotBla private ResponseEntity acquirePDFReceipt(String fiscalCode, String eventId) { try { BizEvent bizEvent = bizEventsService.getBizEvent(eventId); - if (bizEvent.getIdPaymentManager() == null) { + if (bizEvent.getIdPaymentManager() == null || (bizEvent.getIdPaymentManager() != null && bizEvent.getTimestamp() > referenceCreationDate)) { // call the receipt-pdf-service to retrieve the PDF receipt AttachmentsDetailsResponse response = receiptClient.getAttachments(fiscalCode, eventId); String url = response.getAttachments().get(0).getUrl(); diff --git a/src/main/java/it/gov/pagopa/bizeventsservice/entity/BizEvent.java b/src/main/java/it/gov/pagopa/bizeventsservice/entity/BizEvent.java index 857c6910..9c467418 100644 --- a/src/main/java/it/gov/pagopa/bizeventsservice/entity/BizEvent.java +++ b/src/main/java/it/gov/pagopa/bizeventsservice/entity/BizEvent.java @@ -34,6 +34,7 @@ public class BizEvent { private PaymentInfo paymentInfo; private List transferList; private TransactionDetails transactionDetails; + private Long timestamp; // internal management fields private StatusType eventStatus; diff --git a/src/main/java/it/gov/pagopa/bizeventsservice/mapper/ConvertViewsToTransactionDetailResponse.java b/src/main/java/it/gov/pagopa/bizeventsservice/mapper/ConvertViewsToTransactionDetailResponse.java index 08f86707..31b88171 100644 --- a/src/main/java/it/gov/pagopa/bizeventsservice/mapper/ConvertViewsToTransactionDetailResponse.java +++ b/src/main/java/it/gov/pagopa/bizeventsservice/mapper/ConvertViewsToTransactionDetailResponse.java @@ -89,6 +89,7 @@ public static TransactionListItem convertTransactionListItem(BizEventsViewUser v .amount(currencyFormat(totalAmount.get().toString())) .transactionDate(dateFormatZoned(viewUser.getTransactionDate())) .isCart(listOfCartViews.size() > 1) + .isPayer(viewUser.getIsPayer()) .build(); } diff --git a/src/main/java/it/gov/pagopa/bizeventsservice/model/response/transaction/TransactionListItem.java b/src/main/java/it/gov/pagopa/bizeventsservice/model/response/transaction/TransactionListItem.java index 7a1c4741..a46c6bd1 100644 --- a/src/main/java/it/gov/pagopa/bizeventsservice/model/response/transaction/TransactionListItem.java +++ b/src/main/java/it/gov/pagopa/bizeventsservice/model/response/transaction/TransactionListItem.java @@ -15,10 +15,15 @@ @NoArgsConstructor @Builder public class TransactionListItem implements Serializable { - private String transactionId; + /** + * + */ + private static final long serialVersionUID = 8763325343304031081L; + private String transactionId; private String payeeName; private String payeeTaxCode; private String amount; private String transactionDate; private Boolean isCart; + private Boolean isPayer; } diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 570d0b1b..0ddde594 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -19,6 +19,7 @@ logging.level.it.gov.pagopa=INFO # PDF Receipt Service pdf.receipt.subscription-key=${SUBSCRIPTION_KEY} service.pdf.receipt.host=https://api.dev.platform.pagopa.it/receipts/service/v1 +#pm.reference.creation.date.ms=1680307200000 springdoc.group-configs[0].group=all springdoc.group-configs[0].displayName=Biz-Events All diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a045fe19..a0c428a8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -39,6 +39,7 @@ transaction.payee.cartName=${PAYEE_CART_NAME:Pagamento Multiplo} # PDF Receipt Service +pm.reference.creation.date.ms=${PM_REFERENCE_CREATION_DATE: 1680307200000} pdf.receipt.subscription-key=${PDF_RECEIPT_SUBSCRIPTION_KEY} service.pdf.receipt.host=${PDF_RECEIPT_HOST} diff --git a/src/test/java/it/gov/pagopa/bizeventsservice/controller/TransactionControllerTest.java b/src/test/java/it/gov/pagopa/bizeventsservice/controller/TransactionControllerTest.java index d4ca73dc..ac497a5d 100644 --- a/src/test/java/it/gov/pagopa/bizeventsservice/controller/TransactionControllerTest.java +++ b/src/test/java/it/gov/pagopa/bizeventsservice/controller/TransactionControllerTest.java @@ -199,7 +199,7 @@ void getPDFReceipt_ShouldReturnOK() throws Exception { @Test void getPDFReceiptForPMEvent_ShouldReturnNOTFOUND() throws Exception { - BizEvent bizEvent = BizEvent.builder().id("mock_id").idPaymentManager("123456789").build(); + BizEvent bizEvent = BizEvent.builder().id("mock_id").idPaymentManager("123456789").timestamp(1648771200000L).build(); when (bizEventsService.getBizEvent(anyString())).thenReturn(bizEvent); mvc.perform(get(TRANSACTION_RECEIPT_PATH) diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 8b8b07d4..ea5773f5 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -40,6 +40,7 @@ transaction.payee.cartName=${PAYEE_CART_NAME:Pagamento Multiplo} # PDF Receipt Service pdf.receipt.subscription-key=subkey service.pdf.receipt.host=http://localhost:8080 +pm.reference.creation.date.ms=1680307200000 # Openapi springdoc.use-fqn=false