Ejemplo n.º 1
0
 function xtest_AddItem()
 {
     $session = \Services\Ebay::getSession($this->devId, $this->appId, $this->certId);
     $session->setToken($this->token);
     $ebay = new \Services\Ebay($session);
     $item = \Services\Ebay::loadModel('Item', null, $session);
     $item->Category = 57882;
     $item->PrimaryCategory = array('CategoryID' => 57882);
     $item->ConditionID = 1000;
     $item->Title = 'Supergirls\'s cape';
     $item->Description = 'Another test item';
     $item->Location = 'At my home';
     $item->StartPrice = '10';
     $item->PaymentMethods = 'PayPal';
     $item->PayPalEmailAddress = '*****@*****.**';
     $item->Quantity = 1;
     $item->MinimumBid = '532.0';
     $item->ListingDuration = 'Days_7';
     $item->DispatchTimeMax = 3;
     $item->Currency = 'USD';
     $item->Country = 'US';
     $item->Site = 'US';
     $item->ReturnPolicy = array('ReturnsAcceptedOption' => 'ReturnsAccepted', 'RefundOption' => 'MoneyBack', 'ReturnsWithinOption' => 'Days_30', 'Description' => 'If you are not satisfied, return the book for refund.', 'ShippingCostPaidByOption' => 'Buyer');
     $item->SetShipToLocations(array('US'));
     $item->SetShipToLocations(array('CA'));
     $item->ShippingDetails = array('ShippingType' => 'Flat', 'ShippingServiceOptions' => array(array('ShippingServicePriority' => 1, 'ShippingService' => 'UPSGround', 'FreeShipping' => 'true', 'ShippingServiceAdditionalCost' => 0.0)));
     $result = $ebay->AddItem($item);
     // You could as well call the Add() method on the item directly
     //$result = $item->Add();
     $this->assertNotEmpty($result['ItemID']);
     // 		if ($result) {
     // 			echo 'Item has been added with ItemId: '.$result['ItemID'].' and ends on '.$result['EndTime'];
     // 		} else {
     // 			echo 'An error occured while adding the item.';
     // 		}
 }
Ejemplo n.º 2
0
 *
 * @package     Services_Ebay
 * @subpackage  Tests
 * @author      Stephan Schmidt
 */
require_once '../vendor/autoload.php';
require_once '../examples/config-local.php';
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$session->setDebug(\Services\Ebay\Session::DEBUG_PRINT);
$ebay = new \Services\Ebay($session);
$item = \Services\Ebay::loadModel('Item', null, $session);
$item->Category = 57882;
$item->Title = 'International Item';
$item->Description = 'This description contains Umlaut characters like Ä, ü and ß';
$item->Location = 'At my home';
$item->MinimumBid = '532.0';
$item->VisaMaster = 1;
$item->ShippingType = 1;
$item->CheckoutDetailsSpecified = 1;
$item->Country = 'US';
$item->SetShipToLocations(array('US', 'DE', 'GB'));
$item->addShippingServiceOption(1, 1, 3, 1, array('US'));
$result = $ebay->AddItem($item);
// You could as well call the Add() method on the item directly
//$result = $item->Add();
if ($result === true) {
    echo 'Item has been added with ItemId: ' . $item->Id . ' and ends on ' . $item->EndTime . '<br />';
} else {
    echo 'An error occured while adding the item.';
}