Exemplo n.º 1
0
 /**
  * create new preferences
  *
  *
  */
 public function __construct($props, $session = null)
 {
     if (is_string($props)) {
         $this->properties['Name'] = $props;
     } elseif (is_array($props)) {
         if (isset($props['Name'])) {
             $this->properties['Name'] = $props['Name'];
         }
         if (isset($props['PreferenceRole'])) {
             $this->properties['PreferenceRole'] = $props['PreferenceRole'];
         }
         if (isset($props['Preference'])) {
             if (isset($props['Preference'][0])) {
                 $this->preferences = $props['Preference'];
             } else {
                 $this->preferences = array($props['Preference']);
             }
         }
         if (isset($props['Preferences'])) {
             if (isset($props['Preferences'][0])) {
                 $tmp = $props['Preferences'];
             } else {
                 $tmp = array($props['Preferences']);
             }
             foreach ($tmp as $set) {
                 $this->AddPreference(\Services\Ebay::loadModel('Preferences', $set, $session));
             }
         }
     }
 }
Exemplo n.º 2
0
 function test_AddFixedPriceItem()
 {
     $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->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->ListingDuration = 'Days_7';
     $item->ListingType = 'FixedPriceItem';
     $item->DispatchTimeMax = 3;
     $item->Currency = 'USD';
     $item->Country = 'US';
     $item->Site = 'US';
     $item->PictureDetails = array('PictureURL' => array('http://i12.ebayimg.com/03/i/04/8a/5f/a1_1_sbl.JPG', 'http://i22.ebayimg.com/01/i/04/8e/53/69_1_sbl.JPG', 'http://i4.ebayimg.ebay.com/01/i/000/77/3c/d88f_1_sbl.JPG'));
     $item->ReturnPolicy = array('ReturnsAcceptedOption' => 'ReturnsAccepted', 'RefundOption' => 'MoneyBack', 'ReturnsWithinOption' => 'Days_30', 'Description' => 'If you are not satisfied, return the book for refund.', 'ShippingCostPaidByOption' => 'Buyer');
     $item->ShippingDetails = array('ShippingType' => 'Flat', 'ShippingServiceOptions' => array(array('ShippingServicePriority' => 1, 'ShippingService' => 'UPSGround', 'FreeShipping' => 'true', 'ShippingServiceAdditionalCost' => 0.0)));
     $result = $ebay->AddFixedPriceItem($item);
     print_r($result);
     $this->assertNotEmpty($result['ItemID']);
 }
Exemplo n.º 3
0
 /**
  * create new item
  *
  * @param    array   properties
  */
 public function __construct($props, $session = null)
 {
     if (is_array($props) && isset($props['Seller'])) {
         $props['Seller'] = \Services\Ebay::loadModel('User', $props['Seller'], $session);
     }
     parent::__construct($props, $session);
 }
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     if (isset($result['TransactionArray'])) {
         $result = \Services\Ebay::loadModel('TransactionList', $return['TransactionArray'], $session);
         return $result;
     }
     return false;
 }
Exemplo n.º 5
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $xml = parent::call($session, false);
     $dom = DOMDocument::loadXML($xml);
     $result = array();
     $productFinders = $dom->getElementsByTagName('ProductFinder');
     foreach ($productFinders as $node) {
         $result[] = \Services\Ebay::loadModel('ProductFinder', $node, $session);
     }
     return $result;
 }
Exemplo n.º 6
0
 /**
  * create new feedback model
  *
  * @param    array   feedback
  */
 public function __construct($transactions, $session = null)
 {
     if (isset($transactions['Transactions']['Transaction'])) {
         if (!isset($transactions['Transactions']['Transaction'][0])) {
             $transactions['Transactions']['Transaction'] = array($transactions['Transactions']['Transaction']);
         }
         foreach ($transactions['Transactions']['Transaction'] as $tmp) {
             array_push($this->transactions, \Services\Ebay::loadModel('Transaction', $tmp, $session));
         }
         unset($transactions['Transactions']);
     }
     parent::__construct($transactions);
 }
