Esempio n. 1
0
 public function testBuyShipmentLabel()
 {
     $order1 = $this->getPersistedOrderWith2Items();
     $orderItemQtyDTO = new OrderItemQtyDTO();
     $orderItemQtyDTO->addOrderItemQty($order1->getOrderItems()[0]->getId(), 1);
     $comment = 'A comment';
     $rateExternalId = self::RATE_EXTERNAL_ID;
     $shipmentExternalId = self::SHIPMENT_EXTERNAL_ID;
     $this->orderService->buyShipmentLabel($order1->getId(), $orderItemQtyDTO, $comment, $rateExternalId, $shipmentExternalId);
     $shipment = $order1->getShipments()[0];
     $shipmentComment = $shipment->getShipmentComments()[0];
     $shipmentTracker = $shipment->getShipmentTrackers()[0];
     $this->assertSame(1, count($order1->getShipments()));
     $this->assertSame('A comment', $shipmentComment->getComment());
     // TODO: Verify external Ids
     //$this->assertSame($rateExternalId, $shipmentTracker->getExternalId());
     //$this->assertSame($shipmentExternalId, $shipmentTracker->getShipmentRate()->getExternalId());
     $this->assertOrderShippedEventIsDispatched($order1, $shipment);
 }
 public function handle(BuyShipmentLabelCommand $command)
 {
     $this->orderService->buyShipmentLabel($command->getOrderId(), $command->getOrderItemQtyDTO(), $command->getComment(), $command->getRateExternalId(), $command->getShipmentExternalId());
 }