Skip to content

Commit

Permalink
Merge branch '3.1.x' of github.com:link-it/GovPay into 3.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
nardil committed Sep 15, 2019
2 parents 86d5261 + c78fab4 commit 5c20a0e
Show file tree
Hide file tree
Showing 31 changed files with 633 additions and 344 deletions.
4 changes: 2 additions & 2 deletions jars/core/src/main/java/it/govpay/core/business/Rpt.java
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ public List<it.govpay.bd.model.Rpt> avviaTransazione(List<Versamento> versamenti
clientInviaCarrelloRPT.getEventoCtx().setCodDominio(rpt.getCodDominio());
clientInviaCarrelloRPT.getEventoCtx().setIuv(rpt.getIuv());
clientInviaCarrelloRPT.getEventoCtx().setCcp(rpt.getCcp());
clientInviaCarrelloRPT.getEventoCtx().setIdA2A(rpt.getVersamento(this).getApplicazione(this).getCodApplicazione());
clientInviaCarrelloRPT.getEventoCtx().setIdPendenza(rpt.getVersamento(this).getCodVersamentoEnte());
clientInviaCarrelloRPT.getEventoCtx().setIdA2A(rpt.getVersamentoIncasso(this).getApplicazione(this).getCodApplicazione());
clientInviaCarrelloRPT.getEventoCtx().setIdPendenza(rpt.getVersamentoIncasso(this).getCodVersamentoEnte());
try {
if(rpt.getPagamentoPortale(this) != null)
clientInviaCarrelloRPT.getEventoCtx().setIdPagamento(rpt.getPagamentoPortale(this).getIdSessione());
Expand Down
18 changes: 9 additions & 9 deletions jars/core/src/main/java/it/govpay/core/dao/pagamenti/RptDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public LeggiRptDTOResponse leggiRpt(LeggiRptDTO leggiRptDTO) throws ServiceExcep

response.setRpt(rpt);
rpt.getPagamentoPortale(bd).getApplicazione(bd);
VersamentoIncasso versamento = rpt.getVersamento(bd);
VersamentoIncasso versamento = rpt.getVersamentoIncasso(bd);
response.setVersamento(versamento);
response.setApplicazione(versamento.getApplicazione(bd));
response.setDominio(versamento.getDominio(bd));
Expand Down Expand Up @@ -203,7 +203,7 @@ public ListaRptDTOResponse listaRpt(ListaRptDTO listaRptDTO, BasicBD bd) throws
for (Rpt rpt : findAll) {
LeggiRptDTOResponse elem = new LeggiRptDTOResponse();
elem.setRpt(rpt);
VersamentoIncasso versamento = rpt.getVersamento(bd);
VersamentoIncasso versamento = rpt.getVersamentoIncasso(bd);
versamento.getDominio(bd);
versamento.getUo(bd);
versamento.getTipoVersamentoDominio(bd);
Expand Down Expand Up @@ -260,13 +260,13 @@ public PatchRptDTOResponse patch(PatchRptDTO patchRptDTO) throws ServiceExceptio

rpt.getPagamentoPortale(bd).getApplicazione(bd);
response.setRpt(rpt);
response.setVersamento(rpt.getVersamento(bd));
response.setApplicazione(rpt.getVersamento(bd).getApplicazione(bd));
response.setDominio(rpt.getVersamento(bd).getDominio(bd));
response.setUnitaOperativa(rpt.getVersamento(bd).getUo(bd));
rpt.getVersamento(bd).getTipoVersamentoDominio(bd);
rpt.getVersamento(bd).getTipoVersamento(bd);
List<SingoloVersamento> singoliVersamenti = rpt.getVersamento(bd).getSingoliVersamenti(bd);
response.setVersamento(rpt.getVersamentoIncasso(bd));
response.setApplicazione(rpt.getVersamentoIncasso(bd).getApplicazione(bd));
response.setDominio(rpt.getVersamentoIncasso(bd).getDominio(bd));
response.setUnitaOperativa(rpt.getVersamentoIncasso(bd).getUo(bd));
rpt.getVersamentoIncasso(bd).getTipoVersamentoDominio(bd);
rpt.getVersamentoIncasso(bd).getTipoVersamento(bd);
List<SingoloVersamento> singoliVersamenti = rpt.getVersamentoIncasso(bd).getSingoliVersamenti(bd);
response.setLstSingoliVersamenti(singoliVersamenti);
for (SingoloVersamento singoloVersamento : singoliVersamenti) {
singoloVersamento.getCodContabilita(bd);
Expand Down
5 changes: 4 additions & 1 deletion jars/core/src/main/java/it/govpay/core/utils/RptUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ public static boolean aggiornaRptDaNpD(Intermediario intermediario, Rpt rpt, Bas
richiesta.setIdentificativoUnivocoVersamento(rpt.getIuv());
richiesta.setCodiceContestoPagamento(rpt.getCcp());
chiediStatoRptClient = new NodoClient(intermediario, null, giornale, bd);

bd.setupConnection(ctx.getTransactionId());
// salvataggio id Rpt/ versamento/ pagamento
chiediStatoRptClient.getEventoCtx().setCodDominio(rpt.getCodDominio());
chiediStatoRptClient.getEventoCtx().setIuv(rpt.getIuv());
Expand Down Expand Up @@ -326,7 +328,8 @@ public static boolean aggiornaRptDaNpD(Intermediario intermediario, Rpt rpt, Bas
}
throw e;
} finally {
bd.setupConnection(ctx.getTransactionId());
if(bd.isClosed())
bd.setupConnection(ctx.getTransactionId());
}

if(risposta.getFault() != null) {
Expand Down
29 changes: 19 additions & 10 deletions jars/orm/src/main/java/it/govpay/bd/model/Rpt.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,31 @@ public class Rpt extends it.govpay.model.Rpt{

// Business

private transient VersamentoIncasso versamento;
private transient VersamentoIncasso versamentoIncasso;
private transient Versamento versamento;
private transient Dominio dominio;
private transient List<Pagamento> pagamenti;
private transient PagamentoPortale pagamentoPortale;

public VersamentoIncasso getVersamento(BasicBD bd) throws ServiceException {
if(this.versamento == null) {

public VersamentoIncasso getVersamentoIncasso(BasicBD bd) throws ServiceException {
if(this.versamentoIncasso == null) {
VersamentiIncassiBD versamentiIncassiBD = new VersamentiIncassiBD(bd);
try {
this.versamento = versamentiIncassiBD.getVersamento(this.getIdVersamento());
}catch(NotFoundException e) { // se non e' stato ancora incassato non verra' trovato
VersamentiBD versamentiBD = new VersamentiBD(bd);
Versamento versamento = versamentiBD.getVersamento(this.getIdVersamento());
if(versamento != null)
this.versamento = VersamentoIncassoConverter.fromVersamento(versamento);
} // puo' essere null perche' nella vista non e' presente
this.versamentoIncasso = versamentiIncassiBD.getVersamento(this.getIdVersamento());
} catch(NotFoundException e) { // se non e' stato ancora incassato non verra' trovato
getVersamento(bd);
if(this.versamento != null)
this.versamentoIncasso = VersamentoIncassoConverter.fromVersamento(versamento);
}
}
return this.versamentoIncasso;
}

public Versamento getVersamento(BasicBD bd) throws ServiceException {
if(this.versamento == null) {
VersamentiBD versamentiBD = new VersamentiBD(bd);
this.versamento = versamentiBD.getVersamento(this.getIdVersamento());
}
return this.versamento;
}
Expand Down
10 changes: 4 additions & 6 deletions src/main/resources/filters/installer_template.filter.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ it.govpay.versamenti.censimentoAutomaticoTipiPendenza.enabled=false
# Indica il numero dei minuti che devono essere passati dalla creazione della RPT per provare a recuperarne lo stato dal nodo
it.govpay.recuperoRptPendenti.intervalloControlloCreazioneRpt=30

# Controllo se ci sono RPT attivate per lo IUV verificato/attivato nell'intervallo di minuti indicato (indicare il numero di minuti di vita dell'RPT oppure false per non effettuare il controllo) per i pagamenti di tipo 1
it.govpay.modello1.timeoutPagamento=false

# Controllo se ci sono RPT attivate per lo IUV verificato/attivato nell'intervallo di minuti indicato (indicare il numero di minuti di vita dell'RPT oppure false per non effettuare il controllo) per i pagamenti di tipo 3
it.govpay.modello3.timeoutPagamento=false
# Imposta il numero di minuti che devono passare prima di attivare una nuova transazione di pagamento se la precedente non e' ancora conclusa (false: disabilita, 0: attende idefinitamente)
it.govpay.modello1.timeoutPagamento=0
it.govpay.modello3.timeoutPagamento=0

# Numero massimo di righe del prospetto riscossione
it.govpay.reportistica.prospettoRiscossione.numeroMassimoEntries=5000
Expand Down Expand Up @@ -202,7 +200,7 @@ it.govpay.configurazioneFiltroCors.cors.allowRequestOrigin=false
# Se si abilita l'opzione seguente verra' inserito nell'header 'Access-Control-Allow-Origin' il valore '*'
# a meno che l'opzione 'cors.allowOrigin' non sia abilitata e l'heder 'Origin' sia presente in una preflight request.
# da usare solo per sviluppo, tenere false in produzione
it.govpay.configurazioneFiltroCors.cors.allowAllOrigin=true
it.govpay.configurazioneFiltroCors.cors.allowAllOrigin=false

# elenco delle URL abilitate ad accedere ai servizi
it.govpay.configurazioneFiltroCors.cors.allowOrigins=
Expand Down
10 changes: 4 additions & 6 deletions src/main/resources/filters/template.filter.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ it.govpay.versamenti.censimentoAutomaticoTipiPendenza.enabled=false
# Indica il numero dei minuti che devono essere passati dalla creazione della RPT per provare a recuperarne lo stato dal nodo
it.govpay.recuperoRptPendenti.intervalloControlloCreazioneRpt=30

# Controllo se ci sono RPT attivate per lo IUV verificato/attivato nell'intervallo di minuti indicato (indicare il numero di minuti di vita dell'RPT oppure false per non effettuare il controllo) per i pagamenti di tipo 1
it.govpay.modello1.timeoutPagamento=false

# Controllo se ci sono RPT attivate per lo IUV verificato/attivato nell'intervallo di minuti indicato (indicare il numero di minuti di vita dell'RPT oppure false per non effettuare il controllo) per i pagamenti di tipo 3
it.govpay.modello3.timeoutPagamento=false
# Imposta il numero di minuti che devono passare prima di attivare una nuova transazione di pagamento se la precedente non e' ancora conclusa (false: disabilita, 0: attende idefinitamente)
it.govpay.modello1.timeoutPagamento=10
it.govpay.modello3.timeoutPagamento=5

# Numero massimo di righe del prospetto riscossione
it.govpay.reportistica.prospettoRiscossione.numeroMassimoEntries=5000
Expand Down Expand Up @@ -201,7 +199,7 @@ it.govpay.configurazioneFiltroCors.cors.allowRequestOrigin=false
# Se si abilita l'opzione seguente verra' inserito nell'header 'Access-Control-Allow-Origin' il valore '*'
# a meno che l'opzione 'cors.allowOrigin' non sia abilitata e l'heder 'Origin' sia presente in una preflight request.
# da usare solo per sviluppo, tenere false in produzione
it.govpay.configurazioneFiltroCors.cors.allowAllOrigin=true
it.govpay.configurazioneFiltroCors.cors.allowAllOrigin=false

# elenco delle URL abilitate ad accedere ai servizi
it.govpay.configurazioneFiltroCors.cors.allowOrigins=
Expand Down
231 changes: 231 additions & 0 deletions src/main/resources/scripts/abilitaAuth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
#!/bin/bash

pushd () {
command pushd "$@" > /dev/null
}

popd () {
command popd "$@" > /dev/null
}

# DEFAULTS

BACKOFFICE=basic,ssl
PAGAMENTI=basic,ssl
PENDENZE=basic,ssl
RAGIONERIA=basic,ssl
PAGOPA=ssl
GOVPAY_SRC_DIR="ear/target/"
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"

case $key in
-bo|--backoffice)
BACKOFFICE="$2"
shift # past argument
shift # past value
;;
-pag|--pagamenti)
PAGAMENTI="$2"
shift # past argument
shift # past value
;;
-pen|--pendenze)
PENDENZE="$2"
shift # past argument
shift # past value
;;
-rag|--ragioneria)
RAGIONERIA="$2"
shift # past argument
shift # past value
;;
-pp|--pagopa)
PAGOPA="$2"
shift # past argument
shift # past value
;;
-src|--sourcedir)
GOVPAY_SRC_DIR="$2"
shift # past argument
shift # past value
;;
--default)
DEFAULT=YES
shift # past argument
;;
*) # unknown option
echo "Opzione non riconosciuta $1"
echo "usage:"
echo " -bo <args> : lista di autenticazioni da abilitare sulle api di backoffice (spid,header,basic,ssl). Default: basic,ssl"
echo " -pag <args> : lista di autenticazioni da abilitare sulle api di pagamento (spid,header,basic,ssl,public). Default: basic,ssl"
echo " -pen <args> : lista di autenticazioni da abilitare sulle api di pendenza (basic,ssl). Default: basic,ssl"
echo " -rag <args> : lista di autenticazioni da abilitare sulle api di ragioneria (basic,ssl). Default: basic,ssl"
echo " -pp <args> : autenticazione da abilitare sulle api di pagopa (basic,ssl). Default: ssl"
exit 2;
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters


