Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $invoiceNumber = "1245678992222";
- getOrderStatus($invoiceNumber);
- function getOrderStatus($invoiceNumber)
- {
- try
- {
- $soap_client = new SoapClient(null, array(
- "location" => "https://qa1.mypaga.com/paga-webservices/merchantService/",
- "uri" => "http://pagatech.com/merchant/messages",
- "soap_version" => SOAP_1_2,
- "trace" => 1, // enable trace to view what is happening
- "exceptions" => 1, // disable exceptions
- "cache_wsdl" => 0,
- "use" => SOAP_LITERAL
- ));
- $params = new SoapVar("<ns1:invoiceNumber>" . $invoiceNumber . "</ns1:invoiceNumber>", XSD_ANYXML);
- $soap_client->__setSoapHeaders(wssecurity_header("EC9DC953-183C-4C55-89F1-FD00ECFF1136", "password1"));
- $out_arr = $soap_client->getTransactionDetailsByInvoiceNumberRequest($params);
- return $out_arr;
- }
- catch (Exception $e)
- {
- echo $e->getMessage();
- return array();
- }
- function wssecurity_header($username, $password)
- {
- $auth = '<wsse:Security env:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' . '<wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http
- ://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' . '<wsse:Username>' . $username . '</wsse:Username>' . '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-
- username-token-profile-1.0#PasswordText">' . $password . '</wsse:Password>' . '</wsse:UsernameToken>' . '</wsse:Security>' . '<paga:PagaServiceRequestType xmlns:paga="http://pagatech.com/authentication">Merchant</pa
- ga:PagaServiceRequestType>';
- $authvalues = new SoapVar($auth, XSD_ANYXML);
- $header = new SoapHeader("http://pagatech.com/merchant/messages", "Security", $authvalues, true);
- return $header;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement