/**
  * @depends testFetchOrders
  */
 public function testGetList($o)
 {
     $get = $o->getList();
     $this->assertInternalType('array', $get);
     $this->assertEquals(3, count($get));
     $this->assertInternalType('object', $get[0]);
     $this->assertFalse($this->object->getList());
     //not fetched yet for this object
 }
示例#2
0
/**
 * This function will retrieve a list of all unshipped MFN orders made within the past 24 hours.
 * The entire list of orders is returned, with each order contained in an AmazonOrder object.
 * Note that the items in the order are not included in the data.
 * To get the order's items, the "fetchItems" method must be used by the specific order object.
 */
function getAmazonOrders()
{
    try {
        $amz = new AmazonOrderList("myStore");
        //store name matches the array key in the config file
        $amz->setLimits('Modified', "- 24 hours");
        //accepts either specific timestamps or relative times
        $amz->setFulfillmentChannelFilter("MFN");
        //no Amazon-fulfilled orders
        $amz->setOrderStatusFilter(array("Unshipped", "PartiallyShipped", "Canceled", "Unfulfillable"));
        //no shipped or pending orders
        $amz->setUseToken();
        //tells the object to automatically use tokens right away
        $amz->fetchOrders();
        //this is what actually sends the request
        return $amz->getList();
    } catch (Exception $ex) {
        echo 'There was a problem with the Amazon library. Error: ' . $ex->getMessage();
    }
}