Adapter/PlentymarketsAdapter/ServiceBus/CommandHandler/Order/HandleOrderCommandHandler.php
private function isExistingOrder(Order $order)
    {
        $shopIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $order->getShopIdentifier(),
            'objectType' => Shop::TYPE,
            'adapterName' => PlentymarketsAdapter::NAME,
        ]);

        if (null === $shopIdentity) {
            throw new NotFoundException('shop not mapped');
        }

        $result = $this->client->request('GET', 'orders', [
            'externalOrderId' => $order->getOrderNumber(),
        ]);

        $result = array_filter($result, function (array $order) use ($shopIdentity) {
            return (int) $order['plentyId'] === $shopIdentity->getAdapterIdentifier();
        });

        if (!empty($result)) {
            return true;
        }

        return false;
    }
private function isExistingOrder(Order $order)
    {
        $shopIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $order->getShopIdentifier(),
            'objectType' => Shop::TYPE,
            'adapterName' => PlentymarketsAdapter::NAME,
        ]);

        if (null === $shopIdentity) {
            throw new NotFoundException('shop not mapped');
        }

        $result = $this->client->request('GET', 'orders', [
            'externalOrderId' => $order->getOrderNumber(),
        ]);

        $result = array_filter($result, function (array $order) use ($shopIdentity) {
            return (int) $order['plentyId'] === $shopIdentity->getAdapterIdentifier();
        });

        if (!empty($result)) {
            return true;
        }

        return false;
    }
@param Order $order

@return bool