Exemplo n.º 1
0
/**
 * Requests the initial inventory reports from amazon.
 *
 * Stores the request ID returned from Amazon in a cache file,
 * and in the case of Amazon CA actually requests both reports
 * needed to make the completed comparison form.
 *
 * @param object $service
 * @param string $region
 * @param array $creds
 * @return void
 */
function do_request(MarketplaceWebService_Interface $service, $region, $creds)
{
    // Create the request object to retrieve full inventory listing.
    $request = new MarketplaceWebService_Model_RequestReportRequest();
    $request->setMerchant($creds['merchant_id']);
    $request->setReportType('_GET_MERCHANT_LISTINGS_DATA_');
    $request->setReportOptions('ShowSalesChannel=true');
    // Request report and retrieve request ID.
    $requestID .= $region . "\t" . Request_Report($request, $service) . "\n";
    if ($region == 'ca') {
        // Create the request object to retrieve full inventory listing.
        $request = new MarketplaceWebService_Model_RequestReportRequest();
        $request->setMerchant($creds['merchant_id']);
        $request->setReportType('_GET_FLAT_FILE_OPEN_LISTINGS_DATA_');
        $request->setReportOptions('ShowSalesChannel=true');
        // Request report and retrieve request ID.
        $requestID .= $region . " asin\t" . Request_Report($request, $service) . "\n";
    }
    file_put_contents(CACHE_REQ_FILE . $region, $requestID);
}
 public function requestReport_v2($ReportType)
 {
     WPLA()->logger->info('requestReport_v2()');
     $this->initAPI();
     $marketplaceIdArray = array("Id" => array($this->MarketplaceId));
     $request = new MarketplaceWebService_Model_RequestReportRequest();
     $request->setMerchant($this->SellerId);
     $request->setMarketplaceIdList($marketplaceIdArray);
     $request->setReportType($ReportType);
     // $request->setReportOptions('ShowSalesChannel=true');
     $result = $this->invokeRequestReport($this->service, $request);
     return $result;
 }