forecho / amazon-mws

Interaction with the Amazon api for vendors called MWS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initial Test Code not working?

simplyrahul opened this issue · comments

Sorry, but I am a bit of noob when it comes to this:

But, I tried for 4-5 hours to test if my credentials were working using the code provided:
// Optionally check if the supplied credentials are valid
if ($client->validateCredentials()) {
// Credentials are valid
} else {
// Credentials are not valid
}

I modified it to this to test:

// Optionally check if the supplied credentials are valid
if ($client->validateCredentials()) {
echo "worked";
} else {
echo "didn't work";
}

It kept printing didn't work and I was confused as all my credentials were working in python and scratchboard.

Causally, I tested the next code by changing the date to 2020-05-22:
$fromDate = new DateTime('2016-01-01');
$orders = $client->ListOrders($fromDate);
foreach ($orders as $order) {
$items = $client->ListOrderItems($order['AmazonOrderId']);
print_r($order);
print_r($items);
}

And I got all the details. So basic noobs like me will face issue and give up if they don't understand it. Can someone check or explain me why the initial test was not working. I didn't change anything in the "$client = new MCS\MWSClient" and below area before testing both the codes and I tested it twice.

validateCredentials() function is not a must.