public function testSetSellerOrderIdFilter() { $this->object->setOrderStatusFilter('Status'); $this->object->setPaymentMethodFilter('Payment'); $this->object->setFulfillmentChannelFilter('AFN'); $this->object->setLimits('Modified', '-10 min', '-2 min'); $this->object->setEmailFilter('Email'); $this->assertNull($this->object->setSellerOrderIdFilter('123456')); $o = $this->object->getOptions(); $this->assertArrayHasKey('SellerOrderId', $o); $this->assertEquals('123456', $o['SellerOrderId']); $this->assertArrayNotHasKey('BuyerEmail', $o); $this->assertArrayNotHasKey('OrderStatus.Status.1', $o); $this->assertArrayNotHasKey('PaymentMethod.1', $o); $this->assertArrayNotHasKey('FulfillmentChannel.Channel.1', $o); $this->assertArrayNotHasKey('LastUpdatedAfter', $o); $this->assertArrayNotHasKey('LastUpdatedBefore', $o); $this->assertNull($this->object->setSellerOrderIdFilter(null)); $o2 = $this->object->getOptions(); $this->assertArrayNotHasKey('SellerOrderId', $o2); $this->assertNull($this->object->setSellerOrderIdFilter('987654321')); $o3 = $this->object->getOptions(); $this->assertArrayHasKey('SellerOrderId', $o3); $this->assertEquals('987654321', $o3['SellerOrderId']); $this->assertFalse($this->object->setSellerOrderIdFilter(array(5))); }
/** * 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(); } }