Skip to content
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
18 changes: 18 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ services:
build:
dockerfile: Dockerfile
context: ../
environment:
# override helm environment variables to enable all functions
AzureWebJobs.BizEventToReceiptProcessor.Disabled: "false"
AzureWebJobs.CartReceiptToReviewed.Disabled: "false"
AzureWebJobs.ReceiptToReviewed.Disabled: "false"
AzureWebJobs.RecoverFailedCartReceipt.Disabled: "false"
AzureWebJobs.RecoverFailedCartReceiptMassive.Disabled: "false"
AzureWebJobs.RecoverFailedReceipt.Disabled: "false"
AzureWebJobs.RecoverFailedReceiptMassive.Disabled: "false"
AzureWebJobs.RecoverNotNotifiedCartReceipt.Disabled: "false"
AzureWebJobs.RecoverNotNotifiedCartReceiptMassive.Disabled: "false"
AzureWebJobs.RecoverNotNotifiedReceipt.Disabled: "false"
AzureWebJobs.RecoverNotNotifiedReceiptMassive.Disabled: "false"
# Disable cron job
AzureWebJobs.RecoverFailedCartReceiptScheduled.Disabled: "true"
AzureWebJobs.RecoverFailedReceiptScheduled.Disabled: "true"
AzureWebJobs.RecoverNotNotifiedCartTimerTriggerProcessor.Disabled: "true"
AzureWebJobs.RecoverNotNotifiedTimerTriggerProcessor.Disabled: "true"
env_file:
- ./.env
ports:
Expand Down
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: pagopareceiptpdfdatastore
description: Microservice description
type: application
version: 0.150.0
appVersion: 1.17.5
version: 0.151.0
appVersion: 1.17.5-1-PIDM-1484-fix-biz-view-generation
dependencies:
- name: microservice-chart
version: 8.0.2
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: &microservice-chart
fullnameOverride: "pagopa-receipt-pdf-datastore"
image:
repository: ghcr.io/pagopa/pagopa-receipt-pdf-datastore
tag: "1.17.5"
tag: "1.17.5-1-PIDM-1484-fix-biz-view-generation"
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: &microservice-chart
fullnameOverride: "pagopa-receipt-pdf-datastore"
image:
repository: ghcr.io/pagopa/pagopa-receipt-pdf-datastore
tag: "1.17.5"
tag: "1.17.5-1-PIDM-1484-fix-biz-view-generation"
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: &microservice-chart
fullnameOverride: "pagopa-receipt-pdf-datastore"
image:
repository: ghcr.io/pagopa/pagopa-receipt-pdf-datastore
tag: "1.17.5"
tag: "1.17.5-1-PIDM-1484-fix-biz-view-generation"
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 integration-test/src/config/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ RECEIPTS_COSMOS_CART_CONTAINER_NAME=cart-for-receipts
RECEIPT_ERROR_COSMOS_DB_CONTAINER_NAME=receipts-message-errors
CART_RECEIPT_ERROR_COSMOS_DB_CONTAINER_NAME=cart-receipts-message-errors

HELPDESK_URL=http://localhost:50717/
HELPDESK_URL=http://localhost:60486
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 Datastore Helpdesk",
"description": "Microservice for exposing REST APIs about receipts datastore helpdesk.",
"termsOfService": "https://www.pagopa.gov.it/",
"version": "1.17.5"
"version": "1.17.5-1-PIDM-1484-fix-biz-view-generation"
},
"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-datastore</artifactId>
<version>1.17.5</version>
<version>1.17.5-1-PIDM-1484-fix-biz-view-generation</version>
<packaging>jar</packaging>

<name>pagopa-receipt-pdf-datastore</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package it.gov.pagopa.receipt.pdf.datastore.utils;

