Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $serviceNamespace = 'http://websales.astrasig.ro/smartsalesservices';
- $wsdl = 'https://websales.astrasig.ro/smartsalesservices/casco.asmx?wsdl';
- $username = 'broker.test';
- $pwd = '123456';
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $client = new SoapClient($wsdl, array('trace' => true));
- $credentials = new SoapHeader($serviceNamespace, 'CredentialHeader', array(
- 'Username' => $username,
- 'Password' => $pwd
- ));
- $client->__setSoapHeaders($credentials);
- $categorieVehicul = 'VehiculeSub3_5Tone';
- if (!empty($_POST['tipProdus']) && $_POST['tipProdus'] == 'EuroCasco') {
- $categorieVehicul = $_POST['tipVehicul'];
- }
- $clauzeSpeciale = array();
- if (!empty($_POST['ActeVandalice'])) $clauzeSpeciale[] = 'ActeVandalice';
- if (!empty($_POST['FurtPartialFaraUrmeEfractie'])) $clauzeSpeciale[] = 'FurtPartialFaraUrmeEfractie';
- if (!empty($_POST['AspiratieApaInMotor'])) $clauzeSpeciale[] = 'AspiratieApaInMotor';
- if (!empty($_POST['PierdereaCheilor'])) $clauzeSpeciale[] = 'PierdereaCheilor';
- if (!empty($_POST['ReintregireSA'])) $clauzeSpeciale[] = 'ReintregireSA';
- if (!empty($_POST['CirculatieDrumuriNonPublice'])) $clauzeSpeciale[] = 'CirculatieDrumuriNonPublice';
- $optiuniPolita = array();
- $limitaBagaje = 'None';
- $limitaPersoane = 'None';
- if (!empty($_POST['ExcludereRiscFurt'])) $optiuniPolita[] = 'ExcludereRiscFurt';
- if (!empty($_POST['AsistentaRutieraExtinsa'])) $optiuniPolita[] = 'AsistentaRutieraExtinsa';
- if (!empty($_POST['AsigurarePersoane'])) {
- $optiuniPolita[] = 'AsigurareBagaje';
- $limitaPersoane = $_POST['LimitaPersoane'];
- }
- if (!empty($_POST['AsigurareBagaje'])) {
- $optiuniPolita[] = 'AsigurareBagaje';
- $limitaBagaje = $_POST['LimitaBagaje'];
- }
- $calculRequest = array(
- 'TipProdusCasco' => $_POST['tipProdus'],
- 'TipAsigurare' => $_POST['tipAsig'],
- 'AsiguratEstePersoanaFizica' => $_POST['tipPers'] == '1' ? true : false,
- 'AsiguratStareCivila' => $_POST['stareCivila'],
- 'AsiguratVarsta' => $_POST['varstaAsig'],
- 'CategorieVehicul' => $categorieVehicul,
- 'MarcaVehicul' => $_POST['marcaVehicul'],
- 'SerieSasiuVehicul' => $_POST['serieVehicul'],
- 'NrLocuri' => $_POST['nrLocuri'],
- 'ValoareDeNou' => $_POST['valoareDeNou'],
- 'ValoareDotariSuplimentare' => $_POST['valoareDotari'],
- 'AnFabricatie' => $_POST['anFabricatie'],
- 'StareIntretinereVehicul' => $_POST['StareIntretinere'],
- 'Destinatie' => $_POST['destinatieVehicul'],
- 'InmatriculatInMediu' => $_POST['mediuInmatriculare'],
- 'KmMediuParcursiAnual' => $_POST['KmMediuParcursiAnual'],
- 'ConducatorAutoUnic' => $_POST['ConducatorAutoUnic'],
- 'VechimePermisConducere' => $_POST['VechimePermisConducere'],
- 'FrecventaDePlata' => $_POST['FrecventaDePlata'],
- 'Moneda' => $_POST['Moneda'],
- 'InceputValabilitate' => $_POST['InceputValabilitate'],
- 'ClauzeSpeciale' => $clauzeSpeciale,
- 'OptiuniPolita' => $optiuniPolita,
- 'LimitaPersoane' => $limitaPersoane,
- 'LimitaBagaje' => $limitaBagaje,
- 'Fransiza' => $_POST['Fransiza']
- );
- $oferta = $client->CalculOfertaCasco(array('OfertaRequest' => $calculRequest));
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Rezultate calcul CASCO</title>
- <style type="text/css">
- body { font-family: Calibri, Sans-Serif; font-size: 11pt; color: green; }
- div.result { color: green; padding: 4px; border: solid 2px green; font-size: 1.2em; }
- div.result p { font-size: 0.8em; }
- h4 { color: #2C93C6 }
- code { color: black; width: 100%; }
- </style>
- </head>
- <body>
- <?php if(!empty($oferta)) {
- $result = $oferta->CalculOfertaCascoResult;?>
- <div class="result">
- <h3><?php echo 'Suma Asigurata : '.$result->SumaAsigurata.' '.$result->Moneda ?></h3>
- <h3><?php echo 'Prima anuala : '.$result->Prima.' '.$result->Moneda ?></h3>
- <p><?php echo str_replace(array("\r\n", "\r", "\n"), '<br />', trim($result->Formula)) ?></p>
- </div>
- <a href="oferta.php"><strong>Inapoi</strong></a>
- <h4>Request</h4>
- <code>
- <?php echo htmlentities($client->__getLastRequest()) ?>
- </code>
- <h4>Response</h4>
- <code>
- <?php echo htmlentities($client->__getLastResponse()) ?>
- </code>
- <?php }?>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement