/**
  * @param Customer $value
  * @return array
  */
 protected function getRemoteCustomers($value)
 {
     $this->transport->init($value->getChannel()->getTransport());
     $filter = new BatchFilterBag();
     $filter->addComplexFilter('email', ['key' => 'email', 'value' => ['key' => 'eq', 'value' => $value->getEmail()]]);
     $filter->addComplexFilter('store_id', ['key' => 'store_id', 'value' => ['key' => 'eq', 'value' => $value->getStore()->getOriginId()]]);
     $filters = $filter->getAppliedFilters();
     $customers = $this->transport->call(SoapTransport::ACTION_CUSTOMER_LIST, $filters);
     return (array) $customers;
 }
 /**
  * Process search for removal carts in CRM and mark them as "expired"
  *
  * @param array $ids
  */
 protected function processBatch($ids)
 {
     $filterBag = new BatchFilterBag();
     $filterBag->addStoreFilter($this->stores);
     $filterBag->addComplexFilter('entity_id', ['key' => 'entity_id', 'value' => ['key' => 'in', 'value' => implode(',', array_keys($ids))]]);
     $filters = $filterBag->getAppliedFilters();
     $filters['pager'] = ['page' => 1, 'pageSize' => $this->batchSize];
     $result = $this->transport->call(SoapTransport::ACTION_ORO_CART_LIST, $filters);
     $result = WSIUtils::processCollectionResponse($result);
     $resultIds = array_map(function (&$item) {
         return (int) $item->entity_id;
     }, $result);
     $resultIds = array_flip($resultIds);
     $removedIds = array_values(array_diff_key($ids, $resultIds));
     $this->em->getRepository('OroCRMMagentoBundle:Cart')->markExpired($removedIds);
 }