public function updateStatusForFeeds()
 {
     $sql = "select sf.id_subfeed, sf.feed_submission_id from ps_affiliate_subfeed sf where sf.id_status = " . MarketplaceWebService_DB::$STATUS_AZN_SUBMITTED;
     $feeds = $this->db->ExecuteS($sql);
     $service = new MarketplaceWebService_Client($this->mws_config['access_key'], $this->mws_config['secret_key'], $this->config, APPLICATION_NAME, APPLICATION_VERSION);
     foreach ($feeds as $feed) {
         $id_subfeed = $feed['id_subfeed'];
         $feed_submission_id = $feed['feed_submission_id'];
         $request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest();
         $request->setMerchant($this->mws_config['merchant_id']);
         $request->setFeedSubmissionId($feed_submission_id);
         $request->setFeedSubmissionResult(@fopen('php://memory', 'rw+'));
         $this->invokeGetFeedSubmissionResult($service, $request);
         sleep(5);
     }
 }
Beispiel #2
0
 /** Get FeedSubmissionInfo
  * @param $feedSubmissionId
  * @return bool|\SimpleXMLElement
  */
 public function getSubmission($feedSubmissionId)
 {
     if ($feedSubmissionId > 0) {
         $request = new \MarketplaceWebService_Model_GetFeedSubmissionResultRequest();
         $request->setFeedSubmissionId($feedSubmissionId);
         $request->setMarketplace($this->config['marketplace_id']);
         $request->setMerchant($this->config['merchant_id']);
         $handle = @fopen('php://memory', 'rw+');
         $request->setFeedSubmissionResult($handle);
         $this->client->getFeedSubmissionResult($request);
         rewind($handle);
         $xmlResponse = stream_get_contents($handle);
         try {
             return new \SimpleXMLElement($xmlResponse);
         } catch (\Exception $ex) {
             return $xmlResponse;
         }
     } else {
         return false;
     }
 }
function getFeedStatus($submitId, $service, $xmlFile)
{
    if (preg_match('/^\\d+$/', $submitId) < 1) {
        errorLog($submitId, ':submissionId 不正确!', 'N');
        return false;
    }
    if (is_file($xmlFile)) {
        $resource = @fopen($xmlFile, 'w+');
    } else {
        $resource = @fopen('php://memory', 'rw+');
    }
    $parameters = array('Merchant' => MERCHANT_ID, 'FeedSubmissionId' => $submitId, 'FeedSubmissionResult' => $resource);
    $request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest($parameters);
    //$request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest();
    $request->setMerchant(MERCHANT_ID);
    $request->setFeedSubmissionId($submitId);
    if (is_file($xmlFile)) {
        $request->setFeedSubmissionResult(@fopen($xmlFile, 'rw+'));
    } else {
        $request->setFeedSubmissionResult(@fopen('php://memory', 'rw+'));
    }
    invokeGetFeedSubmissionResult($service, $request);
}
Beispiel #4
0
 /**
  * Convert GetFeedSubmissionResultRequest to name value pairs
  * @param MarketplaceWebService_Model_GetFeedSubmissionResultRequest $request
  * @return array
  */
 private function convertGetFeedSubmissionResult($request)
 {
     $parameters = array();
     $parameters['Action'] = 'GetFeedSubmissionResult';
     if ($request->isSetMarketplace()) {
         $parameters['Marketplace'] = $request->getMarketplace();
     }
     if ($request->isSetMerchant()) {
         $parameters['Merchant'] = $request->getMerchant();
     }
     if ($request->isSetFeedSubmissionId()) {
         $parameters['FeedSubmissionId'] = $request->getFeedSubmissionId();
     }
     if ($request->isSetMWSAuthToken()) {
         $parameters['MWSAuthToken'] = $request->getMWSAuthToken();
     }
     return array(CONVERTED_PARAMETERS_KEY => $parameters, CONVERTED_HEADERS_KEY => $this->defaultHeaders);
 }
 * Responses are loaded from local XML files. You can tweak XML files to
 * experiment with various outputs during development
 *
 * XML files available under MarketplaceWebService/Mock tree
 *
 ***********************************************************************/
