@param int $idSalesOrder
@param int $idSalesOrderItem
@param string $status

@return bool
186750
protected function isPayment($idSalesOrder, $idSalesOrderItem, $status)
    {
        $statusLog = $this->getFirstUnprocessedTransactionStatusLog($idSalesOrder, $idSalesOrderItem, $status);
        if ($statusLog === null) {
            return false;
        }

        $this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);

        return true;
    }
1282496
public static function isValidNextStatus($model, $status_id)
	{
		$eventSequence = $model->getEventSequence($status_id);
		foreach ($eventSequence['before'] as $event) {
			if ($model->hasEventHandlers($event->name)) {
				$model->trigger($event->name, $event);
				if ($event->isValid === false) {
					return false;
				}
			}
		}
		return true;
	}
755821
public function usersStatus($id, $status)
    {
        $statuses = ["free", "busy", "dinner", "break"];

        if (empty($status) || !in_array($status, $statuses)) {
            throw new \InvalidArgumentException(
                'Parameter `status` must be not empty & must be equal one of these values: free|busy|dinner|break'
            );
        }

        /** @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            "/users/$id/status",
            "POST",
            ['status' => $status]
        );
    }
606689
public function canDelete(StatusInterface $status, array $parameters)
    {
        return !$this->statusUsageFinder->hasUsage($status)
            && !$status->isInitialState()
            && !$status->isPublishedState()
            && !$status->isTranslationState()
            && !$status->isAutoPublishFromState()
            && !$status->isAutoUnpublishToState();
    }
154782
public function isPaymentOverpaid($idSalesOrder, $idSalesOrderItem)
    {
        $status = PayoneTransactionStatusConstants::TXACTION_PAID;
        $statusLog = $this->getFirstUnprocessedTransactionStatusLog($idSalesOrder, $idSalesOrderItem, $status);
        if ($statusLog === null) {
            return false;
        }
        if ($statusLog->getBalance() >= 0) {
            return false;
        }

        $this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);

        return true;
    }
652612
public function convertStatus($order, $statusId, $flush = false, $persist = true)
    {
        if ($order instanceof Order) {
            $order = $order->getEntity();
        }

        // get current status
        $currentStatus = $order->getStatus();
        if ($currentStatus) {
            if ($currentStatus instanceof \Massive\Bundle\Purchase\OrderBundle\Api\OrderStatus) {
                $currentStatus = $order->getStatus()->getEntity();
            }

            // if status has not changed, skip
            if ($currentStatus->getId() === $statusId) {
                return;
            }
        }

        // get desired status
        $statusEntity = $this->em
            ->getRepository(self::$orderStatusEntityName)
            ->find($statusId);
        if (!$statusEntity) {
            throw new EntityNotFoundException(self::$orderStatusEntityName, $statusId);
        }

        // ACTIVITY LOG
        $orderActivity = new OrderActivityLog();
        $orderActivity->setOrder($order);
        if ($currentStatus) {
            $orderActivity->setStatusFrom($currentStatus);
        }
        $orderActivity->setStatusTo($statusEntity);
        $orderActivity->setCreated(new \DateTime());
        if ($persist) {
            $this->em->persist($orderActivity);
        }

        // BITMASK
        $currentBitmaskStatus = $order->getBitmaskStatus();
        // if desired status already is in bitmask, remove current state
        // since this is a step back
        if ($currentBitmaskStatus && $currentBitmaskStatus & $statusEntity->getId()) {
            $order->setBitmaskStatus($currentBitmaskStatus & ~$currentStatus->getId());
        } else {
            // else increment bitmask status
            $order->setBitmaskStatus($currentBitmaskStatus | $statusEntity->getId());
        }

        // check if status has changed
        if ($statusId === OrderStatusEntity::STATUS_CREATED) {
            // TODO: re-edit - do some business logic
        }
        $order->setStatus($statusEntity);

        if ($flush === true) {
            $this->em->flush();
        }
    }
806335
public function isPaymentOther($idSalesOrder, $idSalesOrderItem)
    {
        $statusLogs = $this->getUnprocessedTransactionStatusLogs($idSalesOrder, $idSalesOrderItem);
        if (empty($statusLogs)) {
            return false;
        }

        /** @var \Orm\Zed\Payone\Persistence\SpyPaymentPayoneTransactionStatusLog $statusLog */
        $statusLog = array_shift($statusLogs);

        $statuses = [
            PayoneTransactionStatusConstants::TXACTION_PAID,
            PayoneTransactionStatusConstants::TXACTION_APPOINTED,
            PayoneTransactionStatusConstants::TXACTION_UNDERPAID,
        ];
        if (in_array($statusLog->getStatus(), $statuses)) {
            return false;
        }

        $this->saveSpyPaymentPayoneTransactionStatusLogOrderItem($idSalesOrderItem, $statusLog);

        return true;
    }
