2014-11-14 149 views
2

我已經訂購了來自亞馬遜賣家中心的此交易報告,因爲無法從報告的API請求。 現在我正在嘗試使用可正常工作的報告api來下載此報告,但現在我正在嘗試將報告類型設置爲「_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_」,以便僅爲這種類型的報告獲取請求的報告列表。 我使用下面的代碼,但它給我這個錯誤如何設置亞馬遜MWS報告api的報告類型

"Fatal error: Call to a member function getType() on a non-object in /AmazonAPI/ReportsAPIClass/src/MarketplaceWebService/Client.php on line 1605"

$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); 

     //===========================GETS REPORT ID  
     $request_report_list = new MarketplaceWebService_Model_GetReportListRequest(); 
     $request_report_list->setMerchant($MERCHANT_ID); 
     $request_report_list->setAcknowledged(false); 
     $request_report_list->setMarketplace($MARKETPLACE_ID); 
     $request_report_list->setReportTypeList(array("TypeList" => "_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_")); 
+0

做工精細「的getType() 「在行號。 1605在Client.php所以從foreach($ reportTypeList-> getType()作爲$ typeIndex => $ type)到「foreach($ reportTypeList作爲$ typeIndex => $ type)」 –

回答

4

你必須創建一個類類型的類型串和刪除後發送的參數

$TypeList = new MarketplaceWebService_Model_TypeList(); 
$TypeList->setType('_GET_DATE_RANGE_FINANCIAL_TRANSACTION_DATA_'); 
$request_report_list->setReportTypeList($TypeList); 
+0

刪除「getType()」後線路號碼。 1605在Client.php所以從foreach($ reportTypeList-> getType()作爲$ typeIndex => $ type)到「foreach($ reportTypeList作爲$ typeIndex => $ type)」 –

+0

當然,但你正在改變官方庫,在庫中不是問題,問題是參數不正確,但是如果它有效的話不用擔心。 – mameyugo

+0

哦謝謝@mameyugo我希望亞馬遜開始在他們的API上開發更好的文檔。 –