// $service = new MarketplaceWebService_Mock();
/************************************************************************
 * Setup request parameters and uncomment invoke to try out 
 * sample for Get Feed Submission Result Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as MarketplaceWebService_Model_GetFeedSubmissionResultRequest
// object or array of parameters
$parameters = array('Merchant' => MERCHANT_ID, 'FeedSubmissionId' => '<Feed Submission Id>', 'FeedSubmissionResult' => @fopen('php://memory', 'rw+'));
$request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest($parameters);
$request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest();
$request->setMerchant(MERCHANT_ID);
$request->setFeedSubmissionId('<Feed Submission Id>');
$request->setFeedSubmissionResult(@fopen('php://memory', 'rw+'));
//invokeGetFeedSubmissionResult($service, $request);
/**
 * Get Feed Submission Result Action Sample
 * retrieves the feed processing report
 *   
 * @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
 * @param mixed $request MarketplaceWebService_Model_GetFeedSubmissionResult or array of parameters
 */
function invokeGetFeedSubmissionResult(MarketplaceWebService_Interface $service, $request)
{
    try {
        $response = $service->getFeedSubmissionResult($request);
 *  @license     http://aws.amazon.com/apache2.0  Apache License, Version 2.0
 *  @version     2009-01-01
 */
/******************************************************************************* 
 *  Marketplace Web Service PHP5 Library
 *  Generated: Thu May 07 13:07:36 PDT 2009
 * 
 */
/**
 * Get Feed Submission Result  Sample
 */
include_once '.config.inc.php';
$serviceUrl = "https://mws.amazonservices.com";
$config = array('ServiceURL' => $serviceUrl, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3);
$service = new MarketplaceWebService_Client(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, $config, APPLICATION_NAME, APPLICATION_VERSION);
$request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest();
$request->setMarketplace(MARKETPLACE_ID);
$request->setMerchant(MERCHANT_ID);
$request->setFeedSubmissionId('3270420532');
$myHandle = @fopen('php://memory', 'rw+');
$request->setFeedSubmissionResult($myHandle);
invokeGetFeedSubmissionResult($service, $request);
rewind($myHandle);
echo stream_get_contents($myHandle);
function invokeGetFeedSubmissionResult(MarketplaceWebService_Interface $service, $request)
{
    try {
        $response = $service->getFeedSubmissionResult($request);
    } catch (MarketplaceWebService_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
 public function getFeedSubmissionResult($FeedSubmissionId)
 {
     $this->initAPI();
     $resultHandle = @fopen('php://memory', 'rw+');
     $request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest();
     $request->setMerchant($this->SellerId);
     $request->setFeedSubmissionId($FeedSubmissionId);
     $request->setFeedSubmissionResult($resultHandle);
     // invoke request
     try {
         $response = $this->service->getFeedSubmissionResult($request);
         if ($response->isSetGetFeedSubmissionResultResult()) {
             rewind($resultHandle);
             $result = new stdClass();
             $result->content = stream_get_contents($resultHandle);
             $result->success = true;
             // log to db - parsed request
             $this->dblogger->updateLog(array('result' => $result->content, 'success' => 'Success'));
             return $result;
         }
     } catch (MarketplaceWebService_Exception $ex) {
         $error = new stdClass();
         $error->ErrorMessage = $ex->getMessage();
         $error->ErrorCode = $ex->getErrorCode();
         $error->StatusCode = $ex->getStatusCode();
         $error->success = false;
         return $error;
     }
     $result = new stdClass();
     $result->success = false;
     return $result;
 }
        }
        foreach (glob(dirname(__FILE__) . '/../../../MarketplaceWebService/Model/*.php') as $file) {
            require_once $file;
        }
        //require_once dirname(__FILE__) . '/../../../MarketplaceWebService/Model/SubmitFeedRequest.php';
        $serviceUrl = "https://mws.amazonservices.com";
        $config = array('ServiceURL' => $serviceUrl, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3);
        /************************************************************************
         * Instantiate Implementation of MarketplaceWebService
         *
         * AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY constants
         * are defined in the .config.inc.php located in the same
         * directory as this sample
         ***********************************************************************/
        $service = new MarketplaceWebService_Client(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, $config, APPLICATION_NAME, APPLICATION_VERSION);
        $request = new MarketplaceWebService_Model_GetFeedSubmissionResultRequest();
        $request->setMerchant(MERCHANT_ID);
        $request->setFeedSubmissionId($_POST['feedid']);
        $request->setFeedSubmissionResult(@fopen('php://memory', 'rw+'));
        invokeGetFeedSubmissionResult($service, $request);
    }
}
/**
 * Get Feed Submission Result Action Sample
 * retrieves the feed processing report
 *
 * @param MarketplaceWebService_Interface $service instance of MarketplaceWebService_Interface
 * @param mixed $request MarketplaceWebService_Model_GetFeedSubmissionResult or array of parameters
 */
function invokeGetFeedSubmissionResult(MarketplaceWebService_Interface $service, $request)
{