import com.microsoft.azure.functions.HttpRequestMessage;
import com.microsoft.azure.functions.HttpResponseMessage;
import com.microsoft.azure.functions.HttpStatus;
import it.gov.pagopa.receipt.pdf.datastore.entity.cart.CartForReceipt;
import it.gov.pagopa.receipt.pdf.datastore.entity.cart.CartStatusType;
import it.gov.pagopa.receipt.pdf.datastore.entity.event.BizEvent;
Expand All @@ -13,7 +10,6 @@
import it.gov.pagopa.receipt.pdf.datastore.entity.receipt.EventData;
import it.gov.pagopa.receipt.pdf.datastore.entity.receipt.Receipt;
import it.gov.pagopa.receipt.pdf.datastore.entity.receipt.enumeration.ReceiptStatusType;
import it.gov.pagopa.receipt.pdf.datastore.model.ProblemJson;
import it.gov.pagopa.receipt.pdf.datastore.service.BizEventToReceiptService;
import lombok.Builder;
import org.slf4j.Logger;
Expand All @@ -25,7 +21,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -39,7 +34,7 @@ public class BizEventToReceiptUtils {
"AUTHENTICATED_CHANNELS", "IO,CHECKOUT,WISP,CHECKOUT_CART").split(","));
private static final List<String> UNWANTED_REMITTANCE_INFO = Arrays.asList(System.getenv().getOrDefault(
"UNWANTED_REMITTANCE_INFO", "pagamento multibeneficiario,pagamento bpay").split(","));
private static final String ECOMMERCE = "CHECKOUT";
private static final List<String> ECOMMERCE = Arrays.asList("CHECKOUT", "CHECKOUT_CART");


private BizEventToReceiptUtils() {
Expand Down Expand Up @@ -118,7 +113,7 @@ public static BizEventValidityCheck isBizEventInvalid(BizEvent bizEvent) {
if (Boolean.TRUE.equals(ECOMMERCE_FILTER_ENABLED)
&& bizEvent.getTransactionDetails() != null
&& bizEvent.getTransactionDetails().getInfo() != null
&& ECOMMERCE.equals(bizEvent.getTransactionDetails().getInfo().getClientId())
&& ECOMMERCE.contains(bizEvent.getTransactionDetails().getInfo().getClientId())
) {
return BizEventValidityCheck.builder()
.invalid(true)
Expand Down Expand Up @@ -294,30 +289,31 @@ public static boolean isCartMod1(BizEvent bizEvent) {
}

public static boolean isValidChannelOrigin(BizEvent bizEvent) {
if (bizEvent.getTransactionDetails() == null) {
var details = bizEvent.getTransactionDetails();
if (details == null) {
return false;
}

var transactionDetails = bizEvent.getTransactionDetails();
var transaction = transactionDetails.getTransaction();
var info = transactionDetails.getInfo();
var user = transactionDetails.getUser();
String origin = details.getTransaction() != null
? details.getTransaction().getOrigin()
: null;

String origin = (transaction != null) ? transaction.getOrigin() : null;
String clientId = (info != null) ? info.getClientId() : null;
UserType userType = (user != null) ? user.getType() : null;
String clientId = details.getInfo() != null
? details.getInfo().getClientId()
: null;

boolean originMatches = origin != null && AUTHENTICATED_CHANNELS.contains(origin);
boolean clientIdMatches = clientId != null && AUTHENTICATED_CHANNELS.contains(clientId);
UserType userType = details.getUser() != null
? details.getUser().getType()
: null;

boolean isCheckoutOrigin = ECOMMERCE.equalsIgnoreCase(origin);
boolean isCheckoutClientId = ECOMMERCE.equalsIgnoreCase(clientId);
boolean isAuthenticated = AUTHENTICATED_CHANNELS.contains(origin) || AUTHENTICATED_CHANNELS.contains(clientId);
boolean isCheckout = ECOMMERCE.contains(origin) || ECOMMERCE.contains(clientId);
boolean isRegisteredUser = UserType.REGISTERED.equals(userType);

if ((isCheckoutOrigin || isCheckoutClientId) && !isRegisteredUser) {
if (isCheckout && !isRegisteredUser) {
return false;
}

return originMatches || clientIdMatches;
return isAuthenticated;
}
}
Loading