/**
  * sample_EndItem::dispatchCall()
  * 
  * Dispatch the call
  *
  * @param array $params array of parameters for the eBay API call
  * 
  * @return boolean success
  */
 public function dispatchCall($params)
 {
     $req = new EndItemRequestType();
     $req->setItemID($params['ItemID']);
     $req->setEndingReason($params['EndingReason']);
     $res = $this->proxy->EndItem($req);
     if ($this->testValid($res)) {
         $this->dumpObject($res);
         return true;
     } else {
         return false;
     }
 }
 /**
  * @return EndItemResponseType
  * @param EndItemRequestType $request 
  */
 function EndItem($request)
 {
     $request->setVersion(EBAY_WSDL_VERSION);
     return $this->call('EndItem', $request);
 }
Beispiel #3
0
 function endItem($id, $session)
 {
     // skip this item if item status not allowed
     $allowed_statuses = array('published', 'changed');
     if (!$this->itemHasAllowedStatus($id, $allowed_statuses)) {
         return $this->result;
     }
     // preparation - set up new ServiceProxy with given session
     $this->initServiceProxy($session);
     // get eBay ID
     $item = self::getItem($id);
     $item_id = $item['ebay_id'];
     $req = new EndItemRequestType();
     # ***
     $req->setItemID($item_id);
     // $req->setEndingReason('LostOrBroken');
     $req->setEndingReason('NotAvailable');
     WPLE()->logger->info("calling EndItem({$id}) #{$item_id} ");
     WPLE()->logger->debug("Request: " . print_r($req, 1));
     $res = $this->_cs->EndItem($req);
     # ***
     WPLE()->logger->info("EndItem() Complete #{$item_id}");
     WPLE()->logger->debug("Response: " . print_r($res, 1));
     // handle response and check if successful
     if ($this->handleResponse($res)) {
         // save ebay ID and fees to db
         $data['end_date'] = $res->EndTime;
         $data['status'] = 'ended';
         // mark as sold if no stock remaining
         if (!self::checkStockLevel($item)) {
             $data['status'] = 'sold';
         }
         // update listing status
         if (17 == $this->handle_error_code) {
             $data['status'] = 'archived';
         }
         self::updateListing($id, $data);
         WPLE()->logger->info("Item #{$id} was ended manually. ");
     }
     // call successful
     self::processErrorsAndWarnings($id, $this->result);
     return $this->result;
 }