Merge branch_C03_2025

This commit is contained in:
manuelstefanile
2025-07-09 08:52:36 +02:00
22 changed files with 208 additions and 39 deletions

View File

@@ -0,0 +1,5 @@
{
"id": "123",
"rifCliente": "0000000859510539",
"statoCertificazioneCliente": "C"
}

View File

@@ -0,0 +1,10 @@
[
{
"id": "0000000859510539:3920131398",
"numLinea": "3920131398",
"rifCliente": "0000000859510539",
"statoLinea": {
"descrizione": "ATTIVO"
}
}
]

View File

@@ -0,0 +1,5 @@
{
"cf": "0000000859510539",
"customerCertification": "Y",
"piva": "00859510539"
}

View File

@@ -0,0 +1,50 @@
{
"attributi": {
"blocco": {
"anagr": "S",
"fraud": "000",
"fs": "S"
},
"dati_commerciali": {
"cliente": "DCNFBA80B06F89M",
"marcaggio_cliente": "X"
},
"descrizione_profilo": "ABBONATO",
"dettaglio_stato": {
"cessazione_mnp": "S"
},
"esp": "TIM",
"prepagato": "S",
"profilo": "00",
"stato": "PREATTIVO",
"tipologia": "BU",
"usage": {
"main_msisdn": "3245562345",
"value": "MAIN"
}
},
"carta": {
"icc-id20": "00000000000001313901"
},
"info": {
"code": "00",
"msg": "OK"
},
"msisdn": "3631517588",
"risorse_rete": {
"Data_ultima_operazione": "20030502160251",
"stato": "LI",
"tipologia": "A"
},
"servizi": {
"servizio": [
{
"attributi_servizio": {
"additional": "3355173796",
"sottoservizio": "BEAR"
},
"name": "BEAR"
}
]
}
}

View File

@@ -0,0 +1,10 @@
############### Middleware Modernization 2024: Servizi GISP lotto7 - Authorization HTTP - Basic - BEGIN - ##############
#La stringa rappresenta la concatenazione della '<USERNAME>:<PASSWORD>' fornite da ESO per l'autenticazione
ESO_RETRIEVE_REST_POST_AUTHBASIC_BASE64 = RVNPX00yTV9TRFA6RXNvW1N0ZzJdLQ==
#Properties utili SOLO per SVILUPPO (VALORI: 0 = COMUNICAZIONE REST WS, 1 = MOCK RETRIEVE ESO RESPONSE)
ESO_RETRIEVE_REST_POST_MOCK_RESPONSE_ENABLED = 0
ESO_RETRIEVE_REST_POST_MOCK_RESPONSE=/mnpapp/mockResponse/retrieveSdpESO.json
############### Middleware Modernization 2024: Servizi GISP lotto7 - Authorization HTTP - Basic - END - ################

View File

@@ -0,0 +1,8 @@
@set ANT_HOME=apache-ant-1.9.2
@set JAVA_HOME=C:\jdk1.6.0_45
@set PATH=%ANT_HOME%/bin;%JAVA_HOME%/bin
@set ANT_OPTS=-Xms512m -Xmx512m
@call ant -buildfile build_ws.xml ESITOCESSMNPWS
@pause

View File

@@ -24,7 +24,7 @@ ErrorJSP
<table width = "100%" border = "0">
<tr>
<td HEIGHT = "100%" width = "10%" bgcolor = "#D61414" valign = "top">
<IMG src ="<%=Res.ReqURL%>/images/LogoMnp.gif">
<IMG src ="/MNP-GUI/images/LogoMnp.gif">
</td>
<td align = "right" valign = "top" width = "90%">
<!-- td dove scrivere i dati a destra -->

View File

@@ -102,7 +102,7 @@ System.out.println("Sono dentro la LoginCrontab.jsp");
<table width = "100%" class = "tableBannerRosso" border = 0>
<tr>
<td align = "left" width = "100%"><IMG border = 0 SRC ="<%=Res.ReqURL%>/images/banner.gif"></td>
<td align = "left" width = "100%"><IMG border = 0 SRC ="/MNP-GUI/images/banner.gif"></td>
</tr>
</table>
@@ -115,7 +115,7 @@ System.out.println("Sono dentro la LoginCrontab.jsp");
<td align = "right" valign = "top" width = "90%">
<BR>
<i><b><FONT face = "Arial" color = "#455598" size = 4 weight = "700">MNP-GUI</Font></b></i>
<form name="loginForm" method="post" action="<%=Res.ReqURL%>/Login.do" target="_self">
<form name="loginForm" method="post" action="/MNP-GUI/Login.do" target="_self">
<INPUT type="hidden" name="ipclient">
<INPUT type="hidden" name="hostnameclient">
<INPUT type="hidden" name="utenzaclient">

