public function handle(CommandInterface $command)
    {
        /**
         * @var Order $order
         */
        $order = $command->getPayload();

        $orderIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $order->getIdentifier(),
            'objectType' => Order::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null === $orderIdentity) {
            return false;
        }

        $params = [
            'details' => [],
        ];

        $package = $this->getPackage($order);

        if (null !== $package) {
            $this->addShippingProviderAttribute($order, $package);

            $params['trackingCode'] = $package->getShippingCode();
        }

        $orderStatusIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $order->getOrderStatusIdentifier(),
            'objectType' => OrderStatus::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null !== $orderStatusIdentity) {
            $params['orderStatusId'] = $orderStatusIdentity->getAdapterIdentifier();
        } else {
            $this->logger->notice('order status not mapped', ['order' => $order]);
        }

        $paymentStatusIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $order->getPaymentStatusIdentifier(),
            'objectType' => PaymentStatus::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null !== $paymentStatusIdentity) {
            $params['paymentStatusId'] = $paymentStatusIdentity->getAdapterIdentifier();

            if ((int) $paymentStatusIdentity->getAdapterIdentifier() === Status::PAYMENT_STATE_COMPLETELY_PAID) {
                $params['cleareddate'] = new DateTime('now');
            }
        } else {
            $this->logger->notice('payment status not mapped', ['order' => $order]);
        }

        $resource = $this->getOrderResource();
        $orderModel = $resource->update($orderIdentity->getAdapterIdentifier(), $params);

        $this->attributePersister->saveOrderAttributes(
            $orderModel,
            $order->getAttributes()
        );

        return true;
    }
public function handle(CommandInterface $command)
    {
        /**
         * @var Order $order
         */
        $order = $command->getPayload();

        $orderIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $order->getIdentifier(),
            'objectType' => Order::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null === $orderIdentity) {
            return false;
        }

        $params = [
            'details' => [],
        ];

        $package = $this->getPackage($order);

        if (null !== $package) {
            $this->addShippingProviderAttribute($order, $package);

            $params['trackingCode'] = $package->getShippingCode();
        }

        $orderStatusIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $order->getOrderStatusIdentifier(),
            'objectType' => OrderStatus::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null !== $orderStatusIdentity) {
            $params['orderStatusId'] = $orderStatusIdentity->getAdapterIdentifier();
        } else {
            $this->logger->notice('order status not mapped', ['order' => $order]);
        }

        $paymentStatusIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $order->getPaymentStatusIdentifier(),
            'objectType' => PaymentStatus::TYPE,
            'adapterName' => ShopwareAdapter::NAME,
        ]);

        if (null !== $paymentStatusIdentity) {
            $params['paymentStatusId'] = $paymentStatusIdentity->getAdapterIdentifier();

            if ((int) $paymentStatusIdentity->getAdapterIdentifier() === Status::PAYMENT_STATE_COMPLETELY_PAID) {
                $params['cleareddate'] = new DateTime('now');
            }
        } else {
            $this->logger->notice('payment status not mapped', ['order' => $order]);
        }

        $resource = $this->getOrderResource();
        $orderModel = $resource->update($orderIdentity->getAdapterIdentifier(), $params);

        $this->attributePersister->saveOrderAttributes(
            $orderModel,
            $order->getAttributes()
        );

        return true;
    }
{@inheritdoc}

@param TransferObjectCommand $command