Skip to content

Commit

Permalink
add new test nm3
Browse files Browse the repository at this point in the history
  • Loading branch information
DamDory committed Jul 19, 2022
1 parent da05f94 commit 3ec8473
Show file tree
Hide file tree
Showing 7 changed files with 949 additions and 1,279 deletions.
1,864 changes: 592 additions & 1,272 deletions report/index.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
Feature: semantic check for sendPaymentOutcomeReq regarding idempotency

Background:
Given systems up
And initial XML activatePaymentNotice
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:activatePaymentNoticeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<idempotencyKey>#idempotency_key#</idempotencyKey>
<qrCode>
<fiscalCode>#creditor_institution_code_old#</fiscalCode>
<noticeNumber>#notice_number_old#</noticeNumber>
</qrCode>
<expirationTime>15000</expirationTime>
<amount>10.00</amount>
<dueDate>2021-12-31</dueDate>
<paymentNote>causale</paymentNote>
</nod:activatePaymentNoticeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
And nodo-dei-pagamenti has config parameter scheduler.jobName_idempotencyCacheClean.enabled set to false
And nodo-dei-pagamenti has config parameter useIdempotency set to true

# Activate Phase
Scenario: Execute activatePaymentNotice1 request
When PSP sends SOAP activatePaymentNotice to nodo-dei-pagamenti
Then check outcome is OK of activatePaymentNotice response
And saving activatePaymentNotice request in activatePaymentNotice1

Scenario: Execute activatePaymentNotice2 request
Given the Execute activatePaymentNotice1 request scenario executed successfully
And initial XML activatePaymentNotice
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:activatePaymentNoticeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<idempotencyKey>#idempotency_key#</idempotencyKey>
<qrCode>
<fiscalCode>#creditor_institution_code_old#</fiscalCode>
<noticeNumber>#notice_number_old#</noticeNumber>
</qrCode>
<expirationTime>15000</expirationTime>
<amount>10.00</amount>
<dueDate>2021-12-31</dueDate>
<paymentNote>causale</paymentNote>
</nod:activatePaymentNoticeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
When PSP sends SOAP activatePaymentNotice to nodo-dei-pagamenti
Then check outcome is OK of activatePaymentNotice response
And saving activatePaymentNotice request in activatePaymentNotice2
And save activatePaymentNotice response in activatePaymentNotice2
And checks the value NotNone of the record at column ID of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_1 on db nodo_online under macro NewMod3
And checks the value NotNone of the record at column ID of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3

# Send payment outcome Phase
Scenario: Execute sendPaymentOutcome request
Given the Execute activatePaymentNotice2 request scenario executed successfully
And initial XML sendPaymentOutcome
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:sendPaymentOutcomeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<idempotencyKey>#idempotency_key#</idempotencyKey>
<paymentToken>$activatePaymentNotice2Response.paymentToken</paymentToken>
<outcome>OK</outcome>
<details>
<paymentMethod>creditCard</paymentMethod>
<paymentChannel>app</paymentChannel>
<fee>2.00</fee>
<payer>
<uniqueIdentifier>
<entityUniqueIdentifierType>F</entityUniqueIdentifierType>
<entityUniqueIdentifierValue>JHNDOE00A01F205N</entityUniqueIdentifierValue>
</uniqueIdentifier>
<fullName>John Doe</fullName>
<streetName>street</streetName>
<civicNumber>12</civicNumber>
<postalCode>89020</postalCode>
<city>city</city>
<stateProvinceRegion>MI</stateProvinceRegion>
<country>IT</country>
<e-mail>john.doe@test.it</e-mail>
</payer>
<applicationDate>2021-10-01</applicationDate>
<transferDate>2021-10-02</transferDate>
</details>
</nod:sendPaymentOutcomeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
When psp sends SOAP sendPaymentOutcome to nodo-dei-pagamenti
Then check outcome is OK of sendPaymentOutcome response
And checks the value NotNone of the record at column ID of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_1 on db nodo_online under macro NewMod3
And verify 0 record for the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
Feature: semantic check for sendPaymentOutcomeReq regarding idempotency

Background:
Given systems up
And initial XML activatePaymentNotice
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:activatePaymentNoticeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<idempotencyKey>#idempotency_key#</idempotencyKey>
<qrCode>
<fiscalCode>#creditor_institution_code_old#</fiscalCode>
<noticeNumber>#notice_number_old#</noticeNumber>
</qrCode>
<expirationTime>15000</expirationTime>
<amount>10.00</amount>
<dueDate>2021-12-31</dueDate>
<paymentNote>causale</paymentNote>
</nod:activatePaymentNoticeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
And nodo-dei-pagamenti has config parameter scheduler.jobName_idempotencyCacheClean.enabled set to false
And nodo-dei-pagamenti has config parameter useIdempotency set to true

