Skip to content

Commit

Permalink
feat: P4PADEV-1776 implement client retrieve reporting list (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: serdimic <[email protected]>
Co-authored-by: antonioT90 <[email protected]>
  • Loading branch information
3 people authored Jan 29, 2025
1 parent f0d3edb commit 4e01aa9
Show file tree
Hide file tree
Showing 23 changed files with 1,140 additions and 5 deletions.
9 changes: 8 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ tasks.register("dependenciesBuild") {
"openApiGenerateORGANIZATION",
"openApiGenerateFILESHARE",
"openApiGeneratePaCreatePosition",
"jaxbJavaGenPaForNode"
"jaxbJavaGenPaForNode",
"jaxbJavaGenNodeForPa"
)
}

Expand Down Expand Up @@ -288,6 +289,12 @@ jaxb {
schema = file("$rootDir/src/main/resources/soap/wsdl/paForNode.wsdl")
bindings = layout.files("$rootDir/src/main/resources/soap/wsdl/paForNode.xjb")
}
register("nodeForPa") {
args = listOf("-wsdl")
outputDir = file("$projectDir/build/generated/jaxb/java")
schema = file("$rootDir/src/main/resources/soap/wsdl/nodeForPa.wsdl")
bindings = layout.files("$rootDir/src/main/resources/soap/wsdl/nodeForPa.xjb")
}
}
}

