@param array $ordersForSingleSync
@param array $website

@return null
320091
protected function createSingleImports($ordersForSingleSync, $website)
    {
        foreach ($ordersForSingleSync as $order) {
            //register in queue with importer
            $this->importerFactory->create()
                ->registerQueue(
                    \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_ORDERS,
                    $order,
                    \Dotdigitalgroup\Email\Model\Importer::MODE_SINGLE,
                    $website[0]
                );
        }
    }
797706
public function ordersPaymentEdit(array $payment, $by = 'id', $site = null)
    {
        if (!count($payment)) {
            throw new \InvalidArgumentException(
                'Parameter `payment` must contains a data'
            );
        }

        $this->checkIdParameter($by);

        if (!array_key_exists($by, $payment)) {
            throw new \InvalidArgumentException(
                sprintf('Order array must contain the "%s" parameter.', $by)
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            sprintf('/orders/payments/%s/edit', $payment[$by]),
            "POST",
            $this->fillSite(
                $site,
                ['payment' => json_encode($payment), 'by' => $by]
            )
        );
    }
393065
public function sortable(
        array $orderColumns = [],
        string $orderByKey = 'order_by',
        string $directionKey = 'direction'
    ): void {
        $model = $this->resolveQueryBuilderFromModel($this->model);
        $request = $this->app->make('request');

        $orderByValue = $request->input($orderByKey);
        $directionValue = $request->input($directionKey);

        $this->set('filter.order_by', ['key' => $orderByKey, 'value' => $orderByValue]);
        $this->set('filter.direction', ['key' => $directionKey, 'value' => $directionValue]);
        $this->set('filter.columns', $orderColumns);

        $this->model = $this->setupBasicQueryFilter($model, [
            'order_by' => $orderByValue,
            'direction' => $directionValue,
            'columns' => $orderColumns,
        ]);
    }
401263
public function getConfigSelectedStatus($website = 0)
    {
        $status = $this->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_ORDER_STATUS,
            $website
        );
        if ($status) {
            return explode(',', $status);
        } else {
            return false;
        }
    }
1203235
public function getSalesCollectionForReviews(
        $orderStatusFromConfig,
        $created,
        $website,
        $campaignOrderIds = []
    ) {
        $storeIds = $website->getStoreIds();
        $collection = $this->orderCollection->create()
            ->addFieldToFilter(
                'main_table.status',
                $orderStatusFromConfig
            )
            ->addFieldToFilter('main_table.created_at', $created)
            ->addFieldToFilter(
                'main_table.store_id',
                ['in' => $storeIds]
            );

        if (!empty($campaignOrderIds)) {
            $collection->addFieldToFilter(
                'main_table.increment_id',
                ['nin' => $campaignOrderIds]
            );
        }

        if ($this->helper->isOnlySubscribersForReview($website->getWebsiteId())) {
            $collection = $this->subscriberFilterer->filterBySubscribedStatus($collection);
        }

        return $collection;
    }
130610
public void captureOrderings(OrderingList<?> ordering) {
        try {
            if (ordering != null) {
                for (OrderedProperty<?> orderedProperty : ordering) {
                    ChainedProperty<?> chained = orderedProperty.getChainedProperty();
                    if (!chained.isDerived()) {
                        mRootJoinNode.addJoin(mRepository, chained, mAliasGenerator);
                    }
                }
            }
        } catch (RepositoryException e) {
            throw new UndeclaredThrowableException(e);
        }
    }
1361871
public function getAuthRefNum($orderIndex = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('authRefNum', $orderStatuses[$orderIndex])
            ? $orderStatuses[$orderIndex]['authRefNum'] : null;
    }
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'];
    }
454178
public function getOrderStatus($website)
    {
        return $this->getReviewWebsiteSettings(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_REVIEW_STATUS, $website);
    }
903810
public function enqueueForExport(
        \Magento\Store\Api\Data\WebsiteInterface $website,
        $customersFile,
        $customerNum,
        $customerIds,
        $resource
    ) {
        if (is_file($this->file->getFilePath($customersFile))) {
            if ($customerNum > 0) {
                //register in queue with importer
                $this->importerFactory->create()
                    ->registerQueue(
                        \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_CONTACT,
                        '',
                        \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                        $website->getId(),
                        $customersFile
                    );

                //set imported
                $resource->setImportedByIds($customerIds);
            }
        }
    }
