diff --git a/helm/Chart.yaml b/helm/Chart.yaml
index 6778649d8..6fd0741c2 100644
--- a/helm/Chart.yaml
+++ b/helm/Chart.yaml
@@ -2,8 +2,8 @@ apiVersion: v2
name: pagopa-selfcare-ms-backoffice
description: Microservice that manage api keys for pagopa product from selfcare
type: application
-version: 0.349.0
-appVersion: "2.15.0-1-next"
+version: 0.350.0
+appVersion: "2.15.0-2-next"
dependencies:
- name: microservice-chart
version: 2.4.0
diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml
index 8a13b2437..32a38feda 100644
--- a/helm/values-dev.yaml
+++ b/helm/values-dev.yaml
@@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend
- tag: "2.15.0-1-next"
+ tag: "2.15.0-2-next"
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml
index 49c88bada..fa0bab960 100644
--- a/helm/values-prod.yaml
+++ b/helm/values-prod.yaml
@@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend
- tag: "2.15.0-1-next" #improve
+ tag: "2.15.0-2-next" #improve
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml
index 002e3c2ac..ddba4ac3f 100644
--- a/helm/values-uat.yaml
+++ b/helm/values-uat.yaml
@@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend
- tag: "2.15.0-1-next" #improve
+ tag: "2.15.0-2-next" #improve
pullPolicy: Always
livenessProbe:
httpGet:
diff --git a/openapi/openapi.json b/openapi/openapi.json
index 6587876a9..b24b5e910 100644
--- a/openapi/openapi.json
+++ b/openapi/openapi.json
@@ -4,7 +4,7 @@
"description": "Microservice to manage PagoPA Backoffice",
"termsOfService": "https://www.pagopa.gov.it/",
"title": "SelfCare Backoffice",
- "version": "2.15.0-1-next"
+ "version": "2.15.0-2-next"
},
"servers": [
{
@@ -3883,24 +3883,6 @@
"required": true
},
"responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/WrapperChannelDetailsResource"
- }
- }
- },
- "description": "OK",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
- }
- }
- }
- },
"201": {
"content": {
"application/json": {
@@ -3909,7 +3891,7 @@
}
}
},
- "description": "Created",
+ "description": "OK",
"headers": {
"X-Request-Id": {
"description": "This header identifies the call",
@@ -4041,100 +4023,6 @@
}
]
},
- "/channels/merged": {
- "get": {
- "description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | | N\n",
- "operationId": "getAllChannelsMerged",
- "parameters": [
- {
- "in": "query",
- "name": "limit",
- "required": false,
- "schema": {
- "type": "integer",
- "format": "int32",
- "default": 50
- }
- },
- {
- "description": "Channel code",
- "in": "query",
- "name": "channelcodefilter",
- "required": false,
- "schema": {
- "type": "string"
- }
- },
- {
- "description": "Broker code filter for search",
- "in": "query",
- "name": "brokerCode",
- "required": false,
- "schema": {
- "type": "string"
- }
- },
- {
- "description": "Page number. Page value starts from 0",
- "in": "query",
- "name": "page",
- "required": true,
- "schema": {
- "type": "integer",
- "format": "int32"
- }
- },
- {
- "description": "Method of sorting",
- "in": "query",
- "name": "sorting",
- "required": false,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/WrapperChannelsResource"
- }
- }
- },
- "description": "OK",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
- }
- }
- }
- }
- },
- "security": [
- {
- "JWT": []
- }
- ],
- "summary": "Get All Channels from cosmos db merged whit apiConfig",
- "tags": [
- "Channels"
- ]
- },
- "parameters": [
- {
- "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
- "in": "header",
- "name": "X-Request-Id",
- "schema": {
- "type": "string"
- }
- }
- ]
- },
"/channels/merged/{channel-code}": {
"get": {
"description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | | N\n",
@@ -4274,7 +4162,7 @@
"required": true
},
"responses": {
- "200": {
+ "201": {
"content": {
"application/json": {
"schema": {
@@ -4292,24 +4180,6 @@
}
}
},
- "201": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/WrapperEntitiesChannelDetails"
- }
- }
- },
- "description": "Created",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
- }
- }
- }
- },
"400": {
"content": {
"application/json": {
@@ -4380,61 +4250,6 @@
]
}
},
- "/channels/wrapper/operator": {
- "parameters": [
- {
- "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
- "in": "header",
- "name": "X-Request-Id",
- "schema": {
- "type": "string"
- }
- }
- ],
- "put": {
- "description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | | N\n",
- "operationId": "updateWrapperChannelDetailsByOpt",
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ChannelDetailsDto"
- }
- }
- },
- "required": true
- },
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/WrapperEntities"
- }
- }
- },
- "description": "OK",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
- }
- }
- }
- }
- },
- "security": [
- {
- "JWT": []
- }
- ],
- "summary": "Execute the update as operator in the channel request that must be validated",
- "tags": [
- "Channels"
- ]
- }
- },
"/channels/wrapper/{channel-code}": {
"get": {
"description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | | N\n",
@@ -10061,56 +9876,16 @@
]
}
},
- "/stations/merged": {
+ "/stations/merged/{station-code}": {
"get": {
"description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | | N\n",
- "operationId": "getAllStationsMerged",
+ "operationId": "getStationDetail",
"parameters": [
- {
- "description": "Number of elements in one page",
- "in": "query",
- "name": "limit",
- "required": false,
- "schema": {
- "type": "integer",
- "format": "int32",
- "default": 50
- }
- },
{
"description": "Station's unique identifier",
- "in": "query",
- "name": "stationcodefilter",
- "required": false,
- "schema": {
- "type": "string"
- }
- },
- {
- "description": "Broker code filter for search",
- "in": "query",
- "name": "brokerCode",
- "required": true,
- "schema": {
- "type": "string"
- }
- },
- {
- "description": "Page number",
- "in": "query",
- "name": "page",
+ "in": "path",
+ "name": "station-code",
"required": true,
- "schema": {
- "minimum": 0,
- "type": "integer",
- "format": "int32"
- }
- },
- {
- "description": "Method of sorting",
- "in": "query",
- "name": "sorting",
- "required": false,
"schema": {
"type": "string"
}
@@ -10121,7 +9896,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/WrapperStationsResource"
+ "$ref": "#/components/schemas/StationDetailResource"
}
}
},
@@ -10141,7 +9916,7 @@
"JWT": []
}
],
- "summary": "Get All Stations from cosmos db merged whit apiConfig",
+ "summary": "Get station's details",
"tags": [
"Stations"
]
@@ -10157,15 +9932,15 @@
}
]
},
- "/stations/merged/{station-code}": {
+ "/stations/station-code": {
"get": {
"description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | | N\n",
- "operationId": "getStationDetail",
+ "operationId": "getStationCode",
"parameters": [
{
- "description": "Station's unique identifier",
- "in": "path",
- "name": "station-code",
+ "description": "Creditor institution code",
+ "in": "query",
+ "name": "ec-code",
"required": true,
"schema": {
"type": "string"
@@ -10177,7 +9952,7 @@
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/StationDetailResource"
+ "$ref": "#/components/schemas/StationCodeResource"
}
}
},
@@ -10197,7 +9972,7 @@
"JWT": []
}
],
- "summary": "Get station's details",
+ "summary": "Generate a station code given the creditor institution's code",
"tags": [
"Stations"
]
@@ -10213,66 +9988,10 @@
}
]
},
- "/stations/station-code": {
+ "/stations/station-code/v2": {
"get": {
"description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | | N\n",
- "operationId": "getStationCode",
- "parameters": [
- {
- "description": "Creditor institution code",
- "in": "query",
- "name": "ec-code",
- "required": true,
- "schema": {
- "type": "string"
- }
- }
- ],
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/StationCodeResource"
- }
- }
- },
- "description": "OK",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
- }
- }
- }
- }
- },
- "security": [
- {
- "JWT": []
- }
- ],
- "summary": "Generate a station code given the creditor institution's code",
- "tags": [
- "Stations"
- ]
- },
- "parameters": [
- {
- "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
- "in": "header",
- "name": "X-Request-Id",
- "schema": {
- "type": "string"
- }
- }
- ]
- },
- "/stations/station-code/v2": {
- "get": {
- "description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | | N\n",
- "operationId": "getStationCodeV2",
+ "operationId": "getStationCodeV2",
"parameters": [
{
"description": "Creditor institution code",
@@ -11840,195 +11559,6 @@
}
}
},
- "ChannelDetails": {
- "required": [
- "agid",
- "broker_psp_code",
- "card_chart",
- "digital_stamp_brand",
- "on_us",
- "payment_model",
- "port",
- "protocol",
- "recovery",
- "rt_push",
- "thread_number",
- "timeout_a",
- "timeout_b",
- "timeout_c"
- ],
- "type": "object",
- "properties": {
- "agid": {
- "type": "boolean"
- },
- "broker_description": {
- "type": "string"
- },
- "broker_psp_code": {
- "type": "string"
- },
- "card_chart": {
- "type": "boolean"
- },
- "channel_code": {
- "type": "string"
- },
- "digital_stamp_brand": {
- "type": "boolean"
- },
- "enabled": {
- "type": "boolean"
- },
- "flag_io": {
- "type": "boolean"
- },
- "flag_psp_cp": {
- "type": "boolean"
- },
- "ip": {
- "type": "string"
- },
- "new_fault_code": {
- "type": "boolean"
- },
- "new_password": {
- "type": "string"
- },
- "nmp_service": {
- "type": "string"
- },
- "on_us": {
- "type": "boolean"
- },
- "password": {
- "type": "string"
- },
- "payment_model": {
- "type": "string",
- "enum": [
- "IMMEDIATE",
- "IMMEDIATE_MULTIBENEFICIARY",
- "DEFERRED",
- "ACTIVATED_AT_PSP"
- ]
- },
- "payment_types": {
- "type": "array",
- "items": {
- "type": "string"
- }
- },
- "port": {
- "maximum": 65535,
- "minimum": 1,
- "type": "integer",
- "format": "int64"
- },
- "primitive_version": {
- "type": "integer",
- "format": "int32"
- },
- "protocol": {
- "type": "string",
- "enum": [
- "HTTPS",
- "HTTP"
- ]
- },
- "proxy_enabled": {
- "type": "boolean"
- },
- "proxy_host": {
- "type": "string"
- },
- "proxy_password": {
- "type": "string"
- },
- "proxy_port": {
- "maximum": 65535,
- "minimum": 1,
- "type": "integer",
- "format": "int64"
- },
- "proxy_username": {
- "type": "string"
- },
- "recovery": {
- "type": "boolean"
- },
- "redirect_ip": {
- "type": "string"
- },
- "redirect_path": {
- "type": "string"
- },
- "redirect_port": {
- "maximum": 65535,
- "minimum": 1,
- "type": "integer",
- "format": "int64"
- },
- "redirect_protocol": {
- "type": "string",
- "enum": [
- "HTTPS",
- "HTTP"
- ]
- },
- "redirect_query_string": {
- "type": "string"
- },
- "rt_push": {
- "type": "boolean"
- },
- "serv_plugin": {
- "type": "string"
- },
- "service": {
- "type": "string"
- },
- "target_host": {
- "type": "string"
- },
- "target_host_nmp": {
- "type": "string"
- },
- "target_path": {
- "type": "string"
- },
- "target_path_nmp": {
- "type": "string"
- },
- "target_port": {
- "type": "integer",
- "format": "int64"
- },
- "target_port_nmp": {
- "type": "string"
- },
- "thread_number": {
- "minimum": 1,
- "type": "integer",
- "format": "int64"
- },
- "timeout_a": {
- "minimum": 0,
- "type": "integer",
- "format": "int64"
- },
- "timeout_b": {
- "minimum": 0,
- "type": "integer",
- "format": "int64"
- },
- "timeout_c": {
- "minimum": 0,
- "type": "integer",
- "format": "int64"
- }
- }
- },
"ChannelDetailsDto": {
"required": [
"validationUrl"
@@ -15630,63 +15160,6 @@
}
}
},
- "WrapperEntitiesChannelDetails": {
- "type": "object",
- "properties": {
- "brokerCode": {
- "type": "string"
- },
- "createdAt": {
- "type": "string",
- "format": "date-time"
- },
- "createdBy": {
- "type": "string"
- },
- "entities": {
- "type": "array",
- "items": {
- "$ref": "#/components/schemas/WrapperEntityChannelDetails"
- }
- },
- "id": {
- "type": "string"
- },
- "modifiedAt": {
- "type": "string",
- "format": "date-time"
- },
- "modifiedBy": {
- "type": "string"
- },
- "modifiedByOpt": {
- "type": "string"
- },
- "new": {
- "type": "boolean"
- },
- "note": {
- "type": "string"
- },
- "status": {
- "type": "string",
- "enum": [
- "APPROVED",
- "TO_CHECK",
- "TO_FIX",
- "TO_CHECK_UPDATE",
- "TO_FIX_UPDATE"
- ]
- },
- "type": {
- "type": "string",
- "enum": [
- "CHANNEL",
- "STATION"
- ]
- }
- }
- },
"WrapperEntitiesList": {
"required": [
"page_info",
@@ -15819,51 +15292,6 @@
}
}
},
- "WrapperEntityChannelDetails": {
- "type": "object",
- "properties": {
- "createdAt": {
- "type": "string",
- "format": "date-time"
- },
- "entity": {
- "$ref": "#/components/schemas/ChannelDetails"
- },
- "id": {
- "type": "string"
- },
- "modifiedAt": {
- "type": "string",
- "format": "date-time"
- },
- "modifiedBy": {
- "type": "string"
- },
- "modifiedByOpt": {
- "type": "string"
- },
- "note": {
- "type": "string"
- },
- "status": {
- "type": "string",
- "enum": [
- "APPROVED",
- "TO_CHECK",
- "TO_FIX",
- "TO_CHECK_UPDATE",
- "TO_FIX_UPDATE"
- ]
- },
- "type": {
- "type": "string",
- "enum": [
- "CHANNEL",
- "STATION"
- ]
- }
- }
- },
"WrapperEntityObject": {
"type": "object",
"properties": {
diff --git a/pom.xml b/pom.xml
index cbab2af4f..e3c92c873 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
2.5.14
pagopa-selfcare-ms-backoffice
- 2.15.0-1-next
+ 2.15.0-2-next
SelfCare Backoffice
Microservice to manage PagoPA Backoffice
diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/ChannelController.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/ChannelController.java
index f7dcb6462..c2815a4a8 100644
--- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/ChannelController.java
+++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/ChannelController.java
@@ -9,7 +9,6 @@
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import it.pagopa.selfcare.pagopa.backoffice.entity.WrapperEntities;
-import it.pagopa.selfcare.pagopa.backoffice.mapper.ChannelMapper;
import it.pagopa.selfcare.pagopa.backoffice.model.ProblemJson;
import it.pagopa.selfcare.pagopa.backoffice.model.channels.ChannelDetailsDto;
import it.pagopa.selfcare.pagopa.backoffice.model.channels.ChannelDetailsResource;
@@ -91,7 +90,7 @@ public WrapperChannelsResource getChannels(
public ChannelDetailsResource getChannelDetails(
@Parameter(description = "Code of the payment channel") @PathVariable("channel-code") String channelCode
) {
- return channelService.getChannel(channelCode);
+ return this.channelService.getChannel(channelCode);
}
@GetMapping(value = "/{channel-code}/payment-service-providers", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -104,7 +103,7 @@ public ChannelPspListResource getChannelPaymentServiceProviders(
@Parameter(description = "Number of elements on one page") @RequestParam(required = false, defaultValue = "50") @Positive Integer limit,
@Parameter(description = "Page number") @RequestParam(required = false, defaultValue = "0") @PositiveOrZero Integer page
) {
- return channelService.getPSPsByChannel(limit, page, channelCode, pspName);
+ return this.channelService.getPSPsByChannel(limit, page, channelCode, pspName);
}
@GetMapping(value = "/csv", produces = {MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_JSON_VALUE})
@@ -113,14 +112,14 @@ public ChannelPspListResource getChannelPaymentServiceProviders(
@OpenApiTableMetadata(readWriteIntense = OpenApiTableMetadata.ReadWrite.READ)
public Resource getChannelsCSV(HttpServletResponse response) {
- return channelService.getChannelsInCSVFile(response);
+ return this.channelService.getChannelsInCSVFile(response);
}
@PostMapping(value = "", produces = {MediaType.APPLICATION_JSON_VALUE})
@ResponseStatus(HttpStatus.CREATED)
@Operation(summary = "Create a channel, validating the creation request previously inserted by user", security = {@SecurityRequirement(name = "JWT")})
@ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = WrapperChannelDetailsResource.class))),
+ @ApiResponse(responseCode = "201", description = "OK", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = WrapperChannelDetailsResource.class))),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class))),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema())),
@ApiResponse(responseCode = "429", description = "Too many requests", content = @Content(schema = @Schema())),
@@ -154,7 +153,7 @@ public ChannelDetailsResource updateChannel(
@Operation(summary = "delete channel", security = {@SecurityRequirement(name = "JWT")})
@OpenApiTableMetadata
public void deleteChannel(@Parameter(description = "Code of the payment channel") @PathVariable("channel-code") String channelCode) {
- channelService.deleteChannel(channelCode);
+ this.channelService.deleteChannel(channelCode);
}
@GetMapping(value = "/{channel-code}/payment-types", produces = {MediaType.APPLICATION_JSON_VALUE})
@@ -164,7 +163,7 @@ public void deleteChannel(@Parameter(description = "Code of the payment channel"
public PspChannelPaymentTypesResource getChannelPaymentTypes(
@Parameter(description = "Channel's unique identifier") @PathVariable("channel-code") String channelCode
) {
- return channelService.getPaymentTypesByChannel(channelCode);
+ return this.channelService.getPaymentTypesByChannel(channelCode);
}
@PostMapping(value = "/{channel-code}/payment-types", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE})
@@ -175,7 +174,7 @@ public PspChannelPaymentTypesResource createChannelPaymentType(
@Parameter(description = "Channel's unique identifier") @PathVariable("channel-code") String channelCode,
@Parameter(description = " List of payment types") @RequestBody PspChannelPaymentTypes pspChannelPaymentTypes
) {
- return channelService.createPaymentTypeOnChannel(pspChannelPaymentTypes, channelCode);
+ return this.channelService.createPaymentTypeOnChannel(pspChannelPaymentTypes, channelCode);
}
@DeleteMapping(value = "/{channel-code}/payment-types/{payment-type-code}", produces = {MediaType.APPLICATION_JSON_VALUE})
@@ -186,21 +185,7 @@ public void deleteChannelPaymentType(
@Parameter(description = "Channel's unique identifier") @PathVariable("channel-code") String channelCode,
@Parameter(description = "Code of the payment type") @PathVariable("payment-type-code") String paymentTypeCode
) {
- channelService.deletePaymentTypeOnChannel(channelCode, paymentTypeCode);
- }
-
- @GetMapping(value = "/merged", produces = {MediaType.APPLICATION_JSON_VALUE})
- @ResponseStatus(HttpStatus.OK)
- @Operation(summary = "Get All Channels from cosmos db merged whit apiConfig", security = {@SecurityRequirement(name = "JWT")})
- @OpenApiTableMetadata
- public WrapperChannelsResource getAllChannelsMerged(
- @Parameter(description = "") @RequestParam(required = false, defaultValue = "50") Integer limit,
- @Parameter(description = "Channel code") @RequestParam(required = false, value = "channelcodefilter") String channelcode,
- @Parameter(description = "Broker code filter for search") @RequestParam(required = false, value = "brokerCode") String brokerCode,
- @Parameter(description = "Page number. Page value starts from 0") @RequestParam Integer page,
- @Parameter(description = "Method of sorting") @RequestParam(required = false, value = "sorting") String sorting
- ) {
- return channelService.getAllMergedChannel(limit, channelcode, brokerCode, page, sorting);
+ this.channelService.deletePaymentTypeOnChannel(channelCode, paymentTypeCode);
}
@GetMapping(value = "/merged/{channel-code}", produces = {MediaType.APPLICATION_JSON_VALUE})
@@ -217,7 +202,7 @@ public WrapperChannelsResource getAllChannelsMerged(
public ChannelDetailsResource getChannelDetail(
@Parameter(description = "Code of the payment channel") @PathVariable("channel-code") String channelCode
) {
- return channelService.getChannelToBeValidated(channelCode);
+ return this.channelService.getChannelToBeValidated(channelCode);
}
@GetMapping(value = "/wrapper/{channel-code}")
@@ -227,14 +212,14 @@ public ChannelDetailsResource getChannelDetail(
public WrapperEntities getGenericWrapperEntities(
@Parameter(description = "Channel code") @PathVariable("channel-code") String channelCode
) {
- return wrapperService.findById(channelCode);
+ return this.wrapperService.findById(channelCode);
}
@PostMapping(value = "/wrapper", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
@Operation(summary = "Request the creation of a channel that will be validated by an operator", security = {@SecurityRequirement(name = "JWT")})
@ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = WrapperEntities.class))),
+ @ApiResponse(responseCode = "201", description = "OK", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = WrapperEntities.class))),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class))),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema())),
@ApiResponse(responseCode = "429", description = "Too many requests", content = @Content(schema = @Schema())),
@@ -263,15 +248,6 @@ public WrapperEntities updateWrapperChannelDetails(
return this.channelService.updateChannelToBeValidated(channelCode, channelDetailsDto);
}
- @PutMapping(value = "/wrapper/operator", consumes = MediaType.APPLICATION_JSON_VALUE)
- @ResponseStatus(HttpStatus.OK)
- @Operation(summary = "Execute the update as operator in the channel request that must be validated", security = {@SecurityRequirement(name = "JWT")})
- @OpenApiTableMetadata
- public WrapperEntities updateWrapperChannelDetailsByOpt(@RequestBody @Valid ChannelDetailsDto channelDetailsDto) {
-
- return wrapperService.updateValidatedWrapperChannel(ChannelMapper.fromChannelDetailsDto(channelDetailsDto), channelDetailsDto.getStatus());
- }
-
/**
* Updates a station wrapper with the operator review's note
*
diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/StationController.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/StationController.java
index c68f2b2ab..8d31c7003 100644
--- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/StationController.java
+++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/StationController.java
@@ -38,7 +38,6 @@
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
-import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import javax.validation.constraints.PositiveOrZero;
@@ -92,7 +91,6 @@ public StationDetailResource getStation(
@Parameter(description = "Station's unique identifier") @PathVariable("station-code") String stationCode
) {
return stationService.getStation(stationCode);
-
}
@GetMapping(value = "/{station-code}/creditor-institutions")
@@ -129,20 +127,6 @@ public WrapperEntities getWrapperEntitiesStation(
return stationService.getWrapperEntitiesStation(code);
}
- @GetMapping(value = "/merged", produces = {MediaType.APPLICATION_JSON_VALUE})
- @ResponseStatus(HttpStatus.OK)
- @Operation(summary = "Get All Stations from cosmos db merged whit apiConfig", security = {@SecurityRequirement(name = "JWT")})
- @OpenApiTableMetadata
- public WrapperStationsResource getAllStationsMerged(
- @Parameter(description = "Number of elements in one page") @RequestParam(required = false, defaultValue = "50") Integer limit,
- @Parameter(description = "Station's unique identifier") @RequestParam(required = false, value = "stationcodefilter") String stationCode,
- @Parameter(description = "Broker code filter for search") @RequestParam("brokerCode") String brokerCode,
- @Parameter(description = "Page number") @PositiveOrZero @Min(0) @RequestParam Integer page,
- @Parameter(description = "Method of sorting") @RequestParam(required = false, value = "sorting") String sorting
- ) {
- return stationService.getAllStationsMerged(limit, stationCode, brokerCode, page, sorting);
- }
-
@PostMapping(value = "/wrapper", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED)
@Operation(summary = "Create a WrapperChannel on Cosmodb", security = {@SecurityRequirement(name = "JWT")})
diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/ChannelService.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/ChannelService.java
index c363c901e..6953bfc73 100644
--- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/ChannelService.java
+++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/ChannelService.java
@@ -23,10 +23,8 @@
import it.pagopa.selfcare.pagopa.backoffice.model.connector.wrapper.WrapperChannel;
import it.pagopa.selfcare.pagopa.backoffice.model.connector.wrapper.WrapperChannels;
import it.pagopa.selfcare.pagopa.backoffice.model.connector.wrapper.WrapperStatus;
-import it.pagopa.selfcare.pagopa.backoffice.model.connector.wrapper.WrapperType;
import it.pagopa.selfcare.pagopa.backoffice.model.email.EmailMessageDetail;
import it.pagopa.selfcare.pagopa.backoffice.model.institutions.SelfcareProductUser;
-import it.pagopa.selfcare.pagopa.backoffice.util.Utility;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
@@ -74,19 +72,6 @@ public ChannelService(
this.awsSesClient = awsSesClient;
}
- public WrapperChannelsResource getAllMergedChannel(
- Integer limit,
- String channelcode,
- String brokerCode,
- Integer page,
- String sorting
- ) {
- Channels channels = apiConfigClient.getChannels(channelcode, brokerCode, sorting, limit, page);
- WrapperEntitiesList mongoList = wrapperService.findByIdLikeOrTypeOrBrokerCode(channelcode, WrapperType.CHANNEL, brokerCode, page, limit);
- WrapperChannels channelsMergedAndSorted = Utility.mergeAndSortWrapperChannels(ChannelMapper.toWrapperChannels(channels), ChannelMapper.toWrapperChannels(mongoList), sorting);
- return ChannelMapper.toWrapperChannelsResource(channelsMergedAndSorted);
- }
-
/**
* Creates a new wrapper channel in status {@link WrapperStatus#TO_CHECK} and open a JIRA ticket for operator
* review
diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/StationService.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/StationService.java
index 94e91bf1f..a14e9789c 100644
--- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/StationService.java
+++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/StationService.java
@@ -10,7 +10,6 @@
import it.pagopa.selfcare.pagopa.backoffice.exception.AppException;
import it.pagopa.selfcare.pagopa.backoffice.mapper.CreditorInstitutionMapper;
import it.pagopa.selfcare.pagopa.backoffice.mapper.StationMapper;
-import it.pagopa.selfcare.pagopa.backoffice.model.connector.PageInfo;
import it.pagopa.selfcare.pagopa.backoffice.model.connector.channel.WrapperEntitiesList;
import it.pagopa.selfcare.pagopa.backoffice.model.connector.creditorinstitution.CreditorInstitutions;
import it.pagopa.selfcare.pagopa.backoffice.model.connector.station.Station;
@@ -40,12 +39,9 @@
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -296,28 +292,10 @@ public StationDetailResource updateStation(@NotNull StationDetailsDto stationDet
return resource;
}
- public WrapperEntities getWrapperEntitiesStation(String code) {
+ public WrapperEntities getWrapperEntitiesStation(String code) {
return wrapperService.findById(code);
}
- public WrapperStationsResource getAllStationsMerged(
- Integer limit,
- String stationCode,
- String brokerCode,
- Integer page,
- String sorting
- ) {
- Stations stations = getStations(limit, page, sorting, brokerCode, null, stationCode);
- WrapperStations responseApiConfig = stationMapper.toWrapperStations(stations);
-
- WrapperEntitiesList mongoList = wrapperService.findByIdLikeOrTypeOrBrokerCode(stationCode, WrapperType.STATION, brokerCode, page, limit);
-
- WrapperStations responseMongo = stationMapper.toWrapperStations(mongoList);
-
- WrapperStations stationsMergedAndSorted = mergeAndSortWrapperStations(responseApiConfig, responseMongo, sorting);
- return stationMapper.toWrapperStationsResource(stationsMergedAndSorted);
- }
-
public TestStationResource testStation(StationTestDto stationTestDto) {
var response = forwarderClient.testForwardConnection(
stationTestDto.getHostProtocol(),
@@ -364,35 +342,6 @@ private String getFirstValidStationCodeAux(String ecCode) {
return generateStationCode(ecCode);
}
- private Stations getStations(
- Integer limit,
- Integer page,
- String sort,
- String brokerCode,
- String ecCode,
- String stationCode
- ) {
- Stations response = null;
- try {
- response = apiConfigClient.getStations(limit, page, sort, brokerCode, ecCode, stationCode);
- } catch (Exception e) {
- if (e.getMessage().contains("[404 Not Found]")) {
- response = new Stations();
- response.setStationsList(new ArrayList<>());
- PageInfo pageInfo = new PageInfo();
- pageInfo.setPage(0);
- pageInfo.setTotalPages(0);
- pageInfo.setLimit(50);
- pageInfo.setItemsFound(0);
- pageInfo.setTotalItems(0L);
- response.setPageInfo(pageInfo);
- } else {
- throw e;
- }
- }
- return response;
- }
-
private String generateStationCode(String ecCode) {
Stations stations = apiConfigClient.getStations(100, 0, "ASC", null, null, ecCode);
List stationsList = stations.getStationsList();
@@ -403,36 +352,6 @@ private String generateStationCode(String ecCode) {
}
- private WrapperStations mergeAndSortWrapperStations(
- WrapperStations wrapperStationsApiConfig,
- WrapperStations wrapperStationsMongo,
- String sorting
- ) {
- List mergedList = new ArrayList<>();
- mergedList.addAll(wrapperStationsMongo.getStationsList());
- mergedList.addAll(
- wrapperStationsApiConfig.getStationsList().stream()
- .filter(obj2 -> wrapperStationsMongo.getStationsList().stream().noneMatch(obj1 -> Objects.equals(obj1.getStationCode(), obj2.getStationCode())))
- .toList()
- );
-
- if ("asc".equalsIgnoreCase(sorting)) {
- mergedList.sort(Comparator.comparing(WrapperStation::getStationCode));
- } else if ("desc".equalsIgnoreCase(sorting)) {
- mergedList.sort(Comparator.comparing(WrapperStation::getStationCode, Comparator.reverseOrder()));
- }
- WrapperStations result = new WrapperStations();
- result.setStationsList(mergedList);
- PageInfo pageInfo = new PageInfo();
- pageInfo.setLimit(wrapperStationsApiConfig.getPageInfo().getLimit());
- pageInfo.setTotalPages(wrapperStationsApiConfig.getPageInfo().getTotalPages());
- pageInfo.setPage(wrapperStationsApiConfig.getPageInfo().getPage());
- pageInfo.setItemsFound(mergedList.size());
- pageInfo.setTotalItems(wrapperStationsApiConfig.getPageInfo().getTotalItems());
- result.setPageInfo(pageInfo);
- return result;
- }
-
private WrapperStations buildEnrichedWrapperStations(Stations stations) {
WrapperStations response;
List wrapperStations = stations.getStationsList().parallelStream()
diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/WrapperService.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/WrapperService.java
index 856d8a999..f97875826 100644
--- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/WrapperService.java
+++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/WrapperService.java
@@ -187,11 +187,9 @@ public WrapperEntities updateWrapperChannel(String channelCode,
*/
public WrapperEntities updateValidatedWrapperChannel(ChannelDetails channelDetails, WrapperStatus status) {
String channelCode = channelDetails.getChannelCode();
- Optional opt = this.repository.findById(channelCode);
- if (opt.isEmpty()) {
- throw new AppException(AppError.WRAPPER_CHANNEL_NOT_FOUND, channelCode);
- }
- WrapperEntities wrapperEntities = (WrapperEntities) opt.get();
+ WrapperEntities wrapperEntities = this.repository.findById(channelCode)
+ .orElseThrow(() -> new AppException(AppError.WRAPPER_CHANNEL_NOT_FOUND, channelCode));
+
String modifiedByOpt = this.auditorAware.getCurrentAuditor().orElse(null);
WrapperEntity wrapperEntity = new WrapperEntity<>(channelDetails);
wrapperEntity.setModifiedByOpt(modifiedByOpt);
diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/util/Utility.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/util/Utility.java
index 254c7e3d4..8678b42d9 100644
--- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/util/Utility.java
+++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/util/Utility.java
@@ -1,21 +1,19 @@
package it.pagopa.selfcare.pagopa.backoffice.util;
import it.pagopa.selfcare.pagopa.backoffice.model.SelfCareUser;
-import it.pagopa.selfcare.pagopa.backoffice.model.connector.PageInfo;
import it.pagopa.selfcare.pagopa.backoffice.model.connector.station.StationDetails;
-import it.pagopa.selfcare.pagopa.backoffice.model.connector.wrapper.WrapperChannel;
-import it.pagopa.selfcare.pagopa.backoffice.model.connector.wrapper.WrapperChannels;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.core.Authentication;
-import java.util.*;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Optional;
public class Utility {
private Utility() {
}
-
public static String extractUserIdFromAuth(Authentication authentication) {
String userIdForAuth = "";
if(authentication != null && authentication.getPrincipal() instanceof SelfCareUser user) {
@@ -24,28 +22,6 @@ public static String extractUserIdFromAuth(Authentication authentication) {
return userIdForAuth;
}
- public static WrapperChannels mergeAndSortWrapperChannels(WrapperChannels channelFromApiConfig, WrapperChannels channelFromLocal, String sorting) {
- List mergedList = new ArrayList<>();
- mergedList.addAll(channelFromLocal.getChannelList());
- mergedList.addAll(channelFromApiConfig.getChannelList().stream().filter(obj2 -> channelFromLocal.getChannelList().stream().noneMatch(obj1 -> Objects.equals(obj1.getChannelCode(), obj2.getChannelCode()))).toList());
-
- if("asc".equalsIgnoreCase(sorting)) {
- mergedList.sort(Comparator.comparing(WrapperChannel::getChannelCode));
- } else if("desc".equalsIgnoreCase(sorting)) {
- mergedList.sort(Comparator.comparing(WrapperChannel::getChannelCode, Comparator.reverseOrder()));
- }
- WrapperChannels result = new WrapperChannels();
- result.setChannelList(mergedList);
- PageInfo pageInfo = new PageInfo();
- pageInfo.setLimit(channelFromApiConfig.getPageInfo().getLimit());
- pageInfo.setTotalPages(channelFromApiConfig.getPageInfo().getTotalPages());
- pageInfo.setPage(channelFromApiConfig.getPageInfo().getPage());
- pageInfo.setItemsFound(mergedList.size());
- pageInfo.setTotalItems(channelFromApiConfig.getPageInfo().getTotalItems());
- result.setPageInfo(pageInfo);
- return result;
- }
-
/**
* @param value value to deNullify.
* @return return empty string if value is null
@@ -99,7 +75,6 @@ public static String sanitizeLogParam(String logParam) {
return "suspicious log param";
}
-
public static boolean isConnectionSync(StationDetails model) {
return (org.apache.commons.lang3.StringUtils.isNotBlank(model.getTargetPath()) && org.apache.commons.lang3.StringUtils.isNotBlank(model.getRedirectIp()))
|| StringUtils.isNotBlank(model.getTargetPathPof());
diff --git a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/controller/StationControllerTest.java b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/controller/StationControllerTest.java
index 8586db92a..47f02af11 100644
--- a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/controller/StationControllerTest.java
+++ b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/controller/StationControllerTest.java
@@ -123,17 +123,6 @@ void getWrapperEntitiesStation() throws Exception {
.andExpect(status().is2xxSuccessful());
}
- @Test
- void getAllStationsMerged() throws Exception {
- when(stationService.getAllStationsMerged(anyInt(), eq(null), anyString(), anyInt(), eq(null)))
- .thenReturn(buildWrapperStationsResource());
- mvc.perform(get("/stations/merged")
- .param("brokerCode", "brokerCode")
- .param("page", "0")
- .contentType(MediaType.APPLICATION_JSON))
- .andExpect(status().is2xxSuccessful());
- }
-
@Test
void createWrapperStationDetails() throws Exception {
when(stationService.createWrapperStationDetails(any())).thenReturn(new WrapperEntities<>());
diff --git a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/StationServiceTest.java b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/StationServiceTest.java
index b125b9b39..ecdefe265 100644
--- a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/StationServiceTest.java
+++ b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/StationServiceTest.java
@@ -384,56 +384,6 @@ void getWrapperEntitiesStationSuccess() {
assertNotNull(result);
}
- @Test
- void getAllStationsMergedSuccess() {
- when(apiConfigClient.getStations(LIMIT, PAGE, SORTING_DESC, BROKER_CODE, null, STATION_CODE))
- .thenReturn(buildStations("station"));
- when(wrapperService.findByIdLikeOrTypeOrBrokerCode(STATION_CODE, WrapperType.STATION, BROKER_CODE, PAGE, LIMIT))
- .thenReturn(buildWrapperEntitiesList());
-
- WrapperStationsResource result = assertDoesNotThrow(() ->
- service.getAllStationsMerged(LIMIT, STATION_CODE, BROKER_CODE, PAGE, SORTING_DESC)
- );
-
- assertNotNull(result);
- assertNotNull(result.getStationsList());
- assertEquals(2, result.getStationsList().size());
- assertNotNull(result.getPageInfo());
- assertEquals(LIMIT, result.getPageInfo().getLimit());
- assertEquals(PAGE, result.getPageInfo().getPage());
- }
-
- @Test
- void getAllStationsMergedApiConfigNotFoundSuccess() {
- when(apiConfigClient.getStations(LIMIT, PAGE, SORTING_ASC, BROKER_CODE, null, STATION_CODE))
- .thenThrow(new RuntimeException("[404 Not Found]"));
- when(wrapperService.findByIdLikeOrTypeOrBrokerCode(STATION_CODE, WrapperType.STATION, BROKER_CODE, PAGE, LIMIT))
- .thenReturn(buildWrapperEntitiesList());
-
- WrapperStationsResource result = assertDoesNotThrow(() ->
- service.getAllStationsMerged(LIMIT, STATION_CODE, BROKER_CODE, PAGE, SORTING_ASC)
- );
-
- assertNotNull(result);
- assertNotNull(result.getStationsList());
- assertEquals(1, result.getStationsList().size());
- assertNotNull(result.getPageInfo());
- }
-
- @Test
- void getAllStationsMergedApiConfigErrorFail() {
- when(apiConfigClient.getStations(LIMIT, PAGE, SORTING_DESC, BROKER_CODE, null, STATION_CODE))
- .thenThrow(new RuntimeException("error"));
-
- Exception e = assertThrows(RuntimeException.class, () ->
- service.getAllStationsMerged(LIMIT, STATION_CODE, BROKER_CODE, PAGE, SORTING_DESC)
- );
-
- assertNotNull(e);
-
- verify(wrapperService, never()).findByIdLikeOrTypeOrBrokerCode(STATION_CODE, WrapperType.STATION, BROKER_CODE, PAGE, LIMIT);
- }
-
@Test
void testStationShouldReturnSuccessOnValidForwardCall() {
HttpResponse response = mock(HttpResponse.class);