BACKOFFICE_BASIC=true
BACKOFFICE_SSL=true
[[ $BACKOFFICE == *"header"* ]] && BACKOFFICE_HEADER=true || BACKOFFICE_HEADER=false
[[ $BACKOFFICE == *"spid"* ]] && BACKOFFICE_SPID=true || BACKOFFICE_SPID=false

PAGAMENTI_BASIC=true
PAGAMENTI_SSL=true
[[ $PAGAMENTI == *"header"* ]] && PAGAMENTI_HEADER=true || PAGAMENTI_HEADER=false
[[ $PAGAMENTI == *"spid"* ]] && PAGAMENTI_SPID=true || PAGAMENTI_SPID=false
[[ $PAGAMENTI == *"public"* ]] && PAGAMENTI_PUBLIC=true || PAGAMENTI_PUBLIC=false

PENDENZE_BASIC=true
PENDENZE_SSL=true
[[ $PENDENZE == *"header"* ]] && PENDENZE_HEADER=true || PENDENZE_HEADER=false

RAGIONERIA_BASIC=true
RAGIONERIA_SSL=true
[[ $RAGIONERIA == *"header"* ]] && RAGIONERIA_HEADER=true || RAGIONERIA_HEADER=false

[[ $PAGOPA == *"basic"* ]] && PAGOPA_BASIC=true || PAGOPA_BASIC=false

