CRON FOR ORDER TRANSACTIONAL DATA.

@return array
777930
public function orderSync()
    {
        if ($this->jobHasAlreadyBeenRun('ddg_automation_order_sync')) {
            $message = 'Skipping ddg_automation_order_sync job run';
            $this->helper->log($message);
            return ['message' => $message];
        }

        // send order
        $orderResult = $this->syncOrderFactory->create()
            ->sync();

        return $orderResult;
    }
1190921
private function order()
    {
        $result = [];

        $data = $this->request;

        if ($data['table1'] > $data['table2']) {
            $result['first'] = $data['table2'];
            $result['second'] = $data['table1'];
        } else {
            $result['first'] = $data['table1'];
            $result['second'] = $data['table2'];
        }

        return $result;
    }
244544
public function cron() {

        global $DB;

        // Get all users who meet this criteria
        $sql = "
            SELECT DISTINCT
                c.id AS course,
                cr.id AS criteriaid,
                ra.userid AS userid,
                cc.timecompleted AS timecompleted
            FROM
                {course_completion_criteria} cr
            INNER JOIN
                {course} c
             ON cr.course = c.id
            INNER JOIN
                {context} con
             ON con.instanceid = c.id
            INNER JOIN
                {role_assignments} ra
              ON ra.contextid = con.id
            INNER JOIN
                {course_completions} cc
             ON cc.course = cr.courseinstance
            AND cc.userid = ra.userid
            LEFT JOIN
                {course_completion_crit_compl} ccc
             ON ccc.criteriaid = cr.id
            AND ccc.userid = ra.userid
            WHERE
                cr.criteriatype = ".COMPLETION_CRITERIA_TYPE_COURSE."
            AND con.contextlevel = ".CONTEXT_COURSE."
            AND c.enablecompletion = 1
            AND ccc.id IS NULL
            AND cc.timecompleted IS NOT NULL
        ";

        // Loop through completions, and mark as complete
        $rs = $DB->get_recordset_sql($sql);
        foreach ($rs as $record) {
            $completion = new completion_criteria_completion((array) $record, DATA_OBJECT_FETCH_BY_KEY);
            $completion->mark_complete($record->timecompleted);
        }
        $rs->close();
    }
295989
protected function getListTransaction()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;

        return (array) $this->transaction->getList($conditions);
    }
1056086
protected function rules() {
        return [
            new Rule('Order ID Exists', function(array $subject) {
                $response   = SubjectReader::readResponse($subject);
                $orderId    = $response['message']['trackId'];
                $order      = $this->orderFactory->create()->loadByIncrementId($orderId);

                return ! $order->isEmpty();
            }, __('Checkout.com track ID is not matching to any orders.') ),
        ];
    }
124920
public function list() : String
    {
        $list = '';

        if( is_file($this->crontabCommands) )
        {
            $jobs  = $this->listArray();
            $list  = '<pre>';
            $list .= '[ID] CRON JOB<br><br>';

            foreach( $jobs as $key => $job )
            {
                $list .= '[' . $key . ']: '. $job . '<br>';
            }

            $list .= '</pre>';
        }

        return $list;
    }
420726
public function listCronsStatus(): array
    {
        /** @var EdgarCron[] $edgarCrons */
        $edgarCrons = $this->repository->listCrons();
        /** @var CronInterface[] $crons */
        $crons = $this->getCrons();
        $cronAlias = [];

        foreach ($crons as $cron) {
            $cronAlias[$cron->getAlias()] = $cron;
        }

        if ($edgarCrons) {
            foreach ($edgarCrons as $edgarCron) {
                if (isset($cronAlias[$edgarCron->getAlias()])) {
                    $cronAlias[$edgarCron->getAlias()] = $edgarCron;
                }
            }
        }

        return $cronAlias;
    }
713612
public function listAction()
    {
        $this->performAccessChecks();

        $crons = $this->cronService->listCronsStatus();
        $cronRows = array();

        foreach ($crons as $cron) {
            $cronRows[] = array(
                'alias' => $cron->getAlias(),
                'queued' => $cron instanceof SmileCron
                    ? ($cron->getQueued() ? $cron->getQueued()->format('d-m-Y H:i') : false)
                    : false,
                'started' => $cron instanceof SmileCron ? ($cron->getStarted()
                    ? $cron->getStarted()->format('d-m-Y H:i') : false)
                    : false,
                'ended' => $cron instanceof SmileCron ? ($cron->getEnded()
                    ? $cron->getEnded()->format('d-m-Y H:i') : false)
                    : false,
                'status' => $cron instanceof SmileCron ? $cron->getStatus() : false
            );
        }

        return $this->render('SmileEzUICronBundle:cron:tab/status/list.html.twig', [
            'datas' => $cronRows
        ]);
    }
