Skip to content

Commit

Permalink
P4ADEV-1674 initial draft
Browse files Browse the repository at this point in the history
  • Loading branch information
serdimic committed Dec 17, 2024
1 parent a9bd14f commit 43fa3b8
Show file tree
Hide file tree
Showing 6 changed files with 527 additions and 1 deletion.
52 changes: 51 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id("org.sonarqube") version "6.0.1.5171"
id("com.github.ben-manes.versions") version "0.51.0"
id("org.openapi.generator") version "7.10.0"
id("org.ajoberstar.grgit") version "5.3.0"
}

group = "it.gov.pagopa.payhub"
Expand Down Expand Up @@ -82,7 +83,7 @@ configurations {
}

tasks.compileJava {
dependsOn("openApiGenerate")
dependsOn("openApiGenerate","openApiGenerateOrganization","openApiGeneratePaCreatePosition")
}

configure<SourceSetContainer> {
Expand All @@ -95,6 +96,12 @@ springBoot {
mainClass.value("it.gov.pagopa.pu.pagopapayments.PagoPaPaymentsApplication")
}

var targetEnv = when (grgit.branch.current().name) {
"uat" -> "uat"
"main" -> "main"
else -> "develop"
}

openApiGenerate {
generatorName.set("spring")
inputSpec.set("$rootDir/openapi/p4pa-pagopa-payments.openapi.yaml")
Expand All @@ -112,3 +119,46 @@ openApiGenerate {
"additionalModelTypeAnnotations" to "@lombok.Data @lombok.Builder @lombok.AllArgsConstructor"
))
}

tasks.register<org.openapitools.generator.gradle.plugin.tasks.GenerateTask>("openApiGenerateOrganization") {
group = "openapi"
description = "description"

generatorName.set("java")
remoteInputSpec.set("https://raw.githubusercontent.com/pagopa/p4pa-organization/refs/heads/$targetEnv/openapi/generated.openapi.json")
outputDir.set("$projectDir/build/generated")
apiPackage.set("it.gov.pagopa.pu.p4pa-organization.controller.generated")
modelPackage.set("it.gov.pagopa.pu.p4pa-organization.dto.generated")
configOptions.set(mapOf(
"swaggerAnnotations" to "false",
"openApiNullable" to "false",
"dateLibrary" to "java8",
"useSpringBoot3" to "true",
"useJakartaEe" to "true",
"serializationLibrary" to "jackson",
"generateSupportingFiles" to "true"
))
library.set("resttemplate")
}

tasks.register<org.openapitools.generator.gradle.plugin.tasks.GenerateTask>("openApiGeneratePaCreatePosition") {
group = "openapi"
description = "description"

generatorName.set("java")
inputSpec.set("$rootDir/openapi/paCreatePosition.yaml")
outputDir.set("$projectDir/build/generated")
apiPackage.set("it.gov.pagopa.nodo.paCreatePosition.controller.generated")
modelPackage.set("it.gov.pagopa.nodo.paCreatePosition.dto.generated")
configOptions.set(mapOf(
"swaggerAnnotations" to "false",
"openApiNullable" to "false",
"dateLibrary" to "java8",
"useSpringBoot3" to "true",
"useJakartaEe" to "true",
"serializationLibrary" to "jackson",
"generateSupportingFiles" to "true"
))
library.set("resttemplate")
}