GOVPAY_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)

GOVPAY_WORK_DIR="govpay_ear_tmp"
GOVPAY_EAR_NAME="govpay.ear"
GOVPAY_TMP_DIR="GOVPAY_EAR"
APP_CONTEXT_BASE_DIR="WEB-INF"
APP_CONTEXT_SECURITY_XML=$APP_CONTEXT_BASE_DIR"/applicationContext-security.xml"

rm -rf $GOVPAY_WORK_DIR
mkdir $GOVPAY_WORK_DIR

cp $GOVPAY_SRC_DIR$GOVPAY_EAR_NAME $GOVPAY_WORK_DIR
pushd $GOVPAY_WORK_DIR

unzip -q -d $GOVPAY_TMP_DIR $GOVPAY_EAR_NAME
pushd $GOVPAY_TMP_DIR

# API-Backoffice
API_BACKOFFICE_WAR="api-backoffice-"
unzip -q $API_BACKOFFICE_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML

if $BACKOFFICE_SPID
then
echo "API-Backoffice abilitazione autenticazione spid...";
sed -i -e "s#SPID_START#SPID_START -->#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#SPID_END#<!-- SPID_END#g" $APP_CONTEXT_SECURITY_XML
echo "API-Backoffice abilitazione spid completata.";
fi

