From fd8fd029789a4a20353d526b101c3c2680740d82 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Thu, 26 Sep 2024 18:08:17 +0200 Subject: [PATCH 01/51] [PPANTT-131] feat: add introducing integration tests --- .github/workflows/code_review.yml | 143 +++++++++--------- integration-test/README.md | 23 ++- integration-test/run_integration_test.sh | 9 ++ integration-test/src/README.md | 51 +++++++ integration-test/src/config/.env.dev | 15 ++ integration-test/src/config/.env.local | 16 ++ integration-test/src/config/.env.uat | 16 ++ .../src/features/get_payment_options.feature | 48 ++++++ integration-test/src/package.json | 21 +++ .../step_definitions/payment_notice_step.js | 100 ++++++++++++ .../support/client/payment_options_client.js | 26 ++++ .../support/utility/axios_common.js | 44 ++++++ 12 files changed, 439 insertions(+), 73 deletions(-) create mode 100755 integration-test/run_integration_test.sh create mode 100644 integration-test/src/README.md create mode 100644 integration-test/src/config/.env.dev create mode 100644 integration-test/src/config/.env.local create mode 100644 integration-test/src/config/.env.uat create mode 100644 integration-test/src/features/get_payment_options.feature create mode 100644 integration-test/src/package.json create mode 100644 integration-test/src/step_definitions/payment_notice_step.js create mode 100644 integration-test/src/step_definitions/support/client/payment_options_client.js create mode 100644 integration-test/src/step_definitions/support/utility/axios_common.js diff --git a/.github/workflows/code_review.yml b/.github/workflows/code_review.yml index b8f7080..e232dd1 100644 --- a/.github/workflows/code_review.yml +++ b/.github/workflows/code_review.yml @@ -45,77 +45,76 @@ jobs: cpd_exclusions: "**/models/**,**/clients/model/**,**/entity/*" coverage_report_path: "./target/jacoco-report/jacoco.xml" -# smoke-test: -# name: Smoke Test -# runs-on: ubuntu-latest -# environment: -# name: dev -# steps: -# - name: Checkout -# id: checkout -# uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 -# -# - name: Login -# id: login -# # from https://github.com/Azure/login/commits/master -# uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 -# with: -# client-id: ${{ secrets.CLIENT_ID }} -# tenant-id: ${{ secrets.TENANT_ID }} -# subscription-id: ${{ secrets.SUBSCRIPTION_ID }} -# -# - name: Run Service on Docker -# shell: bash -# id: run_service_docker -# run: | -# cd ./docker -# chmod +x ./run_docker.sh -# ./run_docker.sh local -# -# - name: Run Integration Tests -# shell: bash -# id: run_integration_test -# run: | -# export GPD_PULL_API_SUBSCRIPTION_KEY=${{ secrets.PULL_SUBKEY }} -# export CANARY=${{ inputs.canary }} -# export CUCUMBER_PUBLISH_TOKEN=${{ secrets.CUCUMBER_PUBLISH_TOKEN }} -# export SUBKEY=${{ secrets.SUBKEY }} -# -# cd ./integration-test -# chmod +x ./run_integration_test.sh -# ./run_integration_test.sh local + smoke-test: + name: Smoke Test + runs-on: ubuntu-latest + environment: + name: dev + steps: + - name: Checkout + id: checkout + uses: actions/checkout@1f9a0c22da41e6ebfa534300ef656657ea2c6707 + + - name: Login + id: login + # from https://github.com/Azure/login/commits/master + uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 + with: + client-id: ${{ secrets.CLIENT_ID }} + tenant-id: ${{ secrets.TENANT_ID }} + subscription-id: ${{ secrets.SUBSCRIPTION_ID }} + + - name: Run Service on Docker + shell: bash + id: run_service_docker + run: | + cd ./docker + chmod +x ./run_docker.sh + ./run_docker.sh local + + - name: Run Integration Tests + shell: bash + id: run_integration_test + run: | + export CANARY=${{ inputs.canary }} + export CUCUMBER_PUBLISH_TOKEN=${{ secrets.CUCUMBER_PUBLISH_TOKEN }} + export SUBKEY=${{ secrets.SUBKEY }} + cd ./integration-test + chmod +x ./run_integration_test.sh + ./run_integration_test.sh local + + + delete_github_deployments: + runs-on: ubuntu-latest + needs: smoke-test + if: ${{ always() }} + steps: + - name: Delete Previous deployments + uses: actions/github-script@v6 + env: + SHA_HEAD: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha}} + with: + script: | + const { SHA_HEAD } = process.env -# delete_github_deployments: -# runs-on: ubuntu-latest -# needs: smoke-test -# if: ${{ always() }} -# steps: -# - name: Delete Previous deployments -# uses: actions/github-script@v6 -# env: -# SHA_HEAD: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.sha}} -# with: -# script: | -# const { SHA_HEAD } = process.env -# -# const deployments = await github.rest.repos.listDeployments({ -# owner: context.repo.owner, -# repo: context.repo.repo, -# sha: SHA_HEAD -# }); -# await Promise.all( -# deployments.data.map(async (deployment) => { -# await github.rest.repos.createDeploymentStatus({ -# owner: context.repo.owner, -# repo: context.repo.repo, -# deployment_id: deployment.id, -# state: 'inactive' -# }); -# return github.rest.repos.deleteDeployment({ -# owner: context.repo.owner, -# repo: context.repo.repo, -# deployment_id: deployment.id -# }); -# }) -# ); + const deployments = await github.rest.repos.listDeployments({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: SHA_HEAD + }); + await Promise.all( + deployments.data.map(async (deployment) => { + await github.rest.repos.createDeploymentStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: deployment.id, + state: 'inactive' + }); + return github.rest.repos.deleteDeployment({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: deployment.id + }); + }) + ); diff --git a/integration-test/README.md b/integration-test/README.md index 16d26a8..1e4aa6e 100644 --- a/integration-test/README.md +++ b/integration-test/README.md @@ -1 +1,22 @@ -Put here the integration tests +# Integration Tests + +👀 Integration tests are in `integration-test/src/` folder. See there for more information. + +## How run on Docker 🐳 + +To run the integration tests on docker, you can run from this directory the script: + +``` shell +sh ./run_integration_test.sh +``` + +ℹ️ _Note_: for **PagoPa ACR** is **required** the login `az acr login -n ` + +If you use dev, uat or prod **you test the images on Azure ACR** + +--- +💻 If you want to test your local branch, + +``` shell +sh ./run_integration_test.sh local SUBSCRIPTION-KEY +``` diff --git a/integration-test/run_integration_test.sh b/integration-test/run_integration_test.sh new file mode 100755 index 0000000..750b584 --- /dev/null +++ b/integration-test/run_integration_test.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# example: sh ./run_integration_test.sh +set -e + +# run integration tests +cd ./src || exit +yarn install +yarn test:"$1" \ No newline at end of file diff --git a/integration-test/src/README.md b/integration-test/src/README.md new file mode 100644 index 0000000..93d85f0 --- /dev/null +++ b/integration-test/src/README.md @@ -0,0 +1,51 @@ +# Integration Test with Cucumber + +## Technology Stack + +- [cucumber js](https://github.com/cucumber/cucumber-js) +- NodeJS v14.17.6 + +## How to start + +- install dependencies: `yarn install` +- run tests: `yarn test` + +if all right you should see something like that : + +```sh +15 scenarios (15 passed) +65 steps (65 passed) +0m09.409s (executing steps: 0m09.349s) +┌──────────────────────────────────────────────────────────────────────────┐ +│ View your Cucumber Report at: │ +│ https://reports.cucumber.io/reports/16ebc4c0-cab6-41f6-9355-f894f9a9601d │ +│ │ +│ This report will self-destruct in 24h. │ +│ Keep reports forever: https://reports.cucumber.io/profile │ +└──────────────────────────────────────────────────────────────────────────┘ +``` + +Click on reporter link to view details . + +### Debug + +To run a single _feature_ or single _Scenario_ typing + +Ex. single _features_ `organizations.feature` + +```sh +npx cucumber-js -r step_definitions features/.feature +``` + +Ex. single _Scenario_ into `.feature` ( add source line ) + +```sh +npx cucumber-js -r step_definitions features/.feature:46 +``` + +### Note + +Remember to start the Backend before start the tests. + +You can configure the host in `./config/.env.local` file. + diff --git a/integration-test/src/config/.env.dev b/integration-test/src/config/.env.dev new file mode 100644 index 0000000..549a6df --- /dev/null +++ b/integration-test/src/config/.env.dev @@ -0,0 +1,15 @@ +PAY_OPT_HOST=https://api.dev.platform.pagopa.it/payment-options/service/v1 + +VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777; +MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777; +SINGLE_OPT_NOTICE_NUMBER=311111111111111111; +SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112; +SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116; +SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225; +INVALID_NOTICE_NUMBER=111111111111111111; +DISABLED_STATION_NOTICE_NUMBER=312111111111111111; +MISSING_STATION_NOTICE_NUMBER=399111111111111111; +UNAUTHORIZED_PSP=AAAAAAAAA; +VALID_PSP=99999000001; + +API_TIMEOUT=30000 diff --git a/integration-test/src/config/.env.local b/integration-test/src/config/.env.local new file mode 100644 index 0000000..1a4059f --- /dev/null +++ b/integration-test/src/config/.env.local @@ -0,0 +1,16 @@ +GPD_PULL_HOST=http://localhost:8080 + +VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777; +MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777; +SINGLE_OPT_NOTICE_NUMBER=311111111111111111; +SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112; +SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116; +SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225; +INVALID_NOTICE_NUMBER=111111111111111111; +DISABLED_STATION_NOTICE_NUMBER=312111111111111111; +MISSING_STATION_NOTICE_NUMBER=399111111111111111; +UNAUTHORIZED_PSP=AAAAAAAAA; +VALID_PSP=99999000001; + +API_TIMEOUT=30000 + diff --git a/integration-test/src/config/.env.uat b/integration-test/src/config/.env.uat new file mode 100644 index 0000000..03d552c --- /dev/null +++ b/integration-test/src/config/.env.uat @@ -0,0 +1,16 @@ +PAY_OPT_HOST=https://api.uat.platform.pagopa.it/payment-options/service/v1 + +VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777; +MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777; +SINGLE_OPT_NOTICE_NUMBER=311111111111111111; +SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112; +SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116; +SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225; +INVALID_NOTICE_NUMBER=111111111111111111; +DISABLED_STATION_NOTICE_NUMBER=312111111111111111; +MISSING_STATION_NOTICE_NUMBER=399111111111111111; +UNAUTHORIZED_PSP=AAAAAAAAA; +VALID_PSP=99999000001; + +API_TIMEOUT=30000 + diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature new file mode 100644 index 0000000..ca01a9c --- /dev/null +++ b/integration-test/src/features/get_payment_options.feature @@ -0,0 +1,48 @@ +Feature: Get Payment Options + + Scenario: Unauthorized idPsp + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "single" and idPsp "invalid" + Then response has a 403 Http status + + Scenario: Nav not allowed for OdP + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "invalid" and idPsp "valid" + Then response has a 400 Http status + And has error code "ODP-015" + + Scenario: Station unavailable for provided noticeNumber + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "missing" and idPsp "valid" + Then response has a 404 Http status + And has error code "ODP-009" + + Scenario: Station has odp flag disabled + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "disabled" and idPsp "valid" + Then response has a 400 Http status + And has error code "ODP-016" + + Scenario: Retrieve Payment Options (Opzione Unica) + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "single" and idPsp "valid" + Then response has a 200 Http status + And payments options has size 1 + And payments option n 0 has 1 installments + + Scenario: Retrieve Payment Options (Opzione Unica + Unico Piano Rateale) + When an Http GET request is sent to recover payment options for taxCode "77777777777" with noticeNumber "singleAndMultiple" and idPsp "valid" + Then response has a 200 Http status + And payments options has size 2 + And payments option n 0 has 1 installments + And payments option n 1 has 3 installments + + Scenario: Retrieve Payment Options (Opzione Unica + Molteplici Piani Rateali) + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "singleAndManyMultiples" and idPsp "valid" + Then response has a 200 Http status + And payments options has size 3 + And payments option n 0 has 1 installments + And payments option n 1 has 3 installments + And payments option n 2 has 5 installments + + Scenario: Retrieve Payment Options (Co-Obbligati) + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "co-oblidged" and idPsp "valid" + Then response has a 200 Http status + And payments options has size 2 + And payments option n 0 has 1 installments + And payments option n 1 has 1 installments diff --git a/integration-test/src/package.json b/integration-test/src/package.json new file mode 100644 index 0000000..274fffa --- /dev/null +++ b/integration-test/src/package.json @@ -0,0 +1,21 @@ +{ + "name": "pagopa-pdf-engine", + "license": "MIT", + "version": "0.0.1", + "main": "index.js", + "scripts": { + "test": "dotenv -e ./config/.env.local yarn cucumber", + "test:local": "dotenv -e ./config/.env.local yarn cucumber", + "test:dev": "dotenv -e ./config/.env.dev yarn cucumber", + "test:uat": "dotenv -e ./config/.env.uat yarn cucumber", + "cucumber": "npx cucumber-js --publish -r step_definitions" + }, + "devDependencies": { + "@cucumber/cucumber": "^9.1.2", + "axios": "^1.4.0", + "dotenv": "^16.1.4", + "dotenv-cli": "^7.2.1", + "form-data": "^4.0.0", + "npx": "^10.2.2" + } +} diff --git a/integration-test/src/step_definitions/payment_notice_step.js b/integration-test/src/step_definitions/payment_notice_step.js new file mode 100644 index 0000000..043a574 --- /dev/null +++ b/integration-test/src/step_definitions/payment_notice_step.js @@ -0,0 +1,100 @@ +const assert = require('assert'); +const {defineParameterType, Given, When, Then, After, AfterAll} = require('@cucumber/cucumber'); +const {getPaymentOptions} = require("./support/client/payment_options_client"); + +const idOrg = process.env.VALID_ORGANIZATIONAL_FISCAL_CODE; +const missingOrg = process.env.MISSING_ORGANIZATIONAL_FISCAL_CODE; +const singleOptNoticeNumber = process.env.SINGLE_OPT_NOTICE_NUMBER; +const singleOptAndSingleMultiNoticeNumber = process.env.SINGLE_AND_MANY_OPT_NOTICE_NUMBER; +const singleOptAndManyMultiNoticeNumber = process.env.SINGLE_AND_MULTI_OPT_NOTICE_NUMBER; +const coOptNoticeNumber = process.env.SINGLE_AND_CO_OPT_NOTICE_NUMBER; +const invalidStationNoticeNumber = process.env.INVALID_NOTICE_NUMBER; +const disabledStationNoticeNumber = process.env.DISABLED_STATION_NOTICE_NUMBER; +const missingStationNoticeNumber = process.env.MISSING_STATION_NOTICE_NUMBER; +const invalidPsp = process.env.UNAUTHORIZED_PSP; +const validPsp = process.env.VALID_PSP; + + +const paymentOptions = []; + +defineParameterType({ + name: "boolean", + regexp: /true|false/, + transformer: (s) => s === "true" +}); + + +// After each Scenario +AfterAll(async function () { + + this.paymentOptions = []; + this.response = null; + +}); + +When('an Http GET request is sent to recover payment options for taxCode {string} with noticeNumber {string} and idPsp {string}', + async function (taxCode, noticeNumber, idPsp) { + + var selectedTaxCode; + var selectedNoticeNumber; + var selectedPsp; + + switch(taxCode) { + case "missing": + selectedTaxCode = missingOrg; + break; + default: + selectedTaxCode = idOrg; + } + + switch(noticeNumber) { + case "invalid": + selectedNoticeNumber = invalidStationNoticeNumber; + break; + case "disabled": + selectedNoticeNumber = disabledStationNoticeNumber; + break; + case "missing": + selectedNoticeNumber = missingStationNoticeNumber; + break; + case "single": + selectedNoticeNumber = singleOptNoticeNumber; + break; + case "singleAndMultiple": + selectedNoticeNumber = singleOptAndSingleMultiNoticeNumber; + break; + case "singleAndManyMultiples": + selectedNoticeNumber = singleOptAndManyMultiNoticeNumber; + break; + case "co-oblidged" + selectedNoticeNumber = coOptNoticeNumber; + break; + } + + switch (idPsp) { + case "invalid": + selectedPsp = invalidPsp; + break; + case "valid": + selectedPsp = validPsp; + } + + this.response = await getPaymentOptions( + selectedTaxCode, selectedNoticeNumber, selectedPsp); + }); + +Then('payments options has size {int}', function (expectedSize) { + assert.strictEqual(this.response?.data?.paymentOptions.length, expectedSize); +}); + +Then('payments option n {int} has {int} installments', function (i, expectedSize) { + assert.strictEqual(this.response?.data?.paymentOptions[i - 1].installments.length, expectedSize); +}); + +Then('response has a {int} Http status', function (expectedStatus) { + assert.strictEqual(this.response.status, expectedStatus); +}); + +Then('has error code {string}', function (expectedCode) { + assert.strictEqual(this.response?.data?.appErrorCode, expectedCode); +}); diff --git a/integration-test/src/step_definitions/support/client/payment_options_client.js b/integration-test/src/step_definitions/support/client/payment_options_client.js new file mode 100644 index 0000000..04b2aa6 --- /dev/null +++ b/integration-test/src/step_definitions/support/client/payment_options_client.js @@ -0,0 +1,26 @@ +const {get} = require("../utility/axios_common"); + +const PAY_OPT_HOST = process.env.PAY_OPT_HOST; +const API_TIMEOUT = process.env.API_TIMEOUT; + +async function getPaymentOptions(taxCode, noticeNumber, idPsp) { + + if (dueDate) { + params.idPsp = idPsp; + } + + const data = await get(PAY_OPT_HOST + + `/payment-options/organizations/{taxCode}/notices/{noticeNumber}`, { + timeout: API_TIMEOUT, + params, + headers: { + "Ocp-Apim-Subscription-Key": process.env.SUBKEY, + "Content-Type": "application/json" + } + }); + return data; +} + +module.exports = { + getPaymentOptions +} diff --git a/integration-test/src/step_definitions/support/utility/axios_common.js b/integration-test/src/step_definitions/support/utility/axios_common.js new file mode 100644 index 0000000..4159779 --- /dev/null +++ b/integration-test/src/step_definitions/support/utility/axios_common.js @@ -0,0 +1,44 @@ +const axios = require("axios"); + +function get(url, config) { + return axios.get(url, config) + .then(res => { + return res; + }) + .catch(error => { + return error.response; + }); +} + +function post(url, body, config) { + return axios.post(url, body, config) + .then(res => { + return res; + }) + .catch(error => { + return error.response; + }); +} + +function put(url, body, config) { + return axios.put(url, body, config) + .then(res => { + return res; + }) + .catch(error => { + return error.response; + }); +} + + +function del(url, config) { + return axios.delete(url, config) + .then(res => { + return res; + }) + .catch(error => { + return error.response; + }); +} + +module.exports = {get, post, put, del} From 292f3d9dac4d1918104d2be8e28e46c173ee41a8 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 09:25:05 +0200 Subject: [PATCH 02/51] [PPANTT-131] feat: Updated docker scripts --- docker/alertmanager/alertmanager.conf | 12 -- docker/docker-compose.yml | 120 ++---------------- docker/grafana/grafana_config.ini | 5 - docker/grafana/grafana_datasources.yml | 7 - .../otel-collector/otel-collector-config.yaml | 33 ----- docker/prometheus/alert_rules.yml | 13 -- docker/prometheus/prometheus.yml | 29 ----- docker/run_docker.sh | 53 ++++---- 8 files changed, 39 insertions(+), 233 deletions(-) delete mode 100644 docker/alertmanager/alertmanager.conf delete mode 100644 docker/grafana/grafana_config.ini delete mode 100644 docker/grafana/grafana_datasources.yml delete mode 100644 docker/otel-collector/otel-collector-config.yaml delete mode 100644 docker/prometheus/alert_rules.yml delete mode 100644 docker/prometheus/prometheus.yml diff --git a/docker/alertmanager/alertmanager.conf b/docker/alertmanager/alertmanager.conf deleted file mode 100644 index 13611f6..0000000 --- a/docker/alertmanager/alertmanager.conf +++ /dev/null @@ -1,12 +0,0 @@ -global: - resolve_timeout: 1m - pagerduty_url: 'https://events.pagerduty.com/v2/enqueue' - -route: - receiverEntity: 'pagerduty-notifications' - -receivers: -- name: 'pagerduty-notifications' - pagerduty_configs: - - service_key: 0c1cc665a594419b6d215e81f4e38f7 - send_resolved: true diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index f834154..7b132a5 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,113 +1,21 @@ version: '3.8' services: - elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:8.6.2 + app: + container_name: 'pagopa-payment-options-service' + image: ${image} + platform: linux/amd64 + build: + dockerfile: Dockerfile_integration_test + context: ../ + args: + QUARKUS_PROFILE: prod + APP_NAME: pagopa-payment-options-service + SLEEP_FOR_INTEGRATION: 180000 + env_file: + - ./.env ports: - - "9200:9200" - - "9300:9300" - environment: - ES_JAVA_OPTS: "-Xms512m -Xmx512m" - discovery.type: "single-node" - xpack.security.enabled: false - xpack.security.enrollment.enabled: false - networks: - - infra - - kibana: - image: docker.elastic.co/kibana/kibana:8.6.2 - ports: - - "5601:5601" - networks: - - infra - depends_on: - - elasticsearch - - alertmanager: - hostname: alertmanager - image: prom/alertmanager - volumes: - - ${PWD}/alertmanager/alertmanager.conf:/etc/alertmanager/alertmanager.conf - command: - - '--config.file=/etc/alertmanager/alertmanager.conf' - ports: - - "9093:9093" - networks: - - infra - - prometheus: - hostname: prometheus - image: prom/prometheus - volumes: - - ${PWD}/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml - - ${PWD}/prometheus/alert_rules.yml:/etc/prometheus/alert_rules.yml - - prometheus_data:/prometheus - command: - - '--config.file=/etc/prometheus/prometheus.yml' - links: - - alertmanager:alertmanager - ports: - - "9090:9090" - networks: - - infra - - grafana: - hostname: grafana - image: grafana/grafana - volumes: - - ${PWD}/grafana/grafana_datasources.yml:/etc/grafana/provisioning/datasources/all.yaml - - ${PWD}/grafana/grafana_config.ini:/etc/grafana/config.ini - - grafana_data:/var/lib/grafana - ports: - - "3000:3000" - networks: - - infra - - jaeger-all-in-one: - image: jaegertracing/all-in-one:latest - ports: - - "16686:16686" - - "14268:14268" - - "14250:14250" - networks: - - infra - - otel-collector: - image: otel/opentelemetry-collector:latest - command: [ "--config=/etc/otel-collector-config.yaml" ] - volumes: - - ${PWD}/otel-collector/otel-collector-config.yaml:/etc/otel-collector-config.yaml:Z - ports: - - "13133:13133" # Health-check extension - - "4317:4317" # OTLP gRPC receiver - depends_on: - - jaeger-all-in-one - networks: - - infra - -# mongo: -# image: mongo -# restart: always -# environment: -# MONGO_INITDB_ROOT_USERNAME: root -# MONGO_INITDB_ROOT_PASSWORD: example -# ports: -# - 27017:27017 -# networks: -# - infra -# -# mongo-express: -# image: mongo-express -# restart: always -# ports: -# - 8085:8081 -# environment: -# ME_CONFIG_MONGODB_ADMINUSERNAME: root -# ME_CONFIG_MONGODB_ADMINPASSWORD: example -# ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/ -# networks: -# - infra - + - "8080:8080" volumes: prometheus_data: { } diff --git a/docker/grafana/grafana_config.ini b/docker/grafana/grafana_config.ini deleted file mode 100644 index 9c84f44..0000000 --- a/docker/grafana/grafana_config.ini +++ /dev/null @@ -1,5 +0,0 @@ -[paths] -provisioning = /etc/grafana/provisioning - -[server] -enable_gzip = true \ No newline at end of file diff --git a/docker/grafana/grafana_datasources.yml b/docker/grafana/grafana_datasources.yml deleted file mode 100644 index ba6949e..0000000 --- a/docker/grafana/grafana_datasources.yml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: 1 - -datasources: - - name: 'prometheus' - type: 'prometheus' - access: 'proxy' - url: 'http://prometheus:9090' \ No newline at end of file diff --git a/docker/otel-collector/otel-collector-config.yaml b/docker/otel-collector/otel-collector-config.yaml deleted file mode 100644 index c08ab06..0000000 --- a/docker/otel-collector/otel-collector-config.yaml +++ /dev/null @@ -1,33 +0,0 @@ -receivers: - otlp: - protocols: - grpc: - endpoint: otel-collector:4317 - -exporters: - jaeger: - endpoint: jaeger-all-in-one:14250 - tls: - insecure: true - otlphttp/elastic: - tls: - insecure: true - # Elastic APM server https endpoint without the "https://" prefix - endpoint: "https://kibana.dev.platform.pagopa.it:443/apm" - headers: - # Elastic APM Server secret token - Authorization: "Bearer 30K8q56M9r3jhKrIdhf968PO" - -processors: - batch: - -extensions: - health_check: - -service: - extensions: [ health_check ] - pipelines: - traces: - receivers: [ otlp ] - processors: [ batch ] - exporters: [ jaeger, otlphttp/elastic ] diff --git a/docker/prometheus/alert_rules.yml b/docker/prometheus/alert_rules.yml deleted file mode 100644 index 5d0c4fd..0000000 --- a/docker/prometheus/alert_rules.yml +++ /dev/null @@ -1,13 +0,0 @@ -groups: - - name: JVMMemory - rules: - - alert: JVMMemoryThresholdCrossed - # Condition for alerting - expr: jvm_memory_committed_bytes{region="heap"}/jvm_memory_max_bytes{region="heap"} > 0.8 - # Annotation - additional informational labels to store more information - annotations: - title: 'Instance has crossed 80% heap memory usage' - description: ' of job has crossed 80% heap memory usage' - # Labels - additional labels to be attached to the alert - labels: - severity: 'critical' \ No newline at end of file diff --git a/docker/prometheus/prometheus.yml b/docker/prometheus/prometheus.yml deleted file mode 100644 index 9521553..0000000 --- a/docker/prometheus/prometheus.yml +++ /dev/null @@ -1,29 +0,0 @@ -# global settings -global: - scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. - evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. - # scrape_timeout is set to the global default (10s). - -alerting: - alertmanagers: - - static_configs: - - targets: [ "alertmanager:9093" ] - -# Load rules once and periodically evaluate them according to the global 'evaluation_interval'. -rule_files: - - /etc/prometheus/alert_rules.yml - -# A scrape configuration containing exactly one endpoint to scrape: -# Here it's Prometheus itself. -scrape_configs: - # The job name is added as a label `job=` to any timeseries scraped from this config. - - job_name: 'ndp-metrics' - metrics_path: '/q/metrics' - scrape_interval: 5s - static_configs: - - targets: [ 'docker.for.mac.host.internal:8080' ] - #labels: - # application: ndp - # namespace: nodo - # service: ndp - # env: dev diff --git a/docker/run_docker.sh b/docker/run_docker.sh index f907c83..6b32fb4 100644 --- a/docker/run_docker.sh +++ b/docker/run_docker.sh @@ -1,7 +1,8 @@ -# sh ./run_docker.sh --skip-recreate +#!/bin/bash + +# sh ./run_docker.sh ENV=$1 -RECREATE=$2 if [ -z "$ENV" ] then @@ -9,48 +10,44 @@ then echo "No environment specified: local is used." fi +pip3 install yq if [ "$ENV" = "local" ]; then - containerRegistry="pagopadcommonacr.azurecr.io" image="service-local:latest" - echo "Running local image and dev dependencies" + ENV="dev" else - - if [ "$ENV" = "dev" ]; then - containerRegistry="pagopadcommonacr.azurecr.io" - echo "Running all dev images" - elif [ "$ENV" = "uat" ]; then - containerRegistry="pagopaucommonacr.azurecr.io" - echo "Running all uat images" - elif [ "$ENV" = "prod" ]; then - containerRegistry="pagopapcommonacr.azurecr.io" - echo "Running all prod images" - else - echo "Error with parameter: use " - exit 1 - fi - - pip3 install yq repository=$(yq -r '."microservice-chart".image.repository' ../helm/values-$ENV.yaml) image="${repository}:latest" fi +export image=${image} +FILE=.env +if test -f "$FILE"; then + rm .env +fi +config=$(yq -r '."microservice-chart".envConfig' ../helm/values-$ENV.yaml) +for line in $(echo $config | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do + echo $line >> .env +done -export containerRegistry=${containerRegistry} -export image=${image} +keyvault=$(yq -r '."microservice-chart".keyvault.name' ../helm/values-$ENV.yaml) +secret=$(yq -r '."microservice-chart".envSecret' ../helm/values-$ENV.yaml) +for line in $(echo $secret | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do + IFS='=' read -r -a array <<< "$line" + response=$(az keyvault secret show --vault-name $keyvault --name "${array[1]}") + value=$(echo $response | jq -r '.value') + echo "${array[0]}=$value" >> .env +done stack_name=$(cd .. && basename "$PWD") -if [ "$RECREATE" = "--skip-recreate" ]; then - docker compose -p "${stack_name}" up -d - else - docker compose -p "${stack_name}" up -d --remove-orphans --force-recreate --build -fi +docker compose -p "${stack_name}" up -d --remove-orphans --force-recreate --build + # waiting the containers printf 'Waiting for the service' attempt_counter=0 max_attempts=50 -until $(curl --output /dev/null --silent --head --fail http://localhost:8080/actuator/info); do +until [ "$(curl -s -w '%{http_code}' -o /dev/null "http://localhost:8080/q/health/live")" -eq 200 ]; do if [ ${attempt_counter} -eq ${max_attempts} ];then echo "Max attempts reached" exit 1 From e505afb0157d734714109230adb8f330c322addd Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 09:31:18 +0200 Subject: [PATCH 03/51] [PPANTT-131] feat: Updated payment_options_step.js --- .../{payment_notice_step.js => payment_options_step.js} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename integration-test/src/step_definitions/{payment_notice_step.js => payment_options_step.js} (99%) diff --git a/integration-test/src/step_definitions/payment_notice_step.js b/integration-test/src/step_definitions/payment_options_step.js similarity index 99% rename from integration-test/src/step_definitions/payment_notice_step.js rename to integration-test/src/step_definitions/payment_options_step.js index 043a574..6659f6a 100644 --- a/integration-test/src/step_definitions/payment_notice_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -66,7 +66,7 @@ When('an Http GET request is sent to recover payment options for taxCode {string case "singleAndManyMultiples": selectedNoticeNumber = singleOptAndManyMultiNoticeNumber; break; - case "co-oblidged" + case "co-oblidged": selectedNoticeNumber = coOptNoticeNumber; break; } From 461209c678c848eec553c8d21d5d794a1e5109cd Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 09:34:56 +0200 Subject: [PATCH 04/51] [PPANTT-131] feat: Updated payment_options_step.js --- integration-test/src/features/get_payment_options.feature | 2 +- .../step_definitions/support/client/payment_options_client.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index ca01a9c..31ce15d 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -26,7 +26,7 @@ Feature: Get Payment Options And payments option n 0 has 1 installments Scenario: Retrieve Payment Options (Opzione Unica + Unico Piano Rateale) - When an Http GET request is sent to recover payment options for taxCode "77777777777" with noticeNumber "singleAndMultiple" and idPsp "valid" + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "singleAndMultiple" and idPsp "valid" Then response has a 200 Http status And payments options has size 2 And payments option n 0 has 1 installments diff --git a/integration-test/src/step_definitions/support/client/payment_options_client.js b/integration-test/src/step_definitions/support/client/payment_options_client.js index 04b2aa6..9b35e13 100644 --- a/integration-test/src/step_definitions/support/client/payment_options_client.js +++ b/integration-test/src/step_definitions/support/client/payment_options_client.js @@ -5,7 +5,7 @@ const API_TIMEOUT = process.env.API_TIMEOUT; async function getPaymentOptions(taxCode, noticeNumber, idPsp) { - if (dueDate) { + if (idPsp) { params.idPsp = idPsp; } From c05a32d2bb3def1a3240bfb3f276d7942ceb0376 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 09:40:23 +0200 Subject: [PATCH 05/51] [PPANTT-131] feat: Updated payment_options_step.js --- .../step_definitions/support/client/payment_options_client.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integration-test/src/step_definitions/support/client/payment_options_client.js b/integration-test/src/step_definitions/support/client/payment_options_client.js index 9b35e13..a73e326 100644 --- a/integration-test/src/step_definitions/support/client/payment_options_client.js +++ b/integration-test/src/step_definitions/support/client/payment_options_client.js @@ -5,6 +5,8 @@ const API_TIMEOUT = process.env.API_TIMEOUT; async function getPaymentOptions(taxCode, noticeNumber, idPsp) { + let params = {}; + if (idPsp) { params.idPsp = idPsp; } @@ -18,6 +20,7 @@ async function getPaymentOptions(taxCode, noticeNumber, idPsp) { "Content-Type": "application/json" } }); + return data; } From 06a3acad17a19f9c49e71de24f47f6789ad1982f Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 09:45:34 +0200 Subject: [PATCH 06/51] [PPANTT-131] feat: Updated payment_options_step.js --- integration-test/src/step_definitions/payment_options_step.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index 6659f6a..c097c76 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -81,6 +81,9 @@ When('an Http GET request is sent to recover payment options for taxCode {string this.response = await getPaymentOptions( selectedTaxCode, selectedNoticeNumber, selectedPsp); + + console.log(this.response); + }); Then('payments options has size {int}', function (expectedSize) { From 547ad4543af3257b4183ef95196c2fef2a50e0ed Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 09:50:02 +0200 Subject: [PATCH 07/51] [PPANTT-131] feat: Updated payment_options_step.js --- .../src/step_definitions/support/utility/axios_common.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/integration-test/src/step_definitions/support/utility/axios_common.js b/integration-test/src/step_definitions/support/utility/axios_common.js index 4159779..3c9ce09 100644 --- a/integration-test/src/step_definitions/support/utility/axios_common.js +++ b/integration-test/src/step_definitions/support/utility/axios_common.js @@ -3,9 +3,13 @@ const axios = require("axios"); function get(url, config) { return axios.get(url, config) .then(res => { + console.log("RESPONSE"); + console.log(res); return res; }) .catch(error => { + console.log("ERROR"); + console.log(error); return error.response; }); } From 5df4a3bd1a97063992cfeb596acf007901278f7c Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 09:56:27 +0200 Subject: [PATCH 08/51] [PPANTT-131] feat: Updated payment_options_step.js --- integration-test/src/config/.env.dev | 22 ++++++++--------- integration-test/src/config/.env.local | 24 +++++++++---------- integration-test/src/config/.env.uat | 22 ++++++++--------- .../support/client/payment_options_client.js | 2 +- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/integration-test/src/config/.env.dev b/integration-test/src/config/.env.dev index 549a6df..5daa2cc 100644 --- a/integration-test/src/config/.env.dev +++ b/integration-test/src/config/.env.dev @@ -1,15 +1,15 @@ PAY_OPT_HOST=https://api.dev.platform.pagopa.it/payment-options/service/v1 -VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777; -MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777; -SINGLE_OPT_NOTICE_NUMBER=311111111111111111; -SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112; -SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116; -SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225; -INVALID_NOTICE_NUMBER=111111111111111111; -DISABLED_STATION_NOTICE_NUMBER=312111111111111111; -MISSING_STATION_NOTICE_NUMBER=399111111111111111; -UNAUTHORIZED_PSP=AAAAAAAAA; -VALID_PSP=99999000001; +VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777 +MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777 +SINGLE_OPT_NOTICE_NUMBER=311111111111111111 +SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 +SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 +SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 +INVALID_NOTICE_NUMBER=111111111111111111 +DISABLED_STATION_NOTICE_NUMBER=312111111111111111 +MISSING_STATION_NOTICE_NUMBER=399111111111111111 +UNAUTHORIZED_PSP=AAAAAAAAA +VALID_PSP=99999000001 API_TIMEOUT=30000 diff --git a/integration-test/src/config/.env.local b/integration-test/src/config/.env.local index 1a4059f..000b6bf 100644 --- a/integration-test/src/config/.env.local +++ b/integration-test/src/config/.env.local @@ -1,16 +1,16 @@ -GPD_PULL_HOST=http://localhost:8080 +PAY_OPT_HOST=http://localhost:8080 -VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777; -MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777; -SINGLE_OPT_NOTICE_NUMBER=311111111111111111; -SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112; -SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116; -SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225; -INVALID_NOTICE_NUMBER=111111111111111111; -DISABLED_STATION_NOTICE_NUMBER=312111111111111111; -MISSING_STATION_NOTICE_NUMBER=399111111111111111; -UNAUTHORIZED_PSP=AAAAAAAAA; -VALID_PSP=99999000001; +VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777 +MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777 +SINGLE_OPT_NOTICE_NUMBER=311111111111111111 +SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 +SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 +SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 +INVALID_NOTICE_NUMBER=111111111111111111 +DISABLED_STATION_NOTICE_NUMBER=312111111111111111 +MISSING_STATION_NOTICE_NUMBER=399111111111111111 +UNAUTHORIZED_PSP=AAAAAAAAA +VALID_PSP=99999000001 API_TIMEOUT=30000 diff --git a/integration-test/src/config/.env.uat b/integration-test/src/config/.env.uat index 03d552c..243d182 100644 --- a/integration-test/src/config/.env.uat +++ b/integration-test/src/config/.env.uat @@ -1,16 +1,16 @@ PAY_OPT_HOST=https://api.uat.platform.pagopa.it/payment-options/service/v1 -VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777; -MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777; -SINGLE_OPT_NOTICE_NUMBER=311111111111111111; -SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112; -SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116; -SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225; -INVALID_NOTICE_NUMBER=111111111111111111; -DISABLED_STATION_NOTICE_NUMBER=312111111111111111; -MISSING_STATION_NOTICE_NUMBER=399111111111111111; -UNAUTHORIZED_PSP=AAAAAAAAA; -VALID_PSP=99999000001; +VALID_ORGANIZATIONAL_FISCAL_CODE=77777777777 +MISSING_ORGANIZATIONAL_FISCAL_CODE=87777777777 +SINGLE_OPT_NOTICE_NUMBER=311111111111111111 +SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 +SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 +SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 +INVALID_NOTICE_NUMBER=111111111111111111 +DISABLED_STATION_NOTICE_NUMBER=312111111111111111 +MISSING_STATION_NOTICE_NUMBER=399111111111111111 +UNAUTHORIZED_PSP=AAAAAAAAA +VALID_PSP=99999000001 API_TIMEOUT=30000 diff --git a/integration-test/src/step_definitions/support/client/payment_options_client.js b/integration-test/src/step_definitions/support/client/payment_options_client.js index a73e326..b0e53bb 100644 --- a/integration-test/src/step_definitions/support/client/payment_options_client.js +++ b/integration-test/src/step_definitions/support/client/payment_options_client.js @@ -12,7 +12,7 @@ async function getPaymentOptions(taxCode, noticeNumber, idPsp) { } const data = await get(PAY_OPT_HOST + - `/payment-options/organizations/{taxCode}/notices/{noticeNumber}`, { + `/payment-options/organizations/`+taxCode+`/notices/`+`noticeNumber`, { timeout: API_TIMEOUT, params, headers: { From 15cb7eff52221ccf5357694a683e534da42674c5 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 10:00:59 +0200 Subject: [PATCH 09/51] [PPANTT-131] feat: Updated axios_common.js --- .../src/step_definitions/support/utility/axios_common.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/integration-test/src/step_definitions/support/utility/axios_common.js b/integration-test/src/step_definitions/support/utility/axios_common.js index 3c9ce09..4159779 100644 --- a/integration-test/src/step_definitions/support/utility/axios_common.js +++ b/integration-test/src/step_definitions/support/utility/axios_common.js @@ -3,13 +3,9 @@ const axios = require("axios"); function get(url, config) { return axios.get(url, config) .then(res => { - console.log("RESPONSE"); - console.log(res); return res; }) .catch(error => { - console.log("ERROR"); - console.log(error); return error.response; }); } From 8b41cf760ecb1437f00eccc1f1e0f02efa66d4ef Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 10:05:38 +0200 Subject: [PATCH 10/51] [PPANTT-131] feat: Updated axios_common.js --- .../step_definitions/support/client/payment_options_client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integration-test/src/step_definitions/support/client/payment_options_client.js b/integration-test/src/step_definitions/support/client/payment_options_client.js index b0e53bb..72d405f 100644 --- a/integration-test/src/step_definitions/support/client/payment_options_client.js +++ b/integration-test/src/step_definitions/support/client/payment_options_client.js @@ -9,10 +9,11 @@ async function getPaymentOptions(taxCode, noticeNumber, idPsp) { if (idPsp) { params.idPsp = idPsp; + params.idBrokerPsp = idPsp; } const data = await get(PAY_OPT_HOST + - `/payment-options/organizations/`+taxCode+`/notices/`+`noticeNumber`, { + `/payment-options/organizations/`+taxCode+`/notices/`+noticeNumber, { timeout: API_TIMEOUT, params, headers: { From a9154fa2787fb3d92dd85a20703dcfaaace6257c Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 10:45:50 +0200 Subject: [PATCH 11/51] [PPANTT-131] feat: Updated get_payment_options.feature --- integration-test/src/features/get_payment_options.feature | 2 +- .../src/step_definitions/payment_options_step.js | 6 ++++++ .../payment/options/resources/PaymentOptionsResource.java | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index 31ce15d..bca3ef0 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -2,7 +2,7 @@ Feature: Get Payment Options Scenario: Unauthorized idPsp When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "single" and idPsp "invalid" - Then response has a 403 Http status + Then response has an http status that contains 40 Scenario: Nav not allowed for OdP When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "invalid" and idPsp "valid" diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index c097c76..68e1816 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -98,6 +98,12 @@ Then('response has a {int} Http status', function (expectedStatus) { assert.strictEqual(this.response.status, expectedStatus); }); + +Then('response has an http status that contains {string}', function (expectedStatus) { + assert.strictEqual(true, this.response.status.startsWith(expectedStatus)); +}); + + Then('has error code {string}', function (expectedCode) { assert.strictEqual(this.response?.data?.appErrorCode, expectedCode); }); diff --git a/src/main/java/it/gov/pagopa/payment/options/resources/PaymentOptionsResource.java b/src/main/java/it/gov/pagopa/payment/options/resources/PaymentOptionsResource.java index cd5bc4c..d6235ce 100644 --- a/src/main/java/it/gov/pagopa/payment/options/resources/PaymentOptionsResource.java +++ b/src/main/java/it/gov/pagopa/payment/options/resources/PaymentOptionsResource.java @@ -1,6 +1,5 @@ package it.gov.pagopa.payment.options.resources; -import io.vertx.core.cli.annotations.Hidden; import it.gov.pagopa.payment.options.models.clients.creditorInstitution.PaymentOptionsResponse; import it.gov.pagopa.payment.options.services.PaymentOptionsService; import jakarta.inject.Inject; From 586c500d03e3512cf1bd8da5a8a9cad5e500cb89 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 11:09:10 +0200 Subject: [PATCH 12/51] [PPANTT-131] feat: Updated get_payment_options.feature --- integration-test/src/config/.env.dev | 3 ++- integration-test/src/config/.env.local | 3 ++- integration-test/src/config/.env.uat | 3 ++- .../src/features/get_payment_options.feature | 10 ++++++++++ .../src/step_definitions/payment_options_step.js | 5 +++-- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/integration-test/src/config/.env.dev b/integration-test/src/config/.env.dev index 5daa2cc..1f7a3a7 100644 --- a/integration-test/src/config/.env.dev +++ b/integration-test/src/config/.env.dev @@ -7,7 +7,8 @@ SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 INVALID_NOTICE_NUMBER=111111111111111111 -DISABLED_STATION_NOTICE_NUMBER=312111111111111111 +DISABLED_STATION_NOTICE_NUMBER=313111111111111111 +DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 diff --git a/integration-test/src/config/.env.local b/integration-test/src/config/.env.local index 000b6bf..d6d08d8 100644 --- a/integration-test/src/config/.env.local +++ b/integration-test/src/config/.env.local @@ -7,7 +7,8 @@ SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 INVALID_NOTICE_NUMBER=111111111111111111 -DISABLED_STATION_NOTICE_NUMBER=312111111111111111 +DISABLED_STATION_NOTICE_NUMBER=313111111111111111 +DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 diff --git a/integration-test/src/config/.env.uat b/integration-test/src/config/.env.uat index 243d182..31317f6 100644 --- a/integration-test/src/config/.env.uat +++ b/integration-test/src/config/.env.uat @@ -7,7 +7,8 @@ SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 INVALID_NOTICE_NUMBER=111111111111111111 -DISABLED_STATION_NOTICE_NUMBER=312111111111111111 +DISABLED_STATION_NOTICE_NUMBER=313111111111111111 +DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index bca3ef0..0a67334 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -14,9 +14,19 @@ Feature: Get Payment Options Then response has a 404 Http status And has error code "ODP-009" + Scenario: Station unavailable for provided fiscalCode + When an Http GET request is sent to recover payment options for taxCode "invalid" with noticeNumber "valid" and idPsp "valid" + Then response has a 404 Http status + And has error code "ODP-009" + Scenario: Station has odp flag disabled When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "disabled" and idPsp "valid" Then response has a 400 Http status + And has error code "ODP-0099" + + Scenario: Station has odp flag disabled + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "disabledOdp" and idPsp "valid" + Then response has a 400 Http status And has error code "ODP-016" Scenario: Retrieve Payment Options (Opzione Unica) diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index 68e1816..8a72633 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -10,6 +10,7 @@ const singleOptAndManyMultiNoticeNumber = process.env.SINGLE_AND_MULTI_OPT_NOTIC const coOptNoticeNumber = process.env.SINGLE_AND_CO_OPT_NOTICE_NUMBER; const invalidStationNoticeNumber = process.env.INVALID_NOTICE_NUMBER; const disabledStationNoticeNumber = process.env.DISABLED_STATION_NOTICE_NUMBER; +const disabledOdpStationNoticeNumber = process.env.DISABLED_STATION_ODP_NOTICE_NUMBER; const missingStationNoticeNumber = process.env.MISSING_STATION_NOTICE_NUMBER; const invalidPsp = process.env.UNAUTHORIZED_PSP; const validPsp = process.env.VALID_PSP; @@ -51,8 +52,8 @@ When('an Http GET request is sent to recover payment options for taxCode {string case "invalid": selectedNoticeNumber = invalidStationNoticeNumber; break; - case "disabled": - selectedNoticeNumber = disabledStationNoticeNumber; + case "disabledOdp": + selectedNoticeNumber = disabledOdpStationNoticeNumber; break; case "missing": selectedNoticeNumber = missingStationNoticeNumber; From abeac1caafbdbe993ed3ffe1082d119aac279513 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 15:35:09 +0200 Subject: [PATCH 13/51] [PPANTT-131] feat: Updated get_payment_options.feature --- integration-test/src/features/get_payment_options.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index 0a67334..244a874 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -19,7 +19,7 @@ Feature: Get Payment Options Then response has a 404 Http status And has error code "ODP-009" - Scenario: Station has odp flag disabled + Scenario: Station is disabled When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "disabled" and idPsp "valid" Then response has a 400 Http status And has error code "ODP-0099" From d2474217a7651ac69d96a60f7f7e43fc3c821b02 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Fri, 27 Sep 2024 15:40:02 +0200 Subject: [PATCH 14/51] [PPANTT-131] feat: Updated get_payment_options.feature --- integration-test/src/step_definitions/payment_options_step.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index 8a72633..91d025b 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -83,8 +83,6 @@ When('an Http GET request is sent to recover payment options for taxCode {string this.response = await getPaymentOptions( selectedTaxCode, selectedNoticeNumber, selectedPsp); - console.log(this.response); - }); Then('payments options has size {int}', function (expectedSize) { From 22c719efc86c1f1537778f2f4a14d9adf39e7718 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 10:28:11 +0200 Subject: [PATCH 15/51] [PPANTT-131] feat: Updated values --- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 39288de..d1e3085 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -78,7 +78,7 @@ microservice-chart: WEBSITE_SITE_NAME: 'payment-options-service' # required to show cloud role name in application insights APP_LOGGING_LEVEL: 'DEBUG' DEFAULT_LOGGING_LEVEL: 'INFO' - APICONFIG_CACHE_URL: 'https://api.dev.platform.pagopa.it/api-config-cache/o/v1' + APICONFIG_CACHE_URL: 'https://api.dev.platform.pagopa.it/api-config-cache/p/v1' CACHE_EVT_HOST: 'pagopa-d-weu-core-evh-ns04.servicebus.windows.net:9093' CACHE_EVT_TOPIC: 'nodo-dei-pagamenti-cache' VERIFY_KO_EVT_HOST: 'pagopa-d-weu-core-evh-ns03.servicebus.windows.net:9093' diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 70f3689..f39257b 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -83,7 +83,7 @@ microservice-chart: WEBSITE_SITE_NAME: 'payment-options-service' # required to show cloud role name in application insights APP_LOGGING_LEVEL: 'DEBUG' DEFAULT_LOGGING_LEVEL: 'INFO' - APICONFIG_CACHE_URL: 'https://api.platform.pagopa.it/api-config-cache/o/v1' + APICONFIG_CACHE_URL: 'https://api.platform.pagopa.it/api-config-cache/p/v1' CACHE_EVT_HOST: 'pagopa-p-weu-core-evh-ns04.servicebus.windows.net:9093' CACHE_EVT_TOPIC: 'nodo-dei-pagamenti-cache' VERIFY_KO_EVT_HOST: 'pagopa-p-weu-core-evh-ns03.servicebus.windows.net:9093' diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index da49b28..66dd9fc 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -83,7 +83,7 @@ microservice-chart: WEBSITE_SITE_NAME: 'payment-options-service' # required to show cloud role name in application insights APP_LOGGING_LEVEL: 'DEBUG' DEFAULT_LOGGING_LEVEL: 'INFO' - APICONFIG_CACHE_URL: 'https://api.uat.platform.pagopa.it/api-config-cache/o/v1' + APICONFIG_CACHE_URL: 'https://api.uat.platform.pagopa.it/api-config-cache/p/v1' CACHE_EVT_HOST: 'pagopa-u-weu-core-evh-ns04.servicebus.windows.net:9093' CACHE_EVT_TOPIC: 'nodo-dei-pagamenti-cache' VERIFY_KO_EVT_HOST: 'pagopa-u-weu-core-evh-ns03.servicebus.windows.net:9093' From d628aa33baf87832cecbc98e09fca2a3f0f949a0 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 10:34:49 +0200 Subject: [PATCH 16/51] [PPANTT-131] feat: Updated get_payment_options.feature --- integration-test/src/features/get_payment_options.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index 244a874..a05cee7 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -2,7 +2,7 @@ Feature: Get Payment Options Scenario: Unauthorized idPsp When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "single" and idPsp "invalid" - Then response has an http status that contains 40 + Then response has an http status that contains "40" Scenario: Nav not allowed for OdP When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "invalid" and idPsp "valid" From 8f16aa9c264ee97a0a0ccacbc3a529fe5d5c976d Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 10:43:40 +0200 Subject: [PATCH 17/51] [PPANTT-131] feat: Updated get_payment_options.feature --- integration-test/src/features/get_payment_options.feature | 2 +- integration-test/src/step_definitions/payment_options_step.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index a05cee7..45308cd 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -2,7 +2,7 @@ Feature: Get Payment Options Scenario: Unauthorized idPsp When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "single" and idPsp "invalid" - Then response has an http status that contains "40" + Then response has an http status that is either 404 or 403 Scenario: Nav not allowed for OdP When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "invalid" and idPsp "valid" diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index 91d025b..c1fc19b 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -98,8 +98,8 @@ Then('response has a {int} Http status', function (expectedStatus) { }); -Then('response has an http status that contains {string}', function (expectedStatus) { - assert.strictEqual(true, this.response.status.startsWith(expectedStatus)); +Then('response has an http status that is either {int} or {int}', function (missingStatus, unauthorizedStatus) { + assert.strictEqual(true, this.response.status == missingStatus || this.response.status == unauthorizedStatus); }); From dd0b1987e62460b21918829a98bd8cb0949ab3df Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 09:27:13 +0000 Subject: [PATCH 18/51] Bump to version 0.4.2-1-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 +- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 284 ++++++++++++++++++++++-------------------- pom.xml | 2 +- 6 files changed, 156 insertions(+), 140 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 0fa6656..051adec 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.69.0 -appVersion: 0.4.2 +version: 0.70.0 +appVersion: 0.4.2-1-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index d1e3085..a9c695d 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2" + tag: "0.4.2-1-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index f39257b..ad1d9c5 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2" + tag: "0.4.2-1-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 66dd9fc..c5d48c6 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2" + tag: "0.4.2-1-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 3c2cf5e..28b0167 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -1,187 +1,203 @@ { - "openapi" : "3.0.3", - "info" : { - "title" : "PagoPa Payment Options (TEST)", - "description" : "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", - "termsOfService" : "https://www.pagopa.gov.it/", - "version" : "0.4.2" + "openapi": "3.0.3", + "info": { + "title": "PagoPa Payment Options (TEST)", + "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", + "termsOfService": "https://www.pagopa.gov.it/", + "version": "0.4.2-1-PPANTT-131-feat-add-integration-tests" }, - "servers" : [ { - "url" : "http://localhost:8080", - "description" : "Localhost base URL" - }, { - "url" : "https://{host}/payment-options/service/v1", - "description" : "Base URL", - "variables" : { - "host" : { - "default" : "api.dev.platform.pagopa.it", - "enum" : [ "api.dev.platform.pagopa.it", "api.uat.platform.pagopa.it", "api.platform.pagopa.it" ] + "servers": [ + { + "url": "http://localhost:8080", + "description": "Localhost base URL" + }, + { + "url": "https://{host}/payment-options/service/v1", + "description": "Base URL", + "variables": { + "host": { + "default": "api.dev.platform.pagopa.it", + "enum": [ + "api.dev.platform.pagopa.it", + "api.uat.platform.pagopa.it", + "api.platform.pagopa.it" + ] + } } } - } ], - "paths" : { - "/info" : { - "get" : { - "tags" : [ "Generic" ], - "responses" : { - "200" : { - "description" : "OK", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/AppInfo" + ], + "paths": { + "/info": { + "get": { + "tags": [ + "Generic" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppInfo" } } } }, - "400" : { - "description" : "Bad Request", - "content" : { - "application/json" : { } + "400": { + "description": "Bad Request", + "content": { + "application/json": {} } } } } }, - "/payment-options/organizations/{fiscal-code}/notices/{notice-number}" : { - "get" : { - "tags" : [ "Payment Options Resource" ], - "summary" : "Get payment options", - "description" : "Retrieve the payment options related to the provided input", - "operationId" : "getPaymentOptions", - "parameters" : [ { - "name" : "fiscal-code", - "in" : "path", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "notice-number", - "in" : "path", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "idPsp", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "X-Session-Id", - "in" : "header", - "schema" : { - "type" : "string" + "/payment-options/organizations/{fiscal-code}/notices/{notice-number}": { + "get": { + "tags": [ + "Payment Options Resource" + ], + "summary": "Get payment options", + "description": "Retrieve the payment options related to the provided input", + "operationId": "getPaymentOptions", + "parameters": [ + { + "name": "fiscal-code", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "notice-number", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "idPsp", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "X-Session-Id", + "in": "header", + "schema": { + "type": "string" + } } - } ], - "responses" : { - "500" : { - "$ref" : "#/components/responses/ErrorResponse500" + ], + "responses": { + "500": { + "$ref": "#/components/responses/ErrorResponse500" }, - "400" : { - "$ref" : "#/components/responses/ErrorResponse400" + "400": { + "$ref": "#/components/responses/ErrorResponse400" }, - "404" : { - "$ref" : "#/components/responses/ErrorResponse404" + "404": { + "$ref": "#/components/responses/ErrorResponse404" }, - "200" : { - "description" : "Success", - "content" : { - "application/json" : { } + "200": { + "description": "Success", + "content": { + "application/json": {} } } } } } }, - "components" : { - "schemas" : { - "AppInfo" : { - "type" : "object", - "properties" : { - "name" : { - "type" : "string" + "components": { + "schemas": { + "AppInfo": { + "type": "object", + "properties": { + "name": { + "type": "string" }, - "version" : { - "type" : "string" + "version": { + "type": "string" }, - "environment" : { - "type" : "string" + "environment": { + "type": "string" } } }, - "ErrorResponse" : { - "type" : "object", - "properties" : { - "httpStatusCode" : { - "format" : "int32", - "type" : "integer", - "example" : 500 + "ErrorResponse": { + "type": "object", + "properties": { + "httpStatusCode": { + "format": "int32", + "type": "integer", + "example": 500 }, - "httpStatusDescription" : { - "type" : "string", - "example" : "Internal Server Error" + "httpStatusDescription": { + "type": "string", + "example": "Internal Server Error" }, - "errorMessage" : { - "type" : "string", - "example" : "An unexpected error has occurred. Please contact support." + "errorMessage": { + "type": "string", + "example": "An unexpected error has occurred. Please contact support." }, - "appErrorCode" : { - "type" : "string", - "example" : "ODP-" + "appErrorCode": { + "type": "string", + "example": "ODP-" }, - "timestamp" : { - "format" : "int64", - "type" : "integer", - "example" : 1724425035 + "timestamp": { + "format": "int64", + "type": "integer", + "example": 1724425035 }, - "dateTime" : { - "type" : "string", - "example" : "2024-08-23T14:57:15.635528" + "dateTime": { + "type": "string", + "example": "2024-08-23T14:57:15.635528" } } } }, - "responses" : { - "ErrorResponse400" : { - "description" : "Default app exception for status 400", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "responses": { + "ErrorResponse400": { + "description": "Default app exception for status 400", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "ErrorResponse404" : { - "description" : "Default app exception for status 404", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "ErrorResponse404": { + "description": "Default app exception for status 404", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "ErrorResponse500" : { - "description" : "Internal Server Error", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "ErrorResponse500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } } }, - "securitySchemes" : { - "ApiKey" : { - "type" : "apiKey", - "name" : "Ocp-Apim-Subscription-Key", - "in" : "header" + "securitySchemes": { + "ApiKey": { + "type": "apiKey", + "name": "Ocp-Apim-Subscription-Key", + "in": "header" } } } -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index fdd3d70..83aca0b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2 + 0.4.2-1-PPANTT-131-feat-add-integration-tests 0.8.7 From f52f07d9bdee99c5d8c556f0d8b74bfbadb90cca Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 12:13:20 +0200 Subject: [PATCH 19/51] [PPANTT-131] feat: Updated Station --- .../pagopa/payment/options/models/clients/cache/Station.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/it/gov/pagopa/payment/options/models/clients/cache/Station.java b/src/main/java/it/gov/pagopa/payment/options/models/clients/cache/Station.java index 1b17687..259ddb8 100644 --- a/src/main/java/it/gov/pagopa/payment/options/models/clients/cache/Station.java +++ b/src/main/java/it/gov/pagopa/payment/options/models/clients/cache/Station.java @@ -68,7 +68,7 @@ public class Station { @JsonProperty("flag_standin") private Boolean flagStandin = null; - @JsonProperty("verify_payment_option_enabled") + @JsonProperty("is_payment_options_enabled") private Boolean verifyPaymentOptionEnabled = false; @JsonProperty("rest_endpoint") From a39057f4358665d3f81c5616db1d70e7d7282bac Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 10:21:12 +0000 Subject: [PATCH 20/51] Bump to version 0.4.2-2-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 051adec..517c251 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.70.0 -appVersion: 0.4.2-1-PPANTT-131-feat-add-integration-tests +version: 0.71.0 +appVersion: 0.4.2-2-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index a9c695d..cbee36c 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-1-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-2-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index ad1d9c5..a4d13b1 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-1-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-2-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index c5d48c6..3d1412a 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-1-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-2-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 28b0167..25038a6 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-1-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-2-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 83aca0b..9ba610f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-1-PPANTT-131-feat-add-integration-tests + 0.4.2-2-PPANTT-131-feat-add-integration-tests 0.8.7 From 480ffcf16f0329aaf91bd01854b4768fab97a489 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 10:35:25 +0000 Subject: [PATCH 21/51] Bump to version 0.4.2-3-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 517c251..06977cd 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.71.0 -appVersion: 0.4.2-2-PPANTT-131-feat-add-integration-tests +version: 0.72.0 +appVersion: 0.4.2-3-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index cbee36c..7fee007 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-2-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-3-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index a4d13b1..651fae2 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-2-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-3-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 3d1412a..2d8651d 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-2-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-3-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 25038a6..4507781 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-2-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-3-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 9ba610f..f1619ad 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-2-PPANTT-131-feat-add-integration-tests + 0.4.2-3-PPANTT-131-feat-add-integration-tests 0.8.7 From 1305a3294bcb354cbb5288aed1eee0a79040cbe6 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 15:38:09 +0200 Subject: [PATCH 22/51] [PPANTT-131] feat: Updated tests and client for POST forwarder --- helm/values-dev.yaml | 2 + helm/values-prod.yaml | 2 + helm/values-uat.yaml | 2 + openapi/openapi.json | 284 +++++++++--------- .../CreditorInstitutionRestClient.java | 5 +- ...reditorInstitutionRestClientInterface.java | 7 +- .../services/CreditorInstitutionService.java | 16 +- src/main/resources/application.properties | 2 + .../CreditorInstitutionRestClientTest.java | 12 +- .../test/extensions/WireMockExtensions.java | 20 +- 10 files changed, 176 insertions(+), 176 deletions(-) diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index a9c695d..e7a5730 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -79,6 +79,8 @@ microservice-chart: APP_LOGGING_LEVEL: 'DEBUG' DEFAULT_LOGGING_LEVEL: 'INFO' APICONFIG_CACHE_URL: 'https://api.dev.platform.pagopa.it/api-config-cache/p/v1' + EC_APIM_FORWARDER_ENDPOINT: 'https://api.dev.platform.pagopa.it' + EC_APIM_PATH: '/pagopa-node-forwarder/api/v1' CACHE_EVT_HOST: 'pagopa-d-weu-core-evh-ns04.servicebus.windows.net:9093' CACHE_EVT_TOPIC: 'nodo-dei-pagamenti-cache' VERIFY_KO_EVT_HOST: 'pagopa-d-weu-core-evh-ns03.servicebus.windows.net:9093' diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index ad1d9c5..3bad834 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -84,6 +84,8 @@ microservice-chart: APP_LOGGING_LEVEL: 'DEBUG' DEFAULT_LOGGING_LEVEL: 'INFO' APICONFIG_CACHE_URL: 'https://api.platform.pagopa.it/api-config-cache/p/v1' + EC_APIM_FORWARDER_ENDPOINT: 'https://api.platform.pagopa.it' + EC_APIM_PATH: '/pagopa-node-forwarder/api/v1' CACHE_EVT_HOST: 'pagopa-p-weu-core-evh-ns04.servicebus.windows.net:9093' CACHE_EVT_TOPIC: 'nodo-dei-pagamenti-cache' VERIFY_KO_EVT_HOST: 'pagopa-p-weu-core-evh-ns03.servicebus.windows.net:9093' diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index c5d48c6..533ceac 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -84,6 +84,8 @@ microservice-chart: APP_LOGGING_LEVEL: 'DEBUG' DEFAULT_LOGGING_LEVEL: 'INFO' APICONFIG_CACHE_URL: 'https://api.uat.platform.pagopa.it/api-config-cache/p/v1' + EC_APIM_FORWARDER_ENDPOINT: 'https://api.uat.platform.pagopa.it' + EC_APIM_PATH: '/pagopa-node-forwarder/api/v1' CACHE_EVT_HOST: 'pagopa-u-weu-core-evh-ns04.servicebus.windows.net:9093' CACHE_EVT_TOPIC: 'nodo-dei-pagamenti-cache' VERIFY_KO_EVT_HOST: 'pagopa-u-weu-core-evh-ns03.servicebus.windows.net:9093' diff --git a/openapi/openapi.json b/openapi/openapi.json index 28b0167..6023ccc 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -1,203 +1,187 @@ { - "openapi": "3.0.3", - "info": { - "title": "PagoPa Payment Options (TEST)", - "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", - "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-1-PPANTT-131-feat-add-integration-tests" + "openapi" : "3.0.3", + "info" : { + "title" : "PagoPa Payment Options (TEST)", + "description" : "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", + "termsOfService" : "https://www.pagopa.gov.it/", + "version" : "0.4.2-1-PPANTT-131-feat-add-integration-tests" }, - "servers": [ - { - "url": "http://localhost:8080", - "description": "Localhost base URL" - }, - { - "url": "https://{host}/payment-options/service/v1", - "description": "Base URL", - "variables": { - "host": { - "default": "api.dev.platform.pagopa.it", - "enum": [ - "api.dev.platform.pagopa.it", - "api.uat.platform.pagopa.it", - "api.platform.pagopa.it" - ] - } + "servers" : [ { + "url" : "http://localhost:8080", + "description" : "Localhost base URL" + }, { + "url" : "https://{host}/payment-options/service/v1", + "description" : "Base URL", + "variables" : { + "host" : { + "default" : "api.dev.platform.pagopa.it", + "enum" : [ "api.dev.platform.pagopa.it", "api.uat.platform.pagopa.it", "api.platform.pagopa.it" ] } } - ], - "paths": { - "/info": { - "get": { - "tags": [ - "Generic" - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AppInfo" + } ], + "paths" : { + "/info" : { + "get" : { + "tags" : [ "Generic" ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/AppInfo" } } } }, - "400": { - "description": "Bad Request", - "content": { - "application/json": {} + "400" : { + "description" : "Bad Request", + "content" : { + "application/json" : { } } } } } }, - "/payment-options/organizations/{fiscal-code}/notices/{notice-number}": { - "get": { - "tags": [ - "Payment Options Resource" - ], - "summary": "Get payment options", - "description": "Retrieve the payment options related to the provided input", - "operationId": "getPaymentOptions", - "parameters": [ - { - "name": "fiscal-code", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "notice-number", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "idPsp", - "in": "query", - "schema": { - "type": "string" - } - }, - { - "name": "X-Session-Id", - "in": "header", - "schema": { - "type": "string" - } + "/payment-options/organizations/{fiscal-code}/notices/{notice-number}" : { + "get" : { + "tags" : [ "Payment Options Resource" ], + "summary" : "Get payment options", + "description" : "Retrieve the payment options related to the provided input", + "operationId" : "getPaymentOptions", + "parameters" : [ { + "name" : "fiscal-code", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "notice-number", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "idPsp", + "in" : "query", + "schema" : { + "type" : "string" + } + }, { + "name" : "X-Session-Id", + "in" : "header", + "schema" : { + "type" : "string" } - ], - "responses": { - "500": { - "$ref": "#/components/responses/ErrorResponse500" + } ], + "responses" : { + "500" : { + "$ref" : "#/components/responses/ErrorResponse500" }, - "400": { - "$ref": "#/components/responses/ErrorResponse400" + "400" : { + "$ref" : "#/components/responses/ErrorResponse400" }, - "404": { - "$ref": "#/components/responses/ErrorResponse404" + "404" : { + "$ref" : "#/components/responses/ErrorResponse404" }, - "200": { - "description": "Success", - "content": { - "application/json": {} + "200" : { + "description" : "Success", + "content" : { + "application/json" : { } } } } } } }, - "components": { - "schemas": { - "AppInfo": { - "type": "object", - "properties": { - "name": { - "type": "string" + "components" : { + "schemas" : { + "AppInfo" : { + "type" : "object", + "properties" : { + "name" : { + "type" : "string" }, - "version": { - "type": "string" + "version" : { + "type" : "string" }, - "environment": { - "type": "string" + "environment" : { + "type" : "string" } } }, - "ErrorResponse": { - "type": "object", - "properties": { - "httpStatusCode": { - "format": "int32", - "type": "integer", - "example": 500 + "ErrorResponse" : { + "type" : "object", + "properties" : { + "httpStatusCode" : { + "format" : "int32", + "type" : "integer", + "example" : 500 }, - "httpStatusDescription": { - "type": "string", - "example": "Internal Server Error" + "httpStatusDescription" : { + "type" : "string", + "example" : "Internal Server Error" }, - "errorMessage": { - "type": "string", - "example": "An unexpected error has occurred. Please contact support." + "errorMessage" : { + "type" : "string", + "example" : "An unexpected error has occurred. Please contact support." }, - "appErrorCode": { - "type": "string", - "example": "ODP-" + "appErrorCode" : { + "type" : "string", + "example" : "ODP-" }, - "timestamp": { - "format": "int64", - "type": "integer", - "example": 1724425035 + "timestamp" : { + "format" : "int64", + "type" : "integer", + "example" : 1724425035 }, - "dateTime": { - "type": "string", - "example": "2024-08-23T14:57:15.635528" + "dateTime" : { + "type" : "string", + "example" : "2024-08-23T14:57:15.635528" } } } }, - "responses": { - "ErrorResponse400": { - "description": "Default app exception for status 400", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "responses" : { + "ErrorResponse400" : { + "description" : "Default app exception for status 400", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "ErrorResponse404": { - "description": "Default app exception for status 404", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "ErrorResponse404" : { + "description" : "Default app exception for status 404", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" } } } }, - "ErrorResponse500": { - "description": "Internal Server Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" + "ErrorResponse500" : { + "description" : "Internal Server Error", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/ErrorResponse" } } } } }, - "securitySchemes": { - "ApiKey": { - "type": "apiKey", - "name": "Ocp-Apim-Subscription-Key", - "in": "header" + "securitySchemes" : { + "ApiKey" : { + "type" : "apiKey", + "name" : "Ocp-Apim-Subscription-Key", + "in" : "header" } } } -} +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index f5366c4..11762be 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -50,6 +50,7 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( RestClientBuilder builder = RestClientBuilder.newBuilder().baseUrl( new URL(String.format(endpoint, fiscalCode, noticeNumber))); + if (proxyHost != null && proxyPort != null) { builder = builder.proxyAddress(proxyHost, proxyPort.intValue()); } @@ -57,9 +58,7 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( CreditorInstitutionRestClientInterface.class); try (Response response = ecRestClientInterface.verifyPaymentOptions( - fiscalCode, noticeNumber, - targetHost, targetPort.intValue(), - targetPath)) { + targetHost, targetPort.intValue(), targetPath)) { return objectMapper.readValue( response.readEntity(String.class), PaymentOptionsResponse.class); diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java index 73f5ca4..67343cf 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java @@ -2,6 +2,7 @@ import jakarta.ws.rs.GET; import jakarta.ws.rs.HeaderParam; +import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.core.Response; @@ -12,12 +13,10 @@ */ public interface CreditorInstitutionRestClientInterface { - @GET - @Path("/payment-options/organizations/{fiscal-code}/notices/{notice-number}") + @POST + @Path("/forward") @ClientHeaderParam(name = "Ocp-Apim-Subscription-Key", value = "${CreditorInstitutionRestClient.ocpSubKey}") Response verifyPaymentOptions( - @PathParam("fiscal-code") String fiscalCode, - @PathParam("notice-number") String noticeNumber, @HeaderParam("X-Host-Url") String hostUrl, @HeaderParam("X-Host-Port") Integer hostPort, @HeaderParam("X-Host-Path") String hostPath diff --git a/src/main/java/it/gov/pagopa/payment/options/services/CreditorInstitutionService.java b/src/main/java/it/gov/pagopa/payment/options/services/CreditorInstitutionService.java index 073cffb..a07b2ef 100644 --- a/src/main/java/it/gov/pagopa/payment/options/services/CreditorInstitutionService.java +++ b/src/main/java/it/gov/pagopa/payment/options/services/CreditorInstitutionService.java @@ -9,6 +9,7 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import java.net.MalformedURLException; +import java.util.Optional; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,6 +25,9 @@ public class CreditorInstitutionService { @ConfigProperty(name = "CreditorInstitutionRestClient.apimEndpoint") String APIM_FORWARDER_ENDPOINT; + @ConfigProperty(name = "CreditorInstitutionRestClient.apimPath") + Optional APIM_FORWARDER_PATH; + static String PAYMENT_OPTIONS_SERVICE_SUFFIX = "/payment-options/organizations/%s/notices/%s"; @Inject @@ -50,8 +54,7 @@ public PaymentOptionsResponse getPaymentOptions( "[Payment Options] Station not configured to pass through the APIM Forwarder"); } - String endpoint = getEndpoint(station); - + String endpoint = getEndpoint(station, APIM_FORWARDER_PATH.orElse("")); if (station.getRestEndpoint() == null) { throw new PaymentOptionsException(AppErrorCodeEnum.ODP_SEMANTICA, @@ -70,8 +73,8 @@ public PaymentOptionsResponse getPaymentOptions( Long.parseLong(hostSplit[1]) : verifyEndpointParts[0].contains(ProtocolEnum.HTTPS.name().toLowerCase()) ? 443L : 80L; - targetPath = verifyEndpointParts[3].concat( - String.format(PAYMENT_OPTIONS_SERVICE_SUFFIX, fiscalCode, noticeNumber)); + String formattedPath = String.format(PAYMENT_OPTIONS_SERVICE_SUFFIX, fiscalCode, noticeNumber); + targetPath = verifyEndpointParts.length > 3 ? verifyEndpointParts[3].concat(formattedPath) : formattedPath; } catch (Exception e) { logger.error("[Payment Options] Malformed Target URL: {}", e.getMessage()); throw new PaymentOptionsException(AppErrorCodeEnum.ODP_SEMANTICA, e.getMessage()); @@ -92,14 +95,15 @@ public PaymentOptionsResponse getPaymentOptions( } - private static String getEndpoint(Station station) { + private static String getEndpoint(Station station, String apimForwarderPath) { return (station.getConnection().getProtocol() != null && (station.getConnection().getProtocol().equals(ProtocolEnum.HTTPS)) ? ProtocolEnum.HTTPS.name().toLowerCase() : station.getConnection().getProtocol().name().toLowerCase()) + "://" + station.getConnection().getIp() + ":" + (station.getConnection().getPort() != null ? - String.valueOf(station.getConnection().getPort()) : "80"); + String.valueOf(station.getConnection().getPort()) : "80") + .concat(apimForwarderPath); } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b8b7c2d..50b43f4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -83,6 +83,8 @@ ApiConfigCacheClient.ocpSubKey=${APICONFIG_SUBKEY:} CreditorInstitutionRestClient.ocpSubKey=${EC_APIM_SUBKEY:} CreditorInstitutionRestClient.apimEndpoint=${EC_APIM_FORWARDER_ENDPOINT:localhost:8083} +CreditorInstitutionRestClient.apimPath=${EC_APIM_PATH:/pagopa-node-forwarder/api/v1} + ################### ## OPENTELEMETRY diff --git a/src/test/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientTest.java b/src/test/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientTest.java index 1f6a8a1..697ed28 100644 --- a/src/test/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientTest.java +++ b/src/test/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientTest.java @@ -34,7 +34,7 @@ void callEcPaymentOptionsVerifyShouldReturnData() { PaymentOptionsResponse paymentOptionsResponse = assertDoesNotThrow(() -> creditorInstitutionRestClient.callEcPaymentOptionsVerify( wiremockUrl, null, null, - "http://externalService", 443L, "/externalPath", + "http://externalService", 443L, "/payment-options/organizations/77777777777/notices/311111111112222222", "77777777777", "311111111112222222")); assertNotNull(paymentOptionsResponse); } @@ -45,7 +45,7 @@ void callEcPaymentOptionsVerifyShouldReturnErrorResponse() { assertThrows(CreditorInstitutionException.class, () -> creditorInstitutionRestClient.callEcPaymentOptionsVerify( wiremockUrl, null, null, - "http://externalService", 443L, "/externalPath", + "http://externalService", 443L, "/payment-options/organizations/87777777777/notices/311111111112222222", "87777777777", "311111111112222222")); assertNotNull(exception); assertEquals(exception.getErrorResponse().getHttpStatusCode(), 500); @@ -57,7 +57,7 @@ void callEcPaymentOptionsVerifyShouldReturnErrorOnUnexpectedContent() { assertThrows(PaymentOptionsException.class, () -> creditorInstitutionRestClient.callEcPaymentOptionsVerify( wiremockUrl, null, null, - "http://externalService", 443L, "/externalPath", + "http://externalService", 443L, "/payment-options/organizations/97777777777/notices/311111111112222222", "97777777777", "311111111112222222")); assertNotNull(exception); } @@ -68,7 +68,7 @@ void callEcPaymentOptionsVerifyShouldReturnUnreachableKOWithoutErrorResponse() { assertThrows(PaymentOptionsException.class, () -> creditorInstitutionRestClient.callEcPaymentOptionsVerify( wiremockUrl, null, null, - "http://externalService", 443L, "/externalPath", + "http://externalService", 443L, "/payment-options/organizations/08888888888/notices/88888888888", "08888888888", "88888888888")); assertNotNull(exception); assertEquals(exception.getErrorCode(), AppErrorCodeEnum.ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE); @@ -80,7 +80,7 @@ void callEcPaymentOptionsVerifyShouldReturnExceptionOnMalformedUrl() { assertThrows(MalformedURLException.class, () -> creditorInstitutionRestClient.callEcPaymentOptionsVerify( "AAAAAAA", null, null, - "http://externalService", 443L, "/externalPath", + "http://externalService", 443L, "/payment-options/organizations/08888888888/notices/88888888888", "88888888888", "88888888888")); } @@ -89,7 +89,7 @@ void callEcPaymentOptionsVerifyShouldReturnExceptionOnWrongProxy() { assertThrows(Exception.class, () -> creditorInstitutionRestClient.callEcPaymentOptionsVerify( "AAAAAAA", "AAAAAAA%%%", 8081L, - "http://externalService", 443L, "/externalPath", + "http://externalService", 443L, "/payment-options/organizations/08888888888/notices/88888888888", "88888888888", "88888888888")); } diff --git a/src/test/java/it/gov/pagopa/payment/options/test/extensions/WireMockExtensions.java b/src/test/java/it/gov/pagopa/payment/options/test/extensions/WireMockExtensions.java index 8b292a1..5774f12 100644 --- a/src/test/java/it/gov/pagopa/payment/options/test/extensions/WireMockExtensions.java +++ b/src/test/java/it/gov/pagopa/payment/options/test/extensions/WireMockExtensions.java @@ -1,7 +1,9 @@ package it.gov.pagopa.payment.options.test.extensions; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import com.fasterxml.jackson.databind.ObjectMapper; @@ -50,7 +52,7 @@ public Map start() { .connection(Connection.builder() .protocol(ProtocolEnum.HTTP).ip("localhost") .port((long) wireMockServer.port()).build()) - .restEndpoint("https://localhost:9095/test") + .restEndpoint("https://localhost:9095") .build())) .creditorInstitutions(Map.of("77777777777", CreditorInstitution.builder() @@ -73,8 +75,9 @@ public Map start() { )); wireMockServer.stubFor( - get(urlEqualTo( - "/payment-options/organizations/97777777777/notices/311111111112222222")) + post(urlEqualTo( + "/forward")) + .withHeader("X-Host-Path", equalTo("/payment-options/organizations/97777777777/notices/311111111112222222")) .willReturn(aResponse() .withHeader("Content-Type", "application/json") .withBody("AAAAAAAA") @@ -82,8 +85,9 @@ public Map start() { ); wireMockServer.stubFor( - get(urlEqualTo( - "/payment-options/organizations/77777777777/notices/311111111112222222")) + post(urlEqualTo( + "/forward")) + .withHeader("X-Host-Path", equalTo("/payment-options/organizations/77777777777/notices/311111111112222222")) .willReturn(aResponse() .withHeader("Content-Type", "application/json") .withResponseBody( @@ -95,8 +99,9 @@ public Map start() { ); wireMockServer.stubFor( - get(urlEqualTo( - "/payment-options/organizations/87777777777/notices/311111111112222222")) + post(urlEqualTo( + "/forward")) + .withHeader("X-Host-Path", equalTo("/payment-options/organizations/87777777777/notices/311111111112222222")) .willReturn(aResponse() .withHeader("Content-Type", "application/json") .withStatus(412) @@ -119,6 +124,7 @@ public Map start() { "ApiConfigCacheClient.ocpSubKey", "test", "CreditorInstitutionRestClient.apimEndpoint", wireMockServer.baseUrl(), + "CreditorInstitutionRestClient.apimPath", "", "CreditorInstitutionRestClient.ocpSubKey", "test", "wiremock.port", String.valueOf(wireMockServer.port()) ); From c9f7b8700e03d07217f8ab9d0775717be84e12be Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 15:40:27 +0200 Subject: [PATCH 23/51] [PPANTT-131] feat: Updated openapi.json --- openapi/openapi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi/openapi.json b/openapi/openapi.json index 6023ccc..7ba1443 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title" : "PagoPa Payment Options (TEST)", "description" : "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService" : "https://www.pagopa.gov.it/", - "version" : "0.4.2-1-PPANTT-131-feat-add-integration-tests" + "version" : "0.4.2-3-PPANTT-131-feat-add-integration-tests" }, "servers" : [ { "url" : "http://localhost:8080", From 459cea48866f362e9702f32d3773a71d1c8f889c Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 14:54:49 +0000 Subject: [PATCH 24/51] Bump to version 0.4.2-4-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 +- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 284 ++++++++++++++++++++++-------------------- pom.xml | 2 +- 6 files changed, 156 insertions(+), 140 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 06977cd..1a7664c 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.72.0 -appVersion: 0.4.2-3-PPANTT-131-feat-add-integration-tests +version: 0.73.0 +appVersion: 0.4.2-4-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index f85851d..296c80b 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-3-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-4-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 9d829f9..e94f099 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-3-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-4-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 640c4f7..d2b3559 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-3-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-4-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 7ba1443..bfaeb5f 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -1,187 +1,203 @@ { - "openapi" : "3.0.3", - "info" : { - "title" : "PagoPa Payment Options (TEST)", - "description" : "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", - "termsOfService" : "https://www.pagopa.gov.it/", - "version" : "0.4.2-3-PPANTT-131-feat-add-integration-tests" + "openapi": "3.0.3", + "info": { + "title": "PagoPa Payment Options (TEST)", + "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", + "termsOfService": "https://www.pagopa.gov.it/", + "version": "0.4.2-4-PPANTT-131-feat-add-integration-tests" }, - "servers" : [ { - "url" : "http://localhost:8080", - "description" : "Localhost base URL" - }, { - "url" : "https://{host}/payment-options/service/v1", - "description" : "Base URL", - "variables" : { - "host" : { - "default" : "api.dev.platform.pagopa.it", - "enum" : [ "api.dev.platform.pagopa.it", "api.uat.platform.pagopa.it", "api.platform.pagopa.it" ] + "servers": [ + { + "url": "http://localhost:8080", + "description": "Localhost base URL" + }, + { + "url": "https://{host}/payment-options/service/v1", + "description": "Base URL", + "variables": { + "host": { + "default": "api.dev.platform.pagopa.it", + "enum": [ + "api.dev.platform.pagopa.it", + "api.uat.platform.pagopa.it", + "api.platform.pagopa.it" + ] + } } } - } ], - "paths" : { - "/info" : { - "get" : { - "tags" : [ "Generic" ], - "responses" : { - "200" : { - "description" : "OK", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/AppInfo" + ], + "paths": { + "/info": { + "get": { + "tags": [ + "Generic" + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppInfo" } } } }, - "400" : { - "description" : "Bad Request", - "content" : { - "application/json" : { } + "400": { + "description": "Bad Request", + "content": { + "application/json": {} } } } } }, - "/payment-options/organizations/{fiscal-code}/notices/{notice-number}" : { - "get" : { - "tags" : [ "Payment Options Resource" ], - "summary" : "Get payment options", - "description" : "Retrieve the payment options related to the provided input", - "operationId" : "getPaymentOptions", - "parameters" : [ { - "name" : "fiscal-code", - "in" : "path", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "notice-number", - "in" : "path", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "idPsp", - "in" : "query", - "schema" : { - "type" : "string" - } - }, { - "name" : "X-Session-Id", - "in" : "header", - "schema" : { - "type" : "string" + "/payment-options/organizations/{fiscal-code}/notices/{notice-number}": { + "get": { + "tags": [ + "Payment Options Resource" + ], + "summary": "Get payment options", + "description": "Retrieve the payment options related to the provided input", + "operationId": "getPaymentOptions", + "parameters": [ + { + "name": "fiscal-code", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "notice-number", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "idPsp", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "X-Session-Id", + "in": "header", + "schema": { + "type": "string" + } } - } ], - "responses" : { - "500" : { - "$ref" : "#/components/responses/ErrorResponse500" + ], + "responses": { + "500": { + "$ref": "#/components/responses/ErrorResponse500" }, - "400" : { - "$ref" : "#/components/responses/ErrorResponse400" + "400": { + "$ref": "#/components/responses/ErrorResponse400" }, - "404" : { - "$ref" : "#/components/responses/ErrorResponse404" + "404": { + "$ref": "#/components/responses/ErrorResponse404" }, - "200" : { - "description" : "Success", - "content" : { - "application/json" : { } + "200": { + "description": "Success", + "content": { + "application/json": {} } } } } } }, - "components" : { - "schemas" : { - "AppInfo" : { - "type" : "object", - "properties" : { - "name" : { - "type" : "string" + "components": { + "schemas": { + "AppInfo": { + "type": "object", + "properties": { + "name": { + "type": "string" }, - "version" : { - "type" : "string" + "version": { + "type": "string" }, - "environment" : { - "type" : "string" + "environment": { + "type": "string" } } }, - "ErrorResponse" : { - "type" : "object", - "properties" : { - "httpStatusCode" : { - "format" : "int32", - "type" : "integer", - "example" : 500 + "ErrorResponse": { + "type": "object", + "properties": { + "httpStatusCode": { + "format": "int32", + "type": "integer", + "example": 500 }, - "httpStatusDescription" : { - "type" : "string", - "example" : "Internal Server Error" + "httpStatusDescription": { + "type": "string", + "example": "Internal Server Error" }, - "errorMessage" : { - "type" : "string", - "example" : "An unexpected error has occurred. Please contact support." + "errorMessage": { + "type": "string", + "example": "An unexpected error has occurred. Please contact support." }, - "appErrorCode" : { - "type" : "string", - "example" : "ODP-" + "appErrorCode": { + "type": "string", + "example": "ODP-" }, - "timestamp" : { - "format" : "int64", - "type" : "integer", - "example" : 1724425035 + "timestamp": { + "format": "int64", + "type": "integer", + "example": 1724425035 }, - "dateTime" : { - "type" : "string", - "example" : "2024-08-23T14:57:15.635528" + "dateTime": { + "type": "string", + "example": "2024-08-23T14:57:15.635528" } } } }, - "responses" : { - "ErrorResponse400" : { - "description" : "Default app exception for status 400", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "responses": { + "ErrorResponse400": { + "description": "Default app exception for status 400", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "ErrorResponse404" : { - "description" : "Default app exception for status 404", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "ErrorResponse404": { + "description": "Default app exception for status 404", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } }, - "ErrorResponse500" : { - "description" : "Internal Server Error", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/ErrorResponse" + "ErrorResponse500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" } } } } }, - "securitySchemes" : { - "ApiKey" : { - "type" : "apiKey", - "name" : "Ocp-Apim-Subscription-Key", - "in" : "header" + "securitySchemes": { + "ApiKey": { + "type": "apiKey", + "name": "Ocp-Apim-Subscription-Key", + "in": "header" } } } -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index f1619ad..888f0b1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-3-PPANTT-131-feat-add-integration-tests + 0.4.2-4-PPANTT-131-feat-add-integration-tests 0.8.7 From 62b1e853af3f64dfe615e0144d0ab447f6def4aa Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 17:29:44 +0200 Subject: [PATCH 25/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../options/clients/CreditorInstitutionRestClient.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index 11762be..f619df7 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -47,6 +47,10 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( String fiscalCode, String noticeNumber) throws MalformedURLException { + logger.debug("[Payment Notice] Calling EC verify with {} endpoint, {} and {} port," + + " {} targetHost, {} target Port, {} targetPath, {} fiscalCode, {} noticeNumber", endpoint, proxyHost, proxyPort, + targetHost, targetPort, targetPath, fiscalCode, noticeNumber); + RestClientBuilder builder = RestClientBuilder.newBuilder().baseUrl( new URL(String.format(endpoint, fiscalCode, noticeNumber))); @@ -71,6 +75,7 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( } catch (Exception e) { logger.error("[Payment Options] Unable to call the station due to error: {}", e.getMessage()); + logger.error(e.getMessage(), e); throw new PaymentOptionsException( AppErrorCodeEnum.ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE, e.getMessage()); } From 133aed9e7d12381c90807b3827aea8b8e7c2cdc9 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 17:30:38 +0200 Subject: [PATCH 26/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- helm/values-dev.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 296c80b..bf73c40 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -76,7 +76,7 @@ microservice-chart: APP_NAME: "payment-options-service" APP_ENVIRONMENT: "dev" WEBSITE_SITE_NAME: 'payment-options-service' # required to show cloud role name in application insights - APP_LOGGING_LEVEL: 'DEBUG' + APP_LOG_LEVEL: 'DEBUG' DEFAULT_LOGGING_LEVEL: 'INFO' APICONFIG_CACHE_URL: 'https://api.dev.platform.pagopa.it/api-config-cache/p/v1' EC_APIM_FORWARDER_ENDPOINT: 'https://api.dev.platform.pagopa.it' From 7fa654dd0d8130f802db8af1a5f91000d88c1c53 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 15:32:38 +0000 Subject: [PATCH 27/51] Bump to version 0.4.2-5-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 1a7664c..2bf124f 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.73.0 -appVersion: 0.4.2-4-PPANTT-131-feat-add-integration-tests +version: 0.74.0 +appVersion: 0.4.2-5-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index bf73c40..d196452 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-4-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-5-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index e94f099..546626d 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-4-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-5-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index d2b3559..69a761e 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-4-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-5-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index bfaeb5f..fb40614 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-4-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-5-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 888f0b1..c4d40c0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-4-PPANTT-131-feat-add-integration-tests + 0.4.2-5-PPANTT-131-feat-add-integration-tests 0.8.7 From 31ee3be5fb8f4b3283d52901369f36c4e73ad74d Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 17:57:43 +0200 Subject: [PATCH 28/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../payment/options/clients/CreditorInstitutionRestClient.java | 2 +- .../payment/options/services/CreditorInstitutionService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index f619df7..cedb02a 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -48,7 +48,7 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( throws MalformedURLException { logger.debug("[Payment Notice] Calling EC verify with {} endpoint, {} and {} port," - + " {} targetHost, {} target Port, {} targetPath, {} fiscalCode, {} noticeNumber", endpoint, proxyHost, proxyPort, + + " {} targetHost, {} target port, {} targetPath, {} fiscalCode, {} noticeNumber", endpoint, proxyHost, proxyPort, targetHost, targetPort, targetPath, fiscalCode, noticeNumber); RestClientBuilder builder = diff --git a/src/main/java/it/gov/pagopa/payment/options/services/CreditorInstitutionService.java b/src/main/java/it/gov/pagopa/payment/options/services/CreditorInstitutionService.java index a07b2ef..8af92be 100644 --- a/src/main/java/it/gov/pagopa/payment/options/services/CreditorInstitutionService.java +++ b/src/main/java/it/gov/pagopa/payment/options/services/CreditorInstitutionService.java @@ -67,7 +67,7 @@ public PaymentOptionsResponse getPaymentOptions( try { String[] verifyEndpointParts = station.getRestEndpoint().split("/", 4); - targetHost = verifyEndpointParts[0] + verifyEndpointParts[2]; + targetHost = verifyEndpointParts[2]; String[] hostSplit = verifyEndpointParts[2].split(":"); targetPort = hostSplit.length > 1 ? Long.parseLong(hostSplit[1]) : From 3f8bbf6e845fbf0cb6c880d4170f73e1b736b25f Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 15:59:45 +0000 Subject: [PATCH 29/51] Bump to version 0.4.2-6-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 2bf124f..1ba7852 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.74.0 -appVersion: 0.4.2-5-PPANTT-131-feat-add-integration-tests +version: 0.75.0 +appVersion: 0.4.2-6-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index d196452..a423c23 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-5-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-6-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 546626d..5087eb5 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-5-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-6-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 69a761e..96671ec 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-5-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-6-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index fb40614..cdd353c 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-5-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-6-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index c4d40c0..3ba08c5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-5-PPANTT-131-feat-add-integration-tests + 0.4.2-6-PPANTT-131-feat-add-integration-tests 0.8.7 From b6ea4e4da87e6b0fe5a565d60457c23f78d9fab7 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 18:45:05 +0200 Subject: [PATCH 30/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../options/clients/CreditorInstitutionRestClient.java | 2 +- .../clients/CreditorInstitutionRestClientInterface.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index cedb02a..5179161 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -62,7 +62,7 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( CreditorInstitutionRestClientInterface.class); try (Response response = ecRestClientInterface.verifyPaymentOptions( - targetHost, targetPort.intValue(), targetPath)) { + targetHost, targetPort.intValue(), targetPath, "")) { return objectMapper.readValue( response.readEntity(String.class), PaymentOptionsResponse.class); diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java index 67343cf..4c11b93 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java @@ -7,6 +7,7 @@ import jakarta.ws.rs.PathParam; import jakarta.ws.rs.core.Response; import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam; +import org.jboss.resteasy.reactive.RestForm; /** * Template for the creditor institution REST client @@ -19,7 +20,8 @@ public interface CreditorInstitutionRestClientInterface { Response verifyPaymentOptions( @HeaderParam("X-Host-Url") String hostUrl, @HeaderParam("X-Host-Port") Integer hostPort, - @HeaderParam("X-Host-Path") String hostPath + @HeaderParam("X-Host-Path") String hostPath, + @RestForm String data ); } From ad3a9f77e0afed7f081cfa3f0ab12be80b6029a5 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 16:48:14 +0000 Subject: [PATCH 31/51] Bump to version 0.4.2-7-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 1ba7852..defe5e5 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.75.0 -appVersion: 0.4.2-6-PPANTT-131-feat-add-integration-tests +version: 0.76.0 +appVersion: 0.4.2-7-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index a423c23..5db2e50 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-6-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-7-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 5087eb5..60d0e10 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-6-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-7-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 96671ec..9cc27ca 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-6-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-7-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index cdd353c..1aa2d78 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-6-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-7-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 3ba08c5..93c1081 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-6-PPANTT-131-feat-add-integration-tests + 0.4.2-7-PPANTT-131-feat-add-integration-tests 0.8.7 From 85830bd8f46f4343fa9738c6e02f186f05436163 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 19:00:17 +0200 Subject: [PATCH 32/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../payment/options/clients/CreditorInstitutionRestClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index 5179161..1cc8f9f 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -62,7 +62,7 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( CreditorInstitutionRestClientInterface.class); try (Response response = ecRestClientInterface.verifyPaymentOptions( - targetHost, targetPort.intValue(), targetPath, "")) { + targetHost, targetPort.intValue(), targetPath, "TEST")) { return objectMapper.readValue( response.readEntity(String.class), PaymentOptionsResponse.class); From c48915f778989b12b5f69a0d118bfd8700543924 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 17:02:04 +0000 Subject: [PATCH 33/51] Bump to version 0.4.2-8-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index defe5e5..e982c7e 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.76.0 -appVersion: 0.4.2-7-PPANTT-131-feat-add-integration-tests +version: 0.77.0 +appVersion: 0.4.2-8-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 5db2e50..8d1ea59 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-7-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-8-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 60d0e10..b6c7156 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-7-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-8-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 9cc27ca..8210cc1 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-7-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-8-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 1aa2d78..2a8c1d4 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-7-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-8-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 93c1081..e23e022 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-7-PPANTT-131-feat-add-integration-tests + 0.4.2-8-PPANTT-131-feat-add-integration-tests 0.8.7 From e35f762ca19846a46c0e099840483b780f9d65c6 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 19:19:23 +0200 Subject: [PATCH 34/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../options/clients/CreditorInstitutionRestClient.java | 4 +++- .../clients/CreditorInstitutionRestClientInterface.java | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index 1cc8f9f..935f036 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -6,6 +6,7 @@ import it.gov.pagopa.payment.options.models.ErrorResponse; import it.gov.pagopa.payment.options.models.clients.creditorInstitution.PaymentOptionsResponse; import it.gov.pagopa.payment.options.models.enums.AppErrorCodeEnum; +import it.gov.pagopa.payment.options.models.events.odpRe.Properties; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import jakarta.ws.rs.core.Response; @@ -62,7 +63,8 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( CreditorInstitutionRestClientInterface.class); try (Response response = ecRestClientInterface.verifyPaymentOptions( - targetHost, targetPort.intValue(), targetPath, "TEST")) { + targetHost, targetPort.intValue(), targetPath, + Properties.builder().serviceIdentifier("ODP").build())) { return objectMapper.readValue( response.readEntity(String.class), PaymentOptionsResponse.class); diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java index 4c11b93..f2926ce 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java @@ -1,12 +1,15 @@ package it.gov.pagopa.payment.options.clients; +import it.gov.pagopa.payment.options.models.events.odpRe.Properties; import jakarta.ws.rs.GET; import jakarta.ws.rs.HeaderParam; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam; +import org.jboss.resteasy.reactive.PartType; import org.jboss.resteasy.reactive.RestForm; /** @@ -21,7 +24,7 @@ Response verifyPaymentOptions( @HeaderParam("X-Host-Url") String hostUrl, @HeaderParam("X-Host-Port") Integer hostPort, @HeaderParam("X-Host-Path") String hostPath, - @RestForm String data + @RestForm @PartType(MediaType.APPLICATION_JSON) Properties properties ); } From c6a10d873b4dc3813d99b173b56e4298e3089909 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 17:31:55 +0000 Subject: [PATCH 35/51] Bump to version 0.4.2-9-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index e982c7e..1c7c707 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.77.0 -appVersion: 0.4.2-8-PPANTT-131-feat-add-integration-tests +version: 0.78.0 +appVersion: 0.4.2-9-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 8d1ea59..86f137d 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-8-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-9-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index b6c7156..9749385 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-8-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-9-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 8210cc1..17f6a2d 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-8-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-9-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 2a8c1d4..f2ac7b3 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-8-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-9-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index e23e022..2fe7094 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-8-PPANTT-131-feat-add-integration-tests + 0.4.2-9-PPANTT-131-feat-add-integration-tests 0.8.7 From b522f65a692c0c121c126f9b8ab9c06c1080b48b Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Mon, 30 Sep 2024 19:48:02 +0200 Subject: [PATCH 36/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../clients/CreditorInstitutionRestClientInterface.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java index f2926ce..466b9f2 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java @@ -8,6 +8,7 @@ import jakarta.ws.rs.PathParam; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; +import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam; import org.jboss.resteasy.reactive.PartType; import org.jboss.resteasy.reactive.RestForm; @@ -24,7 +25,7 @@ Response verifyPaymentOptions( @HeaderParam("X-Host-Url") String hostUrl, @HeaderParam("X-Host-Port") Integer hostPort, @HeaderParam("X-Host-Path") String hostPath, - @RestForm @PartType(MediaType.APPLICATION_JSON) Properties properties + Properties data ); } From 183e9266987afa180777841f01dc55129d57103f Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 30 Sep 2024 17:49:43 +0000 Subject: [PATCH 37/51] Bump to version 0.4.2-10-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 1c7c707..c03c0dd 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.78.0 -appVersion: 0.4.2-9-PPANTT-131-feat-add-integration-tests +version: 0.79.0 +appVersion: 0.4.2-10-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 86f137d..a823df7 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-9-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-10-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 9749385..792873d 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-9-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-10-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 17f6a2d..3713da5 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-9-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-10-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index f2ac7b3..8aa65c8 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-9-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-10-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 2fe7094..f3e16d9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-9-PPANTT-131-feat-add-integration-tests + 0.4.2-10-PPANTT-131-feat-add-integration-tests 0.8.7 From b14e5463db6d68f6163e9e69a5f3da88a671f6f8 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Tue, 1 Oct 2024 00:12:14 +0000 Subject: [PATCH 38/51] Bump to version 0.4.2-11-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index c03c0dd..80ca874 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.79.0 -appVersion: 0.4.2-10-PPANTT-131-feat-add-integration-tests +version: 0.80.0 +appVersion: 0.4.2-11-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index a823df7..46d90c2 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-10-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-11-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 792873d..70bc962 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-10-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-11-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 3713da5..0f7db97 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-10-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-11-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 8aa65c8..75e6d41 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-10-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-11-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index f3e16d9..9752dc5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-10-PPANTT-131-feat-add-integration-tests + 0.4.2-11-PPANTT-131-feat-add-integration-tests 0.8.7 From c37497692027c2255058ab23e051dfd1d13ade27 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 09:30:04 +0200 Subject: [PATCH 39/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../CreditorInstitutionRestClient.java | 3 +- ...reditorInstitutionRestClientInterface.java | 2 +- .../options/resources/MockedResource.java | 124 ++++++++++++++++++ 3 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 src/main/java/it/gov/pagopa/payment/options/resources/MockedResource.java diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index 935f036..952e159 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -63,8 +63,7 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( CreditorInstitutionRestClientInterface.class); try (Response response = ecRestClientInterface.verifyPaymentOptions( - targetHost, targetPort.intValue(), targetPath, - Properties.builder().serviceIdentifier("ODP").build())) { + targetHost, targetPort.intValue(), targetPath, "ODP")) { return objectMapper.readValue( response.readEntity(String.class), PaymentOptionsResponse.class); diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java index 466b9f2..8aa7830 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java @@ -25,7 +25,7 @@ Response verifyPaymentOptions( @HeaderParam("X-Host-Url") String hostUrl, @HeaderParam("X-Host-Port") Integer hostPort, @HeaderParam("X-Host-Path") String hostPath, - Properties data + String data ); } diff --git a/src/main/java/it/gov/pagopa/payment/options/resources/MockedResource.java b/src/main/java/it/gov/pagopa/payment/options/resources/MockedResource.java new file mode 100644 index 0000000..1944251 --- /dev/null +++ b/src/main/java/it/gov/pagopa/payment/options/resources/MockedResource.java @@ -0,0 +1,124 @@ +package it.gov.pagopa.payment.options.resources; + +import it.gov.pagopa.payment.options.exception.CreditorInstitutionException; +import it.gov.pagopa.payment.options.models.ErrorResponse; +import it.gov.pagopa.payment.options.models.clients.cache.BrokerCreditorInstitution; +import it.gov.pagopa.payment.options.models.clients.cache.BrokerPsp; +import it.gov.pagopa.payment.options.models.clients.cache.ConfigDataV1; +import it.gov.pagopa.payment.options.models.clients.cache.Connection; +import it.gov.pagopa.payment.options.models.clients.cache.Connection.ProtocolEnum; +import it.gov.pagopa.payment.options.models.clients.cache.CreditorInstitution; +import it.gov.pagopa.payment.options.models.clients.cache.PaymentServiceProvider; +import it.gov.pagopa.payment.options.models.clients.cache.Station; +import it.gov.pagopa.payment.options.models.clients.cache.StationCreditorInstitution; +import it.gov.pagopa.payment.options.models.clients.creditorInstitution.Installment; +import it.gov.pagopa.payment.options.models.clients.creditorInstitution.PaymentOption; +import it.gov.pagopa.payment.options.models.clients.creditorInstitution.PaymentOptionsResponse; +import it.gov.pagopa.payment.options.models.enums.EnumInstallment; +import it.gov.pagopa.payment.options.models.enums.EnumPo; +import it.gov.pagopa.payment.options.services.PaymentOptionsService; +import jakarta.inject.Inject; +import jakarta.ws.rs.*; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response.Status; +import org.eclipse.microprofile.openapi.annotations.Operation; +import org.eclipse.microprofile.openapi.annotations.media.Content; +import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; +import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; +import org.jboss.resteasy.reactive.RestResponse; +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + +/** + * Exposes mocked REST interfaces for the payment options services + */ +@Path("/mock") +@Produces(value = MediaType.APPLICATION_JSON) +public class MockedResource { + + + @GET + @Path("/payment-options/organizations/{fiscal-code}/notices/{notice-number}") + public RestResponse getPaymentOptions( + @PathParam("fiscal-code") String fiscalCode, + @PathParam("notice-number") String noticeNumber + ) { + if (fiscalCode.equals("77777777777") && noticeNumber.equals("311111111111111111")) { + return RestResponse.status(Status.OK, + PaymentOptionsResponse.builder() + .paFullName("EC") + .paOfficeName("EC") + .paTaxCode("99999000013") + .standin(true) + .paymentOptions(Collections.singletonList( + PaymentOption.builder() + .allCCP(true) + .amount(120L) + .description("Test Opt Inst - unica opzione") + .dueDate("2024-10-30T23:59:59") + .validFrom("2024-10-30T23:59:59") + .status(EnumPo.PO_UNPAID) + .numberOfInstallments(1) + .statusReason("Unpaid") + .installments(Collections.singletonList( + Installment.builder() + .amount(120L) + .description("Test Opt Inst - unica opzione") + .iuv("347000000880099993") + .nav("47000000880099993") + .validFrom("2024-10-30T23:59:59") + .dueDate("2024-10-30T23:59:59") + .status(EnumInstallment.POI_UNPAID) + .statusReason("Description") + .build() + )) + .build() + )) + .build()); + } else { + throw new CreditorInstitutionException(ErrorResponse.builder() + .httpStatusCode(500) + .httpStatusDescription("Error") + .appErrorCode("ODB_ERRID") + .errorMessage("TEST") + .build(), "Mock Error"); + } + + } + + + @GET + @Path("/cache") + public ConfigDataV1 getCache() { + return ConfigDataV1 + .builder() + .psps(Map.of("00001", + PaymentServiceProvider.builder().enabled(true).build())) + .stations(Map.of("00001", + Station.builder().stationCode("00001").enabled(true).verifyPaymentOptionEnabled(true) + .connection(Connection.builder() + .protocol(ProtocolEnum.HTTP).ip("localhost") + .port(8080L) + .build()) + .restEndpoint("https://localhost:9095/test") + .build())) + .creditorInstitutions(Map.of("77777777777", + CreditorInstitution.builder() + .creditorInstitutionCode("77777777777").enabled(true).build())) + .pspBrokers(Map.of("00001", BrokerPsp.builder().enabled(true).build())) + .creditorInstitutionStations(Map.of("00001", + StationCreditorInstitution.builder() + .creditorInstitutionCode("77777777777").stationCode("00001") + .auxDigit(3L) + .segregationCode(11L) + .build()) + ) + .creditorInstitutionBrokers( + Map.of("00001", BrokerCreditorInstitution.builder() + .enabled(true).build()) + ) + .build(); + } + +} From 6bf9d381c4fa48215406548df5b6dec3a058289c Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Tue, 1 Oct 2024 07:44:20 +0000 Subject: [PATCH 40/51] Bump to version 0.4.2-12-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 80ca874..0c6cbbc 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.80.0 -appVersion: 0.4.2-11-PPANTT-131-feat-add-integration-tests +version: 0.81.0 +appVersion: 0.4.2-12-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 46d90c2..6dec2fd 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-11-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-12-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 70bc962..e844a49 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-11-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-12-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 0f7db97..17df676 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-11-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-12-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 75e6d41..86a4edf 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-11-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-12-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 9752dc5..6e4902f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-11-PPANTT-131-feat-add-integration-tests + 0.4.2-12-PPANTT-131-feat-add-integration-tests 0.8.7 From 66b8eb192693c6504f65d9961d5778fccf023255 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 10:27:30 +0200 Subject: [PATCH 41/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../CreditorInstitutionRestClient.java | 2 +- ...reditorInstitutionRestClientInterface.java | 3 +- .../options/resources/MockedResource.java | 124 ------------------ 3 files changed, 2 insertions(+), 127 deletions(-) delete mode 100644 src/main/java/it/gov/pagopa/payment/options/resources/MockedResource.java diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index 952e159..acb1082 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -63,7 +63,7 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( CreditorInstitutionRestClientInterface.class); try (Response response = ecRestClientInterface.verifyPaymentOptions( - targetHost, targetPort.intValue(), targetPath, "ODP")) { + targetHost, targetPort.intValue(), targetPath)) { return objectMapper.readValue( response.readEntity(String.class), PaymentOptionsResponse.class); diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java index 8aa7830..593a881 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClientInterface.java @@ -24,8 +24,7 @@ public interface CreditorInstitutionRestClientInterface { Response verifyPaymentOptions( @HeaderParam("X-Host-Url") String hostUrl, @HeaderParam("X-Host-Port") Integer hostPort, - @HeaderParam("X-Host-Path") String hostPath, - String data + @HeaderParam("X-Host-Path") String hostPath ); } diff --git a/src/main/java/it/gov/pagopa/payment/options/resources/MockedResource.java b/src/main/java/it/gov/pagopa/payment/options/resources/MockedResource.java deleted file mode 100644 index 1944251..0000000 --- a/src/main/java/it/gov/pagopa/payment/options/resources/MockedResource.java +++ /dev/null @@ -1,124 +0,0 @@ -package it.gov.pagopa.payment.options.resources; - -import it.gov.pagopa.payment.options.exception.CreditorInstitutionException; -import it.gov.pagopa.payment.options.models.ErrorResponse; -import it.gov.pagopa.payment.options.models.clients.cache.BrokerCreditorInstitution; -import it.gov.pagopa.payment.options.models.clients.cache.BrokerPsp; -import it.gov.pagopa.payment.options.models.clients.cache.ConfigDataV1; -import it.gov.pagopa.payment.options.models.clients.cache.Connection; -import it.gov.pagopa.payment.options.models.clients.cache.Connection.ProtocolEnum; -import it.gov.pagopa.payment.options.models.clients.cache.CreditorInstitution; -import it.gov.pagopa.payment.options.models.clients.cache.PaymentServiceProvider; -import it.gov.pagopa.payment.options.models.clients.cache.Station; -import it.gov.pagopa.payment.options.models.clients.cache.StationCreditorInstitution; -import it.gov.pagopa.payment.options.models.clients.creditorInstitution.Installment; -import it.gov.pagopa.payment.options.models.clients.creditorInstitution.PaymentOption; -import it.gov.pagopa.payment.options.models.clients.creditorInstitution.PaymentOptionsResponse; -import it.gov.pagopa.payment.options.models.enums.EnumInstallment; -import it.gov.pagopa.payment.options.models.enums.EnumPo; -import it.gov.pagopa.payment.options.services.PaymentOptionsService; -import jakarta.inject.Inject; -import jakarta.ws.rs.*; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response.Status; -import org.eclipse.microprofile.openapi.annotations.Operation; -import org.eclipse.microprofile.openapi.annotations.media.Content; -import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; -import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; -import org.jboss.resteasy.reactive.RestResponse; -import java.util.Collections; -import java.util.Map; -import java.util.UUID; - -/** - * Exposes mocked REST interfaces for the payment options services - */ -@Path("/mock") -@Produces(value = MediaType.APPLICATION_JSON) -public class MockedResource { - - - @GET - @Path("/payment-options/organizations/{fiscal-code}/notices/{notice-number}") - public RestResponse getPaymentOptions( - @PathParam("fiscal-code") String fiscalCode, - @PathParam("notice-number") String noticeNumber - ) { - if (fiscalCode.equals("77777777777") && noticeNumber.equals("311111111111111111")) { - return RestResponse.status(Status.OK, - PaymentOptionsResponse.builder() - .paFullName("EC") - .paOfficeName("EC") - .paTaxCode("99999000013") - .standin(true) - .paymentOptions(Collections.singletonList( - PaymentOption.builder() - .allCCP(true) - .amount(120L) - .description("Test Opt Inst - unica opzione") - .dueDate("2024-10-30T23:59:59") - .validFrom("2024-10-30T23:59:59") - .status(EnumPo.PO_UNPAID) - .numberOfInstallments(1) - .statusReason("Unpaid") - .installments(Collections.singletonList( - Installment.builder() - .amount(120L) - .description("Test Opt Inst - unica opzione") - .iuv("347000000880099993") - .nav("47000000880099993") - .validFrom("2024-10-30T23:59:59") - .dueDate("2024-10-30T23:59:59") - .status(EnumInstallment.POI_UNPAID) - .statusReason("Description") - .build() - )) - .build() - )) - .build()); - } else { - throw new CreditorInstitutionException(ErrorResponse.builder() - .httpStatusCode(500) - .httpStatusDescription("Error") - .appErrorCode("ODB_ERRID") - .errorMessage("TEST") - .build(), "Mock Error"); - } - - } - - - @GET - @Path("/cache") - public ConfigDataV1 getCache() { - return ConfigDataV1 - .builder() - .psps(Map.of("00001", - PaymentServiceProvider.builder().enabled(true).build())) - .stations(Map.of("00001", - Station.builder().stationCode("00001").enabled(true).verifyPaymentOptionEnabled(true) - .connection(Connection.builder() - .protocol(ProtocolEnum.HTTP).ip("localhost") - .port(8080L) - .build()) - .restEndpoint("https://localhost:9095/test") - .build())) - .creditorInstitutions(Map.of("77777777777", - CreditorInstitution.builder() - .creditorInstitutionCode("77777777777").enabled(true).build())) - .pspBrokers(Map.of("00001", BrokerPsp.builder().enabled(true).build())) - .creditorInstitutionStations(Map.of("00001", - StationCreditorInstitution.builder() - .creditorInstitutionCode("77777777777").stationCode("00001") - .auxDigit(3L) - .segregationCode(11L) - .build()) - ) - .creditorInstitutionBrokers( - Map.of("00001", BrokerCreditorInstitution.builder() - .enabled(true).build()) - ) - .build(); - } - -} From a0a4ee566e653fbc75bf69defd79529a167b9b40 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Tue, 1 Oct 2024 08:29:38 +0000 Subject: [PATCH 42/51] Bump to version 0.4.2-13-PPANTT-131-feat-add-integration-tests [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 0c6cbbc..d8f9345 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-payment-options description: Microservice that handles services for payment options type: application -version: 0.81.0 -appVersion: 0.4.2-12-PPANTT-131-feat-add-integration-tests +version: 0.82.0 +appVersion: 0.4.2-13-PPANTT-131-feat-add-integration-tests dependencies: - name: microservice-chart version: 5.9.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 6dec2fd..0bd27e3 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-12-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-13-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index e844a49..e2ea73f 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-12-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-13-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 17df676..8d5e6bc 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "payment-options" image: repository: ghcr.io/pagopa/pagopa-payment-options-service - tag: "0.4.2-12-PPANTT-131-feat-add-integration-tests" + tag: "0.4.2-13-PPANTT-131-feat-add-integration-tests" pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 86a4edf..ecf4ff3 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "title": "PagoPa Payment Options (TEST)", "description": "PagoPa Payment Options service \n ### APP ERROR CODES ### \n\n\n
Details\n **NAME** | **HTTP STATUS CODE** | **DESCRIPTION** \n- | - | - \n **ODP-001** | *Bad Request* | ODP-SINTASSI. Errore riportato in caso di errore di sintassi nel contenuto della richiesta verso ODP\n **ODP-002** | *Not Found* | ODP_PSP_SCONOSCIUTO. Errore riportato in caso non sia presente fra i dati ottenuti da config-cache un psp coincidente con l’id fornito in input\n **ODP-003** | *Bad Request* | ODP_PSP_DISABILITATO. Errore riportato in caso il psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-004** | *Not Found* | ODP_INTERMEDIARIO_PSP_SCONOSCIUTO. Errore riportato in caso il broker psp coincidente con i dati forniti in input non sia presente nei dati ottenuti da config-cache\n **ODP-005** | *Bad Request* | ODP_INTERMEDIARIO_PSP_DISABILITATO. Errore riportato in caso il broker psp coincidente con l’id fornito in input risulti disabilitato\n **ODP-006** | *Unauthorized* | ODP_AUTENTICAZIONE. Errore di autenticazione rispetto ai dati forniti\n **ODP-007** | *Forbidden* | ODP_AUTORIZZAZIONE. Errore di autorizzazione rispetto ai dati forniti\n **ODP-008** | *Bad Request* | ODP_SEMANTICA. Errore fornito in caso della presenza di casi d’invalidità semantica nei dati del flusso di verifica\n **ODP-009** | *Not Found* | ODP_STAZIONE_INT_PA_SCONOSCIUTA. Errore forninca in caso di assenza associazione stazione e PA\n **ODP-0099** | *Bad Request* | ODP_STAZIONE_INT_PA_DISABILITATA. Errore riportato in caso la stazione coincidente con l’id fornito in input risulti disabilitato\n **ODP-010** | *Service Unavailable* | ODP_STAZIONE_INT_PA_IRRAGGIUNGIBILE. Errore fornito in caso d’irraggiungibilità della stazione\n **ODP-011** | *Bad Request* | ODP_STAZIONE_INT_PA_SERVIZIO_NON_ATTIVO. Errore fornito in caso di servizio non attivo\n **ODP-012** | *Internal Server Error* | ODP_STAZIONE_INT_PA_TIMEOUT. Errore fornito in caso di timeout della stazione\n **ODP-013** | *Internal Server Error* | ODP_ERRORE_EMESSO_DA_PAA. Errore fornito in caso di errori da PAA\n **ODP-014** | *Bad Request* | ODP_STAZIONE_INT_PA_ERRORE_RESPONSE. Errore fornito in caso di risposta KO dalla stazione\n **ODP-015** | *Bad Request* | ODP_PSP_NAV_NOT_NMU. Errore fornito nel caso in cui il nav non sia valido per il flusso OdP\n **ODP-016** | *Bad Request* | ODP_SYSTEM_ERROR Codice d’errore generico\n **ODP-017** | *Internal Server Error* | ODP_SYSTEM_ERROR. Codice d’errore generico\n **ODP-018** | *Bad Request* | ODP_INTERMEDIARIO_PA_DISABILITATO\n **ODP-019** | *Not Found* | ODP_INTERMEDIARIO_PA_SCONOSCIUTO\n **ODP-020** | *Bad Request* | ODP_DOMINIO_DISABILITATO\n **ODP-021** | *Not Found* | ODP_DOMINIO_SCONOSCIUTO \n\n
\n", "termsOfService": "https://www.pagopa.gov.it/", - "version": "0.4.2-12-PPANTT-131-feat-add-integration-tests" + "version": "0.4.2-13-PPANTT-131-feat-add-integration-tests" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 6e4902f..ed316bd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ it.gov.pagopa payment-options-service Payment Options Service - 0.4.2-12-PPANTT-131-feat-add-integration-tests + 0.4.2-13-PPANTT-131-feat-add-integration-tests 0.8.7 From 8f2bccecc2662a1790d351d82755dce41168ef95 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 15:41:15 +0200 Subject: [PATCH 43/51] [PPANTT-131] feat: Updated int. tests --- integration-test/src/config/.env.dev | 2 ++ integration-test/src/config/.env.local | 2 ++ integration-test/src/config/.env.uat | 2 ++ .../src/features/get_payment_options.feature | 10 ++++++++++ .../src/step_definitions/payment_options_step.js | 8 ++++++++ 5 files changed, 24 insertions(+) diff --git a/integration-test/src/config/.env.dev b/integration-test/src/config/.env.dev index 1f7a3a7..c9338e2 100644 --- a/integration-test/src/config/.env.dev +++ b/integration-test/src/config/.env.dev @@ -10,6 +10,8 @@ INVALID_NOTICE_NUMBER=111111111111111111 DISABLED_STATION_NOTICE_NUMBER=313111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 +ERROR_STATION_NOTICE_NUMBER=311111111119999999 +WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 diff --git a/integration-test/src/config/.env.local b/integration-test/src/config/.env.local index d6d08d8..6ccc391 100644 --- a/integration-test/src/config/.env.local +++ b/integration-test/src/config/.env.local @@ -10,6 +10,8 @@ INVALID_NOTICE_NUMBER=111111111111111111 DISABLED_STATION_NOTICE_NUMBER=313111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 +ERROR_STATION_NOTICE_NUMBER=311111111119999999 +WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 diff --git a/integration-test/src/config/.env.uat b/integration-test/src/config/.env.uat index 31317f6..3d7e164 100644 --- a/integration-test/src/config/.env.uat +++ b/integration-test/src/config/.env.uat @@ -10,6 +10,8 @@ INVALID_NOTICE_NUMBER=111111111111111111 DISABLED_STATION_NOTICE_NUMBER=313111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 +ERROR_STATION_NOTICE_NUMBER=311111111119999999 +WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index 45308cd..047925c 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -56,3 +56,13 @@ Feature: Get Payment Options And payments options has size 2 And payments option n 0 has 1 installments And payments option n 1 has 1 installments + + Scenario: PAA Wrong System Error + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "wrong" and idPsp "valid" + Then response has a 400 Http status + And has error code "PAA_STAZIONE_INT_ERRATA" + + Scenario: PAA System Error + When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "error" and idPsp "valid" + Then response has a 400 Http status + And has error code "PAA_SYSTEM_ERROR" diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index c1fc19b..16b19d9 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -12,6 +12,8 @@ const invalidStationNoticeNumber = process.env.INVALID_NOTICE_NUMBER; const disabledStationNoticeNumber = process.env.DISABLED_STATION_NOTICE_NUMBER; const disabledOdpStationNoticeNumber = process.env.DISABLED_STATION_ODP_NOTICE_NUMBER; const missingStationNoticeNumber = process.env.MISSING_STATION_NOTICE_NUMBER; +const errorNoticeNumber = process.env.ERROR_STATION_NOTICE_NUMBER; +const wrongNoticeNumber = process.env.WRONG_STATION_NOTICE_NUMBER; const invalidPsp = process.env.UNAUTHORIZED_PSP; const validPsp = process.env.VALID_PSP; @@ -70,6 +72,12 @@ When('an Http GET request is sent to recover payment options for taxCode {string case "co-oblidged": selectedNoticeNumber = coOptNoticeNumber; break; + case "wrong": + selectedNoticeNumber = wrongNoticeNumber; + break; + case "error": + selectedNoticeNumber = errorNoticeNumber; + break; } switch (idPsp) { From 96429e3148b64a51c48d3e6293ced6596f748ae5 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 16:01:37 +0200 Subject: [PATCH 44/51] [PPANTT-131] feat: Updated payment_options_step.js tests --- integration-test/src/step_definitions/payment_options_step.js | 1 + 1 file changed, 1 insertion(+) diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index 16b19d9..724d367 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -98,6 +98,7 @@ Then('payments options has size {int}', function (expectedSize) { }); Then('payments option n {int} has {int} installments', function (i, expectedSize) { + console.logs(this.response?.data?.paymentOptions); assert.strictEqual(this.response?.data?.paymentOptions[i - 1].installments.length, expectedSize); }); From 70cdeb8d9ac239b0de95eb904d19e758ed3d3f11 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 16:11:48 +0200 Subject: [PATCH 45/51] [PPANTT-131] feat: Updated payment_options_step.js tests --- integration-test/src/step_definitions/payment_options_step.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index 724d367..a75c531 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -98,7 +98,7 @@ Then('payments options has size {int}', function (expectedSize) { }); Then('payments option n {int} has {int} installments', function (i, expectedSize) { - console.logs(this.response?.data?.paymentOptions); + console.log(this.response?.data?.paymentOptions); assert.strictEqual(this.response?.data?.paymentOptions[i - 1].installments.length, expectedSize); }); From 67a177032ecefddbb5e9b418a2765fb75e795b3d Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 16:17:59 +0200 Subject: [PATCH 46/51] [PPANTT-131] feat: Updated payment_options_step.js tests --- .../src/features/get_payment_options.feature | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index 047925c..11bb90a 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -33,29 +33,29 @@ Feature: Get Payment Options When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "single" and idPsp "valid" Then response has a 200 Http status And payments options has size 1 - And payments option n 0 has 1 installments + And payments option n 1 has 1 installments Scenario: Retrieve Payment Options (Opzione Unica + Unico Piano Rateale) When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "singleAndMultiple" and idPsp "valid" Then response has a 200 Http status And payments options has size 2 - And payments option n 0 has 1 installments - And payments option n 1 has 3 installments + And payments option n 1 has 1 installments + And payments option n 2 has 3 installments Scenario: Retrieve Payment Options (Opzione Unica + Molteplici Piani Rateali) When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "singleAndManyMultiples" and idPsp "valid" Then response has a 200 Http status And payments options has size 3 - And payments option n 0 has 1 installments - And payments option n 1 has 3 installments - And payments option n 2 has 5 installments + And payments option n 1 has 1 installments + And payments option n 2 has 3 installments + And payments option n 3 has 5 installments Scenario: Retrieve Payment Options (Co-Obbligati) When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "co-oblidged" and idPsp "valid" Then response has a 200 Http status And payments options has size 2 - And payments option n 0 has 1 installments And payments option n 1 has 1 installments + And payments option n 2 has 1 installments Scenario: PAA Wrong System Error When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "wrong" and idPsp "valid" From d4455f914ba6556e3c654826f9d3c9b318d71dde Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 16:27:51 +0200 Subject: [PATCH 47/51] [PPANTT-131] feat: Updated payment_options_step.js tests --- integration-test/src/config/.env.dev | 2 +- integration-test/src/config/.env.local | 2 +- integration-test/src/config/.env.uat | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration-test/src/config/.env.dev b/integration-test/src/config/.env.dev index c9338e2..e6548c5 100644 --- a/integration-test/src/config/.env.dev +++ b/integration-test/src/config/.env.dev @@ -10,7 +10,7 @@ INVALID_NOTICE_NUMBER=111111111111111111 DISABLED_STATION_NOTICE_NUMBER=313111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 -ERROR_STATION_NOTICE_NUMBER=311111111119999999 +ERROR_STATION_NOTICE_NUMBER=311199999999999999 WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 diff --git a/integration-test/src/config/.env.local b/integration-test/src/config/.env.local index 6ccc391..79b7258 100644 --- a/integration-test/src/config/.env.local +++ b/integration-test/src/config/.env.local @@ -10,7 +10,7 @@ INVALID_NOTICE_NUMBER=111111111111111111 DISABLED_STATION_NOTICE_NUMBER=313111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 -ERROR_STATION_NOTICE_NUMBER=311111111119999999 +ERROR_STATION_NOTICE_NUMBER=311199999999999999 WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 diff --git a/integration-test/src/config/.env.uat b/integration-test/src/config/.env.uat index 3d7e164..eea2600 100644 --- a/integration-test/src/config/.env.uat +++ b/integration-test/src/config/.env.uat @@ -10,7 +10,7 @@ INVALID_NOTICE_NUMBER=111111111111111111 DISABLED_STATION_NOTICE_NUMBER=313111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 MISSING_STATION_NOTICE_NUMBER=399111111111111111 -ERROR_STATION_NOTICE_NUMBER=311111111119999999 +ERROR_STATION_NOTICE_NUMBER=311199999999999999 WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA VALID_PSP=99999000001 From 157c607e7849cf69d76400b38511c0b259048171 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 17:08:29 +0200 Subject: [PATCH 48/51] [PPANTT-131] feat: Updated payment_options_step.js tests --- integration-test/src/config/.env.dev | 3 +-- integration-test/src/config/.env.local | 3 +-- integration-test/src/config/.env.uat | 3 +-- integration-test/src/features/get_payment_options.feature | 5 ----- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/integration-test/src/config/.env.dev b/integration-test/src/config/.env.dev index e6548c5..bd804a2 100644 --- a/integration-test/src/config/.env.dev +++ b/integration-test/src/config/.env.dev @@ -7,9 +7,8 @@ SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 INVALID_NOTICE_NUMBER=111111111111111111 -DISABLED_STATION_NOTICE_NUMBER=313111111111111111 +DISABLED_STATION_NOTICE_NUMBER=399111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 -MISSING_STATION_NOTICE_NUMBER=399111111111111111 ERROR_STATION_NOTICE_NUMBER=311199999999999999 WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA diff --git a/integration-test/src/config/.env.local b/integration-test/src/config/.env.local index 79b7258..be6dcf4 100644 --- a/integration-test/src/config/.env.local +++ b/integration-test/src/config/.env.local @@ -7,9 +7,8 @@ SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 INVALID_NOTICE_NUMBER=111111111111111111 -DISABLED_STATION_NOTICE_NUMBER=313111111111111111 +DISABLED_STATION_NOTICE_NUMBER=399111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 -MISSING_STATION_NOTICE_NUMBER=399111111111111111 ERROR_STATION_NOTICE_NUMBER=311199999999999999 WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA diff --git a/integration-test/src/config/.env.uat b/integration-test/src/config/.env.uat index eea2600..45fb289 100644 --- a/integration-test/src/config/.env.uat +++ b/integration-test/src/config/.env.uat @@ -7,9 +7,8 @@ SINGLE_AND_MANY_OPT_NOTICE_NUMBER=311111111111111112 SINGLE_AND_MULTI_OPT_NOTICE_NUMBER=311111111111111116 SINGLE_AND_CO_OPT_NOTICE_NUMBER=311111111112222225 INVALID_NOTICE_NUMBER=111111111111111111 -DISABLED_STATION_NOTICE_NUMBER=313111111111111111 +DISABLED_STATION_NOTICE_NUMBER=399111111111111111 DISABLED_STATION_ODP_NOTICE_NUMBER=312111111111111111 -MISSING_STATION_NOTICE_NUMBER=399111111111111111 ERROR_STATION_NOTICE_NUMBER=311199999999999999 WRONG_STATION_NOTICE_NUMBER=311111111119999902 UNAUTHORIZED_PSP=AAAAAAAAA diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index 11bb90a..890ec98 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -14,11 +14,6 @@ Feature: Get Payment Options Then response has a 404 Http status And has error code "ODP-009" - Scenario: Station unavailable for provided fiscalCode - When an Http GET request is sent to recover payment options for taxCode "invalid" with noticeNumber "valid" and idPsp "valid" - Then response has a 404 Http status - And has error code "ODP-009" - Scenario: Station is disabled When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "disabled" and idPsp "valid" Then response has a 400 Http status From 4a870431b9a8456d50d5cf305512c7898388ebbf Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 17:23:15 +0200 Subject: [PATCH 49/51] [PPANTT-131] feat: Updated payment_options_step.js tests --- integration-test/src/features/get_payment_options.feature | 4 ++-- integration-test/src/step_definitions/payment_options_step.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index 890ec98..c9c9967 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -9,8 +9,8 @@ Feature: Get Payment Options Then response has a 400 Http status And has error code "ODP-015" - Scenario: Station unavailable for provided noticeNumber - When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "missing" and idPsp "valid" + Scenario: Station unavailable for provided fiscalCode + When an Http GET request is sent to recover payment options for taxCode "invalid" with noticeNumber "valid" and idPsp "valid" Then response has a 404 Http status And has error code "ODP-009" diff --git a/integration-test/src/step_definitions/payment_options_step.js b/integration-test/src/step_definitions/payment_options_step.js index a75c531..0f3e04f 100644 --- a/integration-test/src/step_definitions/payment_options_step.js +++ b/integration-test/src/step_definitions/payment_options_step.js @@ -75,6 +75,9 @@ When('an Http GET request is sent to recover payment options for taxCode {string case "wrong": selectedNoticeNumber = wrongNoticeNumber; break; + case "disabled": + selectedNoticeNumber = disabledStationNoticeNumber; + break; case "error": selectedNoticeNumber = errorNoticeNumber; break; From cd7273f429f3b33471c5ce1ba0e98f2aeaca3aff Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 18:09:53 +0200 Subject: [PATCH 50/51] [PPANTT-131] feat: Updated payment_options_step.js tests --- integration-test/src/features/get_payment_options.feature | 5 ----- 1 file changed, 5 deletions(-) diff --git a/integration-test/src/features/get_payment_options.feature b/integration-test/src/features/get_payment_options.feature index c9c9967..a594c93 100644 --- a/integration-test/src/features/get_payment_options.feature +++ b/integration-test/src/features/get_payment_options.feature @@ -9,11 +9,6 @@ Feature: Get Payment Options Then response has a 400 Http status And has error code "ODP-015" - Scenario: Station unavailable for provided fiscalCode - When an Http GET request is sent to recover payment options for taxCode "invalid" with noticeNumber "valid" and idPsp "valid" - Then response has a 404 Http status - And has error code "ODP-009" - Scenario: Station is disabled When an Http GET request is sent to recover payment options for taxCode "valid" with noticeNumber "disabled" and idPsp "valid" Then response has a 400 Http status From b0e4c0e46604da9fe97faf4b6881f252e2e688a0 Mon Sep 17 00:00:00 2001 From: Alessio Cialini Date: Tue, 1 Oct 2024 18:30:36 +0200 Subject: [PATCH 51/51] [PPANTT-131] feat: Updated CreditorInstitutionRestClient --- .../options/clients/CreditorInstitutionRestClient.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java index acb1082..57c6e97 100644 --- a/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java +++ b/src/main/java/it/gov/pagopa/payment/options/clients/CreditorInstitutionRestClient.java @@ -48,10 +48,6 @@ public PaymentOptionsResponse callEcPaymentOptionsVerify( String fiscalCode, String noticeNumber) throws MalformedURLException { - logger.debug("[Payment Notice] Calling EC verify with {} endpoint, {} and {} port," - + " {} targetHost, {} target port, {} targetPath, {} fiscalCode, {} noticeNumber", endpoint, proxyHost, proxyPort, - targetHost, targetPort, targetPath, fiscalCode, noticeNumber); - RestClientBuilder builder = RestClientBuilder.newBuilder().baseUrl( new URL(String.format(endpoint, fiscalCode, noticeNumber)));