DevPortalPagoPA




Table of contents

Checking the correctness of the fiscal code

The fiscal code verification service uses a search criterion to simulate the obtainment of the fiscal code of a citizen.
Proceed as follows to correctly perform the fiscal code verification flow:
  • Create ‘Voucher Interop' and insert it in the Header as a Bearer Token.
  • Generate a client certificate, using the OpenSSL tool, starting with the generation of the private key (2048 bit in the example):
bash openssl genrsa -out private-key.pem 2048
and then generate also the certificate that contains the pubic key (which lasts 365 days in the example):
1openssl req -new -x509 -key private-key.pem -out cert.pem -days 365
2
  • Change the curl under the recovered information, then the bearerToken and the apikey
  • Update the path of the file containing the certificate, with the exact path where the file is present on the machine from which the e-service is tested
  • Create the apikey as described in the “Details” section and use it also for the following calls
  • Contact the Handshake API to insert the certificate:\
1curl --location 'https://mtls.eservices.att.interop.pagopa.it/fiscalcode-verification/data-preparation/handshake'
2--header 'apikey: apikey'
3--header 'x-correlation-id: 123'
4--header 'Authorization: Bearer {{bearerToken-fcv}}'
5--form 'certificate=@"/C:/Users/test-cert/cert.pem"'
6
  • Contact the Data Preparation API to insert the test data in the database.
    In the curl command example, the following parameters can be changed:
    • x-correlation-id: update with valid data, as indicated in the “Details” section.
    • authorization: update with a valid token.
    • apikey: created in the previous point.
    • data: JSON of the request; it is possible to change all the data it contains, keeping the attribute names unchanged. For example, if you want to send a new request, updating the fiscal code, also the value of the "fiscalCode" attribute must be changed with "NEW_CODE”.
1curl --location 'https://mtls.eservices.att.interop.pagopa.it/fiscalcode-verification/data-preparation' \
2--header 'x-correlation-id: id' \
3--header 'Content-Type: application/json' \
4--header 'Content-Encoding: identity' \
5--header 'apikey: your_api_key' \
6--header 'Authorization: Bearer {{bearerToken-fcv}}' \
7--data '{ "codiceFiscale": "1231234" }'
8
  • Contact API to verify the fiscal code:
    before executing the curl, update the data:
    • cert: path of the file containing the certificate, with the exact path where the file is present on the machine from which the e-service is tested
    • key: path of the file containing the key, with the exact path where the file is present on the machine from which the e-service is tested
1curl --location 'https://mtls.eservices.att.interop.pagopa.it/fiscalcode-verification/verifica' \
2--cert '/mnt/c/Users/test-cert/cert.pem' \
3--key '/mnt/c/Users/test-cert/private-key.pem' \
4--header 'x-correlation-id: ca8f8bc9-db92-486b-9e46-6c5596f80399' \
5--header 'Content-Encoding: identity' \
6--header 'apikey: apikey' \
7--header 'Content-Type: application/json' \
8--header 'Authorization: Bearer eyJ0eXAiOiJhdCtqd3QiLCJhbGciOiJSUzI1NiIsInVzZSI6InNpZyIsImtpZCI6IjBlNWUxMDZlLTA4MDYtNDQwMi05ZTkzLTFlMGRlN2MwZTQ1OCJ9.eyJhdWQiOiJpbnRlcm9wLWF0dC1lc2VydmljZXMtZmlzLWNvZGUtdmVyIiwic3ViIjoiODUzMmRlMmItMzg2Zi00YWFjLWFkZmMtZTQ2ZDMzNGQzYWQwIiwibmJmIjoxNzE2NTU1MTI4LCJwdXJwb3NlSWQiOiI5MTBlYmYyMC1lMDVlLTQxNzMtYjY3NC00ZWI0NTQxMDAyZTYiLCJpc3MiOiJhdHQuaW50ZXJvcC5wYWdvcGEuaXQiLCJleHAiOjE3MTY1NjIzMjgsImlhdCI6MTcxNjU1NTEyOCwiY2xpZW50X2lkIjoiODUzMmRlMmItMzg2Zi00YWFjLWFkZmMtZTQ2ZDMzNGQzYWQwIiwianRpIjoiZDAwOTcwNjctNjUwZi00N2Y3LWJlZDgtNDBiOTYyZTQwODA2In0.j15xFa05OnnfHGaYnqnWHbWJNZJ4LQ5fP0eiVp6mp0vkepShpAW8JMdyINVg883In1omHfDnDD-J89-QprotO6Yu_QZCKeQ8DteVOolawfJHwYp9azyvrGP_Qth8fagAOJNEkKzwkC5keJrDKvx9Nq4cL5EUUlFYNR1vUawAh3lzfF1cHP2z6k455ApwmY5Cz7fmos-LzOkD-K4K9Yj2GlRHfMZPSqzIWLG-7s3NPYPpN3RvSRJY5DpuIPrY8g7OCcygQIy_ZUkjiQUtUArxM_0_Pb2Zkyp56u7KlPq25Vt-CUlcSw1Qu_kXuniOk1UsuJIcwqSCv3cI_ioHGPNO9Q' \
9--data '{ "codiceFiscale": "BCCBBB88R61A125S" }' \
10-k
11
\

Need help?

Open a ticket using the dedicated feature inside your Reserved Area

Tell us what you think

To report problems or give feedback, you can open a report on GitHub