/**
  * @param string[] $tagIds
  */
 private function setTagIds(array $tagIds)
 {
     $this->tagIds = [];
     foreach ($tagIds as $tagId) {
         $this->tagIds[] = Uuid::fromString($tagId);
     }
 }
 /**
  * @param string[] $productIds
  */
 private function setProductIds(array $productIds)
 {
     $this->productIds = [];
     foreach ($productIds as $productId) {
         $this->productIds[] = Uuid::fromString($productId);
     }
 }
 /**
  * @param string $productId
  * @param int $quantity (can be negative)
  * @param string $inventoryLocationId
  * @param int $transactionTypeId
  */
 public function __construct($productId, $quantity, $inventoryLocationId, $transactionTypeId)
 {
     $this->productId = Uuid::fromString($productId);
     $this->quantity = (int) $quantity;
     $this->inventoryLocationId = Uuid::fromString($inventoryLocationId);
     $this->transactionTypeId = (int) $transactionTypeId;
 }
Esempio n. 4
0
 public function testHamcrestMatcher()
 {
     $uuid1 = Uuid::fromString(self::UUID4_STRING);
     $uuid2 = Uuid::fromString(self::UUID1_STRING);
     MatcherAssert::assertThat($uuid1, $uuid1);
     $this->setExpectedException(AssertionError::class, 'Expected: "' . self::UUID1_STRING . '"' . PHP_EOL . '     but: was "' . self::UUID4_STRING . '"');
     MatcherAssert::assertThat($uuid1, $uuid2);
 }
 /**
  * @param string $orderId
  * @param OrderItemQtyDTO $orderItemQtyDTO
  * @param string $comment
  * @param string $shipmentExternalId
  * @param string $rateExternalId
  */
 public function __construct($orderId, OrderItemQtyDTO $orderItemQtyDTO, $comment, $shipmentExternalId, $rateExternalId)
 {
     $this->orderId = Uuid::fromString($orderId);
     $this->orderItemQtyDTO = $orderItemQtyDTO;
     $this->comment = (string) $comment;
     $this->shipmentExternalId = (string) $shipmentExternalId;
     $this->rateExternalId = (string) $rateExternalId;
 }
 /**
  * @param string $orderId
  * @param OrderItemQtyDTO $orderItemQtyDTO
  * @param string $comment
  * @param int $carrier ShipmentTracker::$carrier
  * @param string $trackingCode
  */
 public function __construct($orderId, OrderItemQtyDTO $orderItemQtyDTO, $comment, $carrier, $trackingCode)
 {
     $this->orderId = Uuid::fromString($orderId);
     $this->orderItemQtyDTO = $orderItemQtyDTO;
     $this->comment = (string) $comment;
     $this->carrier = (int) $carrier;
     $this->trackingCode = (string) $trackingCode;
 }
 /**
  * @param int $promotionTypeId
  * @param int $value
  * @param bool $reducesTaxSubtotal
  * @param int $maxRedemptions
  * @param DateTime $startDate
  * @param DateTime $endDate
  * @param string $productId
  * @param int $quantity
  * @param bool $flagApplyCatalogPromotions
  */
 public function __construct($promotionTypeId, $value, $reducesTaxSubtotal, $maxRedemptions, $startDate, $endDate, $productId, $quantity, $flagApplyCatalogPromotions)
 {
     $this->productQuantityDiscountId = Uuid::uuid4();
     $this->promotionTypeId = $promotionTypeId;
     $this->value = $value;
     $this->reducesTaxSubtotal = $reducesTaxSubtotal;
     $this->productId = Uuid::fromString($productId);
     $this->quantity = $quantity;
     $this->flagApplyCatalogPromotions = $flagApplyCatalogPromotions;
 }
 /**
  * @param string $cartId
  * @param string $userIdS
  * @param string $ip4
  * @param CreditCardDTO $creditCardDTO
  * @param OrderAddressDTO $shippingAddressDTO
  * @param OrderAddressDTO $billingAddressDTO
  */
 public function __construct($cartId, $userIdS, $ip4, CreditCardDTO $creditCardDTO, OrderAddressDTO $shippingAddressDTO, OrderAddressDTO $billingAddressDTO)
 {
     $this->orderId = Uuid::uuid4();
     $this->cartId = Uuid::fromString($cartId);
     $this->userId = Uuid::fromString($userIdS);
     $this->ip4 = (string) $ip4;
     $this->creditCardDTO = $creditCardDTO;
     $this->shippingAddressDTO = $shippingAddressDTO;
     $this->billingAddressDTO = $billingAddressDTO;
 }
 /**
  * @param string $remoteIp4
  * @param string|null $userId
  * @param string|null $sessionId
  */
 public function __construct($remoteIp4, $userId = null, $sessionId = null)
 {
     $this->cartId = Uuid::uuid4();
     $this->remoteIp4 = (string) $remoteIp4;
     if ($userId !== null) {
         $this->userId = Uuid::fromString($userId);
     }
     if ($sessionId !== null) {
         $this->sessionId = (string) $sessionId;
     }
 }
 /**
  * @param string $name
  * @param int $promotionTypeId
  * @param int $value
  * @param bool $reducesTaxSubtotal
  * @param int $maxRedemptions
  * @param DateTime $startDate
  * @param DateTime $endDate
  * @param string|null $tagId
  */
 public function __construct($name, $promotionTypeId, $value, $reducesTaxSubtotal, $maxRedemptions, $startDate, $endDate, $tagId = null)
 {
     $this->catalogPromotionId = Uuid::uuid4();
     $this->name = $name;
     $this->promotionTypeId = $promotionTypeId;
     $this->value = $value;
     $this->reducesTaxSubtotal = $reducesTaxSubtotal;
     $this->maxRedemptions = $maxRedemptions;
     $this->startDate = $startDate;
     $this->endDate = $endDate;
     if ($tagId !== null) {
         $this->tagId = Uuid::fromString($tagId);
     }
 }
Esempio n. 11
0
 /**
  * {@inheritdoc}
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Uuid) {
         return $value->getBytes();
     }
     try {
         $uuid = Uuid::fromString($value);
     } catch (InvalidArgumentException $e) {
         throw ConversionException::conversionFailed($value, self::NAME);
     }
     return $uuid->getBytes();
 }
 /**
  * @param Product $product
  * @param int $quantity
  * @return UuidInterface
  * @throws EntityNotFoundException
  */
 public function findInventoryIdForProductAndQuantity(Product $product, $quantity)
 {
     $locationsAvailableQuantity = [];
     foreach ($this->findAllByProduct($product) as $inventoryTransaction) {
         // TODO: Test for null from $inventoryTransaction->getInventoryLocation()
         $inventoryLocationId = $inventoryTransaction->getInventoryLocation()->getId()->toString();
         if (!isset($locationsAvailableQuantity[$inventoryLocationId])) {
             $locationsAvailableQuantity[$inventoryLocationId] = 0;
         }
         $locationsAvailableQuantity[$inventoryLocationId] += $inventoryTransaction->getQuantity();
     }
     asort($locationsAvailableQuantity);
     foreach ($locationsAvailableQuantity as $inventoryLocationId => $availableQuantity) {
         if ($quantity <= $availableQuantity) {
             return Uuid::fromString($inventoryLocationId);
         }
     }
     throw $this->getEntityNotFoundException();
 }
Esempio n. 13
0
 private function addShipmentItemsFromOrderItems(OrderItemQtyDTO $orderItemQtyDTO, Shipment $shipment)
 {
     foreach ($orderItemQtyDTO->getItems() as $orderItemId => $quantity) {
         $orderItem = $this->orderItemRepository->findOneById(Uuid::fromString($orderItemId));
         new ShipmentItem($shipment, $orderItem, $quantity);
     }
 }
 /**
  * @param string $attachmentId
  */
 public function __construct($attachmentId)
 {
     $this->attachmentId = Uuid::fromString($attachmentId);
 }
 /**
  * @param string $cartId
  * @param string $couponCode
  */
 public function __construct($cartId, $couponCode)
 {
     $this->cartId = Uuid::fromString($cartId);
     $this->couponCode = (string) $couponCode;
 }
 /**
  * @param string $tagId
  * @param string $optionId
  */
 public function __construct($tagId, $optionId)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->optionId = Uuid::fromString($optionId);
 }
 /**
  * @param string $id
  */
 public function __construct($id)
 {
     $this->id = Uuid::fromString($id);
 }
 /**
  * @param string $productId
  * @param string $tagId
  */
 public function __construct($productId, $tagId)
 {
     $this->productId = Uuid::fromString($productId);
     $this->tagId = Uuid::fromString($tagId);
 }
 /**
  * @param string $cartId
  * @param string $shipmentRateExternalId
  * @param OrderAddressDTO $shippingAddressDTO
  */
 public function __construct($cartId, $shipmentRateExternalId, OrderAddressDTO $shippingAddressDTO)
 {
     $this->cartId = Uuid::fromString($cartId);
     $this->shipmentRateExternalId = (string) $shipmentRateExternalId;
     $this->shippingAddressDTO = $shippingAddressDTO;
 }
 /**
  * @param UploadFileDTO $uploadFileDTO
  * @param string $orderItemId
  */
 public function __construct(UploadFileDTO $uploadFileDTO, $orderItemId)
 {
     $this->orderItemId = Uuid::fromString($orderItemId);
     $this->uploadFileDTO = $uploadFileDTO;
 }
 /**
  * @param string $optionId
  * @param OptionValueDTO $optionValueDTO
  */
 public function __construct($optionId, OptionValueDTO $optionValueDTO)
 {
     $this->optionId = Uuid::fromString($optionId);
     $this->optionValueDTO = $optionValueDTO;
 }
 /**
  * @param string $tagId
  * @param string $imageId
  */
 public function __construct($tagId, $imageId)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->imageId = Uuid::fromString($imageId);
 }
 /**
  * @param string $orderId
  * @param int $orderStatusTypeId
  */
 public function __construct($orderId, $orderStatusTypeId)
 {
     $this->orderId = Uuid::fromString($orderId);
     $this->orderStatusTypeId = (int) $orderStatusTypeId;
 }
 /**
  * @param string $cartId
  * @param int $quantity
  */
 public function __construct($cartId, $quantity)
 {
     $this->cartId = Uuid::fromString($cartId);
     $this->quantity = (int) $quantity;
 }
 /**
  * @param $orderItemQty
  * @return OrderItemQtyDTO
  */
 private function getOrderItemQtyDTO($orderItemQty)
 {
     $orderItemQtyDTO = new OrderItemQtyDTO();
     foreach ($orderItemQty as $orderItemId => $qty) {
         $orderItemQtyDTO->addOrderItemQty(Uuid::fromString($orderItemId), $qty);
     }
     return $orderItemQtyDTO;
 }
Esempio n. 26
0
 /**
  * @param string $cartId
  */
 public function __construct($cartId)
 {
     $this->cartId = Uuid::fromString($cartId);
 }
 /**
  * @param string $optionValueId
  */
 public function __construct($optionValueId)
 {
     $this->optionValueId = Uuid::fromString($optionValueId);
 }
 /**
  * @param string $cartId
  * @param MoneyDTO $moneyDTO
  */
 public function __construct($cartId, $moneyDTO)
 {
     $this->cartId = Uuid::fromString($cartId);
     $this->moneyDTO = $moneyDTO;
 }
Esempio n. 29
0
 /**
  * @param string $orderId
  */
 public function __construct($orderId)
 {
     $this->orderId = Uuid::fromString($orderId);
 }
 /**
  * @param string $tagId
  * @param PaginationDTO $paginationDTO
  */
 public function __construct($tagId, PaginationDTO $paginationDTO)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->paginationDTO = $paginationDTO;
 }