From fcbf778f5a1eeb1c526db79c5f75d8d7d24a8d7a Mon Sep 17 00:00:00 2001 From: stefanodel Date: Wed, 13 Nov 2024 15:17:39 +0100 Subject: [PATCH 1/2] fix: update swagger yaml file --- src/main/resources/META-INF/openapi.yaml | 309 +++++++++++++++++++++-- 1 file changed, 293 insertions(+), 16 deletions(-) diff --git a/src/main/resources/META-INF/openapi.yaml b/src/main/resources/META-INF/openapi.yaml index bdc3ad1..aca966e 100644 --- a/src/main/resources/META-INF/openapi.yaml +++ b/src/main/resources/META-INF/openapi.yaml @@ -25,13 +25,13 @@ tags: description: 'TPP operation' paths: '/': - post: + put: tags: - TPP summary: >- - ENG: Returns the TPP information - IT: Ritorna le informazioni della TPP - operationId: upsert - description: Add or update TPP information + ENG: Update TPP consent state - IT: Aggiornamento dello stato dei consensi della TPP + operationId: updateState + description: Update TPP state parameters: - name: Accept-Language in: header @@ -45,12 +45,15 @@ paths: default: it-IT required: true requestBody: - description: 'ENG: TPP details - IT: Dettagli della TPP' + description: 'ENG: TPP identifier and state - IT: Identificativo univoco della TPP e stato' required: true content: application/json: schema: - $ref: '#/components/schemas/TppDTO' + $ref: '#/components/schemas/TppDTOUpdateState' + example: + tppId: 0e3bee29-8753-447c-b0da-1f7965558ec2_1706867960900 + state: false responses: '200': description: Ok @@ -229,13 +232,14 @@ paths: required: false schema: $ref: '#/components/schemas/RetryAfter' + '/update': put: tags: - TPP summary: >- - ENG: Update TPP consent state - IT: Aggiornamento dello stato dei consensi della TPP - operationId: updateState - description: Update TPP state + ENG: Update TPP information - IT: Aggiorna le informazioni della TPP + operationId: update + description: Save TPP information parameters: - name: Accept-Language in: header @@ -249,15 +253,217 @@ paths: default: it-IT required: true requestBody: - description: 'ENG: TPP identifier and state - IT: Identificativo univoco della TPP e stato' + description: 'ENG: TPP details - IT: Dettagli della TPP' required: true content: application/json: schema: - $ref: '#/components/schemas/TppDTOUpdateState' - example: - tppId: 0e3bee29-8753-447c-b0da-1f7965558ec2_1706867960900 - state: false + $ref: '#/components/schemas/TppDTOTppIdRequired' + responses: + '200': + description: Ok + content: + application/json: + schema: + $ref: '#/components/schemas/TppDTOWithDates' + headers: + Access-Control-Allow-Origin: + description: Indicates whether the response can be shared with requesting code from the given origin + required: false + schema: + $ref: '#/components/schemas/AccessControlAllowOrigin' + RateLimit-Limit: + description: The number of allowed requests in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitLimit' + RateLimit-Reset: + description: The number of seconds left in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitReset' + Retry-After: + description: The number of seconds to wait before allowing a follow-up request + required: false + schema: + $ref: '#/components/schemas/RetryAfter' + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/TPPErrorDTO' + example: + code: TPP_BAD_REQUEST + message: Something went wrong handling the request + headers: + Access-Control-Allow-Origin: + description: Indicates whether the response can be shared with requesting code from the given origin + required: false + schema: + $ref: '#/components/schemas/AccessControlAllowOrigin' + RateLimit-Limit: + description: The number of allowed requests in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitLimit' + RateLimit-Reset: + description: The number of seconds left in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitReset' + Retry-After: + description: The number of seconds to wait before allowing a follow-up request + required: false + schema: + $ref: '#/components/schemas/RetryAfter' + '401': + description: Authentication failed + content: + application/json: + schema: + $ref: '#/components/schemas/TPPErrorDTO' + example: + code: TPP_AUTHENTICATION_FAILED + message: Something went wrong with authentication + headers: + Access-Control-Allow-Origin: + description: Indicates whether the response can be shared with requesting code from the given origin + required: false + schema: + $ref: '#/components/schemas/AccessControlAllowOrigin' + RateLimit-Limit: + description: The number of allowed requests in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitLimit' + RateLimit-Reset: + description: The number of seconds left in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitReset' + Retry-After: + description: The number of seconds to wait before allowing a follow-up request + required: false + schema: + $ref: '#/components/schemas/RetryAfter' + '404': + description: The TPP was not found + content: + application/json: + schema: + $ref: '#/components/schemas/TPPErrorDTO' + example: + code: TPP_NOT_ONBOARDED + message: Tpp not onboarded + headers: + Access-Control-Allow-Origin: + description: Indicates whether the response can be shared with requesting code from the given origin + required: false + schema: + $ref: '#/components/schemas/AccessControlAllowOrigin' + RateLimit-Limit: + description: The number of allowed requests in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitLimit' + RateLimit-Reset: + description: The number of seconds left in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitReset' + Retry-After: + description: The number of seconds to wait before allowing a follow-up request + required: false + schema: + $ref: '#/components/schemas/RetryAfter' + '429': + description: Too many Request + content: + application/json: + schema: + $ref: '#/components/schemas/TPPErrorDTO' + example: + code: TPP_TOO_MANY_REQUESTS + message: Too many requests + headers: + Access-Control-Allow-Origin: + description: Indicates whether the response can be shared with requesting code from the given origin + required: false + schema: + $ref: '#/components/schemas/AccessControlAllowOrigin' + RateLimit-Limit: + description: The number of allowed requests in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitLimit' + RateLimit-Reset: + description: The number of seconds left in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitReset' + Retry-After: + description: The number of seconds to wait before allowing a follow-up request + required: false + schema: + $ref: '#/components/schemas/RetryAfter' + '500': + description: Server ERROR + content: + application/json: + schema: + $ref: '#/components/schemas/TPPErrorDTO' + example: + code: TPP_GENERIC_ERROR + message: Application error + headers: + Access-Control-Allow-Origin: + description: Indicates whether the response can be shared with requesting code from the given origin + required: false + schema: + $ref: '#/components/schemas/AccessControlAllowOrigin' + RateLimit-Limit: + description: The number of allowed requests in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitLimit' + RateLimit-Reset: + description: The number of seconds left in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitReset' + Retry-After: + description: The number of seconds to wait before allowing a follow-up request + required: false + schema: + $ref: '#/components/schemas/RetryAfter' + '/save': + post: + tags: + - TPP + summary: >- + ENG: Save TPP information - IT: Salva le informazioni della TPP + operationId: save + description: Save TPP information + parameters: + - name: Accept-Language + in: header + description: 'ENG: Language - IT: Lingua' + schema: + type: string + pattern: "^[ -~]{2,5}$" + minLength: 2 + maxLength: 5 + example: it-IT + default: it-IT + required: true + requestBody: + description: 'ENG: TPP details - IT: Dettagli della TPP' + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TppDTO' responses: '200': description: Ok @@ -697,9 +903,10 @@ components: description: "Status active/inactive" example: true - TppDTO: + TppDTOTppIdRequired: type: object required: + - tppId - entityId - businessName - legalAddress @@ -773,6 +980,76 @@ components: description: "Status active/inactive" example: true + TppDTO: + type: object + required: + - entityId + - businessName + - legalAddress + - messageUrl + - authenticationUrl + - authenticationType + - contact + description: "TPP information(Third Party Provider)" + properties: + entityId: + type: string + description: "Fiscal Code or P.IVA of the TPP" + pattern: "^[A-Za-z0-9]{11,16}$" + minLength: 11 + maxLength: 16 + example: "86363574890" + idPsp: + type: string + description: "Id of Payment Service Provider" + pattern: "^[A-Za-z0-9 ]+$" + minLength: 1 + maxLength: 50 + example: "MasterCard 123" + businessName: + type: string + description: "Company Name" + pattern: "^[ -~]{1,70}$" + minLength: 1 + maxLength: 70 + example: "MyBusiness Ltd" + legalAddress: + type: string + description: "Company Legal Address" + pattern: "^[ -~]{1,70}$" + minLength: 1 + maxLength: 70 + example: "Via Washington, 13" + messageUrl: + type: string + description: "URL to notify PUSH message" + format: uri + pattern: "^[ -~]{1,2048}$" + minLength: 1 + maxLength: 2048 + example: "https://api.tpp.com/message" + authenticationUrl: + type: string + description: "url for authentication" + format: uri + pattern: "^[ -~]{1,2048}$" + minLength: 1 + maxLength: 2048 + example: "https://api.tpp.com/auth" + authenticationType: + type: string + description: "authentication type" + enum: + - OAUTH2 + example: "OAUTH2" + contact: + $ref: '#/components/schemas/Contact' + state: + type: boolean + description: "Status active/inactive" + example: true + + Contact: type: object required: @@ -805,7 +1082,7 @@ components: TppDTOWithDates: allOf: - - $ref: '#/components/schemas/TppDTO' + - $ref: '#/components/schemas/TppDTOTppIdRequired' - type: object description: "TPP information with date fields" properties: From ab7aa4ba8be1c42eeabd8a50e01f75eb3888cfcc Mon Sep 17 00:00:00 2001 From: stefanodel Date: Wed, 13 Nov 2024 15:54:17 +0100 Subject: [PATCH 2/2] fix: update swagger yaml file --- src/main/resources/META-INF/openapi.yaml | 37 ++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/main/resources/META-INF/openapi.yaml b/src/main/resources/META-INF/openapi.yaml index aca966e..eb81753 100644 --- a/src/main/resources/META-INF/openapi.yaml +++ b/src/main/resources/META-INF/openapi.yaml @@ -552,6 +552,36 @@ paths: required: false schema: $ref: '#/components/schemas/RetryAfter' + '403': + description: The TPP already onboarded + content: + application/json: + schema: + $ref: '#/components/schemas/TPPErrorDTO' + example: + code: TPP_ALREADY_ONBOARDED + message: Tpp is already onboarded + headers: + Access-Control-Allow-Origin: + description: Indicates whether the response can be shared with requesting code from the given origin + required: false + schema: + $ref: '#/components/schemas/AccessControlAllowOrigin' + RateLimit-Limit: + description: The number of allowed requests in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitLimit' + RateLimit-Reset: + description: The number of seconds left in the current period + required: false + schema: + $ref: '#/components/schemas/RateLimitReset' + Retry-After: + description: The number of seconds to wait before allowing a follow-up request + required: false + schema: + $ref: '#/components/schemas/RetryAfter' '404': description: The TPP was not found content: @@ -1115,17 +1145,20 @@ components: - TPP_TOO_MANY_REQUESTS - TPP_GENERIC_ERROR - TPP_AUTHENTICATION_FAILED + - TPP_ALREADY_ONBOARDED description: |- "ENG: Error code: TPP_BAD_REQUEST: Something went wrong handling the request, TPP_NOT_ONBOARDED: TPP not onboarded, TPP_TOO_MANY_REQUESTS: Too many requests, TPP_GENERIC_ERROR: Application Error, - TPP_AUTHENTICATION_FAILED: Something went wrong with authentication - IT: Codice di errore: + TPP_AUTHENTICATION_FAILED: Something went wrong with authentication, + TPP_ALREADY_ONBOARDED: Tpp is already onboarded - IT: Codice di errore: TPP_BAD_REQUEST: Qualcosa è andato storto durante l'invio della richiesta, TPP_NOT_ONBOARDED: TPP non onboardata, TPP_TOO_MANY_REQUESTS: Troppe richieste, TPP_GENERIC_ERROR: Errore generico, - TPP_AUTHENTICATION_FAILED: Qualcosa è andato storto con l'autenticazione" + TPP_AUTHENTICATION_FAILED: Qualcosa è andato storto con l'autenticazione, + TPP_ALREADY_ONBOARDED: La TPP è già onboardata" message: type: string description: 'ENG: Error message - IT: Messaggio di errore'