diff --git a/helm/Chart.yaml b/helm/Chart.yaml
index ce08fa7f..209644bc 100644
--- a/helm/Chart.yaml
+++ b/helm/Chart.yaml
@@ -2,8 +2,8 @@ apiVersion: v2
name: pagopa-afm-calculator
description: Microservice that handles calculation for pagoPA Advanced Fees Management
type: application
-version: 2.44.0
-appVersion: 2.10.31
+version: 2.45.0
+appVersion: 2.10.32
dependencies:
- name: microservice-chart
version: 2.4.0
diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml
index 98e47d06..c5eb511b 100644
--- a/helm/values-dev.yaml
+++ b/helm/values-dev.yaml
@@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
- tag: "2.10.31"
+ tag: "2.10.32"
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml
index dc311fdc..c45f8de9 100644
--- a/helm/values-prod.yaml
+++ b/helm/values-prod.yaml
@@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
- tag: "2.10.31"
+ tag: "2.10.32"
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml
index a46f2e95..d1d7209f 100644
--- a/helm/values-uat.yaml
+++ b/helm/values-uat.yaml
@@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-afm-calculator
- tag: "2.10.31"
+ tag: "2.10.32"
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/openapi/openapi-node-v1.json b/openapi/openapi-node-v1.json
index 3ec5c640..47f662fc 100644
--- a/openapi/openapi-node-v1.json
+++ b/openapi/openapi-node-v1.json
@@ -4,7 +4,7 @@
"title": "PagoPA API Calculator Logic",
"description": "Calculator Logic microservice for pagoPA AFM",
"termsOfService": "https://www.pagopa.gov.it/",
- "version": "2.10.31"
+ "version": "2.10.32"
},
"servers": [
{
diff --git a/openapi/openapi-node-v2.json b/openapi/openapi-node-v2.json
index 778a15de..bf335cb4 100644
--- a/openapi/openapi-node-v2.json
+++ b/openapi/openapi-node-v2.json
@@ -4,7 +4,7 @@
"title": "PagoPA API Calculator Logic",
"description": "Calculator Logic microservice for pagoPA AFM",
"termsOfService": "https://www.pagopa.gov.it/",
- "version": "2.10.31"
+ "version": "2.10.32"
},
"servers": [
{
diff --git a/openapi/openapi-v1-dev-uat.json b/openapi/openapi-v1-dev-uat.json
index 972520a0..61301a2f 100644
--- a/openapi/openapi-v1-dev-uat.json
+++ b/openapi/openapi-v1-dev-uat.json
@@ -4,7 +4,7 @@
"title": "PagoPA API Calculator Logic",
"description": "Calculator Logic microservice for pagoPA AFM",
"termsOfService": "https://www.pagopa.gov.it/",
- "version": "2.10.31"
+ "version": "2.10.32"
},
"servers": [
{
diff --git a/openapi/openapi-v1.json b/openapi/openapi-v1.json
index e69de29b..47f662fc 100644
--- a/openapi/openapi-v1.json
+++ b/openapi/openapi-v1.json
@@ -0,0 +1,510 @@
+{
+ "openapi": "3.0.1",
+ "info": {
+ "title": "PagoPA API Calculator Logic",
+ "description": "Calculator Logic microservice for pagoPA AFM",
+ "termsOfService": "https://www.pagopa.gov.it/",
+ "version": "2.10.32"
+ },
+ "servers": [
+ {
+ "url": "http://localhost/",
+ "description": "Generated server url"
+ }
+ ],
+ "tags": [
+ {
+ "name": "Calculator",
+ "description": "Everything about Calculator business logic"
+ }
+ ],
+ "paths": {
+ "/psps/{idPsp}/fees": {
+ "post": {
+ "tags": [
+ "Calculator"
+ ],
+ "summary": "Get taxpayer fees of the specified idPSP",
+ "operationId": "getFeesByPsp",
+ "parameters": [
+ {
+ "name": "idPsp",
+ "in": "path",
+ "description": "PSP identifier",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "maxOccurrences",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "format": "int32",
+ "default": 10
+ }
+ },
+ {
+ "name": "allCcp",
+ "in": "query",
+ "description": "Flag for the exclusion of Poste bundles: false -> excluded, true or null -> included",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "default": "true"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentOptionByPsp"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "401": {
+ "description": "Unauthorized"
+ },
+ "404": {
+ "description": "Not Found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BundleOption"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Service unavailable",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "422": {
+ "description": "Unable to process the request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "429": {
+ "description": "Too many requests"
+ }
+ },
+ "security": [
+ {
+ "ApiKey": []
+ }
+ ]
+ }
+ },
+ "/fees": {
+ "post": {
+ "tags": [
+ "Calculator"
+ ],
+ "summary": "Get taxpayer fees of all or specified idPSP",
+ "operationId": "getFees",
+ "parameters": [
+ {
+ "name": "maxOccurrences",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "integer",
+ "format": "int32",
+ "default": 10
+ }
+ },
+ {
+ "name": "allCcp",
+ "in": "query",
+ "description": "Flag for the exclusion of Poste bundles: false -> excluded, true or null -> included",
+ "required": false,
+ "schema": {
+ "type": "string",
+ "default": "true"
+ }
+ }
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/PaymentOption"
+ }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "401": {
+ "description": "Unauthorized"
+ },
+ "404": {
+ "description": "Not Found",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/BundleOption"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Service unavailable",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "422": {
+ "description": "Unable to process the request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "429": {
+ "description": "Too many requests"
+ }
+ },
+ "security": [
+ {
+ "ApiKey": []
+ }
+ ]
+ }
+ },
+ "/info": {
+ "get": {
+ "tags": [
+ "Home"
+ ],
+ "summary": "health check",
+ "description": "Return OK if application is started",
+ "operationId": "healthCheck",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/AppInfo"
+ }
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "500": {
+ "description": "Service unavailable",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ProblemJson"
+ }
+ }
+ }
+ },
+ "403": {
+ "description": "Forbidden"
+ },
+ "429": {
+ "description": "Too many requests"
+ }
+ },
+ "security": [
+ {
+ "ApiKey": []
+ }
+ ]
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "PaymentOptionByPsp": {
+ "type": "object",
+ "properties": {
+ "idChannel": {
+ "type": "string"
+ },
+ "idBrokerPsp": {
+ "type": "string"
+ },
+ "paymentAmount": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "primaryCreditorInstitution": {
+ "type": "string"
+ },
+ "paymentMethod": {
+ "type": "string"
+ },
+ "touchpoint": {
+ "type": "string"
+ },
+ "bin": {
+ "type": "string"
+ },
+ "transferList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/TransferListItem"
+ }
+ }
+ }
+ },
+ "TransferListItem": {
+ "type": "object",
+ "properties": {
+ "creditorInstitution": {
+ "type": "string"
+ },
+ "transferCategory": {
+ "type": "string"
+ },
+ "digitalStamp": {
+ "type": "boolean"
+ }
+ }
+ },
+ "ProblemJson": {
+ "type": "object",
+ "properties": {
+ "title": {
+ "type": "string",
+ "description": "A short, summary of the problem type. Written in english and readable for engineers (usually not suited for non technical stakeholders and not localized); example: Service Unavailable"
+ },
+ "status": {
+ "maximum": 600,
+ "minimum": 100,
+ "type": "integer",
+ "description": "The HTTP status code generated by the origin server for this occurrence of the problem.",
+ "format": "int32",
+ "example": 200
+ },
+ "detail": {
+ "type": "string",
+ "description": "A human readable explanation specific to this occurrence of the problem.",
+ "example": "There was an error processing the request"
+ }
+ }
+ },
+ "BundleOption": {
+ "type": "object",
+ "properties": {
+ "belowThreshold": {
+ "type": "boolean",
+ "description": "if true (the payment amount is lower than the threshold value) the bundles onus is not calculated (always false)"
+ },
+ "bundleOptions": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Transfer"
+ }
+ }
+ }
+ },
+ "Transfer": {
+ "type": "object",
+ "properties": {
+ "taxPayerFee": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "primaryCiIncurredFee": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "paymentMethod": {
+ "type": "string"
+ },
+ "touchpoint": {
+ "type": "string"
+ },
+ "idBundle": {
+ "type": "string"
+ },
+ "bundleName": {
+ "type": "string"
+ },
+ "bundleDescription": {
+ "type": "string"
+ },
+ "idCiBundle": {
+ "type": "string"
+ },
+ "idPsp": {
+ "type": "string"
+ },
+ "idChannel": {
+ "type": "string"
+ },
+ "idBrokerPsp": {
+ "type": "string"
+ },
+ "onUs": {
+ "type": "boolean"
+ },
+ "abi": {
+ "type": "string"
+ },
+ "pspBusinessName": {
+ "type": "string"
+ }
+ }
+ },
+ "PaymentOption": {
+ "required": [
+ "paymentAmount",
+ "primaryCreditorInstitution",
+ "transferList"
+ ],
+ "type": "object",
+ "properties": {
+ "paymentAmount": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "primaryCreditorInstitution": {
+ "type": "string"
+ },
+ "bin": {
+ "type": "string"
+ },
+ "paymentMethod": {
+ "type": "string"
+ },
+ "touchpoint": {
+ "type": "string"
+ },
+ "idPspList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/PspSearchCriteria"
+ }
+ },
+ "transferList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/TransferListItem"
+ }
+ }
+ }
+ },
+ "PspSearchCriteria": {
+ "required": [
+ "idPsp"
+ ],
+ "type": "object",
+ "properties": {
+ "idPsp": {
+ "type": "string"
+ },
+ "idChannel": {
+ "type": "string"
+ },
+ "idBrokerPsp": {
+ "type": "string"
+ }
+ }
+ },
+ "AppInfo": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "version": {
+ "type": "string"
+ },
+ "environment": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "securitySchemes": {
+ "ApiKey": {
+ "type": "apiKey",
+ "description": "The API key to access this function app.",
+ "name": "Ocp-Apim-Subscription-Key",
+ "in": "header"
+ }
+ }
+ }
+}
diff --git a/openapi/openapi-v2.json b/openapi/openapi-v2.json
index 778a15de..bf335cb4 100644
--- a/openapi/openapi-v2.json
+++ b/openapi/openapi-v2.json
@@ -4,7 +4,7 @@
"title": "PagoPA API Calculator Logic",
"description": "Calculator Logic microservice for pagoPA AFM",
"termsOfService": "https://www.pagopa.gov.it/",
- "version": "2.10.31"
+ "version": "2.10.32"
},
"servers": [
{
diff --git a/pom.xml b/pom.xml
index 3818bbe9..e7781496 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
it.gov.pagopa
calculator
- 2.10.31
+ 2.10.32
afm-calculator
Calculator Logic microservice for pagoPA AFM
diff --git a/src/main/java/it/gov/pagopa/afm/calculator/repository/CosmosRepository.java b/src/main/java/it/gov/pagopa/afm/calculator/repository/CosmosRepository.java
index 4c24d349..10662b51 100644
--- a/src/main/java/it/gov/pagopa/afm/calculator/repository/CosmosRepository.java
+++ b/src/main/java/it/gov/pagopa/afm/calculator/repository/CosmosRepository.java
@@ -4,6 +4,7 @@
import com.azure.spring.data.cosmos.core.CosmosTemplate;
import com.azure.spring.data.cosmos.core.query.CosmosQuery;
import com.azure.spring.data.cosmos.core.query.Criteria;
+import com.azure.spring.data.cosmos.core.query.CriteriaType;
import it.gov.pagopa.afm.calculator.entity.CiBundle;
import it.gov.pagopa.afm.calculator.entity.PaymentType;
import it.gov.pagopa.afm.calculator.entity.Touchpoint;
@@ -19,6 +20,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
+import org.springframework.data.repository.query.parser.Part;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;
@@ -47,6 +49,8 @@ public class CosmosRepository {
private static final String TRANSFER_CATEGORY_LIST = "transferCategoryList";
+ private static final String CART_PARAM = "cart";
+
/**
* @param ciFiscalCode fiscal code of the CI
* @param bundle a valid bundle
@@ -158,6 +162,13 @@ private Iterable findValidBundlesMulti(PaymentOptionMulti paymentOp
// add filter for PSP blacklist
queryResult = blackListCriteria(queryResult);
+ // add filter for cart bundle param
+ if (paymentOptionMulti.getPaymentNotice().size() > 1) {
+ var queryCart = Criteria.getInstance(
+ CriteriaType.IS_EQUAL, CART_PARAM, Collections.singletonList(Boolean.TRUE), Part.IgnoreCaseType.NEVER);
+ queryResult = and(queryResult, queryCart);
+ }
+
// execute the query
return cosmosTemplate.find(new CosmosQuery(queryResult), ValidBundle.class, "validbundles");
}