From 8b1073086c0f15c83790165628263cbc7517d281 Mon Sep 17 00:00:00 2001 From: Luca Consalvi Date: Thu, 21 Nov 2024 11:44:33 +0100 Subject: [PATCH] draft --- build.gradle | 4 ++-- openapi/activation.openapi.yaml | 6 ------ .../ActivationAPIControllerImpl.java | 9 +++++++++ .../service/ActivationPayerService.java | 7 +++++++ .../service/ActivationPayerServiceImpl.java | 18 ++++++++++++++++++ 5 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/rtp/activator/service/ActivationPayerService.java create mode 100644 src/main/java/it/gov/pagopa/rtp/activator/service/ActivationPayerServiceImpl.java diff --git a/build.gradle b/build.gradle index 03c8de8..65374e2 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id 'org.springframework.boot' version '3.3.5' id 'io.spring.dependency-management' version '1.1.6' id 'org.graalvm.buildtools.native' version '0.10.3' - id("org.openapi.generator") version "7.5.0" + id("org.openapi.generator") version "7.10.0" } group = 'it.gov.pagopa' @@ -27,7 +27,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-webflux' // implementation 'com.azure.spring:spring-cloud-azure-starter-actuator' -// implementation 'com.azure.spring:spring-cloud-azure-starter-data-cosmos' + implementation 'com.azure.spring:spring-cloud-azure-starter-data-cosmos' implementation("io.swagger.core.v3:swagger-annotations:2.2.8") implementation("org.openapitools:jackson-databind-nullable:0.2.6") implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") diff --git a/openapi/activation.openapi.yaml b/openapi/activation.openapi.yaml index 77db3d4..4e40472 100644 --- a/openapi/activation.openapi.yaml +++ b/openapi/activation.openapi.yaml @@ -422,9 +422,6 @@ components: description: Identifier of the RTP activation resource. type: string format: uuid - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - minLength: 36 - maxLength: 36 example: "d0d654e6-97da-4848-b568-99fedccb642b" ActivationLocation: @@ -440,9 +437,6 @@ components: description: Identifier of the request. type: string format: uuid - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - minLength: 36 - maxLength: 36 example: "bd615b4a-066d-443e-8dd2-a28a39931fef" Version: diff --git a/src/main/java/it/gov/pagopa/rtp/activator/controller/ActivationAPIControllerImpl.java b/src/main/java/it/gov/pagopa/rtp/activator/controller/ActivationAPIControllerImpl.java index c1d9c4a..08b3bef 100644 --- a/src/main/java/it/gov/pagopa/rtp/activator/controller/ActivationAPIControllerImpl.java +++ b/src/main/java/it/gov/pagopa/rtp/activator/controller/ActivationAPIControllerImpl.java @@ -9,17 +9,26 @@ import it.gov.pagopa.rtp.activator.controller.generated.CreateApi; import it.gov.pagopa.rtp.activator.model.generated.ActivationReqDto; +import it.gov.pagopa.rtp.activator.service.ActivationPayerService; import reactor.core.publisher.Mono; @RestController @Validated public class ActivationAPIControllerImpl implements CreateApi { + private final ActivationPayerService activationPayerService; + + public ActivationAPIControllerImpl(ActivationPayerService activationPayerService){ + this.activationPayerService = activationPayerService; + } + @Override public Mono> activate(UUID requestId, String version, Mono activationReqDto, ServerWebExchange exchange) { // TODO Auto-generated method stub + activationPayerService.activatePayer(activationReqDto.block().getPayer().getFiscalCode(),activationReqDto.block().getPayer().getRtpSpId().toString()); throw new UnsupportedOperationException("Unimplemented method 'activate'"); + } } diff --git a/src/main/java/it/gov/pagopa/rtp/activator/service/ActivationPayerService.java b/src/main/java/it/gov/pagopa/rtp/activator/service/ActivationPayerService.java new file mode 100644 index 0000000..50f2039 --- /dev/null +++ b/src/main/java/it/gov/pagopa/rtp/activator/service/ActivationPayerService.java @@ -0,0 +1,7 @@ +package it.gov.pagopa.rtp.activator.service; + +import it.gov.pagopa.rtp.activator.model.generated.ActivationDto; + +public interface ActivationPayerService { + ActivationDto activatePayer(String payer, String fiscalCode); +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/rtp/activator/service/ActivationPayerServiceImpl.java b/src/main/java/it/gov/pagopa/rtp/activator/service/ActivationPayerServiceImpl.java new file mode 100644 index 0000000..821e246 --- /dev/null +++ b/src/main/java/it/gov/pagopa/rtp/activator/service/ActivationPayerServiceImpl.java @@ -0,0 +1,18 @@ +package it.gov.pagopa.rtp.activator.service; + +import it.gov.pagopa.rtp.activator.model.generated.ActivationDto; + +public class ActivationPayerServiceImpl implements ActivationPayerService{ + + @Override + public ActivationDto activatePayer() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'activatePayer'"); + // Try to save params into db + // check the db response + // if it's ok response 200 + // if the record already exists + // report 409 error + } + +}