|
|
@@ -1183,9 +1183,16 @@ class Report extends Component{
|
|
|
|
|
|
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(
|
|
|
@@ -1196,8 +1203,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">
|
|
|
@@ -1229,13 +1238,21 @@ 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)
|
|
|
{
|
|
|
$this->loadTarga = $fault->getMessage();
|
|
|
@@ -1243,6 +1260,7 @@ class Report extends Component{
|
|
|
}
|
|
|
catch(\Exception $ex)
|
|
|
{
|
|
|
+ Log::error($ex->getMessage());
|
|
|
}
|
|
|
|
|
|
$this->emit('hideLoading', 'btTarga');
|
|
|
@@ -1258,9 +1276,13 @@ class Report extends Component{
|
|
|
{
|
|
|
$patente = $this->anag_documento_numero;
|
|
|
|
|
|
+ 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(
|
|
|
@@ -1306,6 +1328,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;
|
|
|
@@ -1324,6 +1351,7 @@ class Report extends Component{
|
|
|
}
|
|
|
catch(\SoapFault $ex)
|
|
|
{
|
|
|
+ Log::error($ex->getMessage());
|
|
|
}
|
|
|
|
|
|
$this->emit('hideLoading', 'btPatente');
|
|
|
@@ -1332,6 +1360,16 @@ class Report extends Component{
|
|
|
|
|
|
}
|
|
|
|
|
|
+ protected function handleMCTCError($response)
|
|
|
+ {
|
|
|
+ if (isset($response->errore) && $response->errore->codiceErrore === '01') {
|
|
|
+ Log::error("MCTC API Error: {$response->errore->descrizioneErrore}");
|
|
|
+ session()->flash('error', value: $response->errore->descrizioneErrore);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
public function print($id){
|
|
|
|
|
|
$record = \App\Models\Report::findOrFail($id);
|