if $BACKOFFICE_HEADER
then
echo "API-Backoffice abilitazione HTTP Header-auth ...";
sed -i -e "s#HEADER_START#HEADER_START -->#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#HEADER_END#<!-- HEADER_END#g" $APP_CONTEXT_SECURITY_XML
echo "API-Backoffice abilitazione HTTP Header-auth completata.";
fi
zip -qr $API_BACKOFFICE_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML
rm -rf $APP_CONTEXT_BASE_DIR

# API-Pendenze

API_PENDENZE_WAR="api-pendenze-"
unzip -q $API_PENDENZE_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML

if $PENDENZE_HEADER
then
echo "API-Pendenze abilitazione HTTP Header-auth ...";
sed -i -e "s#HEADER_START#HEADER_START -->#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#HEADER_END#<!-- HEADER_END#g" $APP_CONTEXT_SECURITY_XML
echo "API-Pendenze abilitazione HTTP Header-auth completata.";
fi
zip -qr $API_PENDENZE_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML
rm -rf $APP_CONTEXT_BASE_DIR

# API-Ragioneria
API_RAGIONERIA_WAR="api-ragioneria-"
unzip -q $API_RAGIONERIA_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML

if $RAGIONERIA_HEADER
then
echo "API-Ragioneria abilitazione HTTP Header-auth ...";
sed -i -e "s#HEADER_START#HEADER_START -->#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#HEADER_END#<!-- HEADER_END#g" $APP_CONTEXT_SECURITY_XML
echo "API-Ragioneria abilitazione HTTP Header-auth completata.";
fi
zip -qr $API_RAGIONERIA_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML
rm -rf $APP_CONTEXT_BASE_DIR

