forecho / amazon-mws

Interaction with the Amazon api for vendors called MWS
23 stars 15 forks source link

Initial Test Code not working? #6

Open simplyrahul opened 4 years ago

simplyrahul commented 4 years ago

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.

forecho commented 4 years ago

validateCredentials() function is not a must.