Skip to content

Commit 6c3b43f

Browse files
fix: Promote to UAT (#354)
2 parents eb85a39 + 49646e6 commit 6c3b43f

File tree

45 files changed

+680
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+680
-168
lines changed

.github/terraform/00_data.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ data "azurerm_key_vault_secret" "sonar_token" {
2424
name = "sonar-cloud-token"
2525
}
2626

27-
# Key Vault - Slack webhok
27+
# Key Vault - Slack webhook
2828
data "azurerm_key_vault_secret" "slack_webhook" {
2929
count = var.env_short == "p" ? 1 : 0
3030

3131
key_vault_id = data.azurerm_key_vault.key_vault_core.id
3232
name = "slack-webhook-url"
3333
}
34+
35+
# Key Vault - Azure DevOps Token
36+
data "azurerm_key_vault_secret" "azure_devops_token" {
37+
count = var.env_short == "p" ? 1 : 0
38+
39+
key_vault_id = data.azurerm_key_vault.key_vault_core.id
40+
name = "azure-devops-token"
41+
}

.github/terraform/99_locals.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ locals {
1818
env_variables = {}
1919

2020
repo_secrets = var.env_short == "p" ? {
21-
SONAR_TOKEN = data.azurerm_key_vault_secret.sonar_token[0].value
22-
SLACK_WEBHOOK_URL = data.azurerm_key_vault_secret.slack_webhook[0].value
21+
SONAR_TOKEN = data.azurerm_key_vault_secret.sonar_token[0].value
22+
SLACK_WEBHOOK_URL = data.azurerm_key_vault_secret.slack_webhook[0].value
23+
AZURE_DEVOPS_TOKEN = data.azurerm_key_vault_secret.azure_devops_token[0].value
2324
} : {}
2425

2526
repo_env = var.env_short == "p" ? {

asyncapi/generated.asyncapi.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
"nav": "string",
172172
"notificationDate": "2015-07-20T15:49:04-07:00",
173173
"notificationFeeCents": 0,
174+
"originalRemittanceInformation": "string",
174175
"paymentOptionId": 0,
175176
"receiptId": 0,
176177
"remittanceInformation": "string",
@@ -290,6 +291,7 @@
290291
"nav": "string",
291292
"notificationDate": "2015-07-20T15:49:04-07:00",
292293
"notificationFeeCents": 0,
294+
"originalRemittanceInformation": "string",
293295
"paymentOptionId": 0,
294296
"receiptId": 0,
295297
"remittanceInformation": "string",
@@ -629,6 +631,9 @@
629631
"type": "integer",
630632
"format": "int64"
631633
},
634+
"originalRemittanceInformation": {
635+
"type": "string"
636+
},
632637
"paymentOptionId": {
633638
"type": "integer",
634639
"format": "int64"
@@ -702,6 +707,7 @@
702707
"nav": "string",
703708
"notificationDate": "2015-07-20T15:49:04-07:00",
704709
"notificationFeeCents": 0,
710+
"originalRemittanceInformation": "string",
705711
"paymentOptionId": 0,
706712
"receiptId": 0,
707713
"remittanceInformation": "string",
@@ -975,6 +981,7 @@
975981
"nav": "string",
976982
"notificationDate": "2015-07-20T15:49:04-07:00",
977983
"notificationFeeCents": 0,
984+
"originalRemittanceInformation": "string",
978985
"paymentOptionId": 0,
979986
"receiptId": 0,
980987
"remittanceInformation": "string",

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ val commonsLang3Version = "3.20.0"
7676
val lz4JavaVersion = "1.10.1"
7777
val springCloudDepsVersion = "2025.1.0"
7878

79-
val p4paActivitiesVersion = "1.167.2"
79+
val p4paActivitiesVersion = "1.168.3"
8080

8181
dependencyManagement {
8282
imports {

gradle.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ io.temporal:temporal-spring-boot-autoconfigure:1.32.1=compileClasspath
8080
io.temporal:temporal-spring-boot-starter:1.32.1=compileClasspath
8181
io.temporal:temporal-test-server:1.32.1=compileClasspath
8282
io.temporal:temporal-testing:1.32.1=compileClasspath
83-
it.gov.pagopa.payhub:p4pa-payhub-activities:1.167.2=compileClasspath
83+
it.gov.pagopa.payhub:p4pa-payhub-activities:1.168.3=compileClasspath
8484
jakarta.activation:jakarta.activation-api:2.1.4=compileClasspath
8585
jakarta.annotation:jakarta.annotation-api:3.0.0=compileClasspath
8686
jakarta.persistence:jakarta.persistence-api:3.2.0=compileClasspath

openapi/generated.openapi.json

Lines changed: 65 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,27 @@
18321832
}
18331833
}
18341834
},
1835+
"PageMetadata" : {
1836+
"type" : "object",
1837+
"properties" : {
1838+
"size" : {
1839+
"type" : "integer",
1840+
"format" : "int64"
1841+
},
1842+
"totalElements" : {
1843+
"type" : "integer",
1844+
"format" : "int64"
1845+
},
1846+
"totalPages" : {
1847+
"type" : "integer",
1848+
"format" : "int64"
1849+
},
1850+
"number" : {
1851+
"type" : "integer",
1852+
"format" : "int64"
1853+
}
1854+
}
1855+
},
18351856
"DebtPositionSyncWfName" : {
18361857
"type" : "string",
18371858
"enum" : [ "fineWf" ]
@@ -1878,27 +1899,6 @@
18781899
}
18791900
}
18801901
},
1881-
"PageMetadata" : {
1882-
"type" : "object",
1883-
"properties" : {
1884-
"size" : {
1885-
"type" : "integer",
1886-
"format" : "int64"
1887-
},
1888-
"totalElements" : {
1889-
"type" : "integer",
1890-
"format" : "int64"
1891-
},
1892-
"totalPages" : {
1893-
"type" : "integer",
1894-
"format" : "int64"
1895-
},
1896-
"number" : {
1897-
"type" : "integer",
1898-
"format" : "int64"
1899-
}
1900-
}
1901-
},
19021902
"WfExecutionConfig" : {
19031903
"type" : "object",
19041904
"discriminator" : {
@@ -2273,6 +2273,9 @@
22732273
},
22742274
"updateTraceId" : {
22752275
"type" : "string"
2276+
},
2277+
"originalRemittanceInformation" : {
2278+
"type" : "string"
22762279
}
22772280
},
22782281
"required" : [ "amountCents", "debtor", "remittanceInformation" ]
@@ -2570,16 +2573,51 @@
25702573
},
25712574
"required" : [ "createdAt", "lastExecution", "lastUpdatedAt", "nextActionTimes", "numActions", "numActionsMissedCatchupWindow", "numActionsSkippedOverlap", "recentActions", "runningActions", "scheduleId" ]
25722575
},
2573-
"PagedModelWorkflowTypeOrg" : {
2576+
"DebtPositionWorkflowType" : {
2577+
"type" : "object",
2578+
"properties" : {
2579+
"creationDate" : {
2580+
"type" : "string",
2581+
"format" : "date-time"
2582+
},
2583+
"updateDate" : {
2584+
"type" : "string",
2585+
"format" : "date-time"
2586+
},
2587+
"updateOperatorExternalId" : {
2588+
"type" : "string"
2589+
},
2590+
"updateTraceId" : {
2591+
"type" : "string"
2592+
},
2593+
"debtPositionId" : {
2594+
"type" : "integer",
2595+
"format" : "int64"
2596+
},
2597+
"workflowTypeOrgId" : {
2598+
"type" : "integer",
2599+
"format" : "int64"
2600+
},
2601+
"executionConfig" : {
2602+
"type" : "string",
2603+
"format" : "byte"
2604+
},
2605+
"_links" : {
2606+
"$ref" : "#/components/schemas/Links"
2607+
}
2608+
},
2609+
"required" : [ "debtPositionId", "executionConfig" ]
2610+
},
2611+
"PagedModelDebtPositionWorkflowType" : {
25742612
"type" : "object",
25752613
"properties" : {
25762614
"_embedded" : {
25772615
"type" : "object",
25782616
"properties" : {
2579-
"workflowTypeOrgs" : {
2617+
"debtPositionWorkflowTypes" : {
25802618
"type" : "array",
25812619
"items" : {
2582-
"$ref" : "#/components/schemas/WorkflowTypeOrg"
2620+
"$ref" : "#/components/schemas/DebtPositionWorkflowType"
25832621
}
25842622
}
25852623
}
@@ -2649,51 +2687,16 @@
26492687
}
26502688
}
26512689
},
2652-
"DebtPositionWorkflowType" : {
2653-
"type" : "object",
2654-
"properties" : {
2655-
"creationDate" : {
2656-
"type" : "string",
2657-
"format" : "date-time"
2658-
},
2659-
"updateDate" : {
2660-
"type" : "string",
2661-
"format" : "date-time"
2662-
},
2663-
"updateOperatorExternalId" : {
2664-
"type" : "string"
2665-
},
2666-
"updateTraceId" : {
2667-
"type" : "string"
2668-
},
2669-
"debtPositionId" : {
2670-
"type" : "integer",
2671-
"format" : "int64"
2672-
},
2673-
"workflowTypeOrgId" : {
2674-
"type" : "integer",
2675-
"format" : "int64"
2676-
},
2677-
"executionConfig" : {
2678-
"type" : "string",
2679-
"format" : "byte"
2680-
},
2681-
"_links" : {
2682-
"$ref" : "#/components/schemas/Links"
2683-
}
2684-
},
2685-
"required" : [ "debtPositionId", "executionConfig" ]
2686-
},
2687-
"PagedModelDebtPositionWorkflowType" : {
2690+
"PagedModelWorkflowTypeOrg" : {
26882691
"type" : "object",
26892692
"properties" : {
26902693
"_embedded" : {
26912694
"type" : "object",
26922695
"properties" : {
2693-
"debtPositionWorkflowTypes" : {
2696+
"workflowTypeOrgs" : {
26942697
"type" : "array",
26952698
"items" : {
2696-
"$ref" : "#/components/schemas/DebtPositionWorkflowType"
2699+
"$ref" : "#/components/schemas/WorkflowTypeOrg"
26972700
}
26982701
}
26992702
}

src/main/java/it/gov/pagopa/pu/workflow/event/payments/consumer/PaymentsConsumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void accept(PaymentEventDTO paymentEventDTO) {
7373
.transferIndexes(i.getTransfers().stream()
7474
.filter(t ->{
7575
Organization organization = organizationService.getOrganizationByFiscalCode(t.getOrgFiscalCode())
76-
.orElseThrow(() -> new WorkflowNotFoundException("Organization not found with fiscalCode " + t.getOrgFiscalCode()));
76+
.orElseThrow(() -> new WorkflowNotFoundException("[ORGANIZATION_NOT_FOUND] Organization not found with fiscalCode " + t.getOrgFiscalCode()));
7777
return debtPosition.getOrganizationId().equals(organization.getOrganizationId());
7878
})
7979
.map(TransferDTO::getTransferIndex)

src/main/java/it/gov/pagopa/pu/workflow/exception/WorkflowExceptionHandler.java

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import tools.jackson.core.JacksonException;
3232
import tools.jackson.databind.DatabindException;
3333

34+
import java.util.Optional;
3435
import java.util.stream.Collectors;
3536

3637
/**
@@ -41,6 +42,8 @@
4142
@Order(Ordered.HIGHEST_PRECEDENCE)
4243
public class WorkflowExceptionHandler {
4344

45+
private static final String ERROR_MESSAGE_FORMAT = "[%s] %s";
46+
4447
@ExceptionHandler(WorkflowExecutionAlreadyStarted.class)
4548
public ResponseEntity<WorkflowErrorDTO> handleWorkflowExecutionAlreadyStarted(WorkflowExecutionAlreadyStarted ex, HttpServletRequest request) {
4649
return handleException(ex, request, HttpStatus.CONFLICT, WorkflowErrorDTO.CodeEnum.WORKFLOW_CONFLICT);
@@ -78,10 +81,10 @@ public ResponseEntity<WorkflowErrorDTO> handleTooManyAttemptsException(RuntimeEx
7881

7982
@ExceptionHandler({ServletException.class, ErrorResponseException.class})
8083
public ResponseEntity<WorkflowErrorDTO> handleServletException(Exception ex, HttpServletRequest request) {
81-
HttpStatusCode httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
84+
HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
8285
WorkflowErrorDTO.CodeEnum errorCode = WorkflowErrorDTO.CodeEnum.WORKFLOW_GENERIC_ERROR;
8386
if (ex instanceof ErrorResponse errorResponse) {
84-
httpStatus = errorResponse.getStatusCode();
87+
httpStatus = HttpStatus.valueOf((errorResponse.getStatusCode().value()));
8588
if (httpStatus.isSameCodeAs(HttpStatus.NOT_FOUND)) {
8689
errorCode = WorkflowErrorDTO.CodeEnum.WORKFLOW_NOT_FOUND;
8790
} else if (httpStatus.is4xxClientError()) {
@@ -105,17 +108,26 @@ public ResponseEntity<WorkflowErrorDTO> handleRuntimeException(RuntimeException
105108
return handleException(ex, request, HttpStatus.INTERNAL_SERVER_ERROR, WorkflowErrorDTO.CodeEnum.WORKFLOW_GENERIC_ERROR);
106109
}
107110

108-
static ResponseEntity<WorkflowErrorDTO> handleException(Exception ex, HttpServletRequest request, HttpStatusCode httpStatus, WorkflowErrorDTO.CodeEnum errorEnum) {
111+
static ResponseEntity<WorkflowErrorDTO> handleException(Exception ex, HttpServletRequest request, HttpStatus httpStatus, WorkflowErrorDTO.CodeEnum errorEnum) {
109112
logException(ex, request, httpStatus);
110113

111-
String message = buildReturnedMessage(ex);
114+
String message = Optional.of(request.getRequestURI())
115+
.filter(path -> path.contains("/crud/"))
116+
.map(path -> buildCrudErrorMessage(path, httpStatus, ex))
117+
.orElseGet(() -> buildReturnedMessage(ex));
112118

113119
return ResponseEntity
114120
.status(httpStatus)
115121
.contentType(MediaType.APPLICATION_JSON)
116122
.body(new WorkflowErrorDTO(errorEnum, message, Utilities.getTraceId()));
117123
}
118124

125+
private static String buildCrudErrorMessage(String requestPath, HttpStatus httpStatus, Exception ex) {
126+
String entity = requestPath.split("/crud/")[1].split("/")[0].replaceAll("s$", "");
127+
String entityCode = entity.replace("-", "_").toUpperCase();
128+
return String.format(ERROR_MESSAGE_FORMAT, entityCode + "_" + httpStatus.name(), ex.getMessage());
129+
}
130+
119131
private static void logException(Exception ex, HttpServletRequest request, HttpStatusCode httpStatus) {
120132
boolean printStackTrace = httpStatus.is5xxServerError();
121133
Level logLevel = printStackTrace ? Level.ERROR : Level.INFO;
@@ -136,31 +148,35 @@ private static String buildReturnedMessage(Exception ex) {
136148
switch (ex) {
137149
case HttpMessageNotReadableException httpMessageNotReadableException -> {
138150
if (httpMessageNotReadableException.getCause() instanceof DatabindException jsonMappingException) {
139-
return "Cannot parse body. " +
151+
return String.format(ERROR_MESSAGE_FORMAT, WorkflowErrorDTO.CodeEnum.WORKFLOW_BAD_REQUEST.name(),
152+
"Cannot parse body. " +
140153
jsonMappingException.getPath().stream()
141154
.map(JacksonException.Reference::getPropertyName)
142155
.collect(Collectors.joining(".")) +
143-
": " + jsonMappingException.getOriginalMessage();
156+
": " + jsonMappingException.getOriginalMessage());
144157
}
145-
return "Required request body is missing";
158+
return String.format(ERROR_MESSAGE_FORMAT, WorkflowErrorDTO.CodeEnum.WORKFLOW_BAD_REQUEST.name(),
159+
"Required request body is missing");
146160
}
147161
case MethodArgumentNotValidException methodArgumentNotValidException -> {
148-
return "Invalid request content." +
162+
return String.format(ERROR_MESSAGE_FORMAT, WorkflowErrorDTO.CodeEnum.WORKFLOW_BAD_REQUEST.name(),
163+
"Invalid request content." +
149164
methodArgumentNotValidException.getBindingResult()
150165
.getAllErrors().stream()
151166
.map(e -> " " +
152167
(e instanceof FieldError fieldError ? fieldError.getField() : e.getObjectName()) +
153168
": " + e.getDefaultMessage())
154169
.sorted()
155-
.collect(Collectors.joining(";"));
170+
.collect(Collectors.joining(";")));
156171
}
157172
case ConstraintViolationException constraintViolationException -> {
158-
return "Invalid request content." +
173+
return String.format(ERROR_MESSAGE_FORMAT, WorkflowErrorDTO.CodeEnum.WORKFLOW_BAD_REQUEST.name(),
174+
"Invalid request content." +
159175
constraintViolationException.getConstraintViolations()
160176
.stream()
161177
.map(e -> " " + e.getPropertyPath() + ": " + e.getMessage())
162178
.sorted()
163-
.collect(Collectors.joining(";"));
179+
.collect(Collectors.joining(";")));
164180
}
165181
default -> {
166182
return ex.getMessage();

src/main/java/it/gov/pagopa/pu/workflow/service/DataCipherService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ public <T> byte[] encryptObj(T obj) {
3232
try {
3333
return encrypt(jsonMapper.writeValueAsString(obj));
3434
} catch (JacksonException e) {
35-
throw new IllegalStateException("Cannot serialize object as JSON", e);
35+
throw new IllegalStateException("[JSON_SERIALIZATION_ERROR] Cannot serialize object as JSON", e);
3636
}
3737
}
3838

3939
public <T> T decryptObj(byte[] cipherData, Class<T> clazz) {
4040
try {
4141
return jsonMapper.readValue(decrypt(cipherData), clazz);
4242
} catch (JacksonException e) {
43-
throw new IllegalStateException("Cannot deserialize object as JSON", e);
43+
throw new IllegalStateException("[JSON_DESERIALIZATION_ERROR] Cannot deserialize object as JSON", e);
4444
}
4545
}
4646
}

0 commit comments

Comments
 (0)