116445
private static boolean setPayloadForStatus(StatusType statusType) {
    return statusType.code() != Status.NOT_MODIFIED.code() &&
           statusType.code() != Status.NO_CONTENT.code() &&
           statusType.family() != StatusType.Family.INFORMATIONAL;
  }
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;
        }
    }
698576
public function loadTypeDataByIdentifier($identifier, $status)
    {
        try {
            return $this->innerGateway->loadTypeDataByIdentifier($identifier, $status);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
179652
public function createTransactionStatusLogsBySalesOrder($idIdSalesOrder)
    {
        $query = $this->getFactory()->createPaymentPayoneTransactionStatusLogQuery()
            ->useSpyPaymentPayoneQuery()
            ->filterByFkSalesOrder($idIdSalesOrder)
            ->endUse()
            ->orderByCreatedAt();

        return $query;
    }
68623
protected function setStatusPriceRule($status)
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (!isset($id) && !$all) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = $options = null;

        if (isset($id)) {

            if (empty($id) || !is_numeric($id)) {
                $this->errorAndExit($this->text('Invalid argument'));
            }

            if ($this->getParam('trigger')) {
                $options = array('trigger_id' => $id);
            } else {
                $result = $this->price_rule->update($id, array('status' => $status));
            }

        } else if ($all) {
            $options = array();
        }

        if (isset($options)) {

            $updated = $count = 0;
            foreach ($this->price_rule->getList($options) as $item) {
                $count++;
                $updated += (int) $this->price_rule->update($item['price_rule_id'], array('status' => $status));
            }

            $result = $count && $count == $updated;
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
1285477
private function changeOrderHistory($status)
    {
        $order = $this->loadOrder();
        /** change payment status in magento */
        $order->addStatusToHistory($status, null, true);
        /** save order */
        $order->save();
    }
393735
public function addComment($orderIncrementId, $status, $comment = null, $notify = null)
    {
        return $this->__createAction('salesOrderAddComment', func_get_args());
    }
1100068
public function create(StatusInterface $statusFrom, StatusInterface $statusTo)
    {
        $transition = new $this->transitionClass();
        $transition->setStatusFrom($statusFrom);
        $transition->setStatusTo($statusTo);

        return $transition;
    }
527688
protected function hasPaymentWithStatus($status)
    {
        $hasStatus = false;
        $payments = $this->getArray();

        foreach ($payments as $payment) {
            if ($status == $payment->getStatus()) {
                $hasStatus = true;
                break;
            }
        }

        return $hasStatus;
    }
1052396
public function getOrderByFilter($status = null, $begintime = null, $endtime = null){
		if (!$this->access_token && !$this->checkAuth()) return false;

		$data = array();

		$valid_status = array(2, 3, 5, 8);
		if (is_numeric($status) && in_array($status, $valid_status)) {
			$data['status'] = $status;
		}

		if (is_numeric($begintime) && is_numeric($endtime)) {
			$data['begintime'] = $begintime;
			$data['endtime'] = $endtime;
		}
		$result = $this->http_post(self::API_BASE_URL_PREFIX.self::MERCHANT_ORDER_GETBYFILTER.'access_token='.$this->access_token, self::json_encode($data));
		if ($result)
		{
			$json = json_decode($result,true);
			if (isset($json['errcode']) && $json['errcode']) {
				$this->errCode = $json['errcode'];
				$this->errMsg = $json['errmsg'];
				return false;
			}
			return $json['order_list'];
		}
		return false;
	}