198834
public function exportWishlistForWebsiteInSingle(\Magento\Store\Api\Data\WebsiteInterface $website)
    {
        //transactional data limit
        $limit             = $this->helper->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT,
            $website
        );
        $collection        = $this->getModifiedWishlistToImport(
            $website,
            $limit
        );
        $this->wishlistIds = [];
        //email_wishlist wishlist ids
        $wishlistIds = $collection->getColumnValues('wishlist_id');

        $wishlistCollection = $this->wishlist->create()
                                             ->getWishlistByIds($wishlistIds);

        foreach ($wishlistCollection as $wishlist) {
            $wishlistId    = $wishlist->getid();
            $wishlistItems = $this->itemCollection->create()
                                                  ->addWishlistFilter($wishlist);

            $connectorWishlist = $this->wishlistFactory->create();
            $connectorWishlist->setId($wishlistId)
                              ->setUpdatedAt($wishlist->getUpdatedAt())
                              ->setCustomerId($wishlist->getCustomerId())
                              ->setEmail($wishlist->getEmail());

            if ($wishlistItems->getSize()) {
                /** @var \Magento\Wishlist\Model\Item $item */
                foreach ($wishlistItems as $item) {
                    try {
                        $product = $item->getProduct();
                        $connectorWishlistItem = $this->createConnectorWishlistItem($product, $item);
                        if ($connectorWishlistItem) {
                            $connectorWishlist->setItem($connectorWishlistItem);
                        }
                        $this->countWishlists++;
                    } catch (\Exception $e) {
                        //Product does not exist. Continue to next item
                        continue;
                    }
                }
                //send wishlist as transactional data
                $this->start = microtime(true);
                //register in queue with importer
                $check = $this->importerFactory->create()
                                               ->registerQueue(
                                                   Importer::IMPORT_TYPE_WISHLIST,
                                                   $connectorWishlist->expose(),
                                                   Importer::MODE_SINGLE,
                                                   $website->getId()
                                               );
                if ($check) {
                    $this->wishlistIds[] = $wishlistId;
                }
            } else {
                //register in queue with importer
                $check = $this->importerFactory->create()
                                               ->registerQueue(
                                                   Importer::IMPORT_TYPE_WISHLIST,
                                                   [$wishlist->getId()],
                                                   Importer::MODE_SINGLE_DELETE,
                                                   $website->getId()
                                               );
                if ($check) {
                    $this->wishlistIds[] = $wishlistId;
                }
            }
        }
        if (! empty($this->wishlistIds)) {
            $this->setImported($this->wishlistIds, true);
        }
    }
26568
@Override
	public void cacheResult(List<CommerceOrderNote> commerceOrderNotes) {
		for (CommerceOrderNote commerceOrderNote : commerceOrderNotes) {
			if (entityCache.getResult(
						CommerceOrderNoteModelImpl.ENTITY_CACHE_ENABLED,
						CommerceOrderNoteImpl.class,
						commerceOrderNote.getPrimaryKey()) == null) {
				cacheResult(commerceOrderNote);
			}
			else {
				commerceOrderNote.resetOriginalValues();
			}
		}
	}
466783
public function listOrders($baseIds, $offsetStart = 0, $perPage = 20, $sort = "created_on", $filters = [])
    {
        $qb = $this
            ->createQueryBuilder('o');

        $this->performQuery($qb, $baseIds, $filters);
        $qb->groupBy('o.id');

        if ($sort === 'user') {
            $qb->orderBy('o.user', 'ASC');
        }
        elseif ($sort === 'usage') {
            $qb->orderBy('o.orderUsage', 'ASC');
        }
        else {
            $qb->orderBy('o.createdOn', 'DESC');
        }

        $qb
            ->setFirstResult((int)$offsetStart)
            ->setMaxResults(max(10, (int)$perPage));

        return $qb->getQuery()->getResult();
    }
101341
private function statusCheckAutomationEnrolment($order, $status, $customerEmail, $websiteId, $storeName)
    {
        $configStatusAutomationMap = $this->serializer->unserialize(
            $this->scopeConfig->getValue(
                \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_AUTOMATION_STUDIO_ORDER_STATUS,
                \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
                $order->getStore()
            )
        );

        if (!empty($configStatusAutomationMap)) {
            foreach ($configStatusAutomationMap as $configMap) {
                if ($configMap['status'] == $status) {
                    //send to automation queue
                    $this->doAutomationEnrolment(
                        [
                            'programId' => $configMap['automation'],
                            'automationType' => 'order_automation_' . $status,
                            'email' => $customerEmail,
                            'order_id' => $order->getIncrementId(),
                            'website_id' => $websiteId,
                            'store_name' => $storeName
                        ]
                    );
                }
            }
        }
    }
1318850
public static function fields($orderId, $orderAmount, $orderName = null, $orderDesc = null)
	{

		$fields = self::gateway()->endpoint(array(
			'orderId'     => $orderId,
			'orderAmount' => $orderAmount,
			'orderName'   => $orderName,
			'orderDesc'   => $orderDesc,
		));

		foreach ($fields as $key => $val) {
			echo '<input
				type="hidden"
				name="' . htmlentities($key) . '"
				value="' . htmlentities($val) . '">
			';
		}

	}
188714
function sortQueryresults(matches, order) {
  const orderArray = order.split(',').map(k => {
    let dir = 'asc';
    let key = k;

    if (k.charAt(0) === '-') {
      key = k.substring(1);
      dir = 'desc';
    }

    return [item => deserializeQueryParam(item[key]), dir];
  });

  const keys = orderArray.map(_.first);
  const orders = orderArray.map(_.last);

  return _.orderBy(matches, keys, orders);
}
283303
public function findOneBy(array $criteria = [], array $orders = [], $offset = null): ?AbstractEntity
    {
        $array = $this->findBy($criteria, $orders, 1, $offset);

        return array_shift($array);
    }