jlevers / selling-partner-api

A PHP client library for Amazon's Selling Partner API
BSD 3-Clause "New" or "Revised" License
409 stars 200 forks source link

After downloading the GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA report, a parsing error occurs. #809

Open BaiNight opened 2 weeks ago

BaiNight commented 2 weeks ago

Version:v7.2.3

Download GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA with the following example code:

  use SellingPartnerApi\SellingPartnerApi;

  $reportType = 'GET_FBA_FULFILLMENT_CUSTOMER_RETURNS_DATA';
  $documentId = 'amzn1.spdoc.1.4.na....2610';

  $connector = SellingPartnerApi::seller(/* ... */);
  $response = $connector->reportsV20210630()->getReportDocument($documentId, $reportType);

  $reportDocument = $response->dto();

  $contents = $reportDocument->download($reportType);

After calling the: download method, an error occurs::The conversion from Windows-1252 to UTF-8 failed.

Call stack as follows:

0 D:\php-project\amazon-api\vendor\openspout\openspout\src\Common\Helper\EncodingHelper.php(96): OpenSpout\Common\Helper\EncodingHelper->attemptConversion('Incorrect size,...', 'Windows-1252', 'UTF-8')

1 D:\php-project\amazon-api\vendor\openspout\openspout\src\Reader\CSV\RowIterator.php(204): OpenSpout\Common\Helper\EncodingHelper->attemptConversionToUTF8('Incorrect size,...', 'Windows-1252')

2 D:\php-project\amazon-api\vendor\openspout\openspout\src\Reader\CSV\RowIterator.php(132): OpenSpout\Reader\CSV\RowIterator->getNextUTF8EncodedRow()

3 D:\php-project\amazon-api\vendor\openspout\openspout\src\Reader\CSV\RowIterator.php(90): OpenSpout\Reader\CSV\RowIterator->readDataForNextRow()

4 D:\php-project\amazon-api\vendor\jlevers\selling-partner-api\src\Traits\DownloadsDocument.php(173): OpenSpout\Reader\CSV\RowIterator->next()

5 D:\php-project\amazon-api\vendor\jlevers\selling-partner-api\src\Traits\DownloadsDocument.php(128): SellingPartnerApi\Seller\ReportsV20210630\Responses\ReportDocument->parseSpreadsheet('return-date\tord...')

6 D:\php-project\amazon-api\vendor\jlevers\selling-partner-api\src\Traits\DownloadsDocument.php(84): SellingPartnerApi\Seller\ReportsV20210630\Responses\ReportDocument->parseDocument('return-date\tord...')

7 D:\php-project\amazon-api\app\Http\Services\AmazonReportDocService.php(36): SellingPartnerApi\Seller\ReportsV20210630\Responses\ReportDocument->download('GET_FBA_FULFILL...')