Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: [fix-pdf-gen] metadata null exception #73

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading