public function __construct(ShipmentCarrierType $type)
 {
     parent::__construct($type);
     $this->entityDTO->isUnknown = $this->entity->isUnknown();
     $this->entityDTO->isUps = $this->entity->isUps();
     $this->entityDTO->isUsps = $this->entity->isUsps();
     $this->entityDTO->isFedex = $this->entity->isFedex();
 }
 public function testCreateByIdThrowsExceptionWhenInvalid()
 {
     $this->setExpectedException(InvalidArgumentException::class);
     ShipmentCarrierType::createById(999);
 }
Ejemplo n.º 3
0
 public function getShipmentCarrierType()
 {
     return ShipmentCarrierType::ups();
 }
 private function createWithTrackingCode(Request $request)
 {
     $orderId = $request->input('orderId');
     $orderItemQty = $request->input('orderItemQty');
     $comment = $request->input('comment');
     $order = $this->getOrderWithAllData($orderId);
     return $this->renderTemplate('admin/order/add-shipment-tracking.twig', ['order' => $order, 'orderItemQty' => $orderItemQty, 'comment' => $comment, 'shipmentCarrierTypes' => ShipmentCarrierType::getNameMap()]);
 }
Ejemplo n.º 5
0
 /**
  * @param UuidInterface $orderId
  * @param \inklabs\kommerce\EntityDTO\OrderItemQtyDTO $orderItemQtyDTO
  * @param string $comment
  * @param int $shipmentCarrierTypeId
  * @param string $trackingCode
  */
 public function addShipmentTrackingCode(UuidInterface $orderId, OrderItemQtyDTO $orderItemQtyDTO, $comment, $shipmentCarrierTypeId, $trackingCode)
 {
     $order = $this->orderRepository->findOneById($orderId);
     $shipmentCarrierType = ShipmentCarrierType::createById($shipmentCarrierTypeId);
     $shipmentTracker = new ShipmentTracker($shipmentCarrierType, $trackingCode);
     $this->addShipment($comment, $orderItemQtyDTO, $shipmentTracker, $order);
 }
Ejemplo n.º 6
0
 private function getShipmentTrackerFromEasyPostShipment($shipment)
 {
     switch (strtolower($shipment->tracker->carrier)) {
         case 'ups':
             $carrier = ShipmentCarrierType::ups();
             break;
         case 'usps':
             $carrier = ShipmentCarrierType::usps();
             break;
         case 'fedex':
             $carrier = ShipmentCarrierType::fedex();
             break;
         default:
             $carrier = ShipmentCarrierType::unknown();
     }
     $shipmentTracker = new ShipmentTracker($carrier, $shipment->tracking_code);
     $shipmentTracker->setExternalId($shipment->id);
     $shipmentTracker->setShipmentLabel($this->getShipmentLabelFromEasyPostShipment($shipment));
     $shipmentTracker->setShipmentRate($this->getShipmentRateFromEasyPostRate($shipment->selected_rate));
     return $shipmentTracker;
 }