Exemplo n.º 7
0
 /**
  * create new feedback model
  *
  * @param    array   feedback
  */
 public function __construct($bids, $session = null)
 {
     $this->count = (int) $bids['Bids']['Count'];
     if (isset($bids['Bids']['Bid'])) {
         if (!isset($bids['Bids']['Bid'][0])) {
             $bids['Bids']['Bid'] = array($bids['Bids']['Bid']);
         }
         foreach ($bids['Bids']['Bid'] as $tmp) {
             array_push($this->bids, \Services\Ebay::loadModel('Bid', $tmp, $session));
         }
         unset($bids['Bids']);
     }
     parent::__construct($bids);
 }
Exemplo n.º 8
0
 /**
  * create a new item list
  *
  * @param    array   properties
  * @param    object \Services\Ebay\Session
  */
 public function __construct($props, $session = null)
 {
     if (isset($props['ItemArray'])) {
         if (is_array($props['ItemArray'])) {
             if (!isset($props['ItemArray']['Item'][0])) {
                 $props['ItemArray']['Item'] = array($props['ItemArray']['Item']);
             }
             foreach ($props['ItemArray']['Item'] as $item) {
                 array_push($this->items, \Services\Ebay::loadModel('Item', $item, $session));
             }
         }
         unset($props['ItemArray']);
     }
     parent::__construct($props, $session);
 }
Exemplo n.º 9
0
 /**
  * create new feedback model
  *
  * @param    array   feedback
  */
 public function __construct($messages, $session = null)
 {
     $this->moreItems = $messages['HasMoreItems'] == 'false' ? false : true;
     $this->pages = (int) $messages['PaginationResult']['TotalNumberOfPages'];
     $this->entries = (int) $messages['PaginationResult']['TotalNumberOfEntries'];
     if (isset($messages['MemberMessage'])) {
         if (!isset($messages['MemberMessage'][0])) {
             $messages['MemberMessage'] = array($messages['MemberMessage']);
         }
         foreach ($messages['MemberMessage'] as $tmp) {
             array_push($this->messages, \Services\Ebay::loadModel('MemberMessage', $tmp, $session));
         }
         unset($messages['MemberMessage']);
     }
     parent::__construct($messages);
 }
Exemplo n.º 10
0
 /**
  * create new model
  *
  * @param    array
  * @param    object
  */
 public function __construct($props, $session = null)
 {
     if (isset($props['SearchResultItemArray']['SearchResultItem'])) {
         $items = $props['SearchResultItemArray']['SearchResultItem'];
         unset($props['SearchResultItemArray']['SearchResultItem']);
         if (isset($items[0])) {
             $items = $items;
         } else {
             $items = array($items);
         }
         foreach ($items as $tmp) {
             array_push($this->items, \Services\Ebay::loadModel('Item', $tmp['Item'], $session));
         }
     }
     parent::__construct($props, $session);
 }
Exemplo n.º 11
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $bak = $this->args;
     $this->args['PaginationType'] = array();
     foreach ($this->paramMap as $param) {
         if ($param == 'TransactionsPerPage' || $param == 'PageNumber') {
             if (!isset($this->args[$param])) {
                 continue;
             }
             $this->args['PaginationType'][$param] = $this->args[$param];
             unset($this->args[$param]);
         }
     }
     $return = parent::call($session);
     $result = \Services\Ebay::loadModel('TransactionList', $return, $session);
     $this->args = $bak;
     return $result;
 }
 * $Id$
 *
 * @package     Services_Ebay
 * @subpackage  Examples
 * @author      Stephan Schmidt
 */
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
require_once 'config.php';
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
// build a filesystem cache
$userCache = \Services\Ebay::loadCache('Filesystem', array('path' => './cache'));
// use a static expiry of 15 minutes
$userCache->setExpiry('Static', 15);
// use this cache for all user models
\Services\Ebay\Model\User::setCache($userCache);
// load a new user model
$user = \Services\Ebay::loadModel('User', 'superman-74', $session);
if ($user->isCached()) {
    echo 'data had been cached<br />';
    echo '<pre>';
    print_r($user->toArray());
    echo '</pre>';
} else {
    echo 'fetching user data from eBay<br />';
    $user->Get();
    echo '<pre>';
    print_r($user->toArray());
    echo '</pre>';
}
Exemplo n.º 13
0
<?php

