Skip to content

Commit

Permalink
Merge pull request #49 from pagopa/PRDP-289-feat-add-failed-cart-reco…
Browse files Browse the repository at this point in the history
…very

[PRDP-289] feat: add failed cart recovery
  • Loading branch information
pasqualespica authored Jan 8, 2024
2 parents 95e691d + d0f80f2 commit 670e019
Show file tree
Hide file tree
Showing 36 changed files with 2,919 additions and 359 deletions.
3 changes: 3 additions & 0 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ microservice-chart:
OTEL_TRACES_SAMPLER: "always_on"
MAX_DATE_DIFF_MILLIS: "1800000" # 30min
MAX_DATE_DIFF_NOTIFY_MILLIS: "1800000" # 30nin
MAX_DATE_DIFF_CART_MILLIS: "1800000" # 30nin
TRIGGER_NOTIFY_REC_SCHEDULE: "0 0 */2 * * *"
RECOVER_FAILED_CRON: "0 0 */2 * * *"
RECOVER_FAILED_CART_CRON: "0 0 */2 * * *"
AZURE_FUNCTIONS_MESH_JAVA_OPTS: "-javaagent:/home/site/wwwroot/jmx_prometheus_javaagent-0.19.0.jar=12345:/home/site/wwwroot/config.yaml -javaagent:/home/site/wwwroot/opentelemetry-javaagent.jar -Xmx768m -XX:+UseG1GC"
FAILED_AUTORECOVER_ENABLED: "true"
NOT_NOTIFIED_AUTORECOVER_ENABLED: "true"
FAILED_CART_AUTORECOVER_ENABLED: "true"
RECOVER_FAILED_MASSIVE_MAX_DAYS: "0"
RECOVER_NOT_NOTIFIED_MASSIVE_MAX_DAYS: "0"
RECOVER_NOT_NOTIFIED_MASSIVE_MAX_RECORDS: "200"
Expand Down
3 changes: 3 additions & 0 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ microservice-chart:
OTEL_TRACES_SAMPLER: "always_on"
MAX_DATE_DIFF_MILLIS: "1800000" # 30min
MAX_DATE_DIFF_NOTIFY_MILLIS: "1800000" # 30nin
MAX_DATE_DIFF_CART_MILLIS: "1800000" # 30nin
TRIGGER_NOTIFY_REC_SCHEDULE: "0 0 */1 * * *"
RECOVER_FAILED_CRON: "0 0 */1 * * *"
RECOVER_FAILED_CART_CRON: "0 0 */1 * * *"
AZURE_FUNCTIONS_MESH_JAVA_OPTS: "-javaagent:/home/site/wwwroot/jmx_prometheus_javaagent-0.19.0.jar=12345:/home/site/wwwroot/config.yaml -javaagent:/home/site/wwwroot/opentelemetry-javaagent.jar -Xmx768m -XX:+UseG1GC"
FAILED_AUTORECOVER_ENABLED: "true"
NOT_NOTIFIED_AUTORECOVER_ENABLED: "true"
FAILED_CART_AUTORECOVER_ENABLED: "false"
RECOVER_FAILED_MASSIVE_MAX_DAYS: "0"
RECOVER_NOT_NOTIFIED_MASSIVE_MAX_DAYS: "0"
RECOVER_NOT_NOTIFIED_MASSIVE_MAX_RECORDS: "200"
Expand Down
3 changes: 3 additions & 0 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ microservice-chart:
OTEL_TRACES_SAMPLER: "always_on"
MAX_DATE_DIFF_MILLIS: "1800000" # 30min
MAX_DATE_DIFF_NOTIFY_MILLIS: "1800000" # 30nin
MAX_DATE_DIFF_CART_MILLIS: "1800000" # 30nin
TRIGGER_NOTIFY_REC_SCHEDULE: "0 0 */1 * * *"
RECOVER_FAILED_CRON: "0 0 */1 * * *"
RECOVER_FAILED_CART_CRON: "0 0 */1 * * *"
AZURE_FUNCTIONS_MESH_JAVA_OPTS: "-javaagent:/home/site/wwwroot/jmx_prometheus_javaagent-0.19.0.jar=12345:/home/site/wwwroot/config.yaml -javaagent:/home/site/wwwroot/opentelemetry-javaagent.jar -Xmx768m -XX:+UseG1GC"
FAILED_AUTORECOVER_ENABLED: "true"
NOT_NOTIFIED_AUTORECOVER_ENABLED: "true"
FAILED_CART_AUTORECOVER_ENABLED: "false"
RECOVER_FAILED_MASSIVE_MAX_DAYS: "0"
RECOVER_NOT_NOTIFIED_MASSIVE_MAX_DAYS: "0"
RECOVER_NOT_NOTIFIED_MASSIVE_MAX_RECORDS: "200"
Expand Down
271 changes: 271 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,15 @@
"type": "string"
},
"required": true
},
{
"in": "query",
"name": "isCart",
"description": "Boolean to determine if the id refers to a cart",
"schema": {
"type": "string"
},
"required": false
}
],
"responses": {
Expand Down Expand Up @@ -886,6 +895,241 @@
}
]
},
"/carts/{cart-id}/recover-failed": {
"post": {
"tags": [
"API-recoverFailedCart"
],
"summary": "Recover a cart in FAILED or INSERTED status",
"operationId": "RecoverFailedCart",
"parameters": [
{
"in": "path",
"name": "cart-id",
"description": "Cart id.",
"schema": {
"type": "string"
},
"required": true
}
],
"requestBody": {
"content": {
"application/json": {}
},
"required": false
},
"responses": {
"200": {
"description": "Successful Calls.",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
},
"content": {
"text/plain": {
"schema": {
"type": "string",
"example": "Receipt with eventId 76abb1f1-c9f9-4ead-9e66-12fec4d51042 recovered"
}
}
}
},
"400": {
"description": "Bad request.",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemJson"
}
}
}
},
"404": {
"description": "Receipt or BizEvent not found",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemJson"
}
}
}
},
"500": {
"description": "Error processing the request",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemJson"
}
}
}
},
"default": {
"description": "Unexpected error.",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
}
}
},
"security": [
{
"ApiKey": []
}
]
},
"parameters": [
{
"name": "X-Request-Id",
"in": "header",
"description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
"schema": {
"type": "string"
}
}
]
},
"/carts/recover-failed": {
"post": {
"tags": [
"API-recoverCartFailed"
],
"summary": "Recover a group of cart in FAILED, or INSERTED status",
"operationId": "RecoverFailedCartMassive",
"parameters": [
{
"in": "query",
"name": "status",
"schema": {
"type": "string"
},
"required": true
}
],
"requestBody": {
"content": {
"application/json": {}
},
"required": false
},
"responses": {
"200": {
"description": "Successful Calls.",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
},
"content": {
"text/plain": {
"schema": {
"type": "string",
"example": "Recovered 10 carts"
}
}
}
},
"400": {
"description": "Bad request",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemJson"
}
}
}
},
"500": {
"description": "Error processing the request",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemJson"
}
}
}
},
"default": {
"description": "Unexpected error.",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
"schema": {
"type": "string"
}
}
}
}
},
"security": [
{
"ApiKey": []
}
]
},
"parameters": [
{
"name": "X-Request-Id",
"in": "header",
"description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
"schema": {
"type": "string"
}
}
]
},
"/receipts/{event-id}/recover-failed": {
"post": {
"tags": [
Expand All @@ -902,6 +1146,15 @@
"type": "string"
},
"required": true
},
{
"in": "query",
"name": "isCart",
"description": "Boolean to determine if the id refers to a cart",
"schema": {
"type": "string"
},
"required": false
}
],
"requestBody": {
Expand Down Expand Up @@ -1137,6 +1390,15 @@
"type": "string"
},
"required": true
},
{
"in": "query",
"name": "isCart",
"description": "Boolean to determine if the id refers to a cart",
"schema": {
"type": "string"
},
"required": false
}
],
"requestBody": {
Expand Down Expand Up @@ -1372,6 +1634,15 @@
"type": "string"
},
"required": true
},
{
"in": "query",
"name": "isCart",
"description": "Boolean to determine if the id refers to a cart",
"schema": {
"type": "string"
},
"required": false
}
],
"requestBody": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import it.gov.pagopa.receipt.pdf.helpdesk.client.impl.ReceiptCosmosClientImpl;
import it.gov.pagopa.receipt.pdf.helpdesk.entity.receipt.ReceiptError;
import it.gov.pagopa.receipt.pdf.helpdesk.entity.receipt.enumeration.ReceiptErrorStatusType;
import it.gov.pagopa.receipt.pdf.helpdesk.exception.CartNotFoundException;
import it.gov.pagopa.receipt.pdf.helpdesk.exception.ReceiptNotFoundException;
import it.gov.pagopa.receipt.pdf.helpdesk.model.ProblemJson;
import org.slf4j.Logger;
Expand Down
Loading

0 comments on commit 670e019

Please sign in to comment.