# Activate Phase
Scenario: Execute activatePaymentNotice1 request
When PSP sends SOAP activatePaymentNotice to nodo-dei-pagamenti
Then check outcome is OK of activatePaymentNotice response
And saving activatePaymentNotice request in activatePaymentNotice1

Scenario: Execute activatePaymentNotice2 request
Given the Execute activatePaymentNotice1 request scenario executed successfully
And initial XML activatePaymentNotice
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:activatePaymentNoticeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<idempotencyKey>#idempotency_key#</idempotencyKey>
<qrCode>
<fiscalCode>#creditor_institution_code_old#</fiscalCode>
<noticeNumber>#notice_number_old#</noticeNumber>
</qrCode>
<expirationTime>15000</expirationTime>
<amount>10.00</amount>
<dueDate>2021-12-31</dueDate>
<paymentNote>causale</paymentNote>
</nod:activatePaymentNoticeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
When PSP sends SOAP activatePaymentNotice to nodo-dei-pagamenti
Then check outcome is OK of activatePaymentNotice response
And saving activatePaymentNotice request in activatePaymentNotice2
And save activatePaymentNotice response in activatePaymentNotice2
And checks the value NotNone of the record at column ID of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3

# Send payment outcome Phase
Scenario: Execute sendPaymentOutcome request
Given the Execute activatePaymentNotice2 request scenario executed successfully
And initial XML sendPaymentOutcome
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:sendPaymentOutcomeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<paymentToken>$activatePaymentNotice2Response.paymentToken</paymentToken>
<outcome>OK</outcome>
<details>
<paymentMethod>creditCard</paymentMethod>
<paymentChannel>app</paymentChannel>
<fee>2.00</fee>
<payer>
<uniqueIdentifier>
<entityUniqueIdentifierType>F</entityUniqueIdentifierType>
<entityUniqueIdentifierValue>JHNDOE00A01F205N</entityUniqueIdentifierValue>
</uniqueIdentifier>
<fullName>John Doe</fullName>
<streetName>street</streetName>
<civicNumber>12</civicNumber>
<postalCode>89020</postalCode>
<city>city</city>
<stateProvinceRegion>MI</stateProvinceRegion>
<country>IT</country>
<e-mail>john.doe@test.it</e-mail>
</payer>
<applicationDate>2021-10-01</applicationDate>
<transferDate>2021-10-02</transferDate>
</details>
</nod:sendPaymentOutcomeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
When psp sends SOAP sendPaymentOutcome to nodo-dei-pagamenti
Then check outcome is OK of sendPaymentOutcome response
And checks the value NotNone of the record at column ID of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_1 on db nodo_online under macro NewMod3
And verify 0 record for the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
Feature: semantic check for sendPaymentOutcomeReq regarding idempotency

Background:
Given systems up
And initial XML activatePaymentNotice
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:activatePaymentNoticeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<idempotencyKey>#idempotency_key#</idempotencyKey>
<qrCode>
<fiscalCode>#creditor_institution_code_old#</fiscalCode>
<noticeNumber>#notice_number_old#</noticeNumber>
</qrCode>
<expirationTime>15000</expirationTime>
<amount>10.00</amount>
<dueDate>2021-12-31</dueDate>
<paymentNote>causale</paymentNote>
</nod:activatePaymentNoticeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
And nodo-dei-pagamenti has config parameter scheduler.jobName_idempotencyCacheClean.enabled set to false
And nodo-dei-pagamenti has config parameter useIdempotency set to true

# Activate Phase
Scenario: Execute activatePaymentNotice1 request
When PSP sends SOAP activatePaymentNotice to nodo-dei-pagamenti
Then check outcome is OK of activatePaymentNotice response
And saving activatePaymentNotice request in activatePaymentNotice1

# Send payment outcome Phase
Scenario: Execute sendPaymentOutcome request
Given the Execute activatePaymentNotice1 request scenario executed successfully
And initial XML sendPaymentOutcome
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:sendPaymentOutcomeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<paymentToken>$activatePaymentNoticeResponse.paymentToken</paymentToken>
<outcome>OK</outcome>
<details>
<paymentMethod>creditCard</paymentMethod>
<paymentChannel>app</paymentChannel>
<fee>2.00</fee>
<payer>
<uniqueIdentifier>
<entityUniqueIdentifierType>F</entityUniqueIdentifierType>
<entityUniqueIdentifierValue>JHNDOE00A01F205N</entityUniqueIdentifierValue>
</uniqueIdentifier>
<fullName>John Doe</fullName>
<streetName>street</streetName>
<civicNumber>12</civicNumber>
<postalCode>89020</postalCode>
<city>city</city>
<stateProvinceRegion>MI</stateProvinceRegion>
<country>IT</country>
<e-mail>john.doe@test.it</e-mail>
</payer>
<applicationDate>2021-10-01</applicationDate>
<transferDate>2021-10-02</transferDate>
</details>
</nod:sendPaymentOutcomeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
When psp sends SOAP sendPaymentOutcome to nodo-dei-pagamenti
Then check outcome is OK of sendPaymentOutcome response
And verify 0 record for the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_1 on db nodo_online under macro NewMod3

