Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
require_once __DIR__ . '/src/Component/ValueObject/TypeGuid.php';
require_once __DIR__ . '/src/Component/ValueObject/TypeGuidNullable.php';
require_once __DIR__ . '/src/Component/ValueObject/TypeGuidUnlimited.php';
require_once __DIR__ . '/src/Component/ValueObject/TypeHsCodeNullable.php';
require_once __DIR__ . '/src/Component/ValueObject/TypeNonEmptyString.php';
require_once __DIR__ . '/src/Component/ValueObject/TypePositiveAmount.php';
require_once __DIR__ . '/src/Component/ValueObject/TypePositiveAmountNullable.php';
Expand Down
13 changes: 13 additions & 0 deletions src/Component/Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeAmountNullable;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeDateTimeNullable;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeGuidUnlimited;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeHsCodeNullable;

class Product extends Entity
{
Expand All @@ -39,6 +40,7 @@ class Product extends Entity
protected ?string $conditionDescription;
protected ?string $internalNote;
protected ?bool $preauthorizationRequired;
protected TypeHsCodeNullable $hsCode;
protected DefaultCategory $defaultCategory;
protected ?Categories $categories;
protected ?DescriptiveParameters $descriptiveParameters;
Expand Down Expand Up @@ -258,6 +260,17 @@ public function setPreauthorizationRequired(?bool $preauthorizationRequired): st
return $this;
}

public function getHsCode(): TypeHsCodeNullable
{
return $this->hsCode;
}

public function setHsCode(TypeHsCodeNullable $hsCode): static
{
$this->hsCode = $hsCode;
return $this;
}

public function getDefaultCategory(): DefaultCategory
{
return $this->defaultCategory;
Expand Down
13 changes: 13 additions & 0 deletions src/Component/Entity/ProductUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Shoptet\Api\Sdk\Php\Component\Entity\ProductUpdate\Variants;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeGuid;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeGuidNullable;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeHsCodeNullable;

class ProductUpdate extends Entity
{
Expand All @@ -31,6 +32,7 @@ class ProductUpdate extends Entity
protected ?string $brandCode;
protected ?string $internalNote;
protected ?bool $preauthorizationRequired;
protected ?TypeHsCodeNullable $hsCode;
protected ?TypeGuidNullable $supplierGuid;
protected ?CategoryGuids $categoryGuids;
protected ?int $warrantyId;
Expand Down Expand Up @@ -219,6 +221,17 @@ public function setPreauthorizationRequired(?bool $preauthorizationRequired): st
return $this;
}

public function getHsCode(): ?TypeHsCodeNullable
{
return $this->hsCode;
}

public function setHsCode(?TypeHsCodeNullable $hsCode): static
{
$this->hsCode = $hsCode;
return $this;
}

public function getSupplierGuid(): ?TypeGuidNullable
{
return $this->supplierGuid;
Expand Down
34 changes: 34 additions & 0 deletions src/Component/ValueObject/TypeHsCodeNullable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Shoptet\Api\Sdk\Php\Component\ValueObject;

use Shoptet\Api\Sdk\Php\Exception\InvalidArgumentException;

readonly class TypeHsCodeNullable implements ValueObjectInterface
{
public function __construct(
public ?string $typeHsCodeNullable,
) {
if ($this->typeHsCodeNullable === null) {
return;
}
if (!preg_match('/^\d{6,10}$/', $this->typeHsCodeNullable)) {
throw new InvalidArgumentException(sprintf('Invalid %s "%s".', 'typeHsCodeNullable', $this->typeHsCodeNullable));
}
}

public function equals(self $typeHsCodeNullable): bool
{
return $typeHsCodeNullable->typeHsCodeNullable === $this->typeHsCodeNullable;
}

public function __toString(): string
{
return (string) $this->typeHsCodeNullable;
}

public function jsonSerialize(): string
{
return $this->__toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Shoptet\Api\Sdk\Php\Component\Entity\Entity;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeGuid;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeHsCodeNullable;
use Shoptet\Api\Sdk\Php\Endpoint\Products\CreateProductRequest\CreateProductRequest\Data\CategoryGuids;
use Shoptet\Api\Sdk\Php\Endpoint\Products\CreateProductRequest\CreateProductRequest\Data\DescriptiveParameters;
use Shoptet\Api\Sdk\Php\Endpoint\Products\CreateProductRequest\CreateProductRequest\Data\FilteringParameters;
Expand All @@ -30,6 +31,7 @@ class Data extends Entity
protected ?string $brandCode;
protected ?string $internalNote;
protected ?bool $preauthorizationRequired;
protected ?TypeHsCodeNullable $hsCode;
protected ?TypeGuid $supplierGuid;
protected ?CategoryGuids $categoryGuids;
protected ?int $warrantyId;
Expand Down Expand Up @@ -217,6 +219,17 @@ public function setPreauthorizationRequired(?bool $preauthorizationRequired): st
return $this;
}

public function getHsCode(): ?TypeHsCodeNullable
{
return $this->hsCode;
}

public function setHsCode(?TypeHsCodeNullable $hsCode): static
{
$this->hsCode = $hsCode;
return $this;
}

public function getSupplierGuid(): ?TypeGuid
{
return $this->supplierGuid;
Expand Down
Loading