/**
  * @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
 }
Esempio n. 2
0
 public function testFetchItems()
 {
     $this->object->setMock(true, array('fetchOrder.xml', 'fetchOrderItems.xml'));
     $this->object->setOrderIds('058-1233752-8214740');
     $this->object->fetchOrders();
     resetLog();
     $get = $this->object->fetchItems();
     $this->assertInternalType('array', $get);
     $this->assertEquals(1, count($get));
     $this->assertInternalType('object', $get[0]);
     $getOne = $this->object->fetchItems('string', 0);
     //$token will be set to false
     $this->assertInternalType('object', $getOne);
     $o = new AmazonOrderList('testStore', true, null, __DIR__ . '/../test-config.php');
     $this->assertFalse($o->fetchItems());
     //not fetched yet for this object
 }
Esempio n. 3
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();
    }
}