223581
public function getData()
    {
        $this->validate('transactionReference');

        $data = [
            'opcode'     => 1,
            'payment_id' => $this->getTransactionReference(),
            'token'      => $this->getRequestToken(),
        ];

        if ($this->getAmount()) {
            $data['amount'] = $this->getAmount();
        }

        return $data;
    }
766793
protected function getPaymentDateOrder()
    {
        // Take date of last payment as payment date.
        $paymentDate = null;
        foreach ($this->source->getStatusHistoryCollection() as $statusChange) {
            /** @var \Mage_Sales_Model_Order_Status_History $statusChange */
            if (!$paymentDate || $this->isPaidStatus($statusChange->getStatus())) {
                $createdAt = substr($statusChange->getCreatedAt(), 0, strlen('yyyy-mm-dd'));
                if (!$paymentDate || $createdAt < $paymentDate) {
                    $paymentDate = $createdAt;
                }
            }
        }
        return $paymentDate;
    }
419945
protected function _ExecuteCron()
    {
        $sQuery = "SELECT * FROM `shop_order_basket`
                         WHERE `shop_order_basket`.`processed` != '1'
                      ORDER BY `shop_order_basket`.`lastmodified` DESC";
        $oOrderBasketList = TdbShopOrderBasketList::GetList($sQuery);
        $sStatistics = "#########################################################\r\n";
        while ($oOrderBasket = $oOrderBasketList->Next()) {
            $sStatistics .= $this->GenerateStatisticsFromOrderBasket($oOrderBasket);
            $this->MarkOrderBasketAsProcessed($oOrderBasket);
            ++$this->sTotalBaskets;
        }
        if ($oOrderBasketList->Length() > 0) {
            $sTotalStatistics = $this->GetTotalStatistics().$sStatistics;
            $this->SendBasketStatistics($sTotalStatistics);
        }
    }
140699
public function getDataAsTdbArray()
    {
        $data = (null === $this->getStatusData()) ? array() : $this->getStatusData()->all();
        $data = serialize($data);

        return array(
            'shop_order_id' => $this->getOrder()->id,
            'shop_order_status_code_id' => $this->getShopOrderStatusCodeObject()->id,
            'status_date' => date('Y-m-d H:i:s', $this->getStatusTimestamp()),
            'info' => $this->getInfo(),
            'data' => $data,
        );
    }
1035295
public function get_next($id_cron = null): ?array
  {
    if ( $this->check() && ($data = $this->db->get_row("
        SELECT *
        FROM {$this->table}
        WHERE `active` = 1
        AND `next` < NOW()".
        ( bbn\str::is_uid($id_cron) ? " AND `id` = '$id_cron'" : '' )."
        ORDER BY `priority` ASC, `next` ASC
        LIMIT 1")) ){
      // Dans cfg: timeout, et soit: latency, minute, hour, day of month, day of week, date
      $data['cfg'] = json_decode($data['cfg'], 1);
      return $data;
    }
  }
679405
public function getData() {
        if ($this->toSort && !empty($this->getOrder())) {
            $this->sortData();
        }

        if ($this->getLimit()) {
            return array_slice($this->data, $this->getOffset(), $this->getLimit());
        } else {
            return $this->data;
        }
    }
936902
public function getServerTime()
    {
        $response = $this->getConnection()->get(Urls::URL_ADMIN_TIME);
        $data     = $response->getJson();

        return $data['time'];
    }
973166
public static function getStatusList()
    {
        return [
            TransactionInterface::STATUS_ORDER_UNKNOWN => 'order_unknown',
            TransactionInterface::STATUS_OPEN => 'open',
            TransactionInterface::STATUS_PENDING => 'pending',
            TransactionInterface::STATUS_VALIDATED => 'validated',
            TransactionInterface::STATUS_CANCELLED => 'cancelled',
            TransactionInterface::STATUS_UNKNOWN => 'status_unknown',
            TransactionInterface::STATUS_ERROR_VALIDATION => 'error_validation',
            TransactionInterface::STATUS_WRONG_CALLBACK => 'wrong_callback',
            TransactionInterface::STATUS_WRONG_REQUEST => 'wrong_request',
            TransactionInterface::STATUS_ORDER_NOT_OPEN => 'order_to_open',
        ];
    }
840966
private function getCommitOrder(): array
    {
        static $calculator = null;
        if (null === $calculator) {
            $calculator = new CommitOrderCalculator();
        }

        $objects = array_merge($this->documentInsertions, $this->documentUpdates, $this->documentDeletions);

        $classes = [];
        foreach ($objects as $object) {
            $metadata = $this->manager->getClassMetadata(get_class($object));

            $calculator->addClass($metadata);
            $classes[$metadata->getName()] = $metadata;
        }

        $order = $calculator->getOrder(array_keys($classes));

        return array_map(function (array $element) {
            return $element[0]->getClassName();
        }, $order);
    }