protected function GetApplicationURL()
 {
     $client = new eBaySOAP($this->session);
     $params = array('Version' => 525);
     $results = $client->GetNotificationPreferences($params);
     return $results->ApplicationDeliveryPreferences->ApplicationURL;
 }
Example #2
0
$compatibilityLevel = $config['settings']['compatibilityLevel'];
$dev = $config[$site]['devId'];
$app = $config[$site]['appId'];
$cert = $config[$site]['cert'];
$token = $config[$site]['authToken'];
$location = $config[$site]['gatewaySOAP'];
// Create and configure session
$session = new eBaySession($dev, $app, $cert);
$session->token = $token;
$session->site = 0;
// 0 = US;
$session->location = $location;
// Make AddItem, ReviseItem, and GetItem API calls to demonstate how to modify
// and item listing
try {
    $client = new eBaySOAP($session);
    $PrimaryCategory = array('CategoryID' => 357);
    $Item = array('ListingType' => 'Chinese', 'Currency' => 'USD', 'Country' => 'US', 'PaymentMethods' => 'PaymentSeeDescription', 'RegionID' => 0, 'ListingDuration' => 'Days_3', 'Title' => 'The new item title', 'SubTitle' => 'The new item subtitle', 'Description' => "It's a great new item", 'Location' => "San Jose, CA", 'Quantity' => 1, 'StartPrice' => 24.99, 'BuyItNowPrice' => 54.99, 'PrimaryCategory' => $PrimaryCategory);
    $params = array('Version' => $compatibilityLevel, 'Item' => $Item);
    $results = $client->AddItem($params);
    $ItemID = (string) $results->ItemID;
    print "Listed Item ID: {$ItemID} <br>\n";
    // Get it to confirm
    $params = array('Version' => $compatibilityLevel, 'ItemID' => $ItemID);
    $results = $client->GetItem($params);
    print "Got Item ID: {$ItemID} <br>\n";
    print "It has a title of: " . $results->Item->Title . " <br>\n";
    print "It has a BIN Price of: " . $results->Item->BuyItNowPrice->_ . ' ' . $results->Item->BuyItNowPrice->currencyID . " <br> \n";
    // Revise it and change the Title and raise the BuyItNowPrice
    $Item = array('ItemID' => $ItemID, 'Title' => 'The revised item title', 'BuyItNowPrice' => 99.98999999999999);
    $params = array('Version' => $compatibilityLevel, 'Item' => $Item);
// Load developer-specific configuration data from ini file
$config = parse_ini_file('ebay.ini', true);
$site = 'sandbox';
$dev = $config[$site]['devId'];
$app = $config[$site]['appId'];
$cert = $config[$site]['cert'];
$token = $config[$site]['authToken'];
$location = $config[$site]['gatewaySOAP'];
// Create and configure session
$session = new eBaySession($dev, $app, $cert);
$session->token = $token;
$session->site = 0;
// 0 = US;
$session->location = $location;
// Deliver messages to the following URL
try {
    $client = new eBaySOAP($session);
    $params = array('Version' => 525, 'ApplicationDeliveryPreferences' => array('ApplicationURL' => 'http://www.trachtenberg.com/ebay/notifications/listener.php'));
    $results = $client->SetNotificationPreferences($params);
    print_r($results);
} catch (SOAPFault $f) {
    print $f;
    // error handling
}
/*
// Uncomment below to view SOAP envelopes
print "Request: \n".$client->__getLastRequestHeaders() ."\n";
print "Request: \n".$client->__getLastRequest() ."\n";
print "Response: \n".$client->__getLastResponseHeaders()."\n";
print "Response: \n".$client->__getLastResponse()."\n";
*/
Example #4
0
 private function CompleteSale($token, $transactionId, $itemId, $shipmentMethod, $shippedOn, $postalReferenceNo)
 {
     global $argv;
     $session = $this->configEbay($token);
     try {
         $client = new eBaySOAP($session);
         /*
         if(!empty($postalReferenceNo)){
         	switch ($shipmentMethod){
         		case "M":
         			$ShippingCarrierUsed = "UPS";
         			break;
         			
         		case "U":
         			$ShippingCarrierUsed = "UPS";
         			break;
         			
         		default:
         			$ShippingCarrierUsed = "Other";
         		break;
         	}
         	$Shipment = array("ShipmentTrackingNumber"=>$postalReferenceNo, "ShippedTime"=>$shippedOn, "ShippingCarrierUsed"=>$ShippingCarrierUsed);
         	$params = array("Version"=>"607", "ItemID"=>$itemId, "Paid"=> true, "Shipment"=>$Shipment, "Shipped"=>true, "TransactionID"=>$transactionId);
         	print_r($params);
         	$results = $client->CompleteSale($params);
         }else{
         	$params = array("Version"=>"607", "ItemID"=>$itemId, "Paid"=> true, "Shipped"=>true, "TransactionID"=>$transactionId);
         	print_r($params);
         	$results = $client->CompleteSale($params);
         }
         */
         $tmp = strtotime($shippedOn);
         $shippedOn = date("Y-m-d\\TH:i:s.000\\Z", $tmp - 8 * 60 * 60);
         $Shipment = array("ShippedTime" => $shippedOn);
         $params = array("Version" => "607", "ItemID" => $itemId, "Paid" => true, "Shipment" => $Shipment, "Shipped" => true, "TransactionID" => $transactionId);
         $this->log("synceBayShipped", print_r($params, true));
         $results = $client->CompleteSale($params);
         if ($argv[3] == "debug") {
             print_r($results);
             file_put_contents($this->config['log']['shipments'] . "CompleteSale_Request.xml", $client->__getLastRequest());
             file_put_contents($this->config['log']['shipments'] . "CompleteSale_Response.xml", $client->__getLastResponse());
         }
         if (!empty($results->Ack) && $results->Ack == "Success") {
             $this->log("synceBayShipped", "Success");
             $this->updateEbayShipStatus($transactionId, $itemId, 1);
         } else {
             /*
             		    if(!empty($results->Errors)){
                 print_r($results->Errors);
             		    }else{
             			echo $results->faultstring;
             		    }
             */
             @$this->log("synceBayShipped", "Error:" . $results->Errors->LongMessage);
             $this->updateEbayShipStatus($transactionId, $itemId, 2);
         }
         //exit;
         //sleep(1);
     } catch (SOAPFault $f) {
         print $f;
         // error handling
     }
 }
Example #5
0
 private function CompleteSale($token, $transactionId, $itemId, $shipmentMethod, $shippedOn, $postalReferenceNo)
 {
     $session = $this->configEbay($token);
     try {
         $client = new eBaySOAP($session);
         /*
         if(!empty($postalReferenceNo)){
         	switch ($shipmentMethod){
         		case "M":
         			$ShippingCarrierUsed = "UPS";
         			break;
         			
         		case "U":
         			$ShippingCarrierUsed = "UPS";
         			break;
         			
         		default:
         			$ShippingCarrierUsed = "Other";
         		break;
         	}
         	$Shipment = array("ShipmentTrackingNumber"=>$postalReferenceNo, "ShippedTime"=>$shippedOn, "ShippingCarrierUsed"=>$ShippingCarrierUsed);
         	$params = array("Version"=>"607", "ItemID"=>$itemId, "Paid"=> true, "Shipment"=>$Shipment, "Shipped"=>true, "TransactionID"=>$transactionId);
         	print_r($params);
         	$results = $client->CompleteSale($params);
         }else{
         	$params = array("Version"=>"607", "ItemID"=>$itemId, "Paid"=> true, "Shipped"=>true, "TransactionID"=>$transactionId);
         	print_r($params);
         	$results = $client->CompleteSale($params);
         }
         */
         $params = array("Version" => "607", "ItemID" => $itemId, "Paid" => true, "Shipped" => true, "TransactionID" => $transactionId);
         print_r($params);
         $results = $client->CompleteSale($params);
         //print_r($results);
         if (!empty($results->Ack) && $results->Ack == "Success") {
             $this->updateEbayShipStatus($transactionId, $itemId);
         } else {
             if (!empty($results->Errors)) {
                 print_r($results->Errors);
             } else {
                 echo $results->faultstring;
             }
             $this->updateEbayShipStatus($transactionId, $itemId);
         }
         //exit;
         sleep(1);
     } catch (SOAPFault $f) {
         print $f;
         // error handling
     }
 }
Example #6
0
 public function saveToken()
 {
     session_start();
     try {
         $session = $this->configEbay();
         $session->token = NULL;
         $client = new eBaySOAP($session);
         $Version = $this->version;
         $params = array('Version' => $Version, 'SessionID' => $_SESSION['SessionID']);
         $results = $client->FetchToken($params);
         //print_r($results);
         $_GET['ebaytkn'] = $results->eBayAuthToken;
         $_GET['tknexp'] = $results->HardExpirationTime;
         //eBayAuthToken
         //HardExpirationTime
         if (!empty($_GET['ebaytkn'])) {
             $sql_1 = "select count(*) as num from qo_ebay_seller where id = '" . $_GET['username'] . "'";
             $result_1 = mysql_query($sql_1, eBay::$database_connect);
             $row_1 = mysql_fetch_assoc($result_1);
             if ($row_1['num'] == 0) {
                 $sql = "insert into qo_ebay_seller (id,token,tokenExpiry) values ('" . $_GET['username'] . "','" . $_GET['ebaytkn'] . "','" . $_GET['tknexp'] . "')";
                 //echo $sql;
                 $result = mysql_query($sql, eBay::$database_connect);
             } else {
                 $sql = "update qo_ebay_seller set token = '" . $_GET['ebaytkn'] . "',tokenExpiry = '" . $_GET['tknexp'] . "' where id = '" . $_GET['username'] . "'";
                 //echo $sql;
                 $result = mysql_query($sql, eBay::$database_connect);
             }
             if ($result) {
                 echo "<h1>Thank you, Success!</h1>";
             } else {
                 echo "<h1>Failure!</h1>";
             }
         } else {
             echo "<h1>Failure!</h1>";
         }
     } catch (SOAPFault $f) {
         print $f;
         // error handling
     }
 }
Example #7
0
$site = $config['settings']['site'];
$compatibilityLevel = $config['settings']['compatibilityLevel'];
$dev = $config[$site]['devId'];
$app = $config[$site]['appId'];
$cert = $config[$site]['cert'];
$token = $config[$site]['authToken'];
$location = $config[$site]['gatewaySOAP'];
// Create and configure session
$session = new eBaySession($dev, $app, $cert);
$session->token = $token;
$session->site = 0;
// 0 = US;
$session->location = $location;
// Make a GetUser API call and print results
try {
    $client = new eBaySOAP($session);
    // Default value is to use the user in the Auth & Auth token
    $params = array('Version' => $compatibilityLevel);
    $results = $client->GetUser($params);
    print "<pre> \n";
    print_r($results->User);
    print "</pre> \n";
    print "<p>---\n";
    // Or you can specify a UserID
    $UserID = 'ebay_user_name';
    $params = array('Version' => $compatibilityLevel, 'UserID' => $UserID);
    $results = $client->GetUser($params);
    print "<pre> \n";
    print_r($results->User);
    print "</pre> \n";
} catch (SOAPFault $f) {
Example #8
0
$site = $config['settings']['site'];
$compatibilityLevel = $config['settings']['compatibilityLevel'];
$dev = $config[$site]['devId'];
$app = $config[$site]['appId'];
$cert = $config[$site]['cert'];
$token = $config[$site]['authToken'];
$location = $config[$site]['gatewaySOAP'];
// Create and configure session
$session = new eBaySession($dev, $app, $cert);
$session->token = $token;
$session->site = 1;
// 100 = eBay Motors
$session->location = $location;
// Make a series of GetSearchResults API calls and print results
try {
    $client = new eBaySOAP($session);
    // Find 10 ipods and print their Titles
    $params = array('Version' => $compatibilityLevel, 'Query' => 'ipod', 'Pagination' => array('EntriesPerPage' => 10));
    $results = $client->GetSearchResults($params);
    print "<pre>";
    //print_r($results);
    print "</pre>";
    foreach ($results->SearchResultItemArray as $item) {
        echo $item, "  <br>\n";
    }
    print "<p>---</p>\n";
    // Find 10 passenger vehicles (CategoryID 6001) within 10 miles of ZIP Code 95125
    // ordered by ascending distance
    $params = array('Version' => $compatibilityLevel, 'Query' => '*', 'CategoryID' => 6001, 'ProximitySearch' => array('MaxDistance' => 10, 'PostalCode' => 95125), 'Pagination' => array('EntriesPerPage' => 10), 'Order' => 'SortByDistanceAsc');
    $results = $client->GetSearchResults($params);
    foreach ($results->SearchResultItemArray->SearchResultItem as $item) {
Example #9
0
 public function getToken()
 {
     //echo "test";
     $this->setAccount(1);
     $this->configEbay();
     try {
         $this->session->token = NULL;
         //print_r($this->session);
         //exit;
         $client = new eBaySOAP($this->session);
         $Version = "607";
         $RuName = "Creasion-Creasion-1ca1-4-vuhhajsuh";
         $params = array('Version' => $Version, 'RuName' => $RuName);
         $results = $client->GetSessionID($params);
         //$results->SessionID
         //echo "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=Creasion-Creasion-1ca1-4-vldylhxcb&&sid=$results->SessionID";
         header("Location: https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=" . $RuName . "&sid=" . $results->SessionID);
         //var_dump("https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=Creasion-Creasion-1ca1-4-vldylhxcb&&sid=$results->SessionID");
         //----------   debug --------------------------------
         //print "Request: \n".$client->__getLastRequest() ."\n";
         //print "Response: \n".$client->__getLastResponse()."\n";
         //return $results;
     } catch (SOAPFault $f) {
         print $f;
         // error handling
     }
 }
Example #10
0
$site = $config['settings']['site'];
$compatibilityLevel = $config['settings']['compatibilityLevel'];
$dev = $config[$site]['devId'];
$app = $config[$site]['appId'];
$cert = $config[$site]['cert'];
$token = $config[$site]['authToken'];
$location = $config[$site]['gatewaySOAP'];
// Create and configure session
$session = new eBaySession($dev, $app, $cert);
$session->token = $token;
$session->site = 0;
// 0 = US;
$session->location = $location;
// Make an AddItem API call and print Listing Fee and ItemID
try {
    $client = new eBaySOAP($session);
    $PrimaryCategory = array('CategoryID' => 357);
    $Item = array('ListingType' => 'Chinese', 'Currency' => 'USD', 'Country' => 'US', 'PaymentMethods' => 'PaymentSeeDescription', 'RegionID' => 0, 'ListingDuration' => 'Days_3', 'Title' => 'The new item', 'Description' => "It's a great new item", 'Location' => "San Jose, CA", 'Quantity' => 1, 'StartPrice' => 24.99, 'PrimaryCategory' => $PrimaryCategory);
    $params = array('Version' => $compatibilityLevel, 'Item' => $Item);
    $results = $client->AddItem($params);
    // The $results->Fees['ListingFee'] syntax is a result of SOAP classmapping
    print "Listing fee is: " . $results->Fees['ListingFee'] . " <br> \n";
    print "Listed Item ID: " . $results->ItemID . " <br> \n";
    print "Item was listed for the user associated with the auth token <br>\n";
} catch (SOAPFault $f) {
    print $f;
    // error handling
}
// Uncomment below to view SOAP envelopes
// print "Request: \n".$client->__getLastRequest() ."\n";
// print "Response: \n".$client->__getLastResponse()."\n";