Scenario: Execute activatePaymentNotice2 request
Given the Execute sendPaymentOutcome request scenario executed successfully
And initial XML activatePaymentNotice
"""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:nod="http://pagopa-api.pagopa.gov.it/node/nodeForPsp.xsd">
<soapenv:Header/>
<soapenv:Body>
<nod:activatePaymentNoticeReq>
<idPSP>70000000001</idPSP>
<idBrokerPSP>70000000001</idBrokerPSP>
<idChannel>70000000001_01</idChannel>
<password>pwdpwdpwd</password>
<idempotencyKey>$activatePaymentNotice1.idempotencyKey</idempotencyKey>
<qrCode>
<fiscalCode>#creditor_institution_code_old#</fiscalCode>
<noticeNumber>#notice_number_old#</noticeNumber>
</qrCode>
<expirationTime>15000</expirationTime>
<amount>10.00</amount>
<dueDate>2021-12-31</dueDate>
<paymentNote>causale</paymentNote>
</nod:activatePaymentNoticeReq>
</soapenv:Body>
</soapenv:Envelope>
"""
When PSP sends SOAP activatePaymentNotice to nodo-dei-pagamenti
Then check outcome is OK of activatePaymentNotice response
And saving activatePaymentNotice request in activatePaymentNotice2
And save activatePaymentNotice response in activatePaymentNotice2


Scenario: DB check
Given the Execute activatePaymentNotice2 request scenario executed successfully
Then check datetime plus number of date 0 of the record at column VALID_TO of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value NotNone of the record at column ID of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value $activatePaymentNotice2.fiscalCode of the record at column PA_FISCAL_CODE of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value $activatePaymentNotice2.idPSP of the record at column PSP_ID of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value $activatePaymentNotice2.noticeNumber of the record at column NOTICE_ID of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value $activatePaymentNotice2.idempotencyKey of the record at column IDEMPOTENCY_KEY of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value $activatePaymentNotice2Response.paymentToken of the record at column TOKEN of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value NotNone of the record at column HASH_REQUEST of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value NotNone of the record at column RESPONSE of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3
And checks the value NotNone of the record at column INSERTED_TIMESTAMP of the table IDEMPOTENCY_CACHE retrived by the query idempotency_cache_psp_2 on db nodo_online under macro NewMod3


5 changes: 2 additions & 3 deletions src/integ-test/bdd-test/features/steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ def step_impl(context):
- pagopa-api-config ( used in tests to set DB's nodo-dei-pagamenti correctly according to input test ))
"""
responses = True
""" DA DECOMMENTARE APPENA SPICA RISOLVE MAPPING HEALTHCHECK

for row in context.table:
print(f"calling: {row.get('name')} -> {row.get('url')}")
url = row.get("url") + row.get("healthcheck")
print(f"calling -> {url}")
resp = requests.get(url)
print(f"response: {resp.status_code}")
responses &= (resp.status_code == 200)
"""

assert responses


Expand Down Expand Up @@ -678,7 +678,6 @@ def step_impl(context, query_name, macro, db_name,table_name,columns):
setattr(context, query_name, exec_query)



@step("with the query {query_name1} check assert beetwen elem {elem1} in position {position1:d} and elem {elem2} with position {position2:d} of the query {query_name2}")
def stemp_impl(context, query_name1, elem1, position1, elem2, query_name2, position2):
result_query1 = getattr(context, query_name1)
Expand Down
6 changes: 3 additions & 3 deletions src/integ-test/bdd-test/resources/pipeline_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"rest_service": ""
},
"mock-ec": {
"url": "https://api.dev.platform.pagopa.it/mock-ec/api/v1/mock-ec",
"healthcheck": "",
"soap_service": "",
"url": "https://api.dev.platform.pagopa.it/mock-ec/api/v1",
"healthcheck": "/info",
"soap_service": "/mock-ec",
"rest_service": ""
}
},
Expand Down
Loading

0 comments on commit 3ec8473

Please sign in to comment.