# API-Pagamento
API_PAGAMENTO_WAR="api-pagamento-"
unzip -q $API_PAGAMENTO_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML

if $PAGAMENTI_SPID
then
echo "API-Pagamento abilitazione autenticazione SPID...";
sed -i -e "s#SPID_START#SPID_START -->#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#SPID_END#<!-- SPID_END#g" $APP_CONTEXT_SECURITY_XML
echo "API-Pagamento abilitazione autenticazione SPID completata.";
fi

if $PAGAMENTI_HEADER
then
echo "API-Pagamento abilitazione HTTP Header-auth ...";
sed -i -e "s#HEADER_START#HEADER_START -->#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#HEADER_END#<!-- HEADER_END#g" $APP_CONTEXT_SECURITY_XML
echo "API-Pagamento abilitazione HTTP Header-auth completata.";
fi

if $PAGAMENTI_PUBLIC
then
echo "API-Pagamento abilitazione pagamenti in forma anonima...";
sed -i -e "s#PUBLIC_START#PUBLIC_START -->#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#PUBLIC_END#<!-- PUBLIC_END#g" $APP_CONTEXT_SECURITY_XML
echo "API-Pagamento abilitazione pagamenti in forma anonima completata.";
fi
zip -qr $API_PAGAMENTO_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML
rm -rf $APP_CONTEXT_BASE_DIR

# API-PagoPA

if $PAGOPA_BASIC
then
echo "API-PagoPA abilitazione HTTP Basic-auth...";
API_PAGOPA_WAR="api-pagopa-"
unzip -q $API_PAGOPA_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML

# spengo la modalita' ssl
sed -i -e "s#BASIC_START#BASIC_START -->#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#BASIC_END#<!-- BASIC_END#g" $APP_CONTEXT_SECURITY_XML

# accendo modalita basic
sed -i -e "s#SSL_START -->#SSL_START#g" $APP_CONTEXT_SECURITY_XML
sed -i -e "s#<!-- SSL_END#SSL_END#g" $APP_CONTEXT_SECURITY_XML

# ripristino file
zip -qr $API_PAGOPA_WAR$GOVPAY_VERSION.war $APP_CONTEXT_SECURITY_XML

# eliminazione dei file temporanei
rm -rf $APP_CONTEXT_BASE_DIR

echo "API-PagoPA abilitazione HTTP Basic-auth completata.";
fi

zip -qr $GOVPAY_EAR_NAME *

popd

mv $GOVPAY_TMP_DIR/$GOVPAY_EAR_NAME .
rm -rf $GOVPAY_TMP_DIR

popd

cp $GOVPAY_WORK_DIR/$GOVPAY_EAR_NAME $GOVPAY_SRC_DIR
rm -rf $GOVPAY_WORK_DIR

echo "Configurazione govpay.ear completata";

0 comments on commit 5c20a0e

Please sign in to comment.