302 changes: 302 additions & 0 deletions openapi/paCreatePosition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,302 @@
openapi: 3.0.3
info:
version: 0.6.0
title: Pagopa ACA
description: pagoPA ACA microservice pagoPA ACA microservice contains the api to allow the creation of a new debt position.
contact:
name: pagoPA - Touchpoints team
servers:
- url: https://api.uat.platform.pagopa.it/aca/v1
description: paCreatePosition Test environment
- url: https://api.platform.pagopa.it/aca/v1
description: paCreatePosition Prod environment
tags:
- name: ACA
description: API's for performing a debt position census
paths:
/paCreatePosition:
post:
parameters:
- in: query
name: segregationCodes
required: false
schema:
type: string
description: Segregation codes for which broker is authorized
tags:
- ACA
operationId: newDebtPosition
summary: Create a new debt position
description: Create a new debt position.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewDebtPositionRequest'
responses:
'200':
description: New debt position successfully created or updated
content:
application/json:
schema:
$ref: '#/components/schemas/DebtPositionResponse'
'400':
description: Formally invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemJson'
example:
value:
invalidInput:
type: https://example.com/problem/
title: string
status: 400
detail: Formally invalid input
'404':
description: Entity not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemJson'
examples:
iupd_not_found:
value:
type: https://example.com/problem/
title: Invocation exception
status: 404
detail: Error while invalidate debit position. Debit position not found with {iupd}
pa_fiscal_code_not_found:
value:
type: https://example.com/problem/
title: Invocation exception
status: 404
detail: No debt position found with Creditor institution code {creditorInstitutionCode} and {iupd}
'422':
description: Can not perform the requested action on debit position
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemJson'
example:
value:
type: https://example.com/problem/
title: Unprocessable request
status: 422
detail: Can not perform the requested action on debit position
'409':
description: Conflict into requested action
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemJson'
examples:
create:
value:
type: https://example.com/problem/
title: Invocation exception
status: 409
detail: Error while create new debit position conflict into request
update:
value:
type: https://example.com/problem/
title: Invocation exception
status: 409
detail: Error while update debit position conflict into request
invalidate:
value:
type: https://example.com/problem/
title: Invocation exception
status: 409
detail: Error while invalidate debit position conflict into request
unauthorized_action:
value:
type: https://example.com/problem/
title: Unauthorized action
status: 409
detail: Unauthorized action on debt position with iuv {iuv}
'502':
description: Bad gateway
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemJson'
example:
value:
type: https://example.com/problem/
title: string
status: 502
detail: Bad gateway, error while execute request
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemJson'
example:
value:
type: https://example.com/problem/
title: string
status: 500
detail: Internal server error
components:
schemas:
NewDebtPositionRequest:
type: object
required:
- paFiscalCode
- entityType
- entityFiscalCode
- entityFullName
- iuv
- amount
- description
- expirationDate
description: Request body for creating a new transaction
properties:
paFiscalCode:
type: string
example: "12345678910"
minLength: 11
maxLength: 11
entityType:
type: string
example: "G"
enum:
- F
- G
entityFiscalCode:
type: string
example: "12345678910"
minLength: 2
entityFullName:
type: string
example: "Full Name"
minLength: 1
maxLength: 255
iuv:
type: string
example: "00000000000000000"
minLength: 1
maxLength: 255
nav:
type: string
example: "30000000000000000"
minLength: 1
maxLength: 255
description: |-
notice number, if not specified it will created using the following pattern: 3 + iuv
amount:
$ref: '#/components/schemas/AmountEuroCents'
description:
type: string
example: "ACA Debt Position description"
minLength: 1
maxLength: 255
expirationDate:
type: string
format: date-time
iban:
type: string
example: "IT0000000000000000000000000"
minLength: 27
maxLength: 27
postalIban:
type: string
example: "IT60X0542811101000000123456"
minLength: 27
maxLength: 27
switchToExpired:
type: boolean
example: true
default: false
payStandIn:
type: boolean
example: true
default: true

DebtPositionResponse:
type: object
properties:
paFiscalCode:
type: string
companyName:
type: string
entityType:
type: string
entityFiscalCode:
type: string
entityFullName:
type: string
iuv:
type: string
nav:
type: string
amount:
type: integer
format: int64
description:
type: string
expirationDate:
type: string
format: local-date-time
iban:
type: string
postalIban:
type: string
switchToExpired:
type: boolean
status:
type: string
AmountEuroCents:
description: Amount for payments, in eurocents
type: integer
example: 100
minimum: 0
maximum: 99999999999
ProblemJson:
type: object
properties:
type:
type: string
format: uri
description: |-
An absolute URI that identifies the problem type. When dereferenced,
it SHOULD provide human-readable documentation for the problem type
(e.g., using HTML).
default: about:blank
example: https://example.com/problem/
title:
type: string
description: |-
A short, summary of the problem type. Written in english and readable
for engineers (usually not suited for non technical stakeholders and
not localized); example: Service Unavailable
status:
type: integer
format: int32
description: |-
The HTTP status code generated by the origin server for this occurrence
of the problem.
minimum: 100
maximum: 600
exclusiveMaximum: true
example: 400
detail:
type: string
description: |-
A human readable explanation specific to this occurrence of the
problem.
instance:
type: string
format: uri
description: |-
An absolute URI that identifies the specific occurrence of the problem.
It may or may not yield further information if dereferenced.
securitySchemes:
ApiKey:
type: apiKey
description: The API key to access this function app.
name: Ocp-Apim-Subscription-Key
in: header
Loading

0 comments on commit 43fa3b8

Please sign in to comment.