Skip to content

Commit

Permalink
[fix-pdf-gen] corrected exception for different payer and debtor
Browse files Browse the repository at this point in the history
  • Loading branch information
pagopa-github-bot authored and aacitelli committed Jun 24, 2024
1 parent 48e7c46 commit 62b775e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pagopareceiptpdfhelpdesk
description: Microservice description
type: application
version: 0.162.0
appVersion: 0.9.18
version: 0.163.0
appVersion: 0.9.19
dependencies:
- name: microservice-chart
version: 2.4.0
Expand Down
2 changes: 1 addition & 1 deletion helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-receipt-pdf-helpdesk
tag: "0.9.18"
tag: "0.9.19"
pullPolicy: Always
# https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs
livenessProbe:
Expand Down
2 changes: 1 addition & 1 deletion helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-receipt-pdf-helpdesk
tag: "0.9.18"
tag: "0.9.19"
pullPolicy: Always
# https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs
livenessProbe:
Expand Down
2 changes: 1 addition & 1 deletion helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-receipt-pdf-helpdesk
tag: "0.9.18"
tag: "0.9.19"
pullPolicy: Always
# https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs
livenessProbe:
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"title": "Receipts Helpdesk",
"description": "Microservice for exposing REST APIs about receipts helpdesk.",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "0.9.18"
"version": "0.9.19"
},
"servers": [
{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>it.gov.pagopa.receipt</groupId>
<artifactId>receipt-pdf-helpdesk</artifactId>
<version>0.9.18</version>
<version>0.9.19</version>
<packaging>jar</packaging>

<name>pagopa-receipt-pdf-helpdesk</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,17 @@ private static void checkOrCreateAttachments(Receipt receipt) {
String dateFormatted = LocalDate.now().format(DateTimeFormatter.ofPattern(blobNameDateFormat));
String blobName = String.format(blobNameFormat, TEMPLATE_PREFIX, dateFormatted, receipt.getEventId(), PAYER_TEMPLATE_SUFFIX);
receipt.setMdAttach(ReceiptMetadata.builder().name(blobName).build());
} else if (!receiptMetadataExist(receipt.getMdAttachPayer())){
String dateFormatted = LocalDate.now().format(DateTimeFormatter.ofPattern(blobNameDateFormat));
String blobName = String.format(blobNameFormat, TEMPLATE_PREFIX, dateFormatted, receipt.getEventId(), PAYER_TEMPLATE_SUFFIX);
receipt.setMdAttachPayer(ReceiptMetadata.builder().name(blobName).build());
} else {
if (!receiptMetadataExist(receipt.getMdAttachPayer())){
String dateFormatted = LocalDate.now().format(DateTimeFormatter.ofPattern(blobNameDateFormat));
String blobName = String.format(blobNameFormat, TEMPLATE_PREFIX, dateFormatted, receipt.getEventId(), PAYER_TEMPLATE_SUFFIX);
receipt.setMdAttachPayer(ReceiptMetadata.builder().name(blobName).build());
}
if (!receiptMetadataExist(receipt.getMdAttach())) {
String dateFormatted = LocalDate.now().format(DateTimeFormatter.ofPattern(blobNameDateFormat));
String blobName = String.format(blobNameFormat, TEMPLATE_PREFIX, dateFormatted, receipt.getEventId(), DEBTOR_TEMPLATE_SUFFIX);
receipt.setMdAttach(ReceiptMetadata.builder().name(blobName).build());
}
}
} else {
if (!receiptMetadataExist(receipt.getMdAttach())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ public BlobStorageResponse savePdfToBlobStorage(InputStream pdf, String fileName

//Create the container and return a container client object
BlobContainerClient blobContainerClient = this.blobServiceClient.getBlobContainerClient(containerName);
String fileNamePdf = fileName + FILE_EXTENSION;

//Get a reference to a blob
BlobClient blobClient = blobContainerClient.getBlobClient(fileName);
BlobClient blobClient = blobContainerClient.getBlobClient(fileNamePdf);

//Upload the blob
Response<BlockBlobItem> blockBlobItemResponse = blobClient.uploadWithResponse(
Expand Down

0 comments on commit 62b775e

Please sign in to comment.