/**
  * sample_RelistItem::dispatchCall()
  * 
  * Dispatch the call
  *
  * @param array $params array of parameters for the eBay API call
  * 
  * @return boolean success
  */
 public function dispatchCall($params)
 {
     $req = new RelistItemRequestType();
     $item = new ItemType();
     $item->setItemID($params['ItemID']);
     $req->setItem($item);
     $res = $this->proxy->RelistItem($req);
     if ($this->testValid($res)) {
         $this->dumpObject($res);
         return true;
     } else {
         return false;
     }
 }
 /**
  * @return RelistItemResponseType
  * @param RelistItemRequestType $request 
  */
 function RelistItem($request)
 {
     $request->setVersion(EBAY_WSDL_VERSION);
     return $this->call('RelistItem', $request);
 }
Esempio n. 3
0
 function autoRelistItem($id, $session)
 {
     // skip this item if item status not allowed
     $allowed_statuses = array('ended', 'sold');
     if (!$this->itemHasAllowedStatus($id, $allowed_statuses)) {
         return $this->result;
     }
     // build item
     $ibm = new ItemBuilderModel();
     $item = new ItemType();
     $item = $ibm->setEbaySite($item, $session);
     // add old ItemID for relisting
     $listing_item = self::getItem($id);
     $item->setItemID($listing_item['ebay_id']);
     // use Item.Site from listing details - this way we don't need to check primary category for eBayMotors
     // $listing_details = maybe_unserialize( $listing_item['details'] );
     $listing_details = self::decodeObject($listing_item['details']);
     $item->Site = $listing_details->Site;
     // eBay Motors (beta)
     if ($item->Site == 'eBayMotors') {
         $session->setSiteId(100);
     }
     // preparation - set up new ServiceProxy with given session
     $this->initServiceProxy($session);
     // switch to FixedPriceItem if product has variations
     WPLE()->logger->info("Auto-Relisting #{$id} (ItemID " . $listing_item['ebay_id'] . ") - " . $item->Title);
     if (self::listingUsesFixedPriceItem($listing_item)) {
         $req = new RelistFixedPriceItemRequestType();
         $req->setItem($item);
         WPLE()->logger->debug("Request: " . print_r($req, 1));
         $res = $this->_cs->RelistFixedPriceItem($req);
     } else {
         $req = new RelistItemRequestType();
         $req->setItem($item);
         WPLE()->logger->debug("Request: " . print_r($req, 1));
         $res = $this->_cs->RelistItem($req);
     }
     // handle response and check if successful
     if ($this->handleResponse($res)) {
         // save new ebay ID and details to db
         $listingFee = self::getListingFeeFromResponse($res);
         $data['ebay_id'] = $res->ItemID;
         $data['fees'] = $listingFee;
         $data['status'] = 'published';
         $data['relist_date'] = NULL;
         // update listing status
         if (17 == $this->handle_error_code) {
             $data['status'] = 'archived';
         }
         self::updateListing($id, $data);
         // get details like ViewItemURL from ebay automatically - unless item does not exist on eBay (17)
         if (17 != $this->handle_error_code) {
             $this->updateItemDetails($id, $session, true);
             $this->postProcessListing($id, $res->ItemID, $item, $listing_item, $res, $session);
         }
         WPLE()->logger->info("Item #{$id} auto-relisted on ebay, NEW ItemID is " . $res->ItemID);
         self::addItemIdToHistory($res->ItemID, $listing_item['ebay_id']);
     }
     // call successful
     self::processErrorsAndWarnings($id, $this->result);
     return $this->result;
 }