0
1
Fork 0
hedera-web-mindshore/package/usr/share/hedera-web/tpv/soap-test.php

47 lines
893 B
PHP

<?php
require_once ('vn/tpv/tpv.php');
ini_set ('soap.wsdl_cache_enabled', FALSE);
$requestString = file_get_contents ('soap-request.xml');
$client = new SoapClient (stream_resolve_include_path ('vn/tpv/soap.wsdl'));
$result = $client->__soapCall ('procesaNotificacionSIS', [
'XML' => $requestString
]);
$xml = new SimpleXMLElement ($result);
$key = 'R306314T06596523';
$start = strpos ($result, '<Response');
$end = strrpos ($result, '</Response>');
$shaString = substr ($result, $start, $end - $start + 11);
$shaHash = sha1 ($shaString.$key);
$isValid = $xml->{'Signature'} == $shaHash;
?>
<html>
<head>
<title>
TPV SOAP Client
</title>
</head>
<body>
<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>