forked from verdnatura/hedera-web
62 lines
1.1 KiB
PHP
62 lines
1.1 KiB
PHP
<?php
|
|
|
|
require_once ('vn/tpv/tpv.php');
|
|
|
|
if (isset ($_POST['key']))
|
|
{
|
|
ini_set ('soap.wsdl_cache_enabled', FALSE);
|
|
|
|
$requestString = file_get_contents (__DIR__.'/soap-request.xml');
|
|
|
|
$client = new SoapClient (__DIR__.'/soap.wsdl');
|
|
$result = $client->__soapCall ('procesaNotificacionSIS', [
|
|
'XML' => $requestString
|
|
]);
|
|
|
|
$xml = new SimpleXMLElement ($result);
|
|
|
|
$key = $_POST['key'];
|
|
|
|
$start = strpos ($result, '<Response');
|
|
$end = strrpos ($result, '</Response>');
|
|
$shaString = substr ($result, $start, $end - $start + 11);
|
|
$shaHash = sha1 ($shaString.$key);
|
|
|
|
$isValid = $xml->{'Signature'} == $shaHash;
|
|
}
|
|
else
|
|
{
|
|
$key = '';
|
|
$result = '';
|
|
$shaHash = '';
|
|
$isValid = FALSE;
|
|
}
|
|
|
|
?>
|
|
|
|
<html>
|
|
<head>
|
|
<title>
|
|
TPV SOAP Client
|
|
</title>
|
|
</head>
|
|
<body>
|
|
<form action="?" method="post">
|
|
<label>Key:</label>
|
|
<input type="password" value="<?=$key?>" name="key"/>
|
|
<input type="submit"/>
|
|
</form>
|
|
<h2>Response</h2>
|
|
<p>
|
|
<pre><?=htmlentities ($result)?></pre>
|
|
</p>
|
|
<h2>Signature</h2>
|
|
<p>
|
|
Calculated: <?=$shaHash?>
|
|
</p>
|
|
<p>
|
|
Valid: <input type="checkbox" <?=($isValid ? 'checked' : '')?>/>
|
|
</p>
|
|
</body>
|
|
</html>
|