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
8 changes: 8 additions & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
require_once __DIR__ . '/src/Authorization/TokenHasExpiredException.php';
require_once __DIR__ . '/src/Authorization/TokenNotFoundException.php';
require_once __DIR__ . '/src/Authorization/UnauthorizedException.php';
require_once __DIR__ . '/src/Component/Entity/AbandonedCartSnapshot.php';
require_once __DIR__ . '/src/Component/Entity/AbandonedCartSnapshot/Coupon.php';
require_once __DIR__ . '/src/Component/Entity/AbandonedCartSnapshot/Customer.php';
require_once __DIR__ . '/src/Component/Entity/AbandonedCartSnapshot/Items.php';
require_once __DIR__ . '/src/Component/Entity/AbandonedCartSnapshot/Items/Item.php';
require_once __DIR__ . '/src/Component/Entity/ActionPrice.php';
require_once __DIR__ . '/src/Component/Entity/Address.php';
require_once __DIR__ . '/src/Component/Entity/Article.php';
Expand Down Expand Up @@ -373,6 +378,9 @@
require_once __DIR__ . '/src/Component/ValueObject/TypeWeightRequest.php';
require_once __DIR__ . '/src/Component/ValueObject/TypeWeightUnlimited.php';
require_once __DIR__ . '/src/Component/ValueObject/ValueObjectInterface.php';
require_once __DIR__ . '/src/Endpoint/AbandonedCarts/GetListOfAllAbandonedCarts.php';
require_once __DIR__ . '/src/Endpoint/AbandonedCarts/GetListOfAllAbandonedCartsResponse/GetListOfAllAbandonedCartsResponse.php';
require_once __DIR__ . '/src/Endpoint/AbandonedCarts/GetListOfAllAbandonedCartsResponse/GetListOfAllAbandonedCartsResponse/Data.php';
require_once __DIR__ . '/src/Endpoint/AlternativeProducts/AddAlternativeProduct.php';
require_once __DIR__ . '/src/Endpoint/AlternativeProducts/AddAlternativeProductRequest/AddAlternativeProductRequest.php';
require_once __DIR__ . '/src/Endpoint/AlternativeProducts/AddAlternativeProductRequest/AddAlternativeProductRequest/Data.php';
Expand Down
109 changes: 109 additions & 0 deletions src/Component/Entity/AbandonedCartSnapshot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?php

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

use Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot\Coupon;
use Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot\Customer;
use Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot\Items;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypeDateTime;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypePrice;

class AbandonedCartSnapshot extends Entity
{
protected TypeDateTime $date;
protected int $age;
protected Items $items;
protected TypePrice $cartValue;
protected ?Coupon $coupon;
protected Customer $customer;
protected int $returns;
protected int $lastStep;

public function getDate(): TypeDateTime
{
return $this->date;
}

public function setDate(TypeDateTime $date): static
{
$this->date = $date;
return $this;
}

public function getAge(): int
{
return $this->age;
}

public function setAge(int $age): static
{
$this->age = $age;
return $this;
}

public function getItems(): Items
{
return $this->items;
}

public function setItems(Items $items): static
{
$this->items = $items;
return $this;
}

public function getCartValue(): TypePrice
{
return $this->cartValue;
}

public function setCartValue(TypePrice $cartValue): static
{
$this->cartValue = $cartValue;
return $this;
}

public function getCoupon(): ?Coupon
{
return $this->coupon;
}

public function setCoupon(?Coupon $coupon): static
{
$this->coupon = $coupon;
return $this;
}

public function getCustomer(): Customer
{
return $this->customer;
}

public function setCustomer(Customer $customer): static
{
$this->customer = $customer;
return $this;
}

public function getReturns(): int
{
return $this->returns;
}

public function setReturns(int $returns): static
{
$this->returns = $returns;
return $this;
}

public function getLastStep(): int
{
return $this->lastStep;
}

public function setLastStep(int $lastStep): static
{
$this->lastStep = $lastStep;
return $this;
}
}
59 changes: 59 additions & 0 deletions src/Component/Entity/AbandonedCartSnapshot/Coupon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot;

use Shoptet\Api\Sdk\Php\Component\Entity\Entity;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypePriceNullable;
use Shoptet\Api\Sdk\Php\Component\ValueObject\TypePriceRatio;

