我正在尝试使用nusoap创建支付网关,并且出现了WSDL中不存在的错误操作授权请求。此代码是由Visanet危地马拉支持团队发送给我的。我已经花了几个小时试图弄清正在发生什么或如何解决它。 authorizationRequest是我必须调用的操作的名称。 我的代码如下:
<?php
require_once('./libsoap/nusoap.php');
$url = "https://190.0.195.24:9443/paymentgw/services/paymentgw?wsdl";
$client = new nusoap_client($url , 'wsdl' , false, false, false, false, 0, 25);
$client->authtype = 'certificate';
$client->certRequest['sslcertfile'] = '/var/www/vhosts/VisaKeys/iga.pem'; //'[path]/cert-file.pem';
$client->certRequest['sslkeyfile'] = '/var/www/vhosts/VisaKeys/iga.key'; //'[path]/cert-file.key';
$client->certRequest['CACert'] = '/var/www/vhosts/VisaKeys/VisaNetCA.key'; //'[path]/VisaNetCA.key';
$client->certRequest['verifypeer']=0;
$client->certRequest['passphrase']='password';
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
// At this point, you know the call that follows will fail
}
$param = array(
'pan' => '0000000000000000'//tarjeta de credito de prueba
,'expdate' => '0220' //expiracion de la tarjeta de credito
,'amount' => '100' //cantidad de la transaccion en dinero
,'cvv2' => '6410'//1codigo de la tarjeta de credito de secguridad
,'paymentgwIP' => '190.0.195.24' //ip visanet
,'shopperIP' => $_SERVER['REMOTE_ADDR'] //ip comprador
,'merchantServerIP' => $_SERVER['SERVER_ADDR']//nuestro ip cig 200.12.47.195
,'merchantUser' => 'VNGUser'//Usuario por confirmar en VisaNet
,'merchantPasswd' => 'VNGPass'//Password por confirmar en VisaNet11111
,'terminalId' =>'000000' //Id por confirmar en VisaNet
,'merchant' =>'000000' //por confirmar en VisaNet
,'messageType' => '0200'
,'auditNumber' => '123456'//codigo unico por cada transaccion creado por CIG
);
$params = array(
array('authorizationRequest' => $param)
);
$start = time(); // starting the t1imer
// echo "<pre>".print_r($params, true);
echo "Start time: " . $start . "</pre><br>";
// Call the SOAP method
$result = $client->call('authorizationRequest', $params);
$timing = time() - $start; // calculating the transaction time
echo "<pre>".print_r($result) . "</pre><br>";
echo "Finish time: " . time() . " <br>";
echo "Total time: " . print_r($timing, true) . "<br>";
if ($result == FALSE)
{
echo "Retry <br>";
$result = $client->call('authorizationRequest', $params);
$timing = time() - $start; // calculating the transaction time
echo "<pre>".print_r($result, true) . "</pre>";
echo "Finish time: " . time() . " <br>";
echo "Total time: " . print_r($timing, true) . "<br>";
}
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
?>
</body>
</html>
?>