/**
 * example that fetches an item
 *
 * $Id$
 *
 * @package     Services_Ebay
 * @subpackage  Examples
 * @author      Stephan Schmidt
 */
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
require_once 'config.php';
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$ebay = new \Services\Ebay($session);
$item = $ebay->GetItem(110002463992);
echo 'User-Id of the seller: ' . $item->Seller->UserID . '<br />';
echo '<pre>';
print_r($item->toArray());
echo '</pre>';
$item_2 = \Services\Ebay::loadModel('Item', null, $session);
$item_2->Id = 110002463987;
$res2 = $item_2->Get();
Exemplo n.º 14
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     return \Services\Ebay::loadModel('Account', $return['AccountEntries'], $session);
 }
Exemplo n.º 15
0
<?php

/**
 * example that fetches an item
 *
 * $Id$
 *
 * @package     Services_Ebay
 * @subpackage  Examples
 * @author      Stephan Schmidt
 */
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
require_once 'config.php';
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$ebay = new \Services\Ebay($session);
$item = \Services\Ebay::loadModel('Item', '110002442025', $session);
$item->Get();
$item->Title = 'Supergirl\'s bra';
$ebay->ReviseItem($item);
/*
You may also use the Revise() method
directly on the Item object

$item->Revise();
*/
Exemplo n.º 16
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     $result = \Services\Ebay::loadModel('MemberMessageList', $return, $session);
     return $result;
 }
Exemplo n.º 17
0
 /**
  * Constructor
  *
  * @param array     $props  properties
  * @param \Services\Ebay\Session $session    session
  * @param integer   $DetailLevel    detail-level
  */
 public function __construct($props, $session = null, $DetailLevel = 0)
 {
     parent::__construct($props, $session, $DetailLevel);
     $this->user = \Services\Ebay::loadModel('User', $props['User'], $session);
     unset($this->properties['User']);
 }
Exemplo n.º 18
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     $item = \Services\Ebay::loadModel('Item', $return['Item'], $session);
     return $item;
 }
Exemplo n.º 19
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     return \Services\Ebay::loadModel('SearchResult', $return, $session);
 }
<?php

/**
 * example that fetches shipping rates
 *
 * $Id$
 *
 * @package     Services_Ebay
 * @subpackage  Examples
 * @author      Stephan Schmidt
 */
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
require_once 'config.php';
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$ebay = new \Services\Ebay($session);
$prefs = \Services\Ebay::loadModel('Preferences', 'CrossPromotion');
$prefs->AddPreference('Enabled', 1, 'Boolean');
$sorting = \Services\Ebay::loadModel('Preferences', 'Sorting');
$prefs->AddPreference($sorting);
$crosssell_sortfiltering = \Services\Ebay::loadModel('Preferences', 'Crosssell_SortFiltering');
$crosssell_sortfiltering->AddPreference('BuyItNowSortFiltering', 1, 'Integer');
$crosssell_sortfiltering->AddPreference('FinalSortFiltering', 1, 'Integer');
$sorting->AddPreference($crosssell_sortfiltering);
$result = $ebay->SetPreferences($prefs);
if ($result === true) {
    echo 'Preferences set.';
}
Exemplo n.º 21
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     $feedback = \Services\Ebay::loadModel('Feedback', $return, $session);
     return $feedback;
 }
<?php

/**
 * example that fetches an item
 *
 * $Id$
 *
 * @package     Services_Ebay
 * @subpackage  Examples
 * @author      Stephan Schmidt
 */
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
require_once 'config.php';
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$ebay = new \Services\Ebay($session);
$item = \Services\Ebay::loadModel('Item');
$item->Category = 57882;
$item->Title = 'Supergirls\'s cape';
$item->Description = 'Another test item';
$item->Location = 'At my home';
$item->MinimumBid = '1000.0';
$item->VisaMaster = 1;
$result = $ebay->VerifyAddItem($item);
echo '<pre>';
print_r($result);
echo '</pre>';
Exemplo n.º 23
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     return \Services\Ebay::loadModel('ItemList', $return['BidItemArray'], $session);
 }
