* Payload: rpc/literal * Transport: http * Authentication: none */ require_once 'f:/nusoap/lib/nusoap.php'; $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : ''; $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : ''; $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : ''; $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : ''; echo '<h2>Constructor</h2>'; $client = new soapclient('http://www.scottnichol.com/samples/session.php?wsdl', true, $proxyhost, $proxyport, $proxyusername, $proxypassword); $err = $client->getError(); if ($err) { echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; } echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>'; $client->clearDebug(); // A persistent connection is *optional*, *not* necessary $client->useHTTPPersistentConnection(); echo '<h2>GetSessionID</h2>'; $result = $client->call('GetSessionID', array()); // 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
function do_bill($amount, $title, $products, $u, $invoice) { global $db, $config; $product = $products[0]; $payment_id = $invoice; require_once 'lib/nusoap.php'; if ($this->config['testmode']) { $url = "https://sandbox.api.bidpay.com/ThirdPartyPayment/v1/ThirdPartyPaymentService.asmx"; } else { $url = "https://api.bidpay.com/ThirdPartyPayment/v1/ThirdPartyPaymentService.asmx"; } $item = array('ItemNumber' => $product['product_id'], 'ItemDescription' => $product['title'], 'ItemType' => 'WebsitePurchase', 'Site' => $config['site_title'], 'Amount' => $amount, 'ShippingAmount' => '0'); $items['Item'] = $item; $vars = array('SellerToken' => $this->config['token'], 'ReferenceNumber' => $payment_id, 'AuctionBuyerID' => $member_id, 'Items' => $items, 'ReturnUrl' => $config['root_url'] . "/plugins/payment/bidpay/thanks.php"); $client = new soapclient($url . "?WSDL", true); $err = $client->getError(); if ($err) { if ($this->config['testmode']) { $db->log_error("BidPay ERROR. Response: " . $client->response); } if ($this->config['testmode']) { echo "<pre>" . $client->getDebug() . "</pre>"; } return "Error: " . $err; } $uuidMessageID = NewUuid(); $uuidTimestamp = NewUuid(); $uuidSecurityToken = NewUuid(); $nonce = "RqjH7M+gwhx6vTL/QgJK2A=="; $now = time(); $created = GetUtc8601($now); $now = time() + 60 * 5; $expires = GetUtc8601($now); $headers = array(); $headers[] = "<wsa:Action>http://api.bidpay.com/ThirdPartyPayment/v1/Methods/PaymentRequest</wsa:Action>"; $headers[] = "<wsa:MessageID>urn:uuid:" . $uuidMessageID . "</wsa:MessageID>"; $headers[] = "<wsa:ReplyTo>"; $headers[] = "<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>"; $headers[] = "</wsa:ReplyTo>"; $headers[] = "<wsa:To>" . $url . "</wsa:To>"; $headers[] = "<wsse:Security soap:mustUnderstand=\"1\">"; $headers[] = "<wsu:Timestamp wsu:Id=\"Timestamp-{$uuidTimestamp}\">"; $headers[] = "<wsu:Created>{$created}</wsu:Created>"; $headers[] = "<wsu:Expires>{$expires}</wsu:Expires>"; $headers[] = "</wsu:Timestamp>"; $headers[] = "<wsse:UsernameToken xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"SecurityToken-" . $uuidSecurityToken . "\">"; $headers[] = "<wsse:Username>" . $this->config['username'] . "</wsse:Username>"; $headers[] = "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" . $this->config['password'] . "</wsse:Password>"; //$headers[] = "<wsse:Nonce>".$nonce."</wsse:Nonce>"; $headers[] = "<wsu:Created>" . $created . "</wsu:Created>"; $headers[] = "</wsse:UsernameToken>"; $headers[] = "</wsse:Security>"; $headers = implode("\n", $headers); $result = $client->call('ThirdPartyPayment', array('thirdPartyPaymentRequest' => $vars), '', '', $headers); if ($client->fault) { if ($this->config['testmode']) { $db->log_error("BidPay ERROR. Response: " . $client->response); } if ($this->config['testmode']) { echo "<pre>" . $client->getDebug() . "</pre>"; } return "Soap Request Fault [" . $client->getError() . "]"; } else { $err = $client->getError(); if ($err) { if ($this->config['testmode']) { $db->log_error("BidPay ERROR. Response: " . $client->response); } if ($this->config['testmode']) { echo "<pre>" . $client->getDebug() . "</pre>"; } return "Error " . $err; } else { /* TransactionID This is the ID assigned to the transaction by BidPay. ReferenceNumber This is the value supplied by the third party in the request. PaymentURL This is the URL to which the buyer should be redirected to complete the checkout process. */ } } }