Skip to content

Commit

Permalink
P4ADEV-1426 developed rest call to mock c030
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoGiuliani committed Dec 5, 2024
1 parent f487fc7 commit c4fd15c
Show file tree
Hide file tree
Showing 24 changed files with 445 additions and 22 deletions.
2 changes: 2 additions & 0 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ microservice-chart:
PDND_SERVICE_ANPR_C003_PURPOSE_ID: 5ba1f38f-6a91-4da4-8a42-4da1aa55bfee
PDND_SERVICE_ANPR_C030_PURPOSE_ID: 87520bd5-207a-4616-85d9-10d7bb3e88b8

ANPR_BASE_URL: http://localhost:8080

keyvault:
name: "p4pa-d-payhub-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
2 changes: 2 additions & 0 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ microservice-chart:
PDND_SERVICE_ANPR_C003_PURPOSE_ID: 5ba1f38f-6a91-4da4-8a42-4da1aa55bfee
PDND_SERVICE_ANPR_C030_PURPOSE_ID: 87520bd5-207a-4616-85d9-10d7bb3e88b8

ANPR_BASE_URL: https://modipa-val.anpr.interno.it

keyvault:
name: "p4pa-p-payhub-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
2 changes: 2 additions & 0 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ microservice-chart:
PDND_SERVICE_ANPR_C003_PURPOSE_ID: 5ba1f38f-6a91-4da4-8a42-4da1aa55bfee
PDND_SERVICE_ANPR_C030_PURPOSE_ID: 87520bd5-207a-4616-85d9-10d7bb3e88b8

ANPR_BASE_URL: http://localhost:8080

keyvault:
name: "p4pa-u-payhub-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
78 changes: 59 additions & 19 deletions openapi/p4pa-pdnd.openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,71 @@
openapi: 3.0.1
openapi: 3.0.3
info:
title: Fake API
description: "Una semplice API di esempio"
version: "1.0.0"
title: P4PA-PDND-Service API
description: API and Models.
version: 0.0.1
servers:
- url: "http://localhost:8080/p4papdnd"
paths:
/api/v1/greet:
/anpr-service-e002/citizen:
get:
summary: "Ottieni un saluto"
description: "Endpoint di esempio che restituisce un saluto"
summary: Retrieve citizen data
description: Returns detailed information about a citizen based on their fiscal code.
parameters:
- name: fiscalCode
in: query
description: The fiscal code of the citizen
required: true
schema:
type: string
example: RSSMRA85M01H501Z
responses:
'200':
description: "Successo"
description: OK
content:
application/json:
schema:
type: object
properties:
message:
firstName:
type: string
example: "Hello, World!"
'500':
description: "Errore interno del server"
content:
application/json:
schema:
type: object
properties:
error:
example: Mario
lastName:
type: string
example: "Errore interno del server"
example: Rossi
dateOfBirth:
type: string
format: YYYY-MM-DD
example: '2021-11-15'
address:
$ref: '#/components/schemas/Address'
'400':
description: Invalid request
'403':
description: Forbidden
'404':
description: Citizen not found
'500':
description: Internal server error
security:
- BearerAuth: []
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
schemas:
Address:
type: object
properties:
street:
type: string
example: Via Roma 10
city:
type: string
example: Roma
postalCode:
type: string
example: 00100
country:
type: string
example: Italy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package it.gov.pagopa.payhub.pdnd.config.pdnd.anpr;
package it.gov.pagopa.payhub.pdnd.anpr.c003.service;

import it.gov.pagopa.payhub.pdnd.config.pdnd.PdndServiceIntegratedConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.client;

import it.gov.pagopa.payhub.pdnd.anpr.c030.dto.RichiestaDTO;
import it.gov.pagopa.payhub.pdnd.anpr.c030.dto.RispostaOKDTO;

public interface AnprC030Client {
RispostaOKDTO getIdAnprFromCf(RichiestaDTO clientAssertions);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.client;

import it.gov.pagopa.payhub.pdnd.anpr.c030.dto.RichiestaDTO;
import it.gov.pagopa.payhub.pdnd.anpr.c030.dto.RispostaOKDTO;
import it.gov.pagopa.payhub.pdnd.anpr.c030.service.AnprC030ServiceConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class AnprC030ClientImpl implements AnprC030Client {

@Value("${app.pdnd.anpr.base-url}")
private String anprBasePath;
private final RestTemplate restTemplate;
private final AnprC030ServiceConfig anprC030ServiceConfig;

public AnprC030ClientImpl(RestTemplateBuilder restTemplateBuilder, AnprC030ServiceConfig anprC030ServiceConfig) {
this.restTemplate = restTemplateBuilder.build();
this.anprC030ServiceConfig = anprC030ServiceConfig;
}

public RispostaOKDTO getIdAnprFromCf(RichiestaDTO request) {
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/json");
headers.set("Accept", "application/json");

HttpEntity<RichiestaDTO> entity = new HttpEntity<>(request, headers);

ResponseEntity<RispostaOKDTO> response = restTemplate.exchange(
anprBasePath + anprC030ServiceConfig.getUrl(),
HttpMethod.POST,
entity,
RispostaOKDTO.class
);

return response.getBody();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
@AllArgsConstructor
public class RichiestaDTO {

private String idOperazioneClient;

private TipoCriteriRicercaDTO criteriRicerca;

private TipoDatiRichiestaDTO datiRichiesta;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.*;
import java.util.List;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
public class RispostaOKDTO {

private String idOperazioneANPR;

private TipoListaSoggettiDTO listaSoggetti;

private List<TipoErroriAnomaliaDTO> listaAnomalie;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
@AllArgsConstructor
public class TipoComuneDTO {

private String nomeComune;

private String codiceIstat;

private String siglaProvinciaIstat;

private String descrizioneLocalita;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
@AllArgsConstructor
public class TipoCriteriRicercaDTO {

private String codiceFiscale;

private String cognome;

private String senzaCognome;

private String nome;

private String senzaNome;

private String sesso;

private TipoDatiNascitaDTO datiNascita;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
@AllArgsConstructor
public class TipoDatiNascitaDTO {

private String dataEvento;

private String senzaGiorno;

private String senzaGiornoMese;

private TipoLuogoNascitaDTO luogoNascita;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
@AllArgsConstructor
public class TipoDatiRichiestaDTO {

private String dataRiferimentoRichiesta;

private String motivoRichiesta;

private String casoUso;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
public class TipoDatiSoggettiEnteDTO {

private TipoIdentificativiDTO identificativi;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
public class TipoErroriAnomaliaDTO {

private String codiceErroreAnomalia;

private String tipoErroreAnomalia;

private String testoErroreAnomalia;

private String oggettoErroreAnomalia;

private String campoErroreAnomalia;

private String valoreErroreAnomalia;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
public class TipoIdentificativiDTO {

private String idANPR;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package it.gov.pagopa.payhub.pdnd.anpr.c030.dto;

import lombok.*;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
@RequiredArgsConstructor
public class TipoListaSoggettiDTO {

private List<TipoDatiSoggettiEnteDTO> datiSoggetto;
}
Loading

0 comments on commit c4fd15c

Please sign in to comment.