39 changes: 39 additions & 0 deletions openapi/p4pa-pagopa-payments.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,31 @@ paths:
description: Invalid request
"500":
description: Internal server error
/paymentsReporting/{organizationId}:
get:
tags:
- payments-reporting
operationId: getPaymentsReportingList
parameters:
- name: organizationId
in: path
required: true
schema:
type: integer
format: int64
responses:
"200":
description: List of payments reporting
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PaymentsReportingIdDTO"
"400":
description: Invalid request
"500":
description: Internal server error
security:
- BearerAuth: []
components:
Expand Down Expand Up @@ -484,6 +509,20 @@ components:
$ref: "#/components/schemas/InstallmentStatus"
syncStatusTo:
$ref: "#/components/schemas/InstallmentStatus"
PaymentsReportingIdDTO:
required:
- pagopaPaymentsReportingId
- flowDateTime
- paymentsReportingFileName
type: object
properties:
pagopaPaymentsReportingId:
type: string
flowDateTime:
type: string
format: date-time
paymentsReportingFileName:
type: string
securitySchemes:
BearerAuth:
type: http
Expand Down
307 changes: 307 additions & 0 deletions postman/PagopaPayments E2E.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
{
"info": {
"_postman_id": "3ea7bf76-33db-41ca-b3d8-d4492acfd898",
"name": "PagopaPayments E2E",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "40109713"
},
"item": [
{
"name": "00_login",
"item": [
{
"name": "00_authtoken jwt",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm=instrumentPmMethod(pm);\r",
"\r",
"pm.test(\"p4paAuth - 01_authtoken - Responses with 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"pm.test(\"p4paAuth - 01_authtoken jwt - Verify response body\", function () {\r",
" let jsonResponse = pm.response.json();\r",
"\r",
" pm.expect(jsonResponse).have.property(\"access_token\")\r",
" pm.expect(jsonResponse).have.property(\"token_type\")\r",
" pm.expect(jsonResponse).have.property(\"expires_in\")\r",
"});\r",
"\r",
"let jsonResponse = pm.response.json();\r",
"pm.collectionVariables.set(\"accessToken\", jsonResponse.access_token);\r",
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "{{p4paAuthBaseUrl}}/auth/token?client_id=piattaforma-unitaria&grant_type=urn:ietf:params:oauth:grant-type:token-exchange&subject_token={{tokenExchange_subjectToken}}&subject_issuer={{tokenExchange_issuer}}&scope=openid&subject_token_type=urn:ietf:params:oauth:token-type:jwt",
"host": [
"{{p4paAuthBaseUrl}}"
],
"path": [
"auth",
"token"
],
"query": [
{
"key": "client_id",
"value": "piattaforma-unitaria"
},
{
"key": "grant_type",
"value": "urn:ietf:params:oauth:grant-type:token-exchange"
},
{
"key": "subject_token",
"value": "{{tokenExchange_subjectToken}}"
},
{
"key": "subject_issuer",
"value": "{{tokenExchange_issuer}}"
},
{
"key": "scope",
"value": "openid"
},
{
"key": "subject_token_type",
"value": "urn:ietf:params:oauth:token-type:jwt"
}
]
}
},
"response": []
},
{
"name": "00_getUserInfo",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm=instrumentPmMethod(pm);\r",
"\r",
"pm.test(\"Auth - getUserInfo - Responses with 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"pm.test(\"Auth - getUserInfo - Verify response body\", function () {\r",
" let jsonResponse = pm.response.json();\r",
" const orgIpaCode=pm.environment.get(\"codIpaEnte\")\r",
"\r",
" jsonResponse.organizations.forEach(org => { \r",
" if(org.organizationIpaCode == orgIpaCode){\r",
" pm.collectionVariables.set(\"organizationId\",org.organizationId)\r",
" }\r",
" });\r",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{accessToken}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{p4paAuthBaseUrl}}/auth/userinfo",
"host": [
"{{p4paAuthBaseUrl}}"
],
"path": [
"auth",
"userinfo"
]
}
},
"response": []
}
]
},
{
"name": "01_getPaymentsReportingList",
"item": [
{
"name": "getPaymentsReportingList",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm=instrumentPmMethod(pm);\r",
"\r",
"pm.test(\"PagopaPayments - getPaymentsReportingList - Responses with 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{pagopaPaymentsInnerBaseUrl}}/paymentsReporting/{{organizationId}}",
"host": [
"{{pagopaPaymentsInnerBaseUrl}}"
],
"path": [
"paymentsReporting",
"{{organizationId}}"
]
}
},
"response": []
}
],
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{accessToken}}",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
}
]
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"packages": {},
"exec": [
"// START COMMON UTILITIES\r",
"\r",
"// global variable to use in order to skip tests\r",
"skipTests=false;\r",
"\r",
"// method to be invoked as first thing inside tests in order to instrument the \"pm\" variable:\r",
"// eg: pm = pm=instrumentPmMethod(pm);\r",
"instrumentPmMethod = (pm) => {\r",
" const pmProxy = {\r",
" get: function(pm, key) {\r",
" if (key == 'test') {\r",
" return (skipTests ? pm.test.skip : pm.test);\r",
" }\r",
" return pm[key];\r",
" }\r",
" };\r",
"\r",
" return new Proxy(pm, pmProxy);\r",
"}\r",
"\r",
"// function to be used in order to retry the current request, configuring a maximum number of attempts and a fixed delay between each invoke\r",
"retryRequest = (pm, setTimeout, waitingMillis = 1000, maxAttempts = 30) => {\r",
" if(!pm || !setTimeout){\r",
" throw new Error(\"Invalid invoke to retryRequest function! Some required parameters are undefined: pm=\" + pm + \", setTimeout=\" + setTimeout)\r",
" }\r",
"\r",
" const retryVariableName = \"retry_\" + pm.info.requestId\r",
" const attempt = (pm.variables.get(retryVariableName) ?? 0) + 1;\r",
" if(attempt < maxAttempts) {\r",
" console.info(pm.info.requestName + \" not ready, retrying [attempt \" + attempt + \"/\" + maxAttempts + \"] after \" + waitingMillis + \" ms\");\r",
" pm.variables.set(retryVariableName, attempt)\r",
" pm.execution.setNextRequest(pm.info.requestId);\r",
" return setTimeout(()=>{}, waitingMillis);\r",
" } else {\r",
" pm.test(pm.info.requestName + \" not ready\", () => pm.expect.fail(attempt + \" attempts\"));\r",
" }\r",
"}\r",
"\r",
"// function to be used in order to retry the current request until it returns a known response HTTP status code\r",
"retryWhenStatusCode = (pm, setTimeout, statusCode, waitingMillis, maxAttempts) => {\r",
" if(pm.response.code == statusCode){\r",
" console.log(\"Obtained \" + statusCode + \"! Performing retry...\")\r",
" skipTests=true;\r",
" return retryRequest(pm, setTimeout, waitingMillis, maxAttempts)\r",
" }\r",
"}\r",
"\r",
"// XML utilities\r",
"xml2js = require('xml2js');\r",
"\r",
"parseXmlResponse = (response) => {\r",
" let body;\r",
" xml2js.parseString(response.text(), {\r",
" ignoreAttrs: true, \r",
" explicitArray: false,\r",
" }, function (err, result) {\r",
" if(err){\r",
" console.error(err)\r",
" }\r",
" body = result;\r",
" });\r",
" return body;\r",
"};"
]
}
}
],
"variable": [
{
"key": "accessToken",
"value": ""
},
{
"key": "organizationId",
"value": ""
}
]
}
Loading

0 comments on commit 4e01aa9

Please sign in to comment.