diff --git a/src/Components/ShipmentManager/ShipmentManager.php b/src/Components/ShipmentManager/ShipmentManager.php index b06024d08..50964c074 100644 --- a/src/Components/ShipmentManager/ShipmentManager.php +++ b/src/Components/ShipmentManager/ShipmentManager.php @@ -14,14 +14,12 @@ use Kiener\MolliePayments\Service\MollieApi\OrderDeliveryExtractor; use Kiener\MolliePayments\Service\MollieApi\OrderItemsExtractor; use Kiener\MolliePayments\Service\MollieApi\ShipmentInterface; -use Kiener\MolliePayments\Service\OrderDeliveryService; use Kiener\MolliePayments\Service\OrderService; use Kiener\MolliePayments\Service\TrackingInfoStructFactory; use Kiener\MolliePayments\Service\Transition\DeliveryTransitionServiceInterface; use Kiener\MolliePayments\Struct\Order\OrderAttributes; use Kiener\MolliePayments\Struct\OrderLineItemEntity\OrderLineItemEntityAttributes; use Shopware\Core\Checkout\Cart\LineItem\LineItem; -use Shopware\Core\Checkout\Order\Aggregate\OrderDelivery\OrderDeliveryCollection; use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemCollection; use Shopware\Core\Checkout\Order\Aggregate\OrderLineItem\OrderLineItemEntity; use Shopware\Core\Checkout\Order\OrderEntity; @@ -47,10 +45,6 @@ class ShipmentManager implements ShipmentManagerInterface */ private $shipmentService; - /** - * @var OrderDeliveryService - */ - private $orderDeliveryService; /** * @var OrderService @@ -76,18 +70,16 @@ class ShipmentManager implements ShipmentManagerInterface * @param DeliveryTransitionServiceInterface $deliveryTransitionService * @param Order $mollieApiOrderService * @param ShipmentInterface $shipmentService - * @param OrderDeliveryService $orderDeliveryService * @param OrderService $orderService * @param OrderDeliveryExtractor $orderDataExtractor * @param OrderItemsExtractor $orderItemsExtractor * @param TrackingInfoStructFactory $trackingFactory */ - public function __construct(DeliveryTransitionServiceInterface $deliveryTransitionService, Order $mollieApiOrderService, ShipmentInterface $shipmentService, OrderDeliveryService $orderDeliveryService, OrderService $orderService, OrderDeliveryExtractor $orderDataExtractor, OrderItemsExtractor $orderItemsExtractor, TrackingInfoStructFactory $trackingFactory) + public function __construct(DeliveryTransitionServiceInterface $deliveryTransitionService, Order $mollieApiOrderService, ShipmentInterface $shipmentService, OrderService $orderService, OrderDeliveryExtractor $orderDataExtractor, OrderItemsExtractor $orderItemsExtractor, TrackingInfoStructFactory $trackingFactory) { $this->deliveryTransitionService = $deliveryTransitionService; $this->mollieApiOrderService = $mollieApiOrderService; $this->shipmentService = $shipmentService; - $this->orderDeliveryService = $orderDeliveryService; $this->orderService = $orderService; $this->orderDataExtractor = $orderDataExtractor; $this->orderItemsExtractor = $orderItemsExtractor; @@ -191,7 +183,6 @@ public function shipOrder(OrderEntity $order, ?TrackingData $tracking, array $sh $this->transitionOrder($order, $mollieOrderId, $context); - $this->markDeliveryCustomFields($order, $context); return $shipment; } @@ -234,8 +225,6 @@ public function shipOrderRest(OrderEntity $order, ?TrackingData $tracking, Conte $this->transitionOrder($order, $mollieOrderId, $context); - $this->markDeliveryCustomFields($order, $context); - return $shipment; } @@ -301,7 +290,6 @@ public function shipItem(OrderEntity $order, string $itemIdentifier, int $quanti $this->transitionOrder($order, $mollieOrderId, $context); - $this->markDeliveryCustomFields($order, $context); return $shipment; } @@ -328,28 +316,6 @@ private function transitionOrder(OrderEntity $order, string $mollieOrderId, Cont } } - /** - * @param OrderEntity $order - * @param Context $context - * @return void - */ - private function markDeliveryCustomFields(OrderEntity $order, Context $context) - { - $deliveries = $order->getDeliveries(); - - if (!$deliveries instanceof OrderDeliveryCollection) { - return; - } - - foreach ($deliveries as $delivery) { - $values = [ - CustomFieldsInterface::DELIVERY_SHIPPED => true - ]; - - $this->orderDeliveryService->updateCustomFields($delivery, $values, $context); - } - } - /** * Try to find lineItems matching the $itemIdentifier. Shopware does not have a unique human-readable identifier for * order line items, so we have to check for several fields, like product number or the mollie order line id. diff --git a/src/Resources/config/services/facades.xml b/src/Resources/config/services/facades.xml index abfa9c8d4..a80790453 100644 --- a/src/Resources/config/services/facades.xml +++ b/src/Resources/config/services/facades.xml @@ -10,7 +10,6 @@ - diff --git a/tests/PHPUnit/Components/ShipmentManager/ShipmentManagerTest.php b/tests/PHPUnit/Components/ShipmentManager/ShipmentManagerTest.php index 62c7aefbc..c937fba96 100644 --- a/tests/PHPUnit/Components/ShipmentManager/ShipmentManagerTest.php +++ b/tests/PHPUnit/Components/ShipmentManager/ShipmentManagerTest.php @@ -54,7 +54,6 @@ public function setUp(): void $deliveryTransitionService = $this->createMock(DeliveryTransitionService::class); $mollieApiOrderService = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); - $orderDeliveryService = $this->getMockBuilder(OrderDeliveryService::class)->disableOriginalConstructor()->getMock(); $orderService = $this->getMockBuilder(OrderService::class)->disableOriginalConstructor()->getMock(); $deliveryExtractor = new OrderDeliveryExtractor(new NullLogger()); @@ -62,7 +61,6 @@ public function setUp(): void $deliveryTransitionService, $mollieApiOrderService, $this->fakeShipmentService, - $orderDeliveryService, $orderService, $deliveryExtractor, new OrderItemsExtractor(),