Exemplo n.º 24
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     $user = \Services\Ebay::loadModel('User', $return['User'], $session);
     return $user;
 }
Exemplo n.º 25
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     return \Services\Ebay::loadModel('Dispute', $return['Dispute'], $session);
 }
Exemplo n.º 26
0
 /**
  * make the API call
  *
  * @param    object \Services\Ebay\Session
  * @return   string
  */
 public function call(\Services\Ebay\Session $session, $parseResult = true)
 {
     $return = parent::call($session);
     return \Services\Ebay::loadModel('MyeBay', $return['BiddingWatching'], $session);
 }
 * @author      Stephan Schmidt
 */
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
require_once 'config.php';
/**
 * simple model class
 *
 * You may implement any additional methods you need
 * in your custom models.
 */
class myItem extends \Services\Ebay\Model\Item
{
    /**
     * Dummy method
     *
     * This does not really do anything, but you can implement whatever you like
     * here...
     *
     */
    public function StoreItem()
    {
        echo "Now you could store the item data in your local database...";
    }
}
\Services\Ebay::useModelClass('Item', 'myItem');
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$item = \Services\Ebay::loadModel('Item', '4501296414', $session);
$item->Get();
$item->StoreItem();
Exemplo n.º 28
0
<?php

/**
 * example that fetches shipping rates
 *
 * $Id$
 *
 * @package     Services_Ebay
 * @subpackage  Examples
 * @author      Stephan Schmidt
 */
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
require_once 'config.php';
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$ebay = new \Services\Ebay($session);
$order = \Services\Ebay::loadModel('Order');
$order->CreatingUserRole = 'Buyer';
$order->PaymentMethods = 'None';
$order->Total = '60.0';
$order->ApplyShippingDiscount = 'true';
$order->InsuranceFee = '02.0';
$order->InsuranceOption = 'NotOffered';
$order->AddTransaction('4501333765', 0);
$order->AddTransaction('4501336808', 0);
$order->AddShippingServiceOption('12.12', 1, '40.0', '1.00', 1);
$order->AddInternationalShippingServiceOption(2376, 1, '40.0', 1, 'US');
$order->AddSalesTax('1.03', '1', 'true');
$result = $ebay->AddOrder($order);
Exemplo n.º 29
0
/**
 * example that adds a shipment
 *
 * $Id$
 *
 * @package     Services_Ebay
 * @subpackage  Examples
 * @author      Stephan Schmidt
 */
error_reporting(E_ALL);
require_once '../vendor/autoload.php';
require_once 'config.php';
$session = \Services\Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$ebay = new \Services\Ebay($session);
$shipment = \Services\Ebay::loadModel('Shipment');
$shipment->InsuredValue = 400;
$shipment->PayPalShipmentId = '12345678';
$shipment->PostageTotal = 3;
$shipment->PrintedTime = date('Y-m-d H:i:s');
$shipment->ShippingServiceUsed = 3;
$shipment->ShippingPackage = 0;
$shipment->setPackageDimensions(10, 5, 8);
$shipment->ShipmentTrackNumber = uniqid('shipment');
$shipment->SetFromAddress('Foobar', 'Clark Kent', 'Any Street 123', null, 'San Francisco', '94101', 'CA', 'USA');
$shipment->SetAddress(2, 'Foobar', 'Clark Kent', 'Any Street 456', null, 'San Francisco', '94101', 'CA', 'USA');
$shipment->AddTransaction(4501333179, 0);
$shipment->InsuredValue = '450.00';
$shipment->ShippingCarrierUsed = 1;
$shipment->WeightMajor = 2;
$shipment->WeightMinor = 0;
Exemplo n.º 30
0
 /**
  * create a new item list
  *
  * @param    array   properties
  * @param    object \Services\Ebay\Session
  */
 public function __construct($props, $session = null)
 {
     foreach ($props as $list => $data) {
         $this->lists[$list] = \Services\Ebay::loadModel('ItemList', $data, $session);
     }
 }