class Coupon extends Entity
{
protected string $code;
protected string $discountType;
protected TypePriceNullable $amount;
protected ?TypePriceRatio $ratio;

public function getCode(): string
{
return $this->code;
}

public function setCode(string $code): static
{
$this->code = $code;
return $this;
}

public function getDiscountType(): string
{
return $this->discountType;
}

public function setDiscountType(string $discountType): static
{
$this->discountType = $discountType;
return $this;
}

public function getAmount(): TypePriceNullable
{
return $this->amount;
}

public function setAmount(TypePriceNullable $amount): static
{
$this->amount = $amount;
return $this;
}

public function getRatio(): ?TypePriceRatio
{
return $this->ratio;
}

public function setRatio(?TypePriceRatio $ratio): static
{
$this->ratio = $ratio;
return $this;
}
}
45 changes: 45 additions & 0 deletions src/Component/Entity/AbandonedCartSnapshot/Customer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot;

use Shoptet\Api\Sdk\Php\Component\Entity\Entity;

class Customer extends Entity
{
protected string $name;
protected ?string $email;
protected ?string $phone;

public function getName(): string
{
return $this->name;
}

public function setName(string $name): static
{
$this->name = $name;
return $this;
}

public function getEmail(): ?string
{
return $this->email;
}

public function setEmail(?string $email): static
{
$this->email = $email;
return $this;
}

public function getPhone(): ?string
{
return $this->phone;
}

public function setPhone(?string $phone): static
{
$this->phone = $phone;
return $this;
}
}
31 changes: 31 additions & 0 deletions src/Component/Entity/AbandonedCartSnapshot/Items.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot;

use Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot\Items\Item;
use Shoptet\Api\Sdk\Php\Component\Entity\EntityCollection;

/**
* @extends EntityCollection<Item>
* @property Item[] $data
* @method Item[] toArray()
* @method void set(int $key, Item $item)
* @method null|Item get(int $key)
* @method void add(Item $item)
* @method null|Item remove(int $key)
* @method bool removeItem(Item $item, bool $strict = true)
* @method bool contains(Item $item, bool $strict = true)
* @method null|Item offsetGet(int $offset)
* @method void offsetSet(int $offset, Item $value)
*/
class Items extends EntityCollection
{
/**
* @param mixed $data
* @return class-string<Item>
*/
public function getItemType(mixed $data): string
{
return 'Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot\Items\Item';
}
}
45 changes: 45 additions & 0 deletions src/Component/Entity/AbandonedCartSnapshot/Items/Item.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot\Items;

use Shoptet\Api\Sdk\Php\Component\Entity\Entity;

class Item extends Entity
{
protected string $code;
protected string $name;
protected float $amount;

public function getCode(): string
{
return $this->code;
}

public function setCode(string $code): static
{
$this->code = $code;
return $this;
}

public function getName(): string
{
return $this->name;
}

public function setName(string $name): static
{
$this->name = $name;
return $this;
}

public function getAmount(): float
{
return $this->amount;
}

public function setAmount(float $amount): static
{
$this->amount = $amount;
return $this;
}
}
40 changes: 40 additions & 0 deletions src/Endpoint/AbandonedCarts/GetListOfAllAbandonedCarts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Shoptet\Api\Sdk\Php\Endpoint\AbandonedCarts;

use Shoptet\Api\Sdk\Php\Async\SnapshotEndpoint;
use Shoptet\Api\Sdk\Php\Component\Entity\AbandonedCartSnapshot;
use Shoptet\Api\Sdk\Php\Endpoint\AbandonedCarts\GetListOfAllAbandonedCartsResponse\GetListOfAllAbandonedCartsResponse;
use Shoptet\Api\Sdk\Php\Endpoint\Get;

/**
* @see https://api.docs.shoptet.com/shoptet-api/openapi/Abandoned-carts/getlistofallabandonedcarts
*
* @method GetListOfAllAbandonedCarts setBody(null $entity)
* @method null getBody()
*/
class GetListOfAllAbandonedCarts extends Get implements SnapshotEndpoint
{
protected array $supportedPathParams = [];
protected array $supportedQueryParams = ['language' => false, 'visitTimeFrom' => false, 'visitTimeTo' => false];

public function getRequestEntityClass(): null
{
return null;
}

public function getResponseEntityClass(): string
{
return GetListOfAllAbandonedCartsResponse::class;
}

public function getEndpoint(): string
{
return '/api/abandoned-carts/snapshot';
}

public function getSnapshotResultEntityClass(): string
{
return AbandonedCartSnapshot::class;
}
}
Loading
Loading