Get shipments for a given order

@param $orderID
@param array $filter
@return mixed
513766
public static function getShipments($orderID, $filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/orders/' . $orderID . '/shipments' . $filter->toQuery(), 'Shipment');
    }
39380
private function extractFilterVars(array $filter)
    {
        $collection = array_key_exists('collection', $filter) ? $filter['collection'] : null;
        $systemCollections = array_key_exists('systemCollections', $filter) ? $filter['systemCollections'] : true;
        $types = array_key_exists('types', $filter) ? $filter['types'] : null;
        $search = array_key_exists('search', $filter) ? $filter['search'] : null;
        $orderBy = array_key_exists('orderBy', $filter) ? $filter['orderBy'] : null;
        $orderSort = array_key_exists('orderSort', $filter) ? $filter['orderSort'] : null;
        $ids = array_key_exists('ids', $filter) ? $filter['ids'] : null;

        return [$collection, $systemCollections, $types, $search, $orderBy, $orderSort, $ids];
    }
14398
public function getList($filter = array()) {
        $res = array();
        $dbres = \CAgent::GetList(array("MODULE_ID" => "ASC"), $filter);
        while ($item = $dbres->Fetch()) {
            $res[] = $item;
        }
        return $res;
    }
1179239
public static function getOrder($orderId) {
        $response = self::requestApi("get", null, $orderId);
        $body = $response->getBodyAsJson();
        $order = new Order($body["order"]);
        return $order;
    }
310717
public function select(array $filter, array $sorting = [])
    {
        $this->filter = $filter;
        $this->sorting = $sorting;
        $this->prefetch = false;
        $this->items = null;

        return $this;
    }
400840
public function fetch(array $filter, array $sorting = [])
    {
        $this->filter = $filter;
        $this->sorting = $sorting;
        $this->prefetch = true;
        $this->items = null;

        return $this;
    }
1259360
public function getOrderFileList($orderId)
    {
        $orderFileList = oxNew(OrderFileList::class);
        $orderFileList->loadOrderFiles($orderId);

        if (count($orderFileList) > 0) {
            return $orderFileList;
        }

        return false;
    }
402269
public function get($orderId, $fulfillmentId, $fulfillmentEventId)
    {
        $endpoint = '/admin/orders/'.$orderId.'/fulfillments/'.$fulfillmentId.'/events/'.$fulfillmentEventId.'.json';
        $response = $this->request($endpoint);
        return $this->createObject(FulfillmentEvent::class, $response['fulfillment_event']);
    }
419299
public static function shipped($orderId, $shippedAt = 0)
    {
        $url = static::classUrl();
        $url = $url . '/' . $orderId . '/shipped';
        list($ret, $code) = parent::staticRequest('post', $url, [
            'shippedAt' => date('c', $shippedAt ? $shippedAt : time()),
        ]);

        return (object)[
            'code' => $code,
            'status' => $code === 204? 'success' : 'failed'
        ];
    }
624292
public static function getCustomers($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/customers' . $filter->toQuery(), 'Customer');
    }
697467
static function fetchCount( $orderID, $asObject = true )
    {
        $db = eZDB::instance();

        $orderID = (int)$orderID;
        $countArray = $db->arrayQuery(  "SELECT count( * ) AS count FROM ezorder_status_history WHERE order_id = $orderID" );
        return $countArray[0]['count'];
    }
53177
public function findOneBy(array $criteria, array $orderBy = null)
    {
        $qb = $this->createQueryBuilder('o');

        $this->applyCriteriaAndOrderByToQueryBuilder($qb, $criteria, $orderBy);

        return $qb->getQuery()->getOneOrNullResult();
    }
394408
public function globalFeed($filter = array(), $orderBy = 'ID DESC', $since = null, $number = 10, $markViewed = true) {
		$number = (int) $number;
		
		if (!count($filter)) {
			$filter = array('ParentID' => 0);
		}
		$filter['Deleted'] = 0;

		$items = MicroPost::get()->filter($filter)->sort($orderBy);
		
		if ($since) {
			$since = (int) $since;
			$items = $items->filter('ID:GreaterThan', $since);
		}

		if ($markViewed) {
			$this->recordUserAction();
		}
		$items = $this->updatePostList($items);
		return $items->limit($number)->restrict();
	}
306167
public function countByOrderId($orderId, $statusIds = array(), $comparator = "=")
    {
        try {
            $qb = $this->createQueryBuilder('shipping')
                ->select('count(shipping.id)')
                ->join('shipping.order', 'o')
                ->join('shipping.status', 'status')
                ->where('o.id = :orderId')
                ->groupBy('o.id')
                ->setParameter('orderId', $orderId);
            foreach ($statusIds as $statusId) {
                $qb->andWhere('status.id ' . $comparator . ' :excludeStatus');
                $qb->setParameter('excludeStatus', $statusId);
            }

            return $qb->getQuery()->getSingleScalarResult();
        } catch (NoResultException $nre) {
            return 0;
        }
    }
1171408
public function findAllByLocale($locale, $filter = array())
    {
        if (empty($filter)) {
            $order = $this->orderRepository->findAllByLocale($locale);
        } else {
            $order = $this->orderRepository->findByLocaleAndFilter($locale, $filter);
        }

        if ($order) {
            array_walk(
                $order,
                function (&$order) use ($locale) {
                    $order = $this->orderFactory->createApiEntity($order, $locale);
                    $this->updateApiEntity($order, $locale);
                }
            );
        }

        return $order;
    }
396366
public function get($orderId, array $params = array())
    {
        $endpoint = '/admin/orders/'.$orderId.'.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createObject(Order::class, $response['order']);
    }
716083
public static function getOrderStatusesWithCounts($filter = array())
    {
        $filter = Filter::create($filter);
        $resource = self::getResource('/orders/count' . $filter->toQuery(), "OrderStatus");
        return $resource->statuses;
    }