Skip to content

Commit

Permalink
Aggiunti test di verifica dell'intero pagamento utilizzando la funzio…
Browse files Browse the repository at this point in the history
…nalita' di checkout.
  • Loading branch information
pintorig committed May 5, 2023
1 parent 77e4765 commit 4a89c03
Showing 1 changed file with 70 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,22 @@ And request stazione
When method put
Then assert responseStatus == 200 || responseStatus == 201

* def esitoVerifyPayment = read('classpath:test/workflow/modello3/v2/msg/verifyPayment-response-ok.json')
* def esitoGetPayment = read('classpath:test/workflow/modello3/v2/msg/getPayment-response-ok.json')

* def versionePagamento = 3

Scenario: Pagamento avviso precaricato autenticato basic con indicazione del versante

* def idPendenza = getCurrentTimeMillis()
* def pendenzeBaseurl = getGovPayApiBaseUrl({api: 'pendenze', versione: 'v2', autenticazione: 'basic'})
* def basicAutenticationHeader = getBasicAuthenticationHeader( { username: idA2A, password: pwdA2A } )
* def pendenza = read('classpath:test/api/pendenza/v2/pendenze/put/msg/pendenza-put_monovoce_riferimento.json')
* def pendenzaPut = read('classpath:test/api/pendenza/v2/pendenze/put/msg/pendenza-put_monovoce_riferimento.json')

Given url pendenzeBaseurl
And path 'pendenze', idA2A, idPendenza
And headers basicAutenticationHeader
And request pendenza
And request pendenzaPut
When method put
Then status 201

Expand Down Expand Up @@ -57,21 +62,22 @@ And path '/pagamenti'
And headers basicAutenticationHeader
And request pagamentoPost
When method post
# Then status 400
Then status 400

# * match response == { categoria: 'RICHIESTA', codice: 'SINTASSI', descrizione: 'Richiesta non valida', dettaglio: 'Il campo urlRitorno non deve essere vuoto.' }
* match response == { categoria: 'RICHIESTA', codice: 'SINTASSI', descrizione: 'Richiesta non valida', dettaglio: 'Il campo urlRitorno non deve essere vuoto.' }

Scenario: Pagamento avviso precaricato autenticato basic con indicazione del versante

* def idPendenza = getCurrentTimeMillis()
* def pendenzeBaseurl = getGovPayApiBaseUrl({api: 'pendenze', versione: 'v2', autenticazione: 'basic'})
* def basicAutenticationHeader = getBasicAuthenticationHeader( { username: idA2A, password: pwdA2A } )
* def pendenza = read('classpath:test/api/pendenza/v2/pendenze/put/msg/pendenza-put_monovoce_riferimento.json')
* def pendenzaPut = read('classpath:test/api/pendenza/v2/pendenze/put/msg/pendenza-put_monovoce_riferimento.json')
* def importo = pendenzaPut.importo

Given url pendenzeBaseurl
And path 'pendenze', idA2A, idPendenza
And headers basicAutenticationHeader
And request pendenza
And request pendenzaPut
When method put
Then status 201

Expand All @@ -94,7 +100,7 @@ Then status 201
"cellulare": "+39 000-1234567"
}
"""
* set pagamentoPost.urlRitorno = 'http://localhost:8080/portaleEnte'
* set pagamentoPost.urlRitorno = 'http://localhost:8080/portaletestsuite'

* configure followRedirects = false

Expand All @@ -103,15 +109,40 @@ And path '/pagamenti'
And headers basicAutenticationHeader
And request pagamentoPost
When method post
# Then status 302
Then status 302

* def location = responseHeaders["Location"][0]

Given url location
When method get

* match response == esitoVerifyPayment
* def ccp = response.ccp
* def ccp_numero_avviso = response.ccp

* def tipoRicevuta = "R01"
* call read('classpath:utils/psp-paGetPayment.feature')
* match response.dati == esitoGetPayment

* call sleep(2000)

# Verifico lo stato della pendenza

* call read('classpath:utils/api/v1/backoffice/pendenza-get-dettaglio.feature')
* match response.stato == 'ESEGUITA'
* match response.dataPagamento == '#regex \\d\\d\\d\\d-\\d\\d-\\d\\d'
* match response.voci[0].stato == 'Eseguito'
* match response.rpp == '#[1]'
* match response.rpp[0].stato == 'RT_ACCETTATA_PA'
* match response.rpp[0].rt == '#notnull'


# * def location = responseHeaders["Location"][0]

Scenario: Pagamento spontaneo basic con entrata riferita e versante specificato

* def idPendenza = getCurrentTimeMillis()
* def pagamentoPost = read('classpath:test/api/pagamento/v2/pagamenti/post/msg/pagamento-post_spontaneo_entratariferita_bollo.json')
* set pagamentoPost.urlRitorno = 'http://localhost:8080/portaleEnte'
* def pagamentoPost = read('classpath:test/api/pagamento/v2/pagamenti/post/msg/pagamento-post_spontaneo_entratariferita.json')
* set pagamentoPost.urlRitorno = 'http://localhost:8080/portaletestsuite'
* set pagamentoPost.soggettoVersante =
"""
{
Expand All @@ -128,6 +159,8 @@ Scenario: Pagamento spontaneo basic con entrata riferita e versante specificato
"cellulare": "+39 000-1234567"
}
"""
* def pendenzaPut = pagamentoPost.pendenze[0]
* def importo = pendenzaPut.importo

* configure followRedirects = false

Expand All @@ -136,8 +169,32 @@ And path '/pagamenti'
And headers basicAutenticationHeader
And request pagamentoPost
When method post
# Then status 302
Then status 302

* def location = responseHeaders["Location"][0]

Given url location
When method get

* match response == esitoVerifyPayment
* def ccp = response.ccp
* def ccp_numero_avviso = response.ccp
* def numeroAvviso = ccp_numero_avviso

* def tipoRicevuta = "R01"
* call read('classpath:utils/psp-paGetPayment.feature')
* match response.dati == esitoGetPayment

* call sleep(2000)

# Verifico lo stato della pendenza

# * def location = responseHeaders["Location"][0]
* call read('classpath:utils/api/v1/backoffice/pendenza-get-dettaglio.feature')
* match response.stato == 'ESEGUITA'
* match response.dataPagamento == '#regex \\d\\d\\d\\d-\\d\\d-\\d\\d'
* match response.voci[0].stato == 'Eseguito'
* match response.rpp == '#[1]'
* match response.rpp[0].stato == 'RT_ACCETTATA_PA'
* match response.rpp[0].rt == '#notnull'


0 comments on commit 4a89c03

Please sign in to comment.