/**
  * @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;
 }
Ejemplo n.º 2
0
 /**
  * @param string[] $tagIds
  */
 private function setTagIds(array $tagIds)
 {
     $this->tagIds = [];
     foreach ($tagIds as $tagId) {
         $this->tagIds[] = Uuid::fromString($tagId);
     }
 }
Ejemplo n.º 3
0
 public function setId(UuidInterface $uuid = null)
 {
     if ($uuid === null) {
         $uuid = Uuid::uuid4();
     }
     $this->id = $uuid;
 }
 /**
  * @param string[] $productIds
  */
 private function setProductIds(array $productIds)
 {
     $this->productIds = [];
     foreach ($productIds as $productId) {
         $this->productIds[] = Uuid::fromString($productId);
     }
 }
 /**
  * @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;
 }
Ejemplo n.º 6
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 $name
  * @param string $description
  * @param int $sortOrder
  * @param int $textOptionTypeId
  */
 public function __construct($name, $description, $sortOrder, $textOptionTypeId)
 {
     $this->textOptionId = Uuid::uuid4();
     $this->name = (string) $name;
     $this->description = (string) $description;
     $this->sortOrder = (int) $sortOrder;
     $this->textOptionType = TextOptionType::createById($textOptionTypeId);
 }
 /**
  * @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;
 }
Ejemplo n.º 9
0
 public function __construct(RepositoryFactory $repositoryFactory, CartCalculatorInterface $cartCalculator, EventDispatcherInterface $eventDispatcher, PaymentGatewayInterface $paymentGateway, ShipmentGatewayInterface $shipmentGateway, FileManagerInterface $fileManager)
 {
     $this->repositoryFactory = $repositoryFactory;
     $this->cartCalculator = $cartCalculator;
     $this->eventDispatcher = $eventDispatcher;
     $this->paymentGateway = $paymentGateway;
     $this->shipmentGateway = $shipmentGateway;
     $this->fileManager = $fileManager;
     $this->holdLocationId = Uuid::uuid4();
 }
 /**
  * @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;
 }
Ejemplo n.º 12
0
 /**
  * @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);
     }
 }
Ejemplo n.º 14
0
 /**
  * @param string $fileExtension
  * @param string $basePath
  * @param int $imageType
  * @param string $mimeType
  * @param int $width
  * @param int $height
  * @param string|null $uriPrefix
  */
 public function __construct($fileExtension, $basePath, $imageType, $mimeType, $width, $height, $uriPrefix = null)
 {
     $this->id = Uuid::uuid4();
     $this->baseFileName = $this->id->getHex();
     $this->subPath = $this->buildSubPath();
     $this->fileExtension = (string) $fileExtension;
     $this->basePath = (string) $basePath;
     $this->imageType = (int) $imageType;
     $this->mimeType = (string) $mimeType;
     $this->width = (int) $width;
     $this->height = (int) $height;
     if ($uriPrefix !== null) {
         $this->uriPrefix = (string) $uriPrefix;
     }
 }
Ejemplo n.º 15
0
 /**
  * @param $params
  * @return array
  */
 private function getSafeParamValues($params)
 {
     $safeValues = [];
     foreach (array_values($params) as $value) {
         if (is_array($value)) {
             $safeValues[] = $this->getSafeParamValues($value);
         } else {
             if ($this->isBinary($value)) {
                 $value = Uuid::fromBytes($value)->toString();
             }
             $safeValues[] = $value;
         }
     }
     return $safeValues;
 }
Ejemplo n.º 16
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();
 }
Ejemplo n.º 17
0
 /**
  * CreateCouponCommand constructor.
  * @param string $code
  * @param bool $flagFreeShipping
  * @param int $minOrderValue
  * @param int $maxOrderValue
  * @param bool $canCombineWithOtherCoupons
  * @param string $name
  * @param int $promotionTypeId
  * @param int $value
  * @param bool $reducesTaxSubtotal
  * @param int $maxRedemptions
  * @param DateTime $startDate
  * @param DateTime $endDate
  */
 public function __construct($code, $flagFreeShipping, $minOrderValue, $maxOrderValue, $canCombineWithOtherCoupons, $name, $promotionTypeId, $value, $reducesTaxSubtotal, $maxRedemptions, $startDate, $endDate)
 {
     $this->couponId = Uuid::uuid4();
     $this->code = $code;
     $this->flagFreeShipping = $flagFreeShipping;
     $this->minOrderValue = $minOrderValue;
     $this->maxOrderValue = $maxOrderValue;
     $this->canCombineWithOtherCoupons = $canCombineWithOtherCoupons;
     $this->name = $name;
     $this->promotionTypeId = $promotionTypeId;
     $this->value = $value;
     $this->reducesTaxSubtotal = $reducesTaxSubtotal;
     $this->maxRedemptions = $maxRedemptions;
     $this->startDate = $startDate;
     $this->endDate = $endDate;
 }
 /**
  * @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();
 }
Ejemplo n.º 19
0
 public function getId()
 {
     return Uuid::uuid4();
 }
 /**
  * @param string $tagId
  * @param PaginationDTO $paginationDTO
  */
 public function __construct($tagId, PaginationDTO $paginationDTO)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->paginationDTO = $paginationDTO;
 }
Ejemplo n.º 21
0
 /**
  * @param string $cartId
  */
 public function __construct($cartId)
 {
     $this->cartId = Uuid::fromString($cartId);
 }
Ejemplo n.º 22
0
 public function __construct(UserDTO $userDTO)
 {
     $this->userId = Uuid::uuid4();
     $this->userDTO = $userDTO;
 }
 /**
  * @param string $attachmentId
  */
 public function __construct($attachmentId)
 {
     $this->attachmentId = Uuid::fromString($attachmentId);
 }
 /**
  * @param string $tagId
  * @param string $imageId
  */
 public function __construct($tagId, $imageId)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->imageId = Uuid::fromString($imageId);
 }
 /**
  * @param string $productId
  * @param string $tagId
  */
 public function __construct($productId, $tagId)
 {
     $this->productId = Uuid::fromString($productId);
     $this->tagId = Uuid::fromString($tagId);
 }
Ejemplo n.º 26
0
 /**
  * @param string $tagId
  * @param string $optionId
  */
 public function __construct($tagId, $optionId)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->optionId = Uuid::fromString($optionId);
 }
Ejemplo n.º 27
0
 /**
  * @param string $id
  */
 public function __construct($id)
 {
     $this->id = Uuid::fromString($id);
 }
Ejemplo n.º 28
0
 /**
  * @param string $orderId
  * @param int $orderStatusTypeId
  */
 public function __construct($orderId, $orderStatusTypeId)
 {
     $this->orderId = Uuid::fromString($orderId);
     $this->orderStatusTypeId = (int) $orderStatusTypeId;
 }
Ejemplo n.º 29
0
 /**
  * @param string $orderId
  */
 public function __construct($orderId)
 {
     $this->orderId = Uuid::fromString($orderId);
 }
 /**
  * @param string $cartId
  * @param int $quantity
  */
 public function __construct($cartId, $quantity)
 {
     $this->cartId = Uuid::fromString($cartId);
     $this->quantity = (int) $quantity;
 }