|
|
@@ -1227,10 +1227,18 @@ class Report extends Component
|
|
|
|
|
|
$targa = $this->vei_targa;
|
|
|
|
|
|
- try {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Log::info("veicolo con targa: " . $targa);
|
|
|
+
|
|
|
$wd = "dettaglioAutoveicoloBase";
|
|
|
$wd = "datiCartaCircolazioneAutoveicoloProprietario";
|
|
|
+
|
|
|
+ Log::info("wd: " . $wd);
|
|
|
+
|
|
|
$url = env('MCTC_URL', 'https://e-servizicoll.dtt.ilportaledellautomobilista.it/Info-ws-sh/services');
|
|
|
+ Log::info("url: " . $url);
|
|
|
+
|
|
|
$client = new \SoapClient($url . '/' . $wd . '/' . $wd . '.wsdl', array(
|
|
|
'stream_context' => stream_context_create(array(
|
|
|
'ssl' => array(
|
|
|
@@ -1241,8 +1249,10 @@ class Report extends Component
|
|
|
)),
|
|
|
'trace' => 1
|
|
|
));
|
|
|
+
|
|
|
$utente = env('MCTC_USER', '');
|
|
|
$password = env('MCTC_PASSWORD', '');
|
|
|
+
|
|
|
$xml = '<wsse:Security
|
|
|
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
|
|
|
SOAP-ENV:mustUnderstand="1">
|
|
|
@@ -1273,16 +1283,28 @@ class Report extends Component
|
|
|
"pdf" => false
|
|
|
)
|
|
|
));
|
|
|
+
|
|
|
+ if (!$this->handleMCTCError($obj)) {
|
|
|
+ $this->emit('hideLoading', 'btTarga');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
Log::debug(print_r($obj, true));
|
|
|
+
|
|
|
$this->vei_data_ultima_revisione = @$obj->DatiUltimaRevisione->dataUltimaRevisione;
|
|
|
$this->vei_carta_circolazione = @$obj->DatiAmministrativiVeicolo[0]->NumeroCartaCircolazione;
|
|
|
$this->vei_carta_circolazione_rilasciata_il = @$obj->DatiAmministrativiVeicolo[0]->DataEmissioneDocumento;
|
|
|
$this->vei_cilindrata = @$obj->DatiTecniciVeicolo->CilindrataInCentimetriCubi;
|
|
|
$this->vei_peso_complessivo = @$obj->DatiTecniciVeicolo->TaraInKG;
|
|
|
- } catch (\SoapFault $fault) {
|
|
|
+ }
|
|
|
+ catch(\SoapFault $fault)
|
|
|
+ {
|
|
|
$this->loadTarga = $fault->getMessage();
|
|
|
}
|
|
|
- } catch (\Exception $ex) {
|
|
|
+ }
|
|
|
+ catch(\Exception $ex)
|
|
|
+ {
|
|
|
+ Log::error($ex->getMessage());
|
|
|
}
|
|
|
|
|
|
$this->emit('hideLoading', 'btTarga');
|
|
|
@@ -1295,9 +1317,15 @@ class Report extends Component
|
|
|
if ($this->anag_documento_numero != '') {
|
|
|
$patente = $this->anag_documento_numero;
|
|
|
|
|
|
+ Log::info("patente numero: " . $patente);
|
|
|
+
|
|
|
+ Log::info("patente numero: " . $patente);
|
|
|
+
|
|
|
try {
|
|
|
$wd = "dettaglioPatenteBase";
|
|
|
$url = env('MCTC_URL', 'https://e-servizicoll.dtt.ilportaledellautomobilista.it/Info-ws-sh/services');
|
|
|
+ Log::info("url: " . $url);
|
|
|
+
|
|
|
$client = new \SoapClient($url . '/' . $wd . '/' . $wd . '.wsdl', array(
|
|
|
'stream_context' => stream_context_create(array(
|
|
|
'ssl' => array(
|
|
|
@@ -1342,6 +1370,11 @@ class Report extends Component
|
|
|
)
|
|
|
));
|
|
|
|
|
|
+ if (!$this->handleMCTCError($obj)) {
|
|
|
+ $this->emit('hideLoading', 'btTarga');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
Log::debug(print_r($obj, true));
|
|
|
$this->anag_firstname = @$obj->dettaglioPatenteBaseOutput->anagrafica->nome;
|
|
|
$this->anag_lastname = @$obj->dettaglioPatenteBaseOutput->anagrafica->cognome;
|
|
|
@@ -1355,11 +1388,29 @@ class Report extends Component
|
|
|
'</xmp><br/><br/> Error Message : <br/>',
|
|
|
$fault->getMessage();
|
|
|
}
|
|
|
- } catch (\SoapFault $ex) {
|
|
|
+ }
|
|
|
+ catch(\SoapFault $ex)
|
|
|
+ {
|
|
|
+ Log::error($ex->getMessage());
|
|
|
}
|
|
|
|
|
|
$this->emit('hideLoading', 'btPatente');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function handleMCTCError($response)
|
|
|
+ {
|
|
|
+ if (isset($response->errore) && $response->errore->codiceErrore === '01') {
|
|
|
+ Log::error("MCTC API Error: {$response->errore->descrizioneErrore}");
|
|
|
+ if (str_contains($response->errore->descrizioneErrore, 'Errore di validazione - string length')) {
|
|
|
+ session()->flash('error', 'Errore di validazione numero di caratteri errato');
|
|
|
+ } else {
|
|
|
+ session()->flash('error', $response->errore->descrizioneErrore);
|
|
|
+ } return false;
|
|
|
}
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
public function print($id)
|