Exemple #1
0
 /**
  * Convert CancelFeedSubmissionsRequest to name value pairs
  * @param MarketplaceWebService_Model_CancelFeedSubmissionsRequest $request
  * @return array
  */
 private function convertCancelFeedSubmissions($request)
 {
     $parameters = array();
     $parameters['Action'] = 'CancelFeedSubmissions';
     if ($request->isSetMarketplace()) {
         $parameters['Marketplace'] = $request->getMarketplace();
     }
     if ($request->isSetMerchant()) {
         $parameters['Merchant'] = $request->getMerchant();
     }
     if ($request->isSetFeedSubmissionIdList()) {
         $feedSubmissionIdList = $request->getFeedSubmissionIdList();
         foreach ($feedSubmissionIdList->getId() as $idIndex => $id) {
             $parameters['FeedSubmissionIdList' . '.' . 'Id' . '.' . ($idIndex + 1)] = $id;
         }
     }
     if ($request->isSetFeedTypeList()) {
         $feedTypeList = $request->getFeedTypeList();
         foreach ($feedTypeList->getType() as $typeIndex => $type) {
             $parameters['FeedTypeList' . '.' . 'Type' . '.' . ($typeIndex + 1)] = $type;
         }
     }
     if ($request->isSetSubmittedFromDate()) {
         $parameters['SubmittedFromDate'] = $this->getFormattedTimestamp($request->getSubmittedFromDate());
     }
     if ($request->isSetSubmittedToDate()) {
         $parameters['SubmittedToDate'] = $this->getFormattedTimestamp($request->getSubmittedToDate());
     }
     if ($request->isSetMWSAuthToken()) {
         $parameters['MWSAuthToken'] = $request->getMWSAuthToken();
     }
     return array(CONVERTED_PARAMETERS_KEY => $parameters, CONVERTED_HEADERS_KEY => $this->defaultHeaders);
 }
 public function cancelFeedSubmission($FeedSubmissionId)
 {
     $this->initAPI();
     $request = new MarketplaceWebService_Model_CancelFeedSubmissionsRequest();
     $request->setMerchant($this->SellerId);
     // set idList
     if (!is_array($FeedSubmissionId)) {
         $FeedSubmissionId = array($FeedSubmissionId);
     }
     $idList = new MarketplaceWebService_Model_IdList();
     $idList->setId($FeedSubmissionId);
     $request->setFeedSubmissionIdList($idList);
     // invoke request
     try {
         $response = $this->service->cancelFeedSubmissions($request);
         if ($response->isSetCancelFeedSubmissionsResult()) {
             $cancelFeedSubmissionsResult = $response->getCancelFeedSubmissionsResult();
             $feedSubmissionInfoList = $cancelFeedSubmissionsResult->getFeedSubmissionInfoList();
             $feeds = array();
             foreach ($feedSubmissionInfoList as $feedSubmissionInfo) {
                 $feed = new stdClass();
                 $feed->FeedSubmissionId = $feedSubmissionInfo->getFeedSubmissionId();
                 $feed->FeedType = $feedSubmissionInfo->getFeedType();
                 $feed->FeedProcessingStatus = $feedSubmissionInfo->getFeedProcessingStatus();
                 if ($feedSubmissionInfo->isSetSubmittedDate()) {
                     $feed->SubmittedDate = $feedSubmissionInfo->getSubmittedDate()->format(DATE_FORMAT);
                 }
                 if ($feedSubmissionInfo->isSetStartedProcessingDate()) {
                     $feed->StartedProcessingDate = $feedSubmissionInfo->getStartedProcessingDate()->format(DATE_FORMAT);
                 }
                 if ($feedSubmissionInfo->isSetCompletedProcessingDate()) {
                     $feed->CompletedProcessingDate = $feedSubmissionInfo->getCompletedProcessingDate()->format(DATE_FORMAT);
                 }
                 $feeds[] = $feed;
             }
             $result = new stdClass();
             $result->feeds = $feeds;
             $result->success = true;
             // log to db - parsed request
             $this->dblogger->updateLog(array('result' => json_encode($result), 'success' => 'Success'));
             return $result;
         }
     } catch (MarketplaceWebService_Exception $ex) {
         $error = new stdClass();
         $error->ErrorMessage = $ex->getMessage();
         $error->ErrorCode = $ex->getErrorCode();
         $error->StatusCode = $ex->getStatusCode();
         return $error;
     }
     $result = new stdClass();
     $result->success = false;
     return $result;
 }