davidtsadler / ebay-sdk-php

An eBay SDK for PHP. Use the eBay API in your PHP projects.
Apache License 2.0
349 stars 341 forks source link

GetFeedbackRequest always returning the same date #257

Closed KiloooNL closed 5 years ago

KiloooNL commented 5 years ago

Hi guys, I have a cron job that syncs feedback. I haven't made any changes to the code, but in the last few days, whenever I request feedback data from eBay, it is always returning the same date. I'm not sure if I have missed something on an API update, or if this is an issue on eBay's side.

Here's the code I'm using:

/****************
 * Sync Feedback
 */
header('Content-Type: text/html; charset=utf-8');
echo '<h1>Processing Feedback...</h1>';

use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;

$service = new Services\TradingService(array(
    'credentials' => $config['production']['credentials'],
    'siteId'      => Constants\SiteIds::AU
));

/** Feedback */
$feedbackReq = new Types\GetFeedbackRequestType();
$feedbackReq->RequesterCredentials = new Types\CustomSecurityHeaderType();
$feedbackReq->RequesterCredentials->eBayAuthToken = $config['production']['authToken'];
$feedbackReq->DetailLevel = ['ReturnAll'];
$feedbackReq->Pagination = new Types\PaginationType();
$feedbackReq->Pagination->EntriesPerPage = 25;
$feedbackResp = $service->getFeedback($feedbackReq);
$pageNum = 1;

do {
    if (isset($feedbackResp->Errors)) {
        foreach ($feedbackResp->Errors as $error) {
            printf(
                "%s: %s\n%s\n\n",
                $error->SeverityCode === Enums\SeverityCodeType::C_ERROR ? 'Error' : 'Warning',
                $error->ShortMessage,
                $error->LongMessage
            );
        }
    }
    if ($feedbackResp->Ack !== 'Failure') {
        $i = 0;
        foreach ($feedbackResp->FeedbackDetailArray->FeedbackDetail as $newFeedback) {
            ++$i;
            print_r($newFeedback);

            $feedback['ItemID'] = $newFeedback->ItemID;
            $feedback['FeedbackID'] = $newFeedback->FeedbackID;
            $feedback['UserID'] = $newFeedback->CommentingUser;
            $feedback['Role']   = $newFeedback->Role;
            $feedback['Feedback'] = $newFeedback->CommentText;
            $feedback['FeedbackType'] = $newFeedback->CommentType;
            $feedback['ItemTitle'] = $newFeedback->ItemTitle; // If role = buyer, then the item title will be null
            $feedback['CreatedDate'] = $newFeedback->CommentTime->format('Y-m-d H:i:s');
            echo 'Created Date: ' . $feedback['CreatedDate'] . '<br>';
        }
        echo '<b>Updated a total of ' . $i . ' feedback.</b><br>';
    }
    $pageNum += 1;
} while (isset($feedbackReq->FeedbackID) && $pageNum <= $feedbackResp->PaginationResult->TotalNumberOfPages);

And then if we print_r($newFeedback), we get this array data:

DTS\eBaySDK\Trading\Types\FeedbackDetailType Object
(
    [values:DTS\eBaySDK\Types\BaseType:private] => Array
        (
            [CommentingUser] => <CommentingUser>
            [FeedbackRatingStar] => <Rating>
            [CommentingUserScore] => <CommentingUserScore>
            [CommentText] => <CommentText>
            [CommentTime] => DateTime Object
                (
                    [date] => 2019-04-01 07:00:00.000000
                    [timezone_type] => 2
                    [timezone] => Z
                )

            [CommentType] => <CommentType>
            [ItemID] => <ItemID>
            [Role] => <Role>
            [FeedbackID] => <FeedbackID>
            [TransactionID] => <TransactionID>
            [OrderLineItemID] => <OrderLineItemID>
        )
    [attachment:DTS\eBaySDK\Types\BaseType:private] => Array
        (
            [data] => 
            [mimeType] => 
        )
)

As you can see, the DateTime object returns a date of 2019-04-01 07:00:00.000000, and this happens with every feedback request we make. This leads me to believe it's an issue with eBay's API as it is the server response, unless I'm missing something.

Can anyone advise?

michabbb commented 5 years ago

so when you think, the API itself has an issue, you should post to the ebay api dev forum, or the tec support, because this place is for issues about the SDK itself. you should, as always, test with the api explorer (in your dev account) to be sure, its api related.

KiloooNL commented 5 years ago

@michabbb - thanks. I don't know why I didn't think of using postman even. I'll close this issue - I have created an issue on ebay's dev forums -> https://forums.developer.ebay.com/questions/30666/getfeedbackrequest-always-returning-the-same-date.html

Hopefully one day someone will reply....

michabbb commented 5 years ago

@KiloooNL do you get same results in the api explorer or with postman? 🤔

KiloooNL commented 5 years ago

@KiloooNL do you get same results in the api explorer or with postman? 🤔

yes I did, it appears it was an issue with eBay API, now resolved :)