У меня проблема с интеграцией PayU в Zend Framework (3.2) с SOAP API. Пожалуйста, дайте мне знать, где я делаю не так, также я нажимаю API с SOAP UI 5.5 и получил Ошибка чтения XMLStreamReader.
Но у меня ошибка ниже: -
Класс SoapVar не найден
$baseUrl = 'https://staging.payu.co.za';
$soapWdslUrl = $baseUrl.'/service/PayUAPI?wsdl';
$payuRppUrl = $baseUrl.'/rpp.do?PayUReference=';
$apiVersion = 'ONE_ZERO';
$safeKey = '{0B387E02-870B-477F-BCD5-0541199ADC19}';
$soapUsername = '200257';
$soapPassword = 'JHVH6z1r';
$merchantReference = "merchant_ref_".time();;
$doTransactionArray = array();
$doTransactionArray['Api'] = $apiVersion;
$doTransactionArray['Safekey'] = $safeKey;
$doTransactionArray['TransactionType'] = 'PAYMENT';
$doTransactionArray['AdditionalInformation']['merchantReference'] = $merchantReference;
$doTransactionArray['Basket']['description'] = "Sudhir";
$doTransactionArray['Basket']['amountInCents'] = "1";
$doTransactionArray['Basket']['currencyCode'] = 'KES';
$doTransactionArray['Customer']['merchantUserId'] = "7";
$doTransactionArray['Customer']['email'] = "john@doe.com";
$doTransactionArray['Customer']['firstName'] = 'John';
$doTransactionArray['Customer']['lastName'] = 'Doe';
$doTransactionArray['Customer']['mobile'] = '0211234567';
$doTransactionArray['Customer']['regionalId'] = '1234512345122';
$doTransactionArray['Customer']['countryCode'] = '27';
$doTransactionArray['Creditcard']['nameOnCard'] = "Mr John Doe";
$doTransactionArray['Creditcard']['cardNumber'] = "5453010000064261";
$doTransactionArray['Creditcard']['cardExpiry'] = "0521";
$doTransactionArray['Creditcard']['cvv'] = "123";
$doTransactionArray['Creditcard']['amountInCents'] = $doTransactionArray['Basket']['amountInCents'];
try {
$soapDataArray = array();
$soapDataArray = array_merge($soapDataArray, $doTransactionArray );
$headerXml = '<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">';
$headerXml .= '<wsse:UsernameToken wsu:Id="UsernameToken-9" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">';
$headerXml .= '<wsse:Username>'.$soapUsername.'</wsse:Username>';
$headerXml .= '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">'.$soapPassword.'</wsse:Password>';
$headerXml .= '</wsse:UsernameToken>';
$headerXml .= '</wsse:Security>';
$headerbody = new \SoapVar($headerXml, XSD_ANYXML, null, null, null);
// 3. Create Soap Header.
$ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'; //Namespace of the WS.
$header = new \SOAPHeader($ns, 'Security', $headerbody, true);
$soap_client = new \SoapClient($soapWdslUrl, array("trace" => 1, "exception" => 0));
$soap_client->__setSoapHeaders($header);
$soapCallResult = $soap_client->doTransaction($soapDataArray);
$returnData = json_decode(json_encode($soapCallResult),true);
$decodedXmlData = json_decode(json_encode((array) simplexml_load_string($returnData)),true);
}
catch(Exception $e) {
var_dump($e);
die();
}