View File

@@ -77,7 +77,7 @@ function inviaDatiClient() {
<table width = "100%" class = "tableBannerRosso" border = 0>
<tr>
<td align = "left" width = "100%"><IMG border = 0 SRC ="<%=Res.ReqURL%>/images/banner.gif"></td>
<td align = "left" width = "100%"><IMG border = 0 SRC ="/MNP-GUI/images/banner.gif"></td>
</tr>
</table>
@@ -90,7 +90,7 @@ function inviaDatiClient() {
<td align = "right" valign = "top" width = "90%">
<BR>
<i><b><FONT face = "Arial" color = "#455598" size = 4 weight = "700">MNP-GUI</Font></b></i>
<form name="loginForm" method="post" action="<%=Res.ReqURL%>/Login.do" target="_self">
<form name="loginForm" method="post" action="/MNP-GUI/Login.do" target="_self">
<INPUT type="hidden" name="ipclient">
<INPUT type="hidden" name="hostnameclient">
<INPUT type="hidden" name="utenzaclient">

View File

@@ -4,7 +4,6 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import mnp.database.hb.dto.MnpGinoRetrieveOut;
import mnp.database.hb.dto.MnpGispRetrieveOut;
import mnp.database.hb.dto.MnpSdpRetrieveOut;
import mnp.log.ProcessLogger;
import mnp.proxy.ws.fetrcs.*;
@@ -12,6 +11,7 @@ import mnp.utility.DateUtils;
import mnp.utility.Func;
import mnp.utility.Resources;
import org.apache.http.Header;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
@@ -64,15 +64,25 @@ public class WSRestHandler extends GenericHandler {
post.setEntity(postingString);
post.setHeaders(headers);
response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line;
while ((line = rd.readLine()) != null) {
jsonString.append(line).append('\n');
//check sulla risposta HTTP di ESO
if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK){ // se 200
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line;
while ((line = rd.readLine()) != null) {
jsonString.append(line).append('\n');
}
}
else { //Altrimenti ci aspettiamo solo status code: 401 (Richiesta non autorizzata) o 503 (Non espletata)
log.write("9999","ERRORE REST POST response: " + response.getStatusLine().getStatusCode());
throw new Exception("HTTP Status Code: " + response.getStatusLine().getStatusCode() +" Reason Phrase: " + response.getStatusLine().getReasonPhrase());
}
client.close();
response.close();
} catch (Exception ex) {
log.write("2512","ERRORE POST response");
log.write("9999","ERRORE REST POST response: " + ex.getMessage());
throw ex;
} finally {
try {
@@ -329,11 +339,26 @@ public class WSRestHandler extends GenericHandler {
logWrite("9999", "retrieveESORestPost: INIZIO CHIAMATA SERVIZIO REST");
String risposta = "";
try {
Header[] headers = setHeader("retriverGispXML");
String url = Resources.getESO_RETRIEVE_REST_POST_URL();
risposta = restPost(url,headers,requestSdpJson,log);
logWrite("9999", "retrieveESORestPost: url chiamato: "+url);
logWrite("9999", "retrieveESORestPost: FINE CHIAMATA SERVIZIO REST");
if("1".equals(Resources.getESO_RETRIEVE_REST_POST_MOCK_RESPONSE_ENABLED())) {
logWrite("9999", "retrieveESO: RETRIEVE ESO MOCK RESPONSE");
BufferedReader reader = new BufferedReader(new FileReader(Resources.getESO_RETRIEVE_REST_POST_MOCK_RESPONSE()));
try {
String line;
while ((line = reader.readLine()) != null) {
risposta += line + '\n';
}
} finally {
reader.close();
}
} else {
Header[] headers = setHeaderRetrieveESO("retriveESO");
String url = Resources.getESO_RETRIEVE_REST_POST_URL();
risposta = restPost(url, headers, requestSdpJson, log);
logWrite("9999", "retrieveESORestPost: url chiamato: " + url);
logWrite("9999", "retrieveESORestPost: FINE CHIAMATA SERVIZIO REST");
}
} catch (Exception ex) {
logWrite("9999", "retrieveESORestPost: ECCEZIONE NELLA CHIAMATA REST:" + " Message: " +ex.getMessage() +" Cause: "+ex.getCause());
throw ex;
@@ -363,6 +388,32 @@ public class WSRestHandler extends GenericHandler {
return headers;
}
private Header[] setHeaderRetrieveESO(String restService) {
Date now = new Date();
TID tid = new TID();
// Authorization HTTP - Basic: recupero credenziali <USERNAME:PASSWORD> codificate in BASE64 dal file di resources.properties
String encodedAuth = Resources.getESO_RETRIEVE_REST_POST_AUTHBASIC_BASE64();
// Headers
Header[] headers = new BasicHeader[9];
headers[0] = new BasicHeader("Content-Type", "application/json; charset=UTF-8");
headers[1] = new BasicHeader("sourceSystem", system);
headers[2] = new BasicHeader("channel", system);
headers[3] = new BasicHeader("interactionDate-Date", DateUtils.toDcoString(now));
headers[4] = new BasicHeader("interactionDate-Time", DateUtils.getHourMinSec(now) + ".000");
headers[5] = new BasicHeader("sessionID", tid.toString());
headers[6] = new BasicHeader("businessID", tid.toString());
headers[7] = new BasicHeader("transactionID", tid.toString());
headers[8] = new BasicHeader("Authorization", "Basic " + encodedAuth);
logWrite("9999", restService + ": HEADER DEL SERVIZIO REST: ");
for (Header header : headers) {
logWrite("9999", " -> " + header.toString());
}
return headers;
}
private void manageErrorDTO(Gson gson, String risposta) throws Exception {
ErrorDTO errorDTO = gson.fromJson(risposta, ErrorDTO.class);
logWrite("9999", "CODICE DI ERRORE DELLA RESPONSE: " + errorDTO.getCode());

View File

@@ -100,7 +100,7 @@ public class GispRetrieveDonorFormatController {
* @return RetrieveGisp
*/
public MnpGispRetrieveOut formatEsoDTO(String tracciato) throws Exception {
return RetrieveGispXAO.getRetrieveESOFromXmlResponse(tracciato);
return RetrieveGispXAO.getRetrieveESOFromJsonResponse(tracciato);
}
/**

View File

@@ -2515,4 +2515,21 @@ public class Resources {
init();
return trim(props.getProperty("ESO_RETRIEVE_REST_POST_URL"));
}
public static String getESO_RETRIEVE_REST_POST_AUTHBASIC_BASE64() {
init();
return trim(props.getProperty("ESO_RETRIEVE_REST_POST_AUTHBASIC_BASE64"));
}
public static String getESO_RETRIEVE_REST_POST_MOCK_RESPONSE() {
init();
return trim(props.getProperty("ESO_RETRIEVE_REST_POST_MOCK_RESPONSE"));
}
public static String getESO_RETRIEVE_REST_POST_MOCK_RESPONSE_ENABLED() {
init();
return trim(props.getProperty("ESO_RETRIEVE_REST_POST_MOCK_RESPONSE_ENABLED"));
}
}

View File

@@ -392,7 +392,7 @@ public class RetrieveGispXAO {
* @param xmlResponse String
* @return String
*/
public static MnpGispRetrieveOut getRetrieveESOFromXmlResponse(String xmlResponse) throws Exception{
public static MnpGispRetrieveOut getRetrieveESOFromJsonResponse(String xmlResponse) throws Exception{
MnpGispRetrieveOut retrieveGisp= new MnpGispRetrieveOut();
try {
// databinding con validazione
@@ -408,7 +408,9 @@ public class RetrieveGispXAO {
mnp.proxy.ws.sdp.client.Attributi attributi = response.getAttributi();
retrieveGisp.setStato(attributi.getStato());
//cessazione_mnp
retrieveGisp.setRespCessazioneMnp(attributi.getDettaglioStato().getCessazioneMnp());
if(attributi.getDettaglioStato()!=null){
retrieveGisp.setRespCessazioneMnp(attributi.getDettaglioStato().getCessazioneMnp());
}
//operatore_virtuale
retrieveGisp.setRespOperatoreInterno(attributi.getEsp());
// Descrizione profilo
@@ -416,21 +418,27 @@ public class RetrieveGispXAO {
//profilo
retrieveGisp.setProfilo(attributi.getProfilo());
//blocco
retrieveGisp.setAnagr(attributi.getBlocco().getAnagr());
retrieveGisp.setRespFs(attributi.getBlocco().getFs());
retrieveGisp.setRespFraud(attributi.getBlocco().getFraud());
if(attributi.getBlocco()!=null){
retrieveGisp.setAnagr(attributi.getBlocco().getAnagr());
retrieveGisp.setRespFs(attributi.getBlocco().getFs());
retrieveGisp.setRespFraud(attributi.getBlocco().getFraud());
}
//tipologia
retrieveGisp.setRespTipologia(attributi.getTipologia());
retrieveGisp.setRespValueUsage(attributi.getUsage().getValue());
//usage (value and main_msisdn)
if(attributi.getUsage()!=null){
retrieveGisp.setRespValueUsage(attributi.getUsage().getValue());
if (!retrieveGisp.getRespValueUsage().equals(GispMap.MAIN_USAGE)
|| !retrieveGisp.getRespValueUsage().equals(GispMap.TCB_PADRE_USAGE)){
retrieveGisp.setRespMainMsisdn(attributi.getUsage().getMainMsisdn());
if (!retrieveGisp.getRespValueUsage().equals(GispMap.MAIN_USAGE)
|| !retrieveGisp.getRespValueUsage().equals(GispMap.TCB_PADRE_USAGE)){
retrieveGisp.setRespMainMsisdn(attributi.getUsage().getMainMsisdn());
}
}
//dati commerciali
retrieveGisp.setRespCfPiva(attributi.getDatiCommerciali().getCliente());
retrieveGisp.setRespMarcaggio(attributi.getDatiCommerciali().getMarcaggioCliente());
if(attributi.getDatiCommerciali()!=null){
retrieveGisp.setRespCfPiva(attributi.getDatiCommerciali().getCliente());
retrieveGisp.setRespMarcaggio(attributi.getDatiCommerciali().getMarcaggioCliente());
}
retrieveGisp.setRespPrepagato(attributi.getPrepagato());
}//chiude if attributi
@@ -449,8 +457,10 @@ public class RetrieveGispXAO {
retrieveGisp.setRespServizioAttivo(elencoServizi[0].getName());
//prendo l'elenco degli attributi del servizio (i sottoservizi possono essere più di uno)
mnp.proxy.ws.sdp.client.ServiziAttributiServizio attributiServizi = elencoServizi[0].getAttributiServizio();
retrieveGisp.setRespAdditional(attributiServizi.getAdditional());
retrieveGisp.setRespSottoservizio(attributiServizi.getSottoservizio());
if(attributiServizi != null){
retrieveGisp.setRespAdditional(attributiServizi.getAdditional());
retrieveGisp.setRespSottoservizio(attributiServizi.getSottoservizio());
}
// retrieveGisp.setRespAdditional(elencoServizi[0].getAttributi_servizi()[0].getAttributo(1).getContent());
}
} //chiudi if servizi

View File

@@ -139,14 +139,17 @@ public class MvnoNotifyDonorOutXAO {
if(!Func.isNull(notificaDonOut.getTipoUtenza())) {
mawcts.setAccountType(AccountType.fromValue(notificaDonOut.getTipoUtenza()));
}
//MNP_SM_2461 flag_furto non più dipendente da ICCID
NewSIMWithisStolen nsws_iccid_furto = of2.createNewSIMWithisStolen();
if(!Func.isNull(notificaDonOut.getIccid())) {
NewSIMWithisStolen nsws = of2.createNewSIMWithisStolen();
nsws.setICCID(notificaDonOut.getIccid());
if(!Func.isNull(notificaDonOut.getFlagFurto())) {
nsws.setIsStolen(YesNoType.fromValue(notificaDonOut.getFlagFurto()));
}
mawcts.setNewSIM(nsws);
nsws_iccid_furto.setICCID(notificaDonOut.getIccid());
}
if(!Func.isNull(notificaDonOut.getFlagFurto())) {
nsws_iccid_furto.setIsStolen(YesNoType.fromValue(notificaDonOut.getFlagFurto()));
}
mawcts.setNewSIM(nsws_iccid_furto);
if(!Func.isNull(notificaDonOut.getFlagTc())) {
mawcts.setIsCreditInTransfer(YesNoType.fromValue(notificaDonOut.getFlagTc()));
}

View File

@@ -31,7 +31,7 @@
<xs:simpleType name="typeNOME_RICHIESTA">
<xs:restriction base="xs:string">
<xs:pattern value="DBC_DISATMNPG|DBC_ATTIVGSM|DBC_DISATMNPG_PP|DBC_DISATMNPG_CO|DBC_DISATMNPG_BU"/>
<xs:pattern value="DBC_DISATMNPG|DBC_ATTIVGSM|DBC_DISATMNPG_PP|DBC_DISATMNPG_CO|DBC_DISATMNPG_BU|DBC_RESTITUZIONE"/>
</xs:restriction>
</xs:simpleType>