Skip to content

⏩ Forwarder for requests coming from πŸͺ’ `nodo-dei-pagamenti`

Notifications You must be signed in to change notification settings

pagopa/pagopa-node-forwarder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

pagoPA node forwarder

The microservice behaves like a "proxy": it receives requests from the Nodo Dei Pagamenti and forwards them to the endpoint of the EC or PSP.

infra-fowarder-pagopa

NAT gateway IPs

Outbound pagopa-natgw ips

Environments :

  • UAT πŸ§ͺ
    • ip 20.56.27.220
    • fqdn forwarder.uat.platform.pagopa.it
  • PROD πŸš€
    • ips 20.86.139.154 or 20.86.139.86
    • fqdn forwarder.platform.pagopa.it

Api Documentation πŸ“–

See the OpenApi 3 here.


Technology Stack

  • Java 11
  • Spring Boot
  • Spring Web
  • Hibernate
  • JPA

Start Project Locally πŸš€

Prerequisites

  • docker

Run docker container

from ./docker directory

sh ./run_docker.sh dev

ℹ️ Note: for PagoPa ACR is required the login az acr login -n


Develop Locally πŸ’»

Prerequisites

  • git
  • maven
  • jdk-11

Run the project

Start the springboot application with this command:

mvn spring-boot:run -Dspring-boot.run.profiles=local

Spring Profiles

  • local: to develop locally.
  • default (no profile set): The application gets the properties from the environment (for Azure).

Testing πŸ§ͺ

Manual testing

NOTE : under mock folder run local server typing node server.js

Open terminal and typing :

curl -i --location --request POST 'http://localhost:8080/forward' \
--header 'X-Host-Url: server.aaa.com' \
--header 'X-Host-Port: 8888' \
--header 'X-Host-Path: /path' \
--header 'Content-Type: application/xml' \
--data-raw '<hi></hi>'

if all right y'd see something like that

HTTP/1.1 200
X-Request-Id: fab331b9-8f1d-48d1-a596-ccbaddf778ff
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Date: Thu, 03 Nov 2022 06:21:22 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked
Content-Type: text/plain;charset=UTF-8
Transfer-Encoding: chunked

OK!

Unit testing

To run the Junit tests:

mvn clean verify

Integration testing

From ./integration-test/src

  1. yarn install
  2. yarn test

Performance testing

install k6 and then from ./performance-test/src

  1. k6 run --env VARS=local.environment.json --env TEST_TYPE=./test-types/load.json main_scenario.js

Cert utilities

Open terminal and under script folder typing

NOTE <my_cert_file_name>.pfx should be into current working directory

sh scripts/cert_generator.sh ~/<my_cert_file_name>.pfx

if all right following files are created :

scripts/
β”œβ”€β”€ certificate-key.der
β”œβ”€β”€ certificate-key.pem
└── certificate.crt

Contributors πŸ‘₯

Made with ❀️ by PagoPa S.p.A.

Mainteiners

See CODEOWNERS file