Skip to content

Commit

Permalink
Corretti bug:
Browse files Browse the repository at this point in the history
Autorizzazioni sulle pendenze utenze SPID.
Modificato formato degli header delle risposte, registrate dal gde, in coppie nome/valore.
  • Loading branch information
pintorig committed Sep 18, 2019
1 parent d8c0614 commit 99cdd9f
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,35 @@ And match response ==
}
"""

Scenario Outline: Acquisizione ricevuta non pagato dalla propria posizione

Given url pagamentiBaseurl
And path 'rpp'
And param idA2A = <idA2A>
And param idPendenza = <idPendenza>
And param esito = 'ESEGUITO'
And headers spidHeaders
When method get
Then status 200
And match response ==
"""
{
numRisultati: <numero>,
numPagine: 1,
risultatiPerPagina: 25,
pagina: 1,
prossimiRisultati: '##null',
risultati: '#[]'
}
"""

Examples:
| idA2A | idPendenza | httpStatus | numero |
| idA2A2 | idPendenza_Rossi_DOM1_LIBERO_NONESEGUITO_idA2A2 | 200 | 0 |
| idA2A2 | idPendenza_Rossi_DOM1_SEGRETERIA_NONESEGUITO_idA2A2 | 200 | 0 |
| idA2A | idPendenza_Rossi_DOM1_LIBERO_NONESEGUITO_idA2A | 200 | 0 |
| idA2A | idPendenza_Rossi_DOM1_SEGRETERIA_NONESEGUITO_idA2A | 200 | 0 |

Scenario Outline: Acquisizione ricevuta pagato dalla propria posizione

Given url pagamentiBaseurl
Expand All @@ -72,7 +101,8 @@ And param esito = 'ESEGUITO'
And headers spidHeaders
When method get
Then status 200
And match response.risultati[0].idPagamento == '#notnull'
And match response.risultati[0].rt == '#notnull'
And match response.risultati[0].rt.datiPagamento.codiceEsitoPagamento == '0'
And match response ==
"""
{
Expand All @@ -89,11 +119,8 @@ Examples:
| idA2A | idPendenza | httpStatus | numero |
| idA2A2 | idPendenza_Rossi_DOM1_SPONTANEO_ESEGUITO_idA2A2 | 200 | 1 |
| idA2A2 | idPendenza_Rossi_DOM1_LIBERO_ESEGUITO_idA2A2 | 200 | 1 |
| idA2A2 | idPendenza_Rossi_DOM1_LIBERO_NONESEGUITO_idA2A2 | 200 | 0 |
| idA2A2 | idPendenza_Rossi_DOM1_SEGRETERIA_ESEGUITO_idA2A2 | 200 | 1 |
| idA2A2 | idPendenza_Rossi_DOM1_SEGRETERIA_NONESEGUITO_idA2A2 | 200 | 0 |
| idA2A | idPendenza_Rossi_DOM1_SPONTANEO_ESEGUITO_idA2A | 200 | 1 |
| idA2A | idPendenza_Rossi_DOM1_LIBERO_ESEGUITO_idA2A | 200 | 1 |
| idA2A | idPendenza_Rossi_DOM1_LIBERO_NONESEGUITO_idA2A | 200 | 0 |
| idA2A | idPendenza_Rossi_DOM1_SEGRETERIA_ESEGUITO_idA2A | 200 | 1 |
| idA2A | idPendenza_Rossi_DOM1_SEGRETERIA_NONESEGUITO_idA2A | 200 | 0 |

Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ public ListaPendenzeDTOResponse listaPendenzeConInformazioniIncasso(ListaPendenz
if(!listaPendenzaDTO.isOrderEnabled()) {
filter.addFilterSort(filter.getDefaultFilterSortWrapperDesc());
}
if(userDetails.getTipoUtenza().equals(TIPO_UTENZA.CITTADINO)) {
filter.setCfCittadino(userDetails.getIdentificativo());
// if(userDetails.getTipoUtenza().equals(TIPO_UTENZA.CITTADINO)) {
if(listaPendenzaDTO.getCfCittadino() != null) {
filter.setCfCittadino(listaPendenzaDTO.getCfCittadino());
filter.setAbilitaFiltroCittadino(true);
}
filter.setCodTipoVersamento(listaPendenzaDTO.getIdTipoVersamento());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public ListaPendenzeConInformazioniIncassoDTO(Authentication user) {
private String idTipoVersamento;
private String divisione;
private String direzione;
private String cfCittadino;

public Date getDataA() {
return this.dataA;
Expand Down Expand Up @@ -143,4 +144,10 @@ public String getDirezione() {
public void setDirezione(String direzione) {
this.direzione = direzione;
}
public String getCfCittadino() {
return cfCittadino;
}
public void setCfCittadino(String cfCittadino) {
this.cfCittadino = cfCittadino;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public class DettaglioRisposta implements Serializable{
private Date dataOraRisposta;
private Integer status;
// private Map<String, String> headers;
private List<Entry<String, String>> headers;
private List<Header> headers;
// private List<Entry<String, String>> headers;

private String payload;

Expand All @@ -36,16 +37,19 @@ public Integer getStatus() {
public void setStatus(Integer status) {
this.status = status;
}
public List<Entry<String, String>> getHeaders() {
public List<Header> getHeaders() {
return headers;
}
public void setHeaders(List<Entry<String, String>> headers) {
public void setHeaders(List<Header> headers) {
this.headers = headers;
}
public void setHeadersFromMap(Map<String, String> headers) {
if(headers != null) {
this.headers = new ArrayList<>();
this.headers.addAll(headers.entrySet());

for (Entry<String, String> entry : headers.entrySet()) {
this.headers.add(new Header(entry.getKey(), entry.getValue()));
}
}
}
public String getPayload() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ public IExpression _toExpression() throws ServiceException {
if(addAnd)
newExpression.and();

newExpression.equals(RPT.model().ID_PAGAMENTO_PORTALE.VERSANTE_IDENTIFICATIVO, this.cfCittadinoPagamentoPortale);
IExpression newExpression2 = this.newExpression();
newExpression2.equals(RPT.model().ID_PAGAMENTO_PORTALE.VERSANTE_IDENTIFICATIVO, this.cfCittadinoPagamentoPortale)
.or().equals(RPT.model().ID_VERSAMENTO.DEBITORE_IDENTIFICATIVO, this.cfCittadinoPagamentoPortale);


newExpression.and(newExpression2);
addAnd = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import it.govpay.bd.model.Dominio;
import it.govpay.core.autorizzazione.AuthorizationManager;
import it.govpay.core.autorizzazione.beans.GovpayLdapUserDetails;
import it.govpay.core.autorizzazione.utils.AutorizzazioneUtils;
import it.govpay.core.dao.pagamenti.PendenzeDAO;
import it.govpay.core.dao.pagamenti.dto.LeggiPendenzaDTO;
import it.govpay.core.dao.pagamenti.dto.LeggiPendenzaDTOResponse;
Expand Down Expand Up @@ -74,6 +76,13 @@ public Response pendenzeIdA2AIdPendenzaGET(Authentication user, UriInfo uriInfo,
if(!AuthorizationManager.isTipoVersamentoDominioAuthorized(leggiPendenzaDTO.getUser(), dominio.getCodDominio(), tipoVersamento.getCodTipoVersamento())) {
throw AuthorizationManager.toNotAuthorizedException(leggiPendenzaDTO.getUser(), dominio.getCodDominio(), tipoVersamento.getCodTipoVersamento());
}

GovpayLdapUserDetails userDetails = AutorizzazioneUtils.getAuthenticationDetails(leggiPendenzaDTO.getUser());
if(userDetails.getTipoUtenza().equals(TIPO_UTENZA.CITTADINO)) {
if(!ricevutaDTOResponse.getVersamentoIncasso().getAnagraficaDebitore().getCodUnivoco().equals(userDetails.getIdentificativo())) {
throw AuthorizationManager.toNotAuthorizedException(leggiPendenzaDTO.getUser(), "la pendenza non appartiene al cittadino chiamante.");
}
}

Pendenza pendenza = PendenzeConverter.toRsModel(ricevutaDTOResponse,user);

Expand Down Expand Up @@ -140,6 +149,11 @@ public Response pendenzeGET(Authentication user, UriInfo uriInfo, HttpHeaders ht
listaPendenzeDTO.setDirezione(direzione);
listaPendenzeDTO.setDivisione(divisione);

GovpayLdapUserDetails userDetails = AutorizzazioneUtils.getAuthenticationDetails(listaPendenzeDTO.getUser());
if(userDetails.getTipoUtenza().equals(TIPO_UTENZA.CITTADINO)) {
listaPendenzeDTO.setCfCittadino(userDetails.getIdentificativo());
}

PendenzeDAO pendenzeDAO = new PendenzeDAO();

// CHIAMATA AL DAO
Expand Down

0 comments on commit 99cdd9f

Please sign in to comment.