fillup / walmart-partner-api-sdk-php

PHP client for Walmart Partner APIs
MIT License
37 stars 51 forks source link

nextCursor issue on order pagination #37

Open jpnathannew opened 7 years ago

jpnathannew commented 7 years ago

Hi @fillup,

I got the error on get orders api call. I have 20 orders. So 1st page I got the first 10 orders. But when I tried to get the next page I sent a nextCursor. But I got the fatal error only. My first page request is given below

$requestData = [
    'createdStartDate' => date('Y-m-d'),
    'status'           => 'Created',
    'offset'           => 0,
];
$response = $client->list($requestData);

My error on remaining pages Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error response [url] https://marketplace.walmartapis.com/v3/orders?limit=1&hasMoreElements=true&soIndex=4&poIndex=3577521419838&partnerId=10000003556&sellerId=3647&status=Created&createdStartDate=2016-12-30&createdEndDate=2017-01-03T16%3A51%3A40.041Z [status code] 401 [reason phrase] Unauthorized' in C:\wamp\www\site\vendors\guzzlehttp\command\src\AbstractClient.php on line 171

I found the reason. Its caused from nextcursor URL createdEndDate. AuthSubscriber.php page line number 40.

$requestUrl = rawurldecode($requestUrl);

rawurldecode function create some characters in createdEndDate. When we comment this line. Its working fine.

Are you guys going to fix this in future release? or any other possible solution?

ajbonner commented 7 years ago

We ran into this as well - there is a side discussion on the issue in #15

fillup commented 7 years ago

Yes I need to fix this. I had put a question in to the Walmart API team asking specifically how they calculated the signature but I never got a response and forgot about it.

So you are telling me by commenting out the line that uses rawurldecode fixes the issue? I'm happy to remove that if so.

ajbonner commented 7 years ago

Yeah, literally just commenting out urldecode sorts it as per https://github.com/muscleandstrength/walmart-partner-api-sdk-php/commit/68a94f0507e9f1d805830e3afa6ddf254299dc99

lin3615 commented 5 years ago

It is not OK, the next page still throw errors,as "'Error executing command: Client error response [url] https://marketplace.walmartapis.com/v3/orders?limit=5&hasMoreElements=true&soIndex=78&poIndex=5&partnerId=10000019865&sellerId=18969&status=Acknowledged&createdStartDate=2019-04-25&createdEndDate=2019-05-02T07%3A22%3A10.011Z [status code] 401 [reason phrase] Unauthorized'",I have more 5 ordes

lin3615 commented 5 years ago

Yeah, literally just commenting out urldecode sorts it as per muscleandstrength@68a94f0 It is not OK, the next page still throw errors,as "'Error executing command: Client error response [url] https://marketplace.walmartapis.com/v3/orders?limit=5&hasMoreElements=true&soIndex=78&poIndex=5&partnerId=10000019865&sellerId=18969&status=Acknowledged&createdStartDate=2019-04-25&createdEndDate=2019-05-02T07%3A22%3A10.011Z [status code] 401 [reason phrase] Unauthorized'",I have more 5 ordes