From 87b634505d6e3acf440852231d6626c3da102aeb Mon Sep 17 00:00:00 2001 From: gianmarcoplutino <119858159+gianmarcoplutino@users.noreply.github.com> Date: Mon, 17 Jun 2024 12:16:04 +0200 Subject: [PATCH] [SELC - 4376] feat: added API to complete users onboarding (#314) --- app/src/main/resources/swagger/api-docs.json | 93 + .../connector/api/OnboardingMsConnector.java | 2 + .../openapi/api-selfcare-onboarding-docs.json | 2609 ++++++++--------- .../connector/OnboardingMsConnectorImpl.java | 6 + .../OnboardingMsConnectorImplTest.java | 15 + .../onboarding/core/TokenService.java | 2 + .../onboarding/core/TokenServiceImpl.java | 11 +- .../onboarding/core/TokenServiceImplTest.java | 22 + .../web/controller/TokenV2Controller.java | 25 + .../resources/swagger/swagger_en.properties | 1 + .../web/controller/TokenV2ControllerTest.java | 15 + 11 files changed, 1431 insertions(+), 1370 deletions(-) diff --git a/app/src/main/resources/swagger/api-docs.json b/app/src/main/resources/swagger/api-docs.json index 96ce63c9..ddfdf27b 100644 --- a/app/src/main/resources/swagger/api-docs.json +++ b/app/src/main/resources/swagger/api-docs.json @@ -1621,6 +1621,99 @@ } ] } }, + "/v2/tokens/{onboardingId}/completeOnboardingUsers" : { + "post" : { + "tags" : [ "tokens" ], + "summary" : "Complete an onboarding users request", + "description" : "Complete an onboarding users request", + "operationId" : "completeOnboardingUsersUsingPOST", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "description" : "Onboarding's unique identifier", + "required" : true, + "style" : "simple", + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "multipart/form-data" : { + "schema" : { + "required" : [ "contract" ], + "type" : "object", + "properties" : { + "contract" : { + "type" : "string", + "description" : "contract", + "format" : "binary" + } + } + } + } + } + }, + "responses" : { + "204" : { + "description" : "No Content" + }, + "400" : { + "description" : "Bad Request", + "content" : { + "application/problem+json" : { + "schema" : { + "$ref" : "#/components/schemas/Problem" + } + } + } + }, + "401" : { + "description" : "Unauthorized", + "content" : { + "application/problem+json" : { + "schema" : { + "$ref" : "#/components/schemas/Problem" + } + } + } + }, + "404" : { + "description" : "Not Found", + "content" : { + "application/problem+json" : { + "schema" : { + "$ref" : "#/components/schemas/Problem" + } + } + } + }, + "409" : { + "description" : "Conflict", + "content" : { + "application/problem+json" : { + "schema" : { + "$ref" : "#/components/schemas/Problem" + } + } + } + }, + "500" : { + "description" : "Internal Server Error", + "content" : { + "application/problem+json" : { + "schema" : { + "$ref" : "#/components/schemas/Problem" + } + } + } + } + }, + "security" : [ { + "bearerAuth" : [ "global" ] + } ] + } + }, "/v2/tokens/{onboardingId}/contract" : { "get" : { "tags" : [ "tokens" ], diff --git a/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/api/OnboardingMsConnector.java b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/api/OnboardingMsConnector.java index 329ae1b4..c575b019 100644 --- a/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/api/OnboardingMsConnector.java +++ b/connector-api/src/main/java/it/pagopa/selfcare/onboarding/connector/api/OnboardingMsConnector.java @@ -14,6 +14,8 @@ public interface OnboardingMsConnector { void onboardingTokenComplete(String onboardingId, MultipartFile contract); + void onboardingUsersComplete(String onboardingId, MultipartFile contract); + void onboardingPending(String onboardingId); void approveOnboarding(String onboardingId); diff --git a/connector/rest/docs/openapi/api-selfcare-onboarding-docs.json b/connector/rest/docs/openapi/api-selfcare-onboarding-docs.json index 627ced2c..836215a7 100644 --- a/connector/rest/docs/openapi/api-selfcare-onboarding-docs.json +++ b/connector/rest/docs/openapi/api-selfcare-onboarding-docs.json @@ -1,1859 +1,1730 @@ { - "openapi": "3.0.3", - "info": { - "title": "onboarding-ms API", - "version": "1.0.0" + "openapi" : "3.0.3", + "info" : { + "title" : "Onboarding API", + "version" : "1.0.0" }, - "servers": [ - { - "url": "http://localhost:8080", - "description": "Auto generated value" - }, - { - "url": "http://0.0.0.0:8080", - "description": "Auto generated value" - } - ], - "paths": { - "/v1/onboarding": { - "get": { - "tags": [ - "Onboarding Controller" - ], - "summary": "The API retrieves paged onboarding using optional filter, order by descending creation date", - "parameters": [ - { - "name": "from", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "page", - "in": "query", - "schema": { - "format": "int32", - "default": "0", - "type": "integer" - } - }, - { - "name": "productId", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "size", - "in": "query", - "schema": { - "format": "int32", - "default": "20", - "type": "integer" - } - }, - { - "name": "status", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "taxCode", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "to", - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingGetResponse" + "servers" : [ { + "url" : "http://localhost:8080", + "description" : "Auto generated value" + }, { + "url" : "http://0.0.0.0:8080", + "description" : "Auto generated value" + } ], + "tags" : [ { + "name" : "Onboarding" + }, { + "name" : "support" + } ], + "paths" : { + "/v1/onboarding" : { + "get" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "The API retrieves paged onboarding using optional filter, order by descending creation date", + "parameters" : [ { + "name" : "from", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "page", + "in" : "query", + "schema" : { + "format" : "int32", + "default" : "0", + "type" : "integer" + } + }, { + "name" : "productId", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "size", + "in" : "query", + "schema" : { + "format" : "int32", + "default" : "20", + "type" : "integer" + } + }, { + "name" : "status", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "taxCode", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "to", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingGetResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] }, - "post": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform default onboarding request, it is used for GSP/SA/AS institution type.Users data will be saved on personal data vault if it doesn't already exist.At the end, function triggers async activities related to onboarding based on institution type.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingDefaultRequest" + "post" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform default onboarding request, it is used for GSP/SA/AS institution type.Users data will be saved on personal data vault if it doesn't already exist.At the end, function triggers async activities related to onboarding based on institution type.", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingDefaultRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/users": { - "post": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform onboarding users request, it is used all institution types.Users data will be saved on personal data vault if it doesn't already exist.At the end, function triggers async activities related to onboarding based on institution type.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingUserRequest" + "/v1/onboarding/completion" : { + "post" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform onboarding as /onboarding but completing the onboarding request to COMPLETED phase.", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingDefaultRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/completion": { - "post": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform onboarding as /onboarding but completing the onboarding request to COMPLETED phase.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingDefaultRequest" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "/v1/onboarding/institutionOnboardings" : { + "get" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Returns onboardings record by institution taxCode/subunitCode/origin/originId", + "parameters" : [ { + "name" : "origin", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "originId", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "status", + "in" : "query", + "schema" : { + "$ref" : "#/components/schemas/OnboardingStatus" + } + }, { + "name" : "subunitCode", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "taxCode", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/OnboardingResponse" + } } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/institutionOnboardings": { - "get": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Returns onboardings record by institution taxCode/subunitCode/origin/originId", - "parameters": [ - { - "name": "origin", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "originId", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "subunitCode", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "taxCode", - "in": "query", - "schema": { - "type": "string" + "/v1/onboarding/pa" : { + "post" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform onboarding request for PA institution type, it require billing.recipientCode in additition to default requestUsers data will be saved on personal data vault if it doesn't already exist.At the end, function triggers async activities related to onboarding that consist of create contract and sending mail to institution's digital address.", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingPaRequest" + } } } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OnboardingResponse" - } + }, + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/pa": { - "post": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform onboarding request for PA institution type, it require billing.recipientCode in additition to default requestUsers data will be saved on personal data vault if it doesn't already exist.At the end, function triggers async activities related to onboarding that consist of create contract and sending mail to institution's digital address.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingPaRequest" + "/v1/onboarding/pa/completion" : { + "post" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform onboarding as /onboarding/pa but completing the onboarding request to COMPLETED phase.", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingPaRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/pa/completion": { - "post": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform onboarding as /onboarding/pa but completing the onboarding request to COMPLETED phase.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingPaRequest" + "/v1/onboarding/pa/import" : { + "post" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform onboarding as /onboarding/pa but create token and completing the onboarding request to COMPLETED phase.", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingImportRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/pa/import": { - "post": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform onboarding as /onboarding/pa but create token and completing the onboarding request to COMPLETED phase.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingImportRequest" + "/v1/onboarding/pg/completion" : { + "post" : { + "tags" : [ "Onboarding Controller" ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingPgRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/pg/completion": { - "post": { - "tags": [ - "Onboarding Controller" - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingPgRequest" + "/v1/onboarding/psp" : { + "post" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform onboarding request for PSP institution type.Users data will be saved on personal data vault if it doesn't already exist.At the end, function triggers async activities related to onboarding that consist of sending mail to Selfcare admin for approve request.", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingPspRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/psp": { - "post": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform onboarding request for PSP institution type.Users data will be saved on personal data vault if it doesn't already exist.At the end, function triggers async activities related to onboarding that consist of sending mail to Selfcare admin for approve request.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingPspRequest" + "/v1/onboarding/psp/completion" : { + "post" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform onboarding as /onboarding/psp but completing the onboarding request to COMPLETED phase.", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingPspRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/psp/completion": { - "post": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform onboarding as /onboarding/psp but completing the onboarding request to COMPLETED phase.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingPspRequest" + "/v1/onboarding/users" : { + "post" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform onboarding users request, it is used all institution types.Users data will be saved on personal data vault if it doesn't already exist.At the end, function triggers async activities related to onboarding based on institution type.", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingUserRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/{onboardingId}": { - "get": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Retrieve an onboarding record given its ID", - "parameters": [ - { - "name": "onboardingId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingGet" + "/v1/onboarding/{onboardingId}" : { + "get" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Retrieve an onboarding record given its ID", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingGet" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] + "security" : [ { + "SecurityScheme" : [ ] + } ] + } + }, + "/v1/onboarding/{onboardingId}/approve" : { + "put" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform approve operation of an onboarding request receiving onboarding id.Function triggers async activities related to onboarding based on institution type or completing onboarding. ", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { } + } + }, + "403" : { + "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } - ] + }, + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/{onboardingId}/approve": { - "put": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform approve operation of an onboarding request receiving onboarding id.Function triggers async activities related to onboarding based on institution type or completing onboarding. ", - "parameters": [ - { - "name": "onboardingId", - "in": "path", - "required": true, - "schema": { - "type": "string" + "/v1/onboarding/{onboardingId}/complete" : { + "put" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform complete operation of an onboarding request receiving onboarding id and contract signed by the institution.It checks the contract's signature and upload the contract on an azure storageAt the end, function triggers async activities related to complete onboarding that consist of create the institution, activate the onboarding and sending data to notification queue.", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "multipart/form-data" : { + "schema" : { + "required" : [ "contract" ], + "type" : "object", + "properties" : { + "contract" : { + "format" : "binary", + "type" : "string" + } + } + } } } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": {} + }, + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/{onboardingId}/complete": { - "put": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform complete operation of an onboarding request receiving onboarding id and contract signed by the institution.It checks the contract's signature and upload the contract on an azure storageAt the end, function triggers async activities related to complete onboarding that consist of create the institution, activate the onboarding and sending data to notification queue.", - "parameters": [ - { - "name": "onboardingId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "required": [ - "contract" - ], - "type": "object", - "properties": { - "contract": { - "format": "binary", - "type": "string" + "/v1/onboarding/{onboardingId}/completeOnboardingUsers" : { + "put" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform complete operation of an user onboarding request receiving onboarding id and contract signed by the institution.It checks the contract's signature and upload the contract on an azure storageAt the end, function triggers async activities related to complete onboarding that consist of create the institution, activate the onboarding and sending data to notification queue.", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "multipart/form-data" : { + "schema" : { + "required" : [ "contract" ], + "type" : "object", + "properties" : { + "contract" : { + "format" : "binary", + "type" : "string" } } } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": {} + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/{onboardingId}/consume": { - "put": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform complete operation of an onboarding request as /complete but without signature verification of the contract", - "parameters": [ - { - "name": "onboardingId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "required": [ - "contract" - ], - "type": "object", - "properties": { - "contract": { - "format": "binary", - "type": "string" + "/v1/onboarding/{onboardingId}/consume" : { + "put" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform complete operation of an onboarding request as /complete but without signature verification of the contract", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "multipart/form-data" : { + "schema" : { + "required" : [ "contract" ], + "type" : "object", + "properties" : { + "contract" : { + "format" : "binary", + "type" : "string" } } } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": {} + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/{onboardingId}/pending": { - "get": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Returns an onboarding record by its ID only if its status is PENDING. This feature is crucial for ensuring that the onboarding process can be completed only when the onboarding status is appropriately set to PENDING.", - "parameters": [ - { - "name": "onboardingId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingGet" + "/v1/onboarding/{onboardingId}/pending" : { + "get" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Returns an onboarding record by its ID only if its status is PENDING. This feature is crucial for ensuring that the onboarding process can be completed only when the onboarding status is appropriately set to PENDING.", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingGet" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/{onboardingId}/reject": { - "put": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Perform reject operation of an onboarding request receiving onboarding id.Function change status to REJECT for an onboarding request that is not COMPLETED. ", - "parameters": [ - { - "name": "onboardingId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ReasonRequest" + "/v1/onboarding/{onboardingId}/reject" : { + "put" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Perform reject operation of an onboarding request receiving onboarding id.Function change status to REJECT for an onboarding request that is not COMPLETED. ", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ReasonRequest" } } } }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": {} + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/onboarding/{onboardingId}/withUserInfo": { - "get": { - "tags": [ - "Onboarding Controller" - ], - "summary": "Retrieve an onboarding record given its ID adding to user sensitive information", - "parameters": [ - { - "name": "onboardingId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingGet" + "/v1/onboarding/{onboardingId}/withUserInfo" : { + "get" : { + "tags" : [ "Onboarding Controller" ], + "summary" : "Retrieve an onboarding record given its ID adding to user sensitive information", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/OnboardingGet" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/tokens": { - "get": { - "tags": [ - "Token Controller" - ], - "summary": "Retrieves the token for a given onboarding", - "parameters": [ - { - "name": "onboardingId", - "in": "query", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TokenResponse" + "/v1/tokens" : { + "get" : { + "tags" : [ "Token Controller" ], + "summary" : "Retrieves the token for a given onboarding", + "parameters" : [ { + "name" : "onboardingId", + "in" : "query", + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/TokenResponse" } } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } }, - "/v1/tokens/{onboardingId}/contract": { - "get": { - "tags": [ - "Token Controller" - ], - "summary": "Retrieve contract not signed for a given onboarding", - "parameters": [ - { - "name": "onboardingId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/octet-stream": { - "schema": { - "format": "binary", - "type": "string" + "/v1/tokens/{onboardingId}/contract" : { + "get" : { + "tags" : [ "Token Controller" ], + "summary" : "Retrieve contract not signed for a given onboarding", + "parameters" : [ { + "name" : "onboardingId", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/octet-stream" : { + "schema" : { + "format" : "binary", + "type" : "string" } } } }, - "401": { - "description": "Not Authorized" + "403" : { + "description" : "Not Allowed" }, - "403": { - "description": "Not Allowed" + "401" : { + "description" : "Not Authorized" } }, - "security": [ - { - "SecurityScheme": [] - } - ] + "security" : [ { + "SecurityScheme" : [ ] + } ] } } }, - "components": { - "schemas": { - "AdditionalInformationsDto": { - "type": "object", - "properties": { - "belongRegulatedMarket": { - "type": "boolean" + "components" : { + "schemas" : { + "AdditionalInformationsDto" : { + "type" : "object", + "properties" : { + "belongRegulatedMarket" : { + "type" : "boolean" }, - "regulatedMarketNote": { - "type": "string" + "regulatedMarketNote" : { + "type" : "string" }, - "ipa": { - "type": "boolean" + "ipa" : { + "type" : "boolean" }, - "ipaCode": { - "type": "string" + "ipaCode" : { + "type" : "string" }, - "establishedByRegulatoryProvision": { - "type": "boolean" + "establishedByRegulatoryProvision" : { + "type" : "boolean" }, - "establishedByRegulatoryProvisionNote": { - "type": "string" + "establishedByRegulatoryProvisionNote" : { + "type" : "string" }, - "agentOfPublicService": { - "type": "boolean" + "agentOfPublicService" : { + "type" : "boolean" }, - "agentOfPublicServiceNote": { - "type": "string" + "agentOfPublicServiceNote" : { + "type" : "string" }, - "otherNote": { - "type": "string" + "otherNote" : { + "type" : "string" } } }, - "BillingPaRequest": { - "type": "object", - "properties": { - "vatNumber": { - "type": "string" + "BillingPaRequest" : { + "type" : "object", + "properties" : { + "vatNumber" : { + "type" : "string" }, - "recipientCode": { - "type": "string" + "recipientCode" : { + "type" : "string" }, - "publicServices": { - "type": "boolean" + "publicServices" : { + "type" : "boolean" }, - "taxCodeInvoicing": { - "type": "string" + "taxCodeInvoicing" : { + "type" : "string" } } }, - "BillingRequest": { - "type": "object", - "properties": { - "vatNumber": { - "type": "string" + "BillingRequest" : { + "type" : "object", + "properties" : { + "vatNumber" : { + "type" : "string" }, - "recipientCode": { - "type": "string" + "recipientCode" : { + "type" : "string" }, - "publicServices": { - "type": "boolean" + "publicServices" : { + "type" : "boolean" } } }, - "BillingResponse": { - "type": "object", - "properties": { - "vatNumber": { - "type": "string" + "BillingResponse" : { + "type" : "object", + "properties" : { + "vatNumber" : { + "type" : "string" }, - "recipientCode": { - "type": "string" + "recipientCode" : { + "type" : "string" }, - "publicServices": { - "type": "boolean" + "publicServices" : { + "type" : "boolean" } } }, - "DataProtectionOfficerRequest": { - "type": "object", - "properties": { - "address": { - "type": "string" + "DataProtectionOfficerRequest" : { + "type" : "object", + "properties" : { + "address" : { + "type" : "string" }, - "email": { - "type": "string" + "email" : { + "type" : "string" }, - "pec": { - "type": "string" + "pec" : { + "type" : "string" } } }, - "GeographicTaxonomyDto": { - "type": "object", - "properties": { - "code": { - "type": "string" + "GeographicTaxonomyDto" : { + "type" : "object", + "properties" : { + "code" : { + "type" : "string" }, - "desc": { - "type": "string" + "desc" : { + "type" : "string" } } }, - "InstitutionBaseRequest": { - "required": [ - "institutionType", - "digitalAddress" - ], - "type": "object", - "properties": { - "institutionType": { - "$ref": "#/components/schemas/InstitutionType" + "InstitutionBaseRequest" : { + "required" : [ "institutionType", "digitalAddress" ], + "type" : "object", + "properties" : { + "institutionType" : { + "$ref" : "#/components/schemas/InstitutionType" }, - "taxCode": { - "type": "string" + "taxCode" : { + "type" : "string" }, - "subunitCode": { - "type": "string" + "subunitCode" : { + "type" : "string" }, - "subunitType": { - "$ref": "#/components/schemas/InstitutionPaSubunitType" + "subunitType" : { + "$ref" : "#/components/schemas/InstitutionPaSubunitType" }, - "origin": { - "$ref": "#/components/schemas/Origin" + "origin" : { + "$ref" : "#/components/schemas/Origin" }, - "originId": { - "type": "string" + "originId" : { + "type" : "string" }, - "city": { - "type": "string" + "city" : { + "type" : "string" }, - "country": { - "type": "string" + "country" : { + "type" : "string" }, - "county": { - "type": "string" + "county" : { + "type" : "string" }, - "description": { - "type": "string" + "description" : { + "type" : "string" }, - "digitalAddress": { - "minLength": 1, - "type": "string" + "digitalAddress" : { + "minLength" : 1, + "type" : "string" }, - "address": { - "type": "string" + "address" : { + "type" : "string" }, - "zipCode": { - "type": "string" + "zipCode" : { + "type" : "string" }, - "geographicTaxonomies": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GeographicTaxonomyDto" + "geographicTaxonomies" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/GeographicTaxonomyDto" } }, - "rea": { - "type": "string" + "rea" : { + "type" : "string" }, - "shareCapital": { - "type": "string" + "shareCapital" : { + "type" : "string" }, - "businessRegisterPlace": { - "type": "string" + "businessRegisterPlace" : { + "type" : "string" }, - "supportEmail": { - "type": "string" + "supportEmail" : { + "type" : "string" }, - "supportPhone": { - "type": "string" + "supportPhone" : { + "type" : "string" }, - "imported": { - "type": "boolean" + "imported" : { + "type" : "boolean" } } }, - "InstitutionImportRequest": { - "required": [ - "taxCode" - ], - "type": "object", - "properties": { - "institutionType": { - "$ref": "#/components/schemas/InstitutionType" + "InstitutionImportRequest" : { + "required" : [ "taxCode" ], + "type" : "object", + "properties" : { + "institutionType" : { + "$ref" : "#/components/schemas/InstitutionType" }, - "taxCode": { - "minLength": 1, - "type": "string" + "taxCode" : { + "minLength" : 1, + "type" : "string" }, - "subunitCode": { - "type": "string" + "subunitCode" : { + "type" : "string" }, - "subunitType": { - "$ref": "#/components/schemas/InstitutionPaSubunitType" + "subunitType" : { + "$ref" : "#/components/schemas/InstitutionPaSubunitType" }, - "origin": { - "$ref": "#/components/schemas/Origin" + "origin" : { + "$ref" : "#/components/schemas/Origin" }, - "city": { - "type": "string" + "city" : { + "type" : "string" }, - "country": { - "type": "string" + "country" : { + "type" : "string" }, - "county": { - "type": "string" + "county" : { + "type" : "string" }, - "description": { - "type": "string" + "description" : { + "type" : "string" }, - "digitalAddress": { - "type": "string" + "digitalAddress" : { + "type" : "string" }, - "address": { - "type": "string" + "address" : { + "type" : "string" }, - "zipCode": { - "type": "string" + "zipCode" : { + "type" : "string" }, - "geographicTaxonomies": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GeographicTaxonomyDto" + "geographicTaxonomies" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/GeographicTaxonomyDto" } }, - "rea": { - "type": "string" + "rea" : { + "type" : "string" }, - "shareCapital": { - "type": "string" + "shareCapital" : { + "type" : "string" }, - "businessRegisterPlace": { - "type": "string" + "businessRegisterPlace" : { + "type" : "string" }, - "supportEmail": { - "type": "string" + "supportEmail" : { + "type" : "string" }, - "supportPhone": { - "type": "string" + "supportPhone" : { + "type" : "string" }, - "imported": { - "type": "boolean" + "imported" : { + "type" : "boolean" } } }, - "InstitutionPaSubunitType": { - "enum": [ - "AOO", - "UO" - ], - "type": "string" + "InstitutionPaSubunitType" : { + "enum" : [ "AOO", "UO" ], + "type" : "string" }, - "InstitutionPspRequest": { - "required": [ - "institutionType", - "digitalAddress", - "paymentServiceProvider" - ], - "type": "object", - "properties": { - "institutionType": { - "$ref": "#/components/schemas/InstitutionType" + "InstitutionPspRequest" : { + "required" : [ "institutionType", "digitalAddress", "paymentServiceProvider" ], + "type" : "object", + "properties" : { + "institutionType" : { + "$ref" : "#/components/schemas/InstitutionType" }, - "taxCode": { - "type": "string" + "taxCode" : { + "type" : "string" }, - "subunitCode": { - "type": "string" + "subunitCode" : { + "type" : "string" }, - "subunitType": { - "$ref": "#/components/schemas/InstitutionPaSubunitType" + "subunitType" : { + "$ref" : "#/components/schemas/InstitutionPaSubunitType" }, - "origin": { - "$ref": "#/components/schemas/Origin" + "origin" : { + "$ref" : "#/components/schemas/Origin" }, - "originId": { - "type": "string" + "originId" : { + "type" : "string" }, - "city": { - "type": "string" + "city" : { + "type" : "string" }, - "country": { - "type": "string" + "country" : { + "type" : "string" }, - "county": { - "type": "string" + "county" : { + "type" : "string" }, - "description": { - "type": "string" + "description" : { + "type" : "string" }, - "digitalAddress": { - "minLength": 1, - "type": "string" + "digitalAddress" : { + "minLength" : 1, + "type" : "string" }, - "address": { - "type": "string" + "address" : { + "type" : "string" }, - "zipCode": { - "type": "string" + "zipCode" : { + "type" : "string" }, - "geographicTaxonomies": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GeographicTaxonomyDto" + "geographicTaxonomies" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/GeographicTaxonomyDto" } }, - "rea": { - "type": "string" + "rea" : { + "type" : "string" }, - "shareCapital": { - "type": "string" + "shareCapital" : { + "type" : "string" }, - "businessRegisterPlace": { - "type": "string" + "businessRegisterPlace" : { + "type" : "string" }, - "supportEmail": { - "type": "string" + "supportEmail" : { + "type" : "string" }, - "supportPhone": { - "type": "string" + "supportPhone" : { + "type" : "string" }, - "imported": { - "type": "boolean" + "imported" : { + "type" : "boolean" }, - "paymentServiceProvider": { - "$ref": "#/components/schemas/PaymentServiceProviderRequest" + "paymentServiceProvider" : { + "$ref" : "#/components/schemas/PaymentServiceProviderRequest" }, - "dataProtectionOfficer": { - "$ref": "#/components/schemas/DataProtectionOfficerRequest" + "dataProtectionOfficer" : { + "$ref" : "#/components/schemas/DataProtectionOfficerRequest" } } }, - "InstitutionResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" + "InstitutionResponse" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" }, - "institutionType": { - "$ref": "#/components/schemas/InstitutionType" + "institutionType" : { + "$ref" : "#/components/schemas/InstitutionType" }, - "taxCode": { - "type": "string" + "taxCode" : { + "type" : "string" }, - "taxCodeInvoicing": { - "type": "string" + "taxCodeInvoicing" : { + "type" : "string" }, - "subunitCode": { - "type": "string" + "subunitCode" : { + "type" : "string" }, - "subunitType": { - "$ref": "#/components/schemas/InstitutionPaSubunitType" + "subunitType" : { + "$ref" : "#/components/schemas/InstitutionPaSubunitType" }, - "origin": { - "$ref": "#/components/schemas/Origin" + "origin" : { + "$ref" : "#/components/schemas/Origin" }, - "city": { - "type": "string" + "city" : { + "type" : "string" }, - "country": { - "type": "string" + "country" : { + "type" : "string" }, - "county": { - "type": "string" + "county" : { + "type" : "string" }, - "description": { - "type": "string" + "description" : { + "type" : "string" }, - "digitalAddress": { - "type": "string" + "digitalAddress" : { + "type" : "string" }, - "address": { - "type": "string" + "address" : { + "type" : "string" }, - "zipCode": { - "type": "string" + "zipCode" : { + "type" : "string" }, - "geographicTaxonomies": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GeographicTaxonomyDto" + "geographicTaxonomies" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/GeographicTaxonomyDto" } }, - "rea": { - "type": "string" + "rea" : { + "type" : "string" }, - "shareCapital": { - "type": "string" + "shareCapital" : { + "type" : "string" }, - "businessRegisterPlace": { - "type": "string" + "businessRegisterPlace" : { + "type" : "string" }, - "supportEmail": { - "type": "string" + "supportEmail" : { + "type" : "string" }, - "supportPhone": { - "type": "string" + "supportPhone" : { + "type" : "string" }, - "paymentServiceProvider": { - "$ref": "#/components/schemas/PaymentServiceProviderRequest" + "paymentServiceProvider" : { + "$ref" : "#/components/schemas/PaymentServiceProviderRequest" }, - "dataProtectionOfficer": { - "$ref": "#/components/schemas/DataProtectionOfficerRequest" + "dataProtectionOfficer" : { + "$ref" : "#/components/schemas/DataProtectionOfficerRequest" } } }, - "InstitutionType": { - "enum": [ - "PA", - "PG", - "GSP", - "SA", - "PT", - "SCP", - "PSP", - "AS", - "REC", - "CON" - ], - "type": "string" + "InstitutionType" : { + "enum" : [ "PA", "PG", "GSP", "SA", "PT", "SCP", "PSP", "AS", "REC", "CON" ], + "type" : "string" }, - "LocalDateTime": { - "format": "date-time", - "type": "string", - "example": "2022-03-10T12:15:50" + "LocalDateTime" : { + "format" : "date-time", + "type" : "string", + "example" : "2022-03-10T12:15:50" }, - "OnboardingDefaultRequest": { - "required": [ - "productId", - "users", - "institution" - ], - "type": "object", - "properties": { - "productId": { - "minLength": 1, - "type": "string" - }, - "users": { - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRequest" + "OnboardingDefaultRequest" : { + "required" : [ "productId", "users", "institution" ], + "type" : "object", + "properties" : { + "productId" : { + "minLength" : 1, + "type" : "string" + }, + "users" : { + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/UserRequest" } }, - "pricingPlan": { - "type": "string" + "pricingPlan" : { + "type" : "string" }, - "signContract": { - "type": "boolean" + "signContract" : { + "type" : "boolean" }, - "institution": { - "$ref": "#/components/schemas/InstitutionBaseRequest" + "institution" : { + "$ref" : "#/components/schemas/InstitutionBaseRequest" }, - "billing": { - "$ref": "#/components/schemas/BillingRequest" + "billing" : { + "$ref" : "#/components/schemas/BillingRequest" }, - "additionalInformations": { - "$ref": "#/components/schemas/AdditionalInformationsDto" + "additionalInformations" : { + "$ref" : "#/components/schemas/AdditionalInformationsDto" } } }, - "OnboardingGet": { - "type": "object", - "properties": { - "id": { - "type": "string" + "OnboardingGet" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" }, - "productId": { - "type": "string" + "productId" : { + "type" : "string" }, - "workflowType": { - "type": "string" + "workflowType" : { + "type" : "string" }, - "institution": { - "$ref": "#/components/schemas/InstitutionResponse" + "institution" : { + "$ref" : "#/components/schemas/InstitutionResponse" }, - "users": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserResponse" + "users" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/UserResponse" } }, - "pricingPlan": { - "type": "string" + "pricingPlan" : { + "type" : "string" }, - "billing": { - "$ref": "#/components/schemas/BillingResponse" + "billing" : { + "$ref" : "#/components/schemas/BillingResponse" }, - "signContract": { - "type": "boolean" + "signContract" : { + "type" : "boolean" }, - "additionalInformations": { - "$ref": "#/components/schemas/AdditionalInformationsDto" + "additionalInformations" : { + "$ref" : "#/components/schemas/AdditionalInformationsDto" }, - "createdAt": { - "$ref": "#/components/schemas/LocalDateTime" + "createdAt" : { + "$ref" : "#/components/schemas/LocalDateTime" }, - "updatedAt": { - "$ref": "#/components/schemas/LocalDateTime" + "updatedAt" : { + "$ref" : "#/components/schemas/LocalDateTime" }, - "expiringDate": { - "$ref": "#/components/schemas/LocalDateTime" + "expiringDate" : { + "$ref" : "#/components/schemas/LocalDateTime" }, - "status": { - "type": "string" + "status" : { + "type" : "string" }, - "userRequestUid": { - "type": "string" + "userRequestUid" : { + "type" : "string" }, - "reasonForReject": { - "type": "string" + "reasonForReject" : { + "type" : "string" } } }, - "OnboardingGetResponse": { - "type": "object", - "properties": { - "count": { - "format": "int64", - "type": "integer" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/OnboardingGet" + "OnboardingGetResponse" : { + "type" : "object", + "properties" : { + "count" : { + "format" : "int64", + "type" : "integer" + }, + "items" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/OnboardingGet" } } } }, - "OnboardingImportContract": { - "required": [ - "fileName", - "filePath", - "createdAt" - ], - "type": "object", - "properties": { - "fileName": { - "minLength": 1, - "type": "string" - }, - "filePath": { - "minLength": 1, - "type": "string" - }, - "contractType": { - "type": "string" - }, - "createdAt": { - "$ref": "#/components/schemas/LocalDateTime" + "OnboardingImportContract" : { + "required" : [ "fileName", "filePath", "createdAt" ], + "type" : "object", + "properties" : { + "fileName" : { + "minLength" : 1, + "type" : "string" + }, + "filePath" : { + "minLength" : 1, + "type" : "string" + }, + "contractType" : { + "type" : "string" + }, + "createdAt" : { + "$ref" : "#/components/schemas/LocalDateTime" } } }, - "OnboardingImportRequest": { - "required": [ - "institution", - "productId", - "users", - "contractImported" - ], - "type": "object", - "properties": { - "institution": { - "$ref": "#/components/schemas/InstitutionImportRequest" - }, - "productId": { - "minLength": 1, - "type": "string" - }, - "users": { - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRequest" + "OnboardingImportRequest" : { + "required" : [ "institution", "productId", "users", "contractImported" ], + "type" : "object", + "properties" : { + "institution" : { + "$ref" : "#/components/schemas/InstitutionImportRequest" + }, + "productId" : { + "minLength" : 1, + "type" : "string" + }, + "users" : { + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/UserRequest" } }, - "contractImported": { - "$ref": "#/components/schemas/OnboardingImportContract" + "contractImported" : { + "$ref" : "#/components/schemas/OnboardingImportContract" } } }, - "OnboardingPaRequest": { - "required": [ - "productId", - "users", - "institution" - ], - "type": "object", - "properties": { - "productId": { - "minLength": 1, - "type": "string" - }, - "users": { - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRequest" + "OnboardingPaRequest" : { + "required" : [ "productId", "users", "institution" ], + "type" : "object", + "properties" : { + "productId" : { + "minLength" : 1, + "type" : "string" + }, + "users" : { + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/UserRequest" } }, - "pricingPlan": { - "type": "string" + "pricingPlan" : { + "type" : "string" }, - "signContract": { - "type": "boolean" + "signContract" : { + "type" : "boolean" }, - "institution": { - "$ref": "#/components/schemas/InstitutionBaseRequest" + "institution" : { + "$ref" : "#/components/schemas/InstitutionBaseRequest" }, - "billing": { - "$ref": "#/components/schemas/BillingPaRequest" + "billing" : { + "$ref" : "#/components/schemas/BillingPaRequest" } } }, - "OnboardingPgRequest": { - "required": [ - "productId", - "users", - "taxCode", - "origin", - "digitalAddress" - ], - "type": "object", - "properties": { - "productId": { - "minLength": 1, - "type": "string" - }, - "institutionType": { - "$ref": "#/components/schemas/InstitutionType" - }, - "users": { - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRequest" + "OnboardingPgRequest" : { + "required" : [ "productId", "users", "taxCode", "origin", "digitalAddress" ], + "type" : "object", + "properties" : { + "productId" : { + "minLength" : 1, + "type" : "string" + }, + "institutionType" : { + "$ref" : "#/components/schemas/InstitutionType" + }, + "users" : { + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/UserRequest" } }, - "taxCode": { - "type": "string" + "taxCode" : { + "type" : "string" }, - "businessName": { - "type": "string" + "businessName" : { + "type" : "string" }, - "origin": { - "$ref": "#/components/schemas/Origin" + "origin" : { + "$ref" : "#/components/schemas/Origin" }, - "digitalAddress": { - "type": "string" + "digitalAddress" : { + "type" : "string" } } }, - "OnboardingPspRequest": { - "required": [ - "productId", - "users", - "institution" - ], - "type": "object", - "properties": { - "productId": { - "minLength": 1, - "type": "string" - }, - "users": { - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRequest" + "OnboardingPspRequest" : { + "required" : [ "productId", "users", "institution" ], + "type" : "object", + "properties" : { + "productId" : { + "minLength" : 1, + "type" : "string" + }, + "users" : { + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/UserRequest" } }, - "pricingPlan": { - "type": "string" + "pricingPlan" : { + "type" : "string" }, - "signContract": { - "type": "boolean" + "signContract" : { + "type" : "boolean" }, - "institution": { - "$ref": "#/components/schemas/InstitutionPspRequest" + "institution" : { + "$ref" : "#/components/schemas/InstitutionPspRequest" }, - "billing": { - "$ref": "#/components/schemas/BillingRequest" + "billing" : { + "$ref" : "#/components/schemas/BillingRequest" } } }, - "OnboardingResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" + "OnboardingResponse" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" }, - "productId": { - "type": "string" + "productId" : { + "type" : "string" }, - "workflowType": { - "type": "string" + "workflowType" : { + "type" : "string" }, - "institution": { - "$ref": "#/components/schemas/InstitutionResponse" + "institution" : { + "$ref" : "#/components/schemas/InstitutionResponse" }, - "pricingPlan": { - "type": "string" + "pricingPlan" : { + "type" : "string" }, - "users": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UserOnboardingResponse" + "users" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/UserOnboardingResponse" } }, - "billing": { - "$ref": "#/components/schemas/BillingResponse" + "billing" : { + "$ref" : "#/components/schemas/BillingResponse" + }, + "status" : { + "type" : "string" + }, + "additionalInformations" : { + "$ref" : "#/components/schemas/AdditionalInformationsDto" + }, + "userRequestUid" : { + "type" : "string" + } + } + }, + "OnboardingStatus" : { + "enum" : [ "REQUEST", "TOBEVALIDATED", "PENDING", "COMPLETED", "FAILED", "REJECTED", "DELETED" ], + "type" : "string" + }, + "OnboardingUserRequest" : { + "required" : [ "productId", "origin", "originId", "users" ], + "type" : "object", + "properties" : { + "productId" : { + "minLength" : 1, + "type" : "string" + }, + "institutionType" : { + "$ref" : "#/components/schemas/InstitutionType" + }, + "subunitCode" : { + "type" : "string" }, - "status": { - "type": "string" + "origin" : { + "minLength" : 1, + "type" : "string" }, - "additionalInformations": { - "$ref": "#/components/schemas/AdditionalInformationsDto" + "originId" : { + "minLength" : 1, + "type" : "string" }, - "userRequestUid": { - "type": "string" + "taxCode" : { + "type" : "string" + }, + "users" : { + "minItems" : 1, + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/UserRequest" + } } } }, - "Origin": { - "enum": [ - "MOCK", - "IPA", - "SELC", - "ANAC", - "UNKNOWN", - "ADE", - "INFOCAMERE", - "IVASS" - ], - "type": "string" + "Origin" : { + "enum" : [ "MOCK", "IPA", "SELC", "ANAC", "UNKNOWN", "ADE", "INFOCAMERE", "IVASS" ], + "type" : "string" }, - "PartyRole": { - "enum": [ - "MANAGER", - "DELEGATE", - "SUB_DELEGATE", - "OPERATOR", - "ADMIN_EA" - ], - "type": "string" + "PartyRole" : { + "enum" : [ "MANAGER", "DELEGATE", "SUB_DELEGATE", "OPERATOR", "ADMIN_EA" ], + "type" : "string" }, - "PaymentServiceProviderRequest": { - "type": "object", - "properties": { - "abiCode": { - "type": "string" + "PaymentServiceProviderRequest" : { + "type" : "object", + "properties" : { + "abiCode" : { + "type" : "string" }, - "businessRegisterNumber": { - "type": "string" + "businessRegisterNumber" : { + "type" : "string" }, - "legalRegisterNumber": { - "type": "string" + "legalRegisterNumber" : { + "type" : "string" }, - "legalRegisterName": { - "type": "string" + "legalRegisterName" : { + "type" : "string" }, - "vatNumberGroup": { - "type": "boolean" + "vatNumberGroup" : { + "type" : "boolean" } } }, - "ReasonRequest": { - "type": "object", - "properties": { - "reasonForReject": { - "type": "string" + "ReasonRequest" : { + "type" : "object", + "properties" : { + "reasonForReject" : { + "type" : "string" } } }, - "TokenResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" + "TokenResponse" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" }, - "type": { - "$ref": "#/components/schemas/TokenType" + "type" : { + "$ref" : "#/components/schemas/TokenType" }, - "productId": { - "type": "string" + "productId" : { + "type" : "string" }, - "checksum": { - "type": "string" + "checksum" : { + "type" : "string" }, - "contractVersion": { - "type": "string" + "contractVersion" : { + "type" : "string" }, - "contractTemplate": { - "type": "string" + "contractTemplate" : { + "type" : "string" }, - "contractSigned": { - "type": "string" + "contractSigned" : { + "type" : "string" }, - "createdAt": { - "$ref": "#/components/schemas/LocalDateTime" + "createdAt" : { + "$ref" : "#/components/schemas/LocalDateTime" }, - "updatedAt": { - "$ref": "#/components/schemas/LocalDateTime" + "updatedAt" : { + "$ref" : "#/components/schemas/LocalDateTime" }, - "closedAt": { - "$ref": "#/components/schemas/LocalDateTime" + "closedAt" : { + "$ref" : "#/components/schemas/LocalDateTime" }, - "deletedAt": { - "$ref": "#/components/schemas/LocalDateTime" + "deletedAt" : { + "$ref" : "#/components/schemas/LocalDateTime" } } }, - "TokenType": { - "enum": [ - "INSTITUTION", - "LEGALS" - ], - "type": "string" + "TokenType" : { + "enum" : [ "INSTITUTION", "LEGALS" ], + "type" : "string" }, - "UserOnboardingResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" + "UserOnboardingResponse" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" }, - "role": { - "$ref": "#/components/schemas/PartyRole" + "role" : { + "$ref" : "#/components/schemas/PartyRole" }, - "productRole": { - "type": "string" + "productRole" : { + "type" : "string" }, - "userMailUuid": { - "type": "string" + "userMailUuid" : { + "type" : "string" } } }, - "UserRequest": { - "type": "object", - "properties": { - "taxCode": { - "type": "string" + "UserRequest" : { + "type" : "object", + "properties" : { + "taxCode" : { + "type" : "string" }, - "name": { - "type": "string" + "name" : { + "type" : "string" }, - "surname": { - "type": "string" + "surname" : { + "type" : "string" }, - "email": { - "type": "string" + "email" : { + "type" : "string" }, - "role": { - "$ref": "#/components/schemas/PartyRole" + "role" : { + "$ref" : "#/components/schemas/PartyRole" } } }, - "UserResponse": { - "type": "object", - "properties": { - "id": { - "type": "string" + "UserResponse" : { + "type" : "object", + "properties" : { + "id" : { + "type" : "string" }, - "taxCode": { - "type": "string" + "taxCode" : { + "type" : "string" }, - "name": { - "type": "string" + "name" : { + "type" : "string" }, - "surname": { - "type": "string" + "surname" : { + "type" : "string" }, - "email": { - "type": "string" + "email" : { + "type" : "string" }, - "role": { - "$ref": "#/components/schemas/PartyRole" + "role" : { + "$ref" : "#/components/schemas/PartyRole" }, - "productRole": { - "type": "string" - } - } - }, - "OnboardingUserRequest": { - "required": [ - "productId", - "origin", - "originId", - "users" - ], - "type": "object", - "properties": { - "productId": { - "minLength": 1, - "type": "string" - }, - "institutionType": { - "$ref": "#/components/schemas/InstitutionType" - }, - "subunitCode": { - "type": "string" - }, - "origin": { - "minLength": 1, - "type": "string" - }, - "originId": { - "minLength": 1, - "type": "string" - }, - "taxCode": { - "type": "string" - }, - "users": { - "minItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/UserRequest" - } + "productRole" : { + "type" : "string" } } } }, - "securitySchemes": { - "SecurityScheme": { - "type": "http", - "description": "Authentication", - "scheme": "bearer", - "bearerFormat": "JWT" + "securitySchemes" : { + "SecurityScheme" : { + "type" : "http", + "description" : "Authentication", + "scheme" : "bearer", + "bearerFormat" : "JWT" } } } diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImpl.java b/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImpl.java index 3f480f1a..8b9d4462 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImpl.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImpl.java @@ -62,6 +62,12 @@ public void onboardingTokenComplete(String onboardingId, MultipartFile contract) msOnboardingApiClient._v1OnboardingOnboardingIdCompletePut(onboardingId, contract); } + @Override + @Retry(name = "retryTimeout") + public void onboardingUsersComplete(String onboardingId, MultipartFile contract) { + msOnboardingApiClient._v1OnboardingOnboardingIdCompleteOnboardingUsersPut(onboardingId, contract); + } + @Override @Retry(name = "retryTimeout") public void onboardingPending(String onboardingId) { diff --git a/connector/rest/src/test/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImplTest.java b/connector/rest/src/test/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImplTest.java index 7f24a24a..cfb4476e 100644 --- a/connector/rest/src/test/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImplTest.java +++ b/connector/rest/src/test/java/it/pagopa/selfcare/onboarding/connector/OnboardingMsConnectorImplTest.java @@ -158,6 +158,21 @@ void onboardingComplete() throws IOException { verifyNoMoreInteractions(msOnboardingApiClient); } + @Test + void onboardingUsersComplete() throws IOException { + // given + final String tokenId = "tokenId"; + final MockMultipartFile mockMultipartFile = + new MockMultipartFile("example", new ByteArrayInputStream("example".getBytes(StandardCharsets.UTF_8))); + // when + final Executable executable = () -> msOnboardingApiClient._v1OnboardingOnboardingIdCompleteOnboardingUsersPut(tokenId, mockMultipartFile); + // then + assertDoesNotThrow(executable); + verify(msOnboardingApiClient, times(1)) + ._v1OnboardingOnboardingIdCompleteOnboardingUsersPut(tokenId, mockMultipartFile); + verifyNoMoreInteractions(msOnboardingApiClient); + } + @Test void onboardingPending() { // given diff --git a/core/src/main/java/it/pagopa/selfcare/onboarding/core/TokenService.java b/core/src/main/java/it/pagopa/selfcare/onboarding/core/TokenService.java index 030a83ab..44074cca 100644 --- a/core/src/main/java/it/pagopa/selfcare/onboarding/core/TokenService.java +++ b/core/src/main/java/it/pagopa/selfcare/onboarding/core/TokenService.java @@ -15,5 +15,7 @@ public interface TokenService { void completeTokenV2(String onboardingId, MultipartFile contract); + void completeOnboardingUsers(String onboardingId, MultipartFile contract); + Resource getContract(String onboardingId); } diff --git a/core/src/main/java/it/pagopa/selfcare/onboarding/core/TokenServiceImpl.java b/core/src/main/java/it/pagopa/selfcare/onboarding/core/TokenServiceImpl.java index abcf74de..1b35b691 100644 --- a/core/src/main/java/it/pagopa/selfcare/onboarding/core/TokenServiceImpl.java +++ b/core/src/main/java/it/pagopa/selfcare/onboarding/core/TokenServiceImpl.java @@ -61,7 +61,6 @@ public OnboardingData getOnboardingWithUserInfo(String onboardingId) { return onboardingData; } - @Override public void completeTokenV2(String onboardingId, MultipartFile contract) { log.trace("completeTokenAsync start"); @@ -72,6 +71,16 @@ public void completeTokenV2(String onboardingId, MultipartFile contract) { log.trace("completeTokenAsync end"); } + @Override + public void completeOnboardingUsers(String onboardingId, MultipartFile contract) { + log.trace("completeOnboardingUsersAsync start"); + log.debug("completeOnboardingUsersAsync id = {}", onboardingId); + Assert.notNull(onboardingId, "onboardingId is required"); + onboardingMsConnector.onboardingUsersComplete(onboardingId, contract); + log.debug("completeOnboardingUsersAsync result = success"); + log.trace("completeOnboardingUsersAsync end"); + } + @Override public Resource getContract(String onboardingId) { log.trace("getContract start"); diff --git a/core/src/test/java/it/pagopa/selfcare/onboarding/core/TokenServiceImplTest.java b/core/src/test/java/it/pagopa/selfcare/onboarding/core/TokenServiceImplTest.java index cf1579c2..a5ca37a4 100644 --- a/core/src/test/java/it/pagopa/selfcare/onboarding/core/TokenServiceImplTest.java +++ b/core/src/test/java/it/pagopa/selfcare/onboarding/core/TokenServiceImplTest.java @@ -56,6 +56,28 @@ void shouldCompleteTokenV2() throws IOException { .onboardingTokenComplete(tokenId, mockMultipartFile); } + @Test + void shouldNotCompleteOnboardingUsersWhenIdIsNull() { + Executable executable = () -> tokenService.completeOnboardingUsers(null, null); + //then + Exception e = Assertions.assertThrows(IllegalArgumentException.class, executable); + Assertions.assertEquals("onboardingId is required", e.getMessage()); + Mockito.verifyNoInteractions(partyConnector); + } + + @Test + void shouldCompleteOnboardingUsers() throws IOException { + //given + String tokenId = "example"; + MockMultipartFile mockMultipartFile = new MockMultipartFile("example", new ByteArrayInputStream("example".getBytes(StandardCharsets.UTF_8))); + doNothing().when(onboardingMsConnector).onboardingUsersComplete(anyString(), any()); + // when + tokenService.completeOnboardingUsers(tokenId, mockMultipartFile); + //then + Mockito.verify(onboardingMsConnector, Mockito.times(1)) + .onboardingUsersComplete(tokenId, mockMultipartFile); + } + @Test void verifyOnboarding() { //given diff --git a/web/src/main/java/it/pagopa/selfcare/onboarding/web/controller/TokenV2Controller.java b/web/src/main/java/it/pagopa/selfcare/onboarding/web/controller/TokenV2Controller.java index 04cbec97..98e2cc45 100644 --- a/web/src/main/java/it/pagopa/selfcare/onboarding/web/controller/TokenV2Controller.java +++ b/web/src/main/java/it/pagopa/selfcare/onboarding/web/controller/TokenV2Controller.java @@ -66,6 +66,31 @@ public ResponseEntity complete(@ApiParam("${swagger.tokens.onboardingId}") return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); } + /** + * The function perform complete operation of an onboarding request receiving onboarding id and contract signed by hte institution. + * It checks the contract's signature and upload the contract on an azure storage + * At the end, function triggers async activities related to complete users onboarding + * that consist of create userInstitution and userInfo records, activate the onboarding for users and sending data to notification queue + * + * @param onboardingId String + * @param contract MultipartFile + * @return no content + * * Code: 204, Message: successful operation, DataType: TokenId + * * Code: 400, Message: Invalid ID supplied, DataType: Problem + * * Code: 404, Message: Not found, DataType: Problem + */ + @ResponseStatus(HttpStatus.NO_CONTENT) + @ApiOperation(value = "${swagger.tokens.completeOnboardingUsers}", notes = "${swagger.tokens.completeOnboardingUsers}") + @PostMapping(value = "/{onboardingId}/completeOnboardingUsers") + public ResponseEntity completeOnboardingUsers(@ApiParam("${swagger.tokens.onboardingId}") + @PathVariable(value = "onboardingId") String onboardingId, + @RequestPart MultipartFile contract) { + log.trace("complete Onboarding Users start"); + log.debug(LogUtils.CONFIDENTIAL_MARKER, "complete Onboarding Users tokenId = {}, contract = {}", onboardingId, contract); + tokenService.completeOnboardingUsers(onboardingId, contract); + return ResponseEntity.status(HttpStatus.NO_CONTENT).build(); + } + /** * The verifyOnboarding function is used to verify the onboarding has already consumed. * It takes in a String onboarding and returns a Token object. diff --git a/web/src/main/resources/swagger/swagger_en.properties b/web/src/main/resources/swagger/swagger_en.properties index 141b8fe3..0a2bbddc 100644 --- a/web/src/main/resources/swagger/swagger_en.properties +++ b/web/src/main/resources/swagger/swagger_en.properties @@ -107,6 +107,7 @@ swagger.model.certifiedField.value=Field value swagger.tokens.verify=Verify if the token is already consumed swagger.tokens.complete=Complete an onboarding request +swagger.tokens.completeOnboardingUsers=Complete an onboarding users request swagger.tokens.tokenId=Contract's unique identifier swagger.tokens.onboardingId=Onboarding's unique identifier diff --git a/web/src/test/java/it/pagopa/selfcare/onboarding/web/controller/TokenV2ControllerTest.java b/web/src/test/java/it/pagopa/selfcare/onboarding/web/controller/TokenV2ControllerTest.java index 713d38da..855b9333 100644 --- a/web/src/test/java/it/pagopa/selfcare/onboarding/web/controller/TokenV2ControllerTest.java +++ b/web/src/test/java/it/pagopa/selfcare/onboarding/web/controller/TokenV2ControllerTest.java @@ -64,6 +64,21 @@ void shouldCompleteToken() throws Exception { .andExpect(MockMvcResultMatchers.status().isNoContent()); } + /** + * Method under test: {@link TokenV2Controller#completeOnboardingUsers(String, MultipartFile)} + */ + @Test + void shouldCompleteOnboardingUsers() throws Exception { + + MockMultipartFile file = new MockMultipartFile("contract", "".getBytes()); + MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders + .multipart("/v2/tokens/{tokenId}/completeOnboardingUsers", + "42") + .file(file); + mvc.perform(requestBuilder) + .andExpect(MockMvcResultMatchers.status().isNoContent()); + } + /** * Method under test: {@link TokenV2Controller#verifyOnboarding(String)} */