From 1749055c27ef08da36d091895fe5b762e76ae510 Mon Sep 17 00:00:00 2001 From: giomella Date: Mon, 9 Oct 2023 12:02:38 +0200 Subject: [PATCH] update biz event and receipt in integration and performance tests --- .../src/step_definitions/common.js | 213 +++++++----------- .../receipt_pdf_generator_step.js | 2 +- performance-test/src/modules/common.js | 152 ++++++++----- 3 files changed, 170 insertions(+), 197 deletions(-) diff --git a/integration-test/src/step_definitions/common.js b/integration-test/src/step_definitions/common.js index cbcd5208..7b11a14c 100644 --- a/integration-test/src/step_definitions/common.js +++ b/integration-test/src/step_definitions/common.js @@ -2,99 +2,6 @@ function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } -function createEvent(id) { - let json_event = { - "id": id, - "version": "2", - "complete": "false", - "receiptId": "0095ff2bafec4bc0a719c9bf003aee4a", - "missingInfo": [ - "idPaymentManager", - "psp.pspPartitaIVA", - "paymentInfo.primaryCiIncurredFee", - "paymentInfo.idBundle", - "paymentInfo.idCiBundle", - "paymentInfo.metadata" - ], - "debtorPosition": { - "modelType": "2", - "noticeNumber": "302115802768026801", - "iuv": "02115802768026801" - }, - "creditor": { - "idPA": "66666666666", - "idBrokerPA": "66666666666", - "idStation": "66666666666_01", - "companyName": "PA paolo", - "officeName": "office PA" - }, - "psp": { - "idPsp": "POSTE3", - "idBrokerPsp": "BANCOPOSTA", - "idChannel": "POSTE3", - "psp": "Poste Italiane", - "pspFiscalCode": "CFPOSTE3", - "channelDescription": "app" - }, - "debtor": { - "fullName": "John Doe", - "entityUniqueIdentifierType": "F", - "entityUniqueIdentifierValue": "JHNDOE00A01F205N", - "streetName": "street", - "civicNumber": "12", - "postalCode": "89020", - "city": "city", - "stateProvinceRegion": "MI", - "country": "IT", - "eMail": "john.doe@test.it" - }, - "payer": { - "fullName": "John Doe", - "entityUniqueIdentifierType": "F", - "entityUniqueIdentifierValue": "JHNDOE00A01F205S", - "streetName": "street", - "civicNumber": "12", - "postalCode": "89020", - "city": "city", - "stateProvinceRegion": "MI", - "country": "IT", - "eMail": "john.doe@test.it" - }, - "paymentInfo": { - "paymentDateTime": "2022-12-13T01:52:02.926587", - "applicationDate": "2021-10-01", - "transferDate": "2021-10-02", - "dueDate": "2021-07-31", - "paymentToken": "0095ff2bafec4bc0a719c9bf003aee4a", - "amount": "70.0", - "fee": "2.0", - "totalNotice": "1", - "paymentMethod": "creditCard", - "touchpoint": "app", - "remittanceInformation": "TARI 2021", - "description": "TARI 2021" - }, - "transferList": [ - { - "idTransfer": "1", - "fiscalCodePA": "77777777777", - "companyName": "Pa Salvo", - "amount": "70.0", - "transferCategory": "0101101IM", - "remittanceInformation": "TARI Comune EC_TE" - } - ], - "eventStatus": "DONE", - "eventRetryEnrichmentCount": 0, - "_rid": "sMJGAMl3HZnqAQAAAAAAAA==", - "_self": "dbs/sMJGAA==/colls/sMJGAMl3HZk=/docs/sMJGAMl3HZnqAQAAAAAAAA==/", - "_etag": "\"2400e1e4-0000-0d00-0000-6397ccb60000\"", - "_attachments": "attachments/", - "_ts": 1670892726 - } - return json_event -} - function createEventForQueue(id) { return createEventForPoisonQueue(id, false); } @@ -103,86 +10,115 @@ function createEventForPoisonQueue(id, attemptedPoisonRetry) { let json_event = { "id": id, "version": "2", + "idPaymentManager": "54927408", "complete": "false", - "receiptId": "0095ff2bafec4bc0a719c9bf003aee4a", + "receiptId": "9851395f09544a04b288202299193ca6", "attemptedPoisonRetry": attemptedPoisonRetry, "missingInfo": [ - "idPaymentManager", "psp.pspPartitaIVA", "paymentInfo.primaryCiIncurredFee", "paymentInfo.idBundle", - "paymentInfo.idCiBundle", - "paymentInfo.metadata" + "paymentInfo.idCiBundle" ], "debtorPosition": { "modelType": "2", - "noticeNumber": "302115802768026801", - "iuv": "02115802768026801" + "noticeNumber": "310391366991197059", + "iuv": "10391366991197059" }, "creditor": { "idPA": "66666666666", "idBrokerPA": "66666666666", - "idStation": "66666666666_01", + "idStation": "66666666666_08", "companyName": "PA paolo", - "officeName": "office PA" + "officeName": "office" }, "psp": { - "idPsp": "POSTE3", - "idBrokerPsp": "BANCOPOSTA", - "idChannel": "POSTE3", - "psp": "Poste Italiane", - "pspFiscalCode": "CFPOSTE3", + "idPsp": "60000000001", + "idBrokerPsp": "60000000001", + "idChannel": "60000000001_08", + "psp": "PSP Paolo", + "pspFiscalCode": "CF60000000006", "channelDescription": "app" }, "debtor": { - "fullName": "John Doe", - "entityUniqueIdentifierType": "F", + "fullName": "paGetPaymentName", + "entityUniqueIdentifierType": "G", "entityUniqueIdentifierValue": "JHNDOE00A01F205N", - "streetName": "street", - "civicNumber": "12", - "postalCode": "89020", - "city": "city", - "stateProvinceRegion": "MI", + "streetName": "paGetPaymentStreet", + "civicNumber": "paGetPayment99", + "postalCode": "20155", + "city": "paGetPaymentCity", + "stateProvinceRegion": "paGetPaymentState", "country": "IT", - "eMail": "john.doe@test.it" + "eMail": "paGetPayment@test.it" }, "payer": { - "fullName": "John Doe", - "entityUniqueIdentifierType": "F", + "fullName": "name", + "entityUniqueIdentifierType": "G", "entityUniqueIdentifierValue": "JHNDOE00A01F205S", "streetName": "street", - "civicNumber": "12", - "postalCode": "89020", + "civicNumber": "civic", + "postalCode": "postal", "city": "city", - "stateProvinceRegion": "MI", + "stateProvinceRegion": "state", "country": "IT", - "eMail": "john.doe@test.it" + "eMail": "prova@test.it" }, "paymentInfo": { - "paymentDateTime": "2022-12-13T01:52:02.926587", - "applicationDate": "2021-10-01", - "transferDate": "2021-10-02", - "dueDate": "2021-07-31", - "paymentToken": "0095ff2bafec4bc0a719c9bf003aee4a", - "amount": "70.0", + "paymentDateTime": "2023-03-17T16:37:36.955813", + "applicationDate": "2021-12-12", + "transferDate": "2021-12-11", + "dueDate": "2021-12-12", + "paymentToken": "9851395f09544a04b288202299193ca6", + "amount": "10.0", "fee": "2.0", "totalNotice": "1", "paymentMethod": "creditCard", "touchpoint": "app", "remittanceInformation": "TARI 2021", - "description": "TARI 2021" + "description": "TARI 2021", + "metadata": [ + { + "key": "1", + "value": "22" + } + ] }, "transferList": [ { "idTransfer": "1", - "fiscalCodePA": "77777777777", - "companyName": "Pa Salvo", - "amount": "70.0", - "transferCategory": "0101101IM", - "remittanceInformation": "TARI Comune EC_TE" + "fiscalCodePA": "66666666666", + "companyName": "PA paolo", + "amount": "10.0", + "transferCategory": "paGetPaymentTest", + "remittanceInformation": "/RFB/00202200000217527/5.00/TXT/" } ], - "eventStatus": "DONE" + "transactionDetails": { + "user": { + "fullName": "John Doe", + "type": "F", + "fiscalCode": "JHNDOE00A01F205N", + "notificationEmail": "john.doe@mail.it", + "userId": "1234", + "userStatus": "11", + "userStatusDescription": "REGISTERED_SPID" + }, + "transaction": { + "idTransaction": 123456, + "transactionId": 123456, + "grandTotal": 0, + "amount": 0, + "fee": 0 + } + }, + "timestamp": 1679067463501, + "properties": { + "diagnostic-id": "00-f70ef3167cffad76c6657a67a33ee0d2-61d794a75df0b43b-01", + "serviceIdentifier": "NDP002SIT" + }, + "eventStatus": "DONE", + "eventRetryEnrichmentCount": 0 } return json_event } @@ -193,7 +129,14 @@ function createReceipt(id) { "eventId": id, "eventData": { "payerFiscalCode": "JHNDOE00A01F205N", - "debtorFiscalCode": "JHNDOE00A01F205N" + "debtorFiscalCode": "JHNDOE00A01F205N", + "amount": "200", + "cart": [ + { + "payeeName": "Comune di Milano", + "subject": "ACI" + } + ] }, "status": "INSERTED", "numRetry": 0, @@ -208,5 +151,5 @@ function createReceipt(id) { } module.exports = { - createEvent, sleep, createReceipt, createEventForPoisonQueue, createEventForQueue + sleep, createReceipt, createEventForPoisonQueue, createEventForQueue } \ No newline at end of file diff --git a/integration-test/src/step_definitions/receipt_pdf_generator_step.js b/integration-test/src/step_definitions/receipt_pdf_generator_step.js index 5b55411b..b1812056 100644 --- a/integration-test/src/step_definitions/receipt_pdf_generator_step.js +++ b/integration-test/src/step_definitions/receipt_pdf_generator_step.js @@ -1,7 +1,7 @@ const assert = require('assert'); const { After, Given, When, Then, setDefaultTimeout } = require('@cucumber/cucumber'); const { sleep, createEventForQueue, createEventForPoisonQueue } = require("./common"); -const { getDocumentByIdFromReceiptsDatastore, deleteDocumentFromErrorReceiptsDatastoreByMessagePayload, deleteDocumentFromReceiptsDatastoreByEventId, deleteDocumentFromReceiptsDatastore, createDocumentInReceiptsDatastore, createDocumentInErrorReceiptsDatastore, deleteDocumentFromErrorReceiptsDatastore, getDocumentByMessagePayloadFromErrorReceiptsDatastore } = require("./receipts_datastore_client"); +const { getDocumentByIdFromReceiptsDatastore, deleteDocumentFromErrorReceiptsDatastoreByMessagePayload, deleteDocumentFromReceiptsDatastore, createDocumentInReceiptsDatastore, createDocumentInErrorReceiptsDatastore, deleteDocumentFromErrorReceiptsDatastore, getDocumentByMessagePayloadFromErrorReceiptsDatastore } = require("./receipts_datastore_client"); const { putMessageOnPoisonQueue, putMessageOnReceiptQueue } = require("./reqeipt_queue_client"); const { receiptPDFExist } = require("./receipts_blob_storage_client"); diff --git a/performance-test/src/modules/common.js b/performance-test/src/modules/common.js index b6ab1d4c..85ad65c0 100644 --- a/performance-test/src/modules/common.js +++ b/performance-test/src/modules/common.js @@ -6,92 +6,115 @@ export function randomString(length, charset) { } export function createEvent(id) { - const idPA = randomString(11, "0123456789"); - const idPSP = randomString(11, "0123456789"); let json_event = { "id": id, "version": "2", + "idPaymentManager": "54927408", "complete": "false", - "receiptId": "0095ff2bafec4bc0a719c9bf003aee4a", + "receiptId": "9851395f09544a04b288202299193ca6", "missingInfo": [ - "idPaymentManager", "psp.pspPartitaIVA", "paymentInfo.primaryCiIncurredFee", "paymentInfo.idBundle", - "paymentInfo.idCiBundle", - "paymentInfo.metadata" + "paymentInfo.idCiBundle" ], - "debtorPosition": { - "modelType": "2", - "noticeNumber": randomString(18, "0123456789"), - "iuv": randomString(17, "0123456789") - }, - "creditor": { - "idPA": idPA, - "idBrokerPA": idPA, - "idStation": `${idPA}_08`, - "companyName": "PA test_company" - }, - "psp": { - "idPsp": idPSP, - "idBrokerPsp": idPSP, - "idChannel": `${idPSP}_08`, - "psp": "test_PSP" - }, + "debtorPosition": { + "modelType": "2", + "noticeNumber": "310391366991197059", + "iuv": "10391366991197059" + }, + "creditor": { + "idPA": "66666666666", + "idBrokerPA": "66666666666", + "idStation": "66666666666_08", + "companyName": "PA paolo", + "officeName": "office" + }, + "psp": { + "idPsp": "60000000001", + "idBrokerPsp": "60000000001", + "idChannel": "60000000001_08", + "psp": "PSP Paolo", + "pspFiscalCode": "CF60000000006", + "channelDescription": "app" + }, "debtor": { - "fullName": "John Doe", - "entityUniqueIdentifierType": "F", - "entityUniqueIdentifierValue": "GENERATOR_PERF_TEST", - "streetName": "street", - "civicNumber": "12", - "postalCode": "89020", - "city": "city", - "stateProvinceRegion": "MI", + "fullName": "paGetPaymentName", + "entityUniqueIdentifierType": "G", + "entityUniqueIdentifierValue": "JHNDOE00A01F205N", + "streetName": "paGetPaymentStreet", + "civicNumber": "paGetPayment99", + "postalCode": "20155", + "city": "paGetPaymentCity", + "stateProvinceRegion": "paGetPaymentState", "country": "IT", - "eMail": "john.doe@test.it" + "eMail": "paGetPayment@test.it" }, "payer": { - "fullName": "John Doe", - "entityUniqueIdentifierType": "F", - "entityUniqueIdentifierValue": "GENERATOR_PERF_TEST", + "fullName": "name", + "entityUniqueIdentifierType": "G", + "entityUniqueIdentifierValue": "JHNDOE00A01F205S", "streetName": "street", - "civicNumber": "12", - "postalCode": "89020", + "civicNumber": "civic", + "postalCode": "postal", "city": "city", - "stateProvinceRegion": "MI", + "stateProvinceRegion": "state", "country": "IT", - "eMail": "john.doe@test.it" + "eMail": "prova@test.it" }, "paymentInfo": { - "paymentDateTime": "2022-12-13T01:52:02.926587", - "applicationDate": "2021-10-01", - "transferDate": "2021-10-02", - "dueDate": "2021-07-31", - "paymentToken": "0095ff2bafec4bc0a719c9bf003aee4a", - "amount": "70.0", + "paymentDateTime": "2023-03-17T16:37:36.955813", + "applicationDate": "2021-12-12", + "transferDate": "2021-12-11", + "dueDate": "2021-12-12", + "paymentToken": "9851395f09544a04b288202299193ca6", + "amount": "10.0", "fee": "2.0", "totalNotice": "1", "paymentMethod": "creditCard", "touchpoint": "app", "remittanceInformation": "TARI 2021", - "description": "TARI 2021" + "description": "TARI 2021", + "metadata": [ + { + "key": "1", + "value": "22" + } + ] }, "transferList": [ - { - "fiscalCodePA": idPA, - "companyName": "PA test_company", - "amount": "2.00", - "transferCategory": "paTest", - "remittanceInformation": "/RFB/00202200000217527/5.00/TXT/" - }, - { - "fiscalCodePA": randomString(11, "0123456789"), - "companyName": "PA test_company", - "amount": "8.00", - "transferCategory": "paTest", - "remittanceInformation": "/RFB/00202200000217527/5.00/TXT/" - } + { + "idTransfer": "1", + "fiscalCodePA": "66666666666", + "companyName": "PA paolo", + "amount": "10.0", + "transferCategory": "paGetPaymentTest", + "remittanceInformation": "/RFB/00202200000217527/5.00/TXT/" + } ], + "transactionDetails": { + "user": { + "fullName": "John Doe", + "type": "F", + "fiscalCode": "JHNDOE00A01F205N", + "notificationEmail": "john.doe@mail.it", + "userId": "1234", + "userStatus": "11", + "userStatusDescription": "REGISTERED_SPID" + }, + "transaction": { + "idTransaction": 123456, + "transactionId": 123456, + "grandTotal": 0, + "amount": 0, + "fee": 0 + } + }, + "timestamp": 1679067463501, + "properties": { + "diagnostic-id": "00-f70ef3167cffad76c6657a67a33ee0d2-61d794a75df0b43b-01", + "serviceIdentifier": "NDP002SIT" + }, "eventStatus": "DONE", "eventRetryEnrichmentCount": 0 } @@ -104,7 +127,14 @@ export function createReceipt(id) { "eventId": id, "eventData": { "payerFiscalCode": "GENERATOR_PERF_TEST", - "debtorFiscalCode": "GENERATOR_PERF_TEST" + "debtorFiscalCode": "GENERATOR_PERF_TEST", + "amount": "200", + "cart": [ + { + "payeeName": "Comune di Milano", + "subject": "ACI" + } + ] }, "status": "INSERTED", "numRetry": 0,