2015-01-23 13:09:30 +00:00
|
|
|
<?php
|
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
if (isset($_POST['key'])) {
|
|
|
|
ini_set('soap.wsdl_cache_enabled', FALSE);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
$requestString = file_get_contents(__DIR__.'/soap-request.xml');
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
$client = new SoapClient(__DIR__.'/soap.wsdl');
|
|
|
|
$result = $client->__soapCall('procesaNotificacionSIS', [
|
2015-03-06 23:33:54 +00:00
|
|
|
'XML' => $requestString
|
|
|
|
]);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
$xml = new SimpleXMLElement($result);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-03-06 23:33:54 +00:00
|
|
|
$key = $_POST['key'];
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2018-05-23 10:14:20 +00:00
|
|
|
$start = strpos($result, '<Response');
|
|
|
|
$end = strrpos($result, '</Response>');
|
|
|
|
$shaString = substr($result, $start, $end - $start + 11);
|
|
|
|
$shaHash = sha1($shaString.$key);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2015-03-06 23:33:54 +00:00
|
|
|
$isValid = $xml->{'Signature'} == $shaHash;
|
2018-05-23 11:09:55 +00:00
|
|
|
} else {
|
2015-03-06 23:33:54 +00:00
|
|
|
$key = '';
|
|
|
|
$result = '';
|
|
|
|
$shaHash = '';
|
|
|
|
$isValid = FALSE;
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>
|
|
|
|
TPV SOAP Client
|
|
|
|
</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
2015-03-06 23:33:54 +00:00
|
|
|
<form action="?" method="post">
|
|
|
|
<label>Key:</label>
|
|
|
|
<input type="password" value="<?=$key?>" name="key"/>
|
|
|
|
<input type="submit"/>
|
|
|
|
</form>
|
2015-01-23 13:09:30 +00:00
|
|
|
<h2>Response</h2>
|
|
|
|
<p>
|
2018-05-23 10:14:20 +00:00
|
|
|
<pre><?=htmlentities($result)?></pre>
|
2015-01-23 13:09:30 +00:00
|
|
|
</p>
|
|
|
|
<h2>Signature</h2>
|
|
|
|
<p>
|
|
|
|
Calculated: <?=$shaHash?>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Valid: <input type="checkbox" <?=($isValid ? 'checked' : '')?>/>
|
|
|
|
</p>
|
|
|
|
</body>
|
|
|
|
</html>
|