first commit

This commit is contained in:
2024-11-11 18:46:54 +01:00
commit a630d17338
25634 changed files with 4923715 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
<?php
namespace x13allegro\Api\Model\Command;
interface CommandInterface {}

View File

@@ -0,0 +1,61 @@
<?php
namespace x13allegro\Api\Model\Command;
use JsonSerializable;
final class OfferCriteria implements JsonSerializable
{
const TYPE_CONTAINS_OFFERS = 'CONTAINS_OFFERS';
/** @var Offer[] */
public $offers;
/** @var string */
public $type;
/** @var array */
private $offersCollection = array();
/**
* @param string|array $offers
* @return $this
*/
public function offers($offers)
{
if (!is_array($offers)) {
$offers = array($offers);
}
foreach ($offers as $offer) {
$this->offersCollection[] = new Offer($offer);
}
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return array(
'offers' => $this->offersCollection,
'type' => $this->type
);
}
}
final class Offer
{
/** @var string */
public $id;
/**
* @param string $id
*/
public function __construct($id)
{
$this->id = $id;
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace x13allegro\Api\Model\Command\OfferPublication;
use x13allegro\Api\Model\Command\CommandInterface;
final class OfferPublicationCommand implements CommandInterface
{
/** @var Publication */
public $publication;
/** @var \x13allegro\Api\Model\Command\OfferCriteria[] */
public $offerCriteria;
/**
* @return \x13allegro\Api\Model\Command\OfferCriteria
*/
public function offerCriteria()
{
return $this->offerCriteria[0];
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Command\OfferPublication;
final class Publication
{
/** @var string */
public $action;
/** @var \x13allegro\Api\Model\DateTime */
public $scheduledFor;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Command\OfferPublication;
final class PublicationAction
{
const ACTIVATE = 'ACTIVATE';
const END = 'END';
}

View File

@@ -0,0 +1,50 @@
<?php
namespace x13allegro\Api\Model\Command\PriceChange;
use JsonSerializable;
final class Modification implements JsonSerializable
{
/** @var string */
public $type;
/** @var \x13allegro\Api\Model\Price */
public $price;
/** @var \x13allegro\Api\Model\Price */
public $value;
/** @var string */
public $percentage;
/**
* @return array
*/
public function jsonSerialize()
{
$type = [
'type' => $this->type
];
switch ($this->type)
{
case ModificationType::INCREASE_PRICE:
case ModificationType::DECREASE_PRICE:
return $type + [
'value' => $this->value
];
case ModificationType::INCREASE_PERCENTAGE:
case ModificationType::DECREASE_PERCENTAGE:
return $type + [
'percentage' => (string)$this->percentage
];
default:
return $type + [
'price' => $this->price
];
}
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Command\PriceChange;
final class ModificationType
{
const FIXED_PRICE = 'FIXED_PRICE';
const INCREASE_PRICE = 'INCREASE_PRICE';
const DECREASE_PRICE = 'DECREASE_PRICE';
const INCREASE_PERCENTAGE = 'INCREASE_PERCENTAGE';
const DECREASE_PERCENTAGE = 'DECREASE_PERCENTAGE';
}

View File

@@ -0,0 +1,22 @@
<?php
namespace x13allegro\Api\Model\Command\PriceChange;
use x13allegro\Api\Model\Command\CommandInterface;
final class PriceChangeCommand implements CommandInterface
{
/** @var Modification */
public $modification;
/** @var \x13allegro\Api\Model\Command\OfferCriteria[] */
public $offerCriteria;
/**
* @return \x13allegro\Api\Model\Command\OfferCriteria
*/
public function offerCriteria()
{
return $this->offerCriteria[0];
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Command\QuantityChange;
final class Modification
{
/** @var string */
public $changeType;
/** @var int */
public $value;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Command\QuantityChange;
final class ModificationType
{
const FIXED = 'FIXED';
const GAIN = 'GAIN';
}

View File

@@ -0,0 +1,22 @@
<?php
namespace x13allegro\Api\Model\Command\QuantityChange;
use x13allegro\Api\Model\Command\CommandInterface;
final class QuantityChangeCommand implements CommandInterface
{
/** @var Modification */
public $modification;
/** @var \x13allegro\Api\Model\Command\OfferCriteria[] */
public $offerCriteria;
/**
* @return \x13allegro\Api\Model\Command\OfferCriteria
*/
public function offerCriteria()
{
return $this->offerCriteria[0];
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace x13allegro\Api\Model;
use DateTime as PhpDateTime;
use JsonSerializable;
final class DateTime extends PhpDateTime implements JsonSerializable
{
/**
* @return string
*/
public function jsonSerialize()
{
return $this->format(self::ATOM);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace x13allegro\Api\Model;
final class Image
{
/** @var string */
public $url;
/**
* @param string $url
*/
public function __construct($url = '')
{
$this->url = $url;
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace x13allegro\Api\Model\Marketplace\Enum;
use x13allegro\Api\XAllegroApi;
use x13allegro\Component\Enum;
/**
* @method static Marketplace ALLEGRO_PL()
* @method static Marketplace ALLEGRO_CZ()
* @method static Marketplace ALLEGRO_SK()
*/
final class Marketplace extends Enum
{
static $backedEnum = true;
const ALLEGRO_PL = XAllegroApi::MARKETPLACE_PL;
const ALLEGRO_CZ = XAllegroApi::MARKETPLACE_CZ;
const ALLEGRO_SK = XAllegroApi::MARKETPLACE_SK;
/**
* @return string[]
*/
public static function translateValues()
{
return [
self::ALLEGRO_PL => 'Polska - allegro.pl',
self::ALLEGRO_CZ => 'Czechy - allegro.cz',
self::ALLEGRO_SK => 'Słowacja - allegro.sk'
];
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace x13allegro\Api\Model\Marketplace\Enum;
use x13allegro\Component\Enum;
/**
* @method static MarketplaceCountry ALLEGRO_PL()
* @method static MarketplaceCountry ALLEGRO_CZ()
* @method static MarketplaceCountry ALLEGRO_SK()
*/
final class MarketplaceCountry extends Enum
{
const ALLEGRO_PL = 'PL';
const ALLEGRO_CZ = 'CZ';
const ALLEGRO_SK = 'SK';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace x13allegro\Api\Model\Marketplace\Enum;
use x13allegro\Component\Enum;
/**
* @method static MarketplaceCurrency ALLEGRO_PL()
* @method static MarketplaceCurrency ALLEGRO_CZ()
* @method static MarketplaceCurrency ALLEGRO_SK()
*/
final class MarketplaceCurrency extends Enum
{
const ALLEGRO_PL = 'PLN';
const ALLEGRO_CZ = 'CZK';
const ALLEGRO_SK = 'EUR';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace x13allegro\Api\Model\Marketplace\Enum;
use x13allegro\Component\Enum;
/**
* @method static MarketplaceCurrencyPrecision ALLEGRO_PL()
* @method static MarketplaceCurrencyPrecision ALLEGRO_CZ()
* @method static MarketplaceCurrencyPrecision ALLEGRO_SK()
*/
final class MarketplaceCurrencyPrecision extends Enum
{
const ALLEGRO_PL = 2;
const ALLEGRO_CZ = 0;
const ALLEGRO_SK = 2;
}

View File

@@ -0,0 +1,17 @@
<?php
namespace x13allegro\Api\Model\Marketplace\Enum;
use x13allegro\Component\Enum;
/**
* @method static MarketplaceLocalization ALLEGRO_PL()
* @method static MarketplaceLocalization ALLEGRO_CZ()
* @method static MarketplaceLocalization ALLEGRO_SK()
*/
final class MarketplaceLocalization extends Enum
{
const ALLEGRO_PL = 'pl';
const ALLEGRO_CZ = 'cz';
const ALLEGRO_SK = 'sk';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace x13allegro\Api\Model\Marketplace\Enum;
use x13allegro\Component\Enum;
/**
* @method static MarketplaceOfferUrl ALLEGRO_PL()
* @method static MarketplaceOfferUrl ALLEGRO_CZ()
* @method static MarketplaceOfferUrl ALLEGRO_SK()
*/
final class MarketplaceOfferUrl extends Enum
{
const ALLEGRO_PL = 'https://allegro.pl{sandbox}/oferta/{offerId}';
const ALLEGRO_CZ = 'https://allegro.cz{sandbox}/nabidka/{offerId}';
const ALLEGRO_SK = 'https://allegro.sk{sandbox}/ponuka/{offerId}';
}

View File

@@ -0,0 +1,35 @@
<?php
namespace x13allegro\Api\Model\Marketplace\Enum;
use x13allegro\Component\Enum;
/**
* @method static MarketplacePublicationStatus APPROVED()
* @method static MarketplacePublicationStatus REFUSED()
* @method static MarketplacePublicationStatus IN_PROGRESS()
* @method static MarketplacePublicationStatus NOT_REQUESTED()
* @method static MarketplacePublicationStatus PENDING()
*/
final class MarketplacePublicationStatus extends Enum
{
const APPROVED = 'APPROVED';
const REFUSED = 'REFUSED';
const IN_PROGRESS = 'IN_PROGRESS';
const NOT_REQUESTED = 'NOT_REQUESTED';
const PENDING = 'PENDING';
/**
* @return array
*/
public static function translateValues()
{
return [
self::APPROVED => 'zatwierdzona',
self::REFUSED => 'odrzucona',
self::IN_PROGRESS => 'przetwarzana',
self::NOT_REQUESTED => 'nie zgłoszona',
self::PENDING => 'w oczekiwaniu'
];
}
}

View File

@@ -0,0 +1,5 @@
<?php
namespace x13allegro\Api\Model;
final class OfferPropertyDelete {}

View File

@@ -0,0 +1,5 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class AdditionalMarketplaces extends \StdClass {}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\AdditionalMarketplaces;
final class Marketplace
{
/** @var SellingMode */
public $sellingMode;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\AdditionalMarketplaces;
final class SellingMode
{
/** @var \x13allegro\Api\Model\Price */
public $price;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class AdditionalServices
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,29 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
final class AfterSalesServices implements JsonSerializable
{
/** @var AfterSalesServices\ImpliedWarranty */
public $impliedWarranty;
/** @var AfterSalesServices\ReturnPolicy */
public $returnPolicy;
/** @var AfterSalesServices\Warranty */
public $warranty;
/**
* @return array
*/
public function jsonSerialize()
{
return [
'impliedWarranty' => (is_object($this->impliedWarranty) && $this->impliedWarranty->id ? $this->impliedWarranty : null),
'returnPolicy' => (is_object($this->returnPolicy) && $this->returnPolicy->id ? $this->returnPolicy : null),
'warranty' => (is_object($this->warranty) && $this->warranty->id ? $this->warranty : null)
];
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\AfterSalesServices;
final class ImpliedWarranty
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,10 @@
<?php
namespace x13allegro\Api\Model\Offers\AfterSalesServices;
final class ReturnPolicy
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\AfterSalesServices;
final class Warranty
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class B2b
{
/** @var bool */
public $buyableOnlyByBusiness;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Category
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,53 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
use x13allegro\Api\Model\Offers\CompatibilityList\ListItemType;
final class CompatibilityList implements JsonSerializable
{
/** @var string */
public $id;
/** @var string */
public $type;
/** @var CompatibilityList\ListItem[] */
public $items;
/**
* @return array
*/
private function getProductBasedItems()
{
$items = [];
foreach ($this->items as $item) {
$itemObj = new \StdClass();
$itemObj->text = $item->text;
$items[] = $itemObj;
}
return $items;
}
/**
* @return array
*/
public function jsonSerialize()
{
$fields = [
'type' => $this->type
];
if ($this->type == ListItemType::PRODUCT_BASED) {
$fields['id'] = $this->id;
$fields['items'] = $this->getProductBasedItems();
} else {
$fields['items'] = $this->items;
}
return $fields;
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\CompatibilityList;
final class ItemType
{
const ID = 'ID';
const TEXT = 'TEXT';
}

View File

@@ -0,0 +1,38 @@
<?php
namespace x13allegro\Api\Model\Offers\CompatibilityList;
use JsonSerializable;
final class ListItem implements JsonSerializable
{
/** @var string */
public $id;
/** @var string */
public $type;
/** @var string */
public $text;
/** @var ListItemAdditionalInfo[] */
public $additionalInfo;
/**
* @return array
*/
public function jsonSerialize()
{
$fields = [
'type' => $this->type,
'text' => $this->text
];
if ($this->type == ItemType::ID) {
$fields['id'] = $this->id;
$fields['additionalInfo'] = $this->additionalInfo;
}
return $fields;
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\CompatibilityList;
final class ListItemAdditionalInfo
{
/** @var string */
public $value;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\CompatibilityList;
final class ListItemType
{
const MANUAL = 'MANUAL';
const PRODUCT_BASED = 'PRODUCT_BASED';
}

View File

@@ -0,0 +1,44 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
use x13allegro\Api\Model\OfferPropertyDelete;
final class Delivery implements JsonSerializable
{
/** @var string */
public $additionalInfo;
/** @var string */
public $handlingTime;
/** @var ShippingRate */
public $shippingRates;
/** @var \x13allegro\Api\Model\DateTime */
public $shipmentDate;
/**
* @return array
*/
public function jsonSerialize()
{
$output = [];
if (!empty($this->additionalInfo)) {
$output['additionalInfo'] = $this->additionalInfo;
}
if (!empty($this->handlingTime)) {
$output['handlingTime'] = $this->handlingTime;
}
if (!empty($this->shippingRates)) {
$output['shippingRates'] = $this->shippingRates;
}
if (!empty($this->shipmentDate)) {
$output['shipmentDate'] = ($this->shipmentDate instanceof OfferPropertyDelete ? null : $this->shipmentDate);
}
return (!empty($output) ? $output : null);
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Description
{
/** @var Description\Section[] */
public $sections;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\Description;
final class Section
{
/** @var SectionItem[] */
public $items;
}

View File

@@ -0,0 +1,35 @@
<?php
namespace x13allegro\Api\Model\Offers\Description;
use JsonSerializable;
final class SectionItem implements JsonSerializable
{
/** @var string */
public $type;
/** @var string */
public $content;
/** @var string */
public $url;
/**
* @return array
*/
public function jsonSerialize()
{
$fields = [
'type' => $this->type
];
if ($this->type == SectionItemType::TEXT) {
$fields['content'] = $this->content;
} else {
$fields['url'] = $this->url;
}
return $fields;
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\Description;
final class SectionItemType
{
const TEXT = 'TEXT';
const IMAGE = 'IMAGE';
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Discounts
{
/** @var Discounts\WholesalePriceList */
public $wholesalePriceList;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\Discounts;
final class WholesalePriceList
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,18 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use x13allegro\Component\Enum;
final class EventType extends Enum
{
const ACTIVATED = 'OFFER_ACTIVATED';
const CHANGED = 'OFFER_CHANGED';
const ENDED = 'OFFER_ENDED';
const STOCK_CHANGED = 'OFFER_STOCK_CHANGED';
const PRICE_CHANGED = 'OFFER_PRICE_CHANGED';
const ARCHIVED = 'OFFER_ARCHIVED';
const BID_PLACED = 'OFFER_BID_PLACED';
const BID_CANCELED = 'OFFER_BID_CANCELED';
const VISIBILITY_CHANGED = 'OFFER_VISIBILITY_CHANGED';
}

View File

@@ -0,0 +1,21 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use x13allegro\Component\Enum;
final class HandlingTime extends Enum
{
const PT0S = 'natychmiast';
const PT24H = '24h';
const P2D = '2 dni';
const P3D = '3 dni';
const P4D = '4 dni';
const P5D = '5 dni';
const P7D = '7 dni';
const P10D = '10 dni';
const P14D = '14 dni';
const P21D = '21 dni';
const P30D = '30 dni';
const P60D = '60 dni';
}

View File

@@ -0,0 +1,13 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use MyCLabs\Enum;
final class InvoiceType extends Enum
{
const VAT = 'faktura VAT';
const VAT_MARGIN = 'faktura VAT marża';
const WITHOUT_VAT = 'faktura bez VAT';
const NO_INVOICE = 'nie wystawiam faktury';
}

View File

@@ -0,0 +1,11 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use x13allegro\Component\Enum;
final class MessageToSellerSettings extends Enum
{
const OPTIONAL = 'Tak';
const HIDDEN = 'Nie';
}

View File

@@ -0,0 +1,11 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use MyCLabs\Enum;
final class PromotionPackageType extends Enum
{
const BASE = 'BASE';
const EXTRA = 'EXTRA';
}

View File

@@ -0,0 +1,13 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use MyCLabs\Enum;
final class PublicationStatus extends Enum
{
const INACTIVE = 'INACTIVE';
const ACTIVATING = 'ACTIVATING';
const ACTIVE = 'ACTIVE';
const ENDED = 'ENDED';
}

View File

@@ -0,0 +1,15 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use x13allegro\Component\Enum;
/**
* @method static SellingModeType BUY_NOW()
* @method static SellingModeType AUCTION()
*/
final class SellingModeType extends Enum
{
const BUY_NOW = 'BUY_NOW';
const AUCTION = 'AUCTION';
}

View File

@@ -0,0 +1,13 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use MyCLabs\Enum;
final class TaxPercentage extends Enum
{
const PL_TAX_0 = 0;
const PL_TAX_5 = 5;
const PL_TAX_8 = 8;
const PL_TAX_23 = 23;
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Offers\Enum;
use x13allegro\Component\Enum;
final class UnitType extends Enum
{
const UNIT = 'szt';
const SET = 'kpl';
const PAIR = 'par';
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class External
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class ImpliedWarranty
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,18 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Location
{
/** @var string */
public $city;
/** @var string */
public $countryCode;
/** @var string */
public $postCode;
/** @var string */
public $province;
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Marketplaces
{
/** @var Marketplaces\Base */
public $base;
/** @var Marketplaces\Additional[] */
public $additional = [];
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\Marketplaces;
final class Additional
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers\Marketplaces;
final class Base
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class MessageToSellerSettings
{
/** @var string */
public $mode;
}

View File

@@ -0,0 +1,140 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
class Offer implements JsonSerializable
{
/** @var string */
public $id;
/** @var string */
public $language;
/** @var string */
public $name;
/** @var External */
public $external;
/** @var Product */
public $product;
/** @var Description */
public $description;
/** @var Category */
public $category;
/** @var array */
public $parameters;
/** @var \x13allegro\Api\Model\Image[] */
public $images;
/** @var Publication */
public $publication;
/** @var SellingMode */
public $sellingMode;
/** @var TaxSettings */
public $taxSettings;
/** @var SizeTable */
public $sizeTable;
/** @var Stock */
public $stock;
/** @var Delivery */
public $delivery;
/** @var Discounts */
public $discounts;
/** @var Location */
public $location;
/** @var Payments */
public $payments;
/** @var Promotion */
public $promotion;
/** @var AdditionalMarketplaces */
public $additionalMarketplaces;
/** @var AfterSalesServices */
public $afterSalesServices;
/** @var AdditionalServices */
public $additionalServices;
/** @var CompatibilityList */
public $compatibilityList;
/** @var TecDocSpecification */
public $tecdocSpecification;
/** @var MessageToSellerSettings */
public $messageToSellerSettings;
/** @var B2b */
public $b2b;
/**
* @param string $offerId
*/
public function __construct($offerId = '')
{
$this->id = $offerId;
}
/**
* @param string $url
* @return $this
*/
public function image($url)
{
$this->images[] = new \x13allegro\Api\Model\Image($url);
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return array(
'id' => $this->id,
'language' => $this->language,
'name' => $this->name,
'external' => $this->external,
'product' => $this->product,
'description' => $this->description,
'parameters' => $this->parameters,
'category' => $this->category,
'images' => $this->images,
'publication' => $this->publication,
'sellingMode' => $this->sellingMode,
'taxSettings' => $this->taxSettings,
'sizeTable' => $this->sizeTable,
'stock' => $this->stock,
'delivery' => $this->delivery,
'discounts' => $this->discounts,
'location' => $this->location,
'payments' => $this->payments,
'promotion' => $this->promotion,
'additionalMarketplaces' => $this->additionalMarketplaces,
'afterSalesServices' => $this->afterSalesServices,
'additionalServices' => (is_object($this->additionalServices) && $this->additionalServices->id ? $this->additionalServices : null),
'compatibilityList' => $this->compatibilityList,
'tecdocSpecification' => $this->tecdocSpecification,
'messageToSellerSettings' => $this->messageToSellerSettings,
'b2b' => $this->b2b
);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class OfferDraft
{
/** @var string */
public $name;
/** @var Category */
public $category;
/** @var string */
public $language;
}

View File

@@ -0,0 +1,24 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class OfferPricing
{
/** @var string */
public $id;
/** @var Category */
public $category;
/** @var array */
public $parameters;
/** @var Promotion */
public $promotion;
/** @var Publication */
public $publication;
/** @var SellingMode */
public $sellingMode;
}

View File

@@ -0,0 +1,133 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
class OfferProduct implements JsonSerializable
{
/** @var string */
public $id;
/** @var string */
public $language;
/** @var string */
public $name;
/** @var External */
public $external;
/** @var Description */
public $description;
/** @var Category */
public $category;
/** @var ProductSet[] */
public $productSet;
/** @var array */
public $parameters;
/** @var array */
public $images;
/** @var Publication */
public $publication;
/** @var SellingMode */
public $sellingMode;
/** @var TaxSettings */
public $taxSettings;
/** @var SizeTable */
public $sizeTable;
/** @var Stock */
public $stock;
/** @var Delivery */
public $delivery;
/** @var Discounts */
public $discounts;
/** @var Location */
public $location;
/** @var Payments */
public $payments;
/** @var AdditionalMarketplaces */
public $additionalMarketplaces;
/** @var AfterSalesServices */
public $afterSalesServices;
/** @var AdditionalServices */
public $additionalServices;
/** @var MessageToSellerSettings */
public $messageToSellerSettings;
/** @var B2b */
public $b2b;
/**
* @param string $url
* @return $this
*/
public function image($url)
{
$this->images[] = $url;
return $this;
}
/**
* @param ProductSet\Product $product
* @return $this
*/
public function setProduct(ProductSet\Product $product)
{
$productSet = new ProductSet();
$productSet->product = $product;
$this->productSet[] = $productSet;
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return [
'language' => $this->language,
'name' => $this->name,
'external' => $this->external,
'description' => $this->description,
'parameters' => $this->parameters,
'category' => $this->category,
'productSet' => $this->productSet,
'images' => $this->images,
'publication' => $this->publication,
'sellingMode' => $this->sellingMode,
'taxSettings' => $this->taxSettings,
'sizeTable' => $this->sizeTable,
'stock' => $this->stock,
'delivery' => $this->delivery,
'discounts' => $this->discounts,
'location' => $this->location,
'payments' => $this->payments,
'additionalMarketplaces' => $this->additionalMarketplaces,
'afterSalesServices' => $this->afterSalesServices,
'additionalServices' => (is_object($this->additionalServices) && $this->additionalServices->id ? $this->additionalServices : null),
'messageToSellerSettings' => $this->messageToSellerSettings,
'b2b' => $this->b2b
];
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
/**
* @todo Refactor - move outside this namespace and separate to different files
*/
final class OfferTags implements JsonSerializable
{
/** @var Tag[] */
public $tags;
/** @var array */
private $tagsCollection = array();
/**
* @param string $id
* @return $this
*/
public function tag($id)
{
$this->tagsCollection[] = new Tag($id);
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return array(
'tags' => $this->tagsCollection
);
}
}
final class Tag
{
/** @var string */
public $id;
/**
* @param string $id
*/
public function __construct($id = null)
{
$this->id = $id;
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace x13allegro\Api\Model\Offers;
use x13allegro\Api\Model\OfferPropertyDelete;
final class OfferUpdate extends OfferProduct
{
/**
* @param string $offerId
*/
public function __construct($offerId)
{
$this->id = $offerId;
}
/**
* @return array
*/
public function jsonSerialize()
{
$output = [];
$fields = [
'additionalMarketplaces',
'additionalServices',
'afterSalesServices',
'delivery',
'description',
'discounts',
'external',
'images',
'name',
'category',
'parameters',
'payments',
'productSet',
'publication',
'sellingMode',
'sizeTable',
'stock',
'taxSettings'
];
foreach ($fields as $field) {
switch ($field) {
// nullable properties
case 'additionalServices':
case 'discounts':
case 'external':
case 'sizeTable':
if ($this->{$field} instanceof OfferPropertyDelete) {
$output[$field] = null;
}
else if (is_object($this->{$field})) {
$output[$field] = $this->{$field};
}
break;
default:
if (!empty($this->{$field})) {
$output[$field] = $this->{$field};
}
}
}
return $output;
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Payments
{
/** @var string */
public $invoice;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Product
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class ProductSet
{
/** @var ProductSet\Product */
public $product;
}

View File

@@ -0,0 +1,52 @@
<?php
namespace x13allegro\Api\Model\Offers\ProductSet;
use JsonSerializable;
final class Product implements JsonSerializable
{
/** @var string */
public $id;
/** @var string */
public $idType;
/** @var string */
public $name;
/** @var \x13allegro\Api\Model\Offers\Category */
public $category;
/** @var array */
public $parameters;
/** @var array */
public $images;
/**
* @param string $url
* @return $this
*/
public function image($url)
{
$this->images[] = $url;
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return array(
'id' => $this->id,
'idType' => $this->idType,
'name' => $this->name,
'category' => $this->category,
'parameters' => $this->parameters,
'images' => $this->images
);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Promotion
{
/** @var bool */
public $emphasized1d;
/** @var bool */
public $emphasized10d;
/** @var bool */
public $promoPackage;
/** @var bool */
public $departmentPage;
}

View File

@@ -0,0 +1,40 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
final class Publication implements JsonSerializable
{
/** @var string */
public $duration;
/** @var Marketplaces readonly property */
public $marketplaces;
/** @var string */
public $status;
/** @var string */
public $startingAt;
/**
* @return array
*/
public function jsonSerialize()
{
$output = [];
if (!empty($this->duration)) {
$output['duration'] = $this->duration;
}
if (!empty($this->status)) {
$output['status'] = $this->status;
}
if (!empty($this->startingAt)) {
$output['startingAt'] = $this->startingAt;
}
return (!empty($output) ? $output : null);
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class PublicationStatus
{
const INACTIVE = 'INACTIVE';
const ACTIVATING = 'ACTIVATING';
const ACTIVE = 'ACTIVE';
const ENDED = 'ENDED';
}

View File

@@ -0,0 +1,10 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class ReturnPolicy
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,62 @@
<?php
namespace x13allegro\Api\Model\Offers;
use x13allegro\Api\Model\Offers\Enum\SellingModeType;
use JsonSerializable;
final class SellingMode implements JsonSerializable
{
/** @var string */
public $format;
/** @var \x13allegro\Api\Model\Price */
public $price;
/** @var \x13allegro\Api\Model\Price */
public $startingPrice;
/** @var \x13allegro\Api\Model\Price */
public $minimalPrice;
/**
* @return array
*/
public function jsonSerialize()
{
$output = [];
$fields = [
'format',
'price',
'startingPrice',
'minimalPrice'
];
foreach ($fields as $field) {
switch ($field) {
case 'startingPrice':
case 'minimalPrice':
if (!empty($this->{$field})
&& $this->format == SellingModeType::AUCTION
&& $this->{$field}->amount > 0
) {
$output[$field] = $this->{$field};
}
break;
case 'price':
if (!empty($this->{$field}) && $this->{$field}->amount > 0) {
$output[$field] = $this->{$field};
}
break;
default:
if (!empty($this->{$field})) {
$output[$field] = $this->{$field};
}
}
}
return $output;
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class SellingModeType
{
const BUY_NOW = 'BUY_NOW';
const AUCTION = 'AUCTION';
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class ShippingRate
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class SizeTable
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,31 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
final class Stock implements JsonSerializable
{
/** @var int */
public $available;
/** @var string */
public $unit;
/**
* @return array
*/
public function jsonSerialize()
{
$output = [];
if (!empty($this->available)) {
$output['available'] = $this->available;
}
if (!empty($this->unit)) {
$output['unit'] = $this->unit;
}
return (!empty($output) ? $output : null);
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
final class Tax implements JsonSerializable
{
/** @var string */
public $percentage;
/**
* @return array
*/
public function jsonSerialize()
{
return array(
'percentage' => number_format((float)str_replace(',', '.', $this->percentage), 2, '.', '')
);
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace x13allegro\Api\Model\Offers;
use JsonSerializable;
final class TaxSettings implements JsonSerializable
{
/** @var TaxSettings\Rate[] */
public $rates;
/** @var string */
public $subject;
/** @var string */
public $exemption;
/**
* @param string $rate
* @param string $countryCode
* @return $this
*/
public function addTaxRate($rate, $countryCode)
{
$taxRate = new TaxSettings\Rate();
$taxRate->rate = $rate;
$taxRate->countryCode = $countryCode;
$this->rates[$countryCode] = $taxRate;
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
$output = [
'rates' => array_values($this->rates)
];
if (!empty($this->subject)) {
$output['subject'] = $this->subject;
}
if (!empty($this->exemption)) {
$output['exemption'] = $this->exemption;
}
return $output;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace x13allegro\Api\Model\Offers\TaxSettings\Enum;
use x13allegro\Component\Enum;
/**
* @method static TaxCZ TAX_21()
* @method static TaxCZ TAX_15()
* @method static TaxCZ TAX_10()
*/
final class TaxCZ extends Enum
{
static $backedEnum = true;
const TAX_21 = '21.00';
const TAX_15 = '15.00';
const TAX_10 = '10.00';
const TAX_EXEMPT = 'EXEMPT';
/**
* @return string[]
*/
public static function translateValues()
{
return [
self::TAX_21 => '21%',
self::TAX_15 => '15%',
self::TAX_10 => '10%',
self::TAX_EXEMPT => 'ZW'
];
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace x13allegro\Api\Model\Offers\TaxSettings\Enum;
use x13allegro\Component\Enum;
/**
* @method static TaxPL TAX_23()
* @method static TaxPL TAX_8()
* @method static TaxPL TAX_5()
* @method static TaxPL TAX_EXEMPT()
*/
final class TaxPL extends Enum
{
static $backedEnum = true;
const TAX_23 = '23.00';
const TAX_8 = '8.00';
const TAX_5 = '5.00';
const TAX_EXEMPT = 'EXEMPT';
/**
* @return string[]
*/
public static function translateValues()
{
return [
self::TAX_23 => '23%',
self::TAX_8 => '8%',
self::TAX_5 => '5%',
self::TAX_EXEMPT => 'ZW'
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace x13allegro\Api\Model\Offers\TaxSettings\Enum;
use x13allegro\Component\Enum;
/**
* @method static TaxSK TAX_20()
* @method static TaxSK TAX_10()
* @method static TaxSK TAX_5()
*/
final class TaxSK extends Enum
{
static $backedEnum = true;
const TAX_20 = '20.00';
const TAX_10 = '10.00';
const TAX_5 = '5.00';
const TAX_EXEMPT = 'EXEMPT';
/**
* @return string[]
*/
public static function translateValues()
{
return [
self::TAX_20 => '20%',
self::TAX_10 => '10%',
self::TAX_5 => '5%',
self::TAX_EXEMPT => 'ZW'
];
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace x13allegro\Api\Model\Offers\TaxSettings;
use JsonSerializable;
final class Rate implements JsonSerializable
{
/** @var string */
public $rate;
/** @var string */
public $countryCode;
/**
* @return array
*/
public function jsonSerialize()
{
return [
'rate' => (is_numeric($this->rate) ? number_format((float)str_replace(',', '.', $this->rate), 2, '.', '') : $this->rate),
'countryCode' => $this->countryCode
];
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class TecDocSpecification
{
/** @var string */
public $id;
/** @var TecDocSpecification\Item[] */
public $items;
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Offers\TecDocSpecification;
final class Item
{
/** @var string */
public $name;
/** @var string[] */
public $values;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Offers;
final class Warranty
{
/** @var string */
public $id;
}

View File

@@ -0,0 +1,13 @@
<?php
namespace x13allegro\Api\Model\Order;
use x13allegro\Component\Enum;
/**
* @method static CarrierOperator OTHER()
*/
final class CarrierOperator extends Enum
{
const OTHER = 'Inny';
}

View File

@@ -0,0 +1,13 @@
<?php
namespace x13allegro\Api\Model\Order\Enum;
use x13allegro\Component\Enum;
final class CheckoutFormStatus extends Enum
{
const BOUGHT = 'BOUGHT'; // purchase without checkout form filled in
const FILLED_IN = 'FILLED_IN'; // checkout form filled in but payment is not completed yet so data could still change
const READY_FOR_PROCESSING = 'READY_FOR_PROCESSING'; // payment completed, purchase is ready for processing
const CANCELLED = 'CANCELLED'; // purchase cancelled by buyer
}

View File

@@ -0,0 +1,15 @@
<?php
namespace x13allegro\Api\Model\Order\Enum;
use x13allegro\Component\Enum;
final class EventType extends Enum
{
const BOUGHT = 'BOUGHT';
const FILLED_IN = 'FILLED_IN';
const READY_FOR_PROCESSING = 'READY_FOR_PROCESSING';
const FULFILLMENT_STATUS_CHANGED = 'FULFILLMENT_STATUS_CHANGED';
const AUTO_CANCELLED = 'AUTO_CANCELLED';
const BUYER_CANCELLED = 'BUYER_CANCELLED';
}

View File

@@ -0,0 +1,16 @@
<?php
namespace x13allegro\Api\Model\Order\Enum;
use x13allegro\Component\Enum;
class FulfillmentStatus extends Enum
{
const PROCESSING = 'W realizacji';
const SUSPENDED = 'Wstrzymane';
const READY_FOR_SHIPMENT = 'Do wysłania';
const READY_FOR_PICKUP = 'Do odbioru';
const SENT = 'Wysłane';
const PICKED_UP = 'Odebrane';
const CANCELLED = 'Anulowane';
}

View File

@@ -0,0 +1,13 @@
<?php
namespace x13allegro\Api\Model\Order\Enum;
use x13allegro\Component\Enum;
final class PaymentType extends Enum
{
const ONLINE = 'ONLINE';
const EXTENDED_TERM = 'EXTENDED_TERM';
const SPLIT_PAYMENT = 'SPLIT_PAYMENT';
const CASH_ON_DELIVERY = 'CASH_ON_DELIVERY';
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Order\Enum;
use x13allegro\Component\Enum;
final class ShipmentSummarySent extends Enum
{
const NONE = 'Żadne';
const SOME = 'Niektóre';
const ALL = 'Wszystkie';
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Order;
final class Fulfillment
{
/** @var string */
public $status;
/** @var ShipmentSummary */
public $shipmentSummary;
}

View File

@@ -0,0 +1,12 @@
<?php
namespace x13allegro\Api\Model\Order;
final class Invoice
{
/** @var InvoiceFile */
public $file;
/** @var string */
public $invoiceNumber;
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Order;
final class InvoiceFile
{
/** @var string */
public $name;
}

View File

@@ -0,0 +1,17 @@
<?php
namespace x13allegro\Api\Model\Order;
final class LineItem
{
/** @var string */
public $id;
/**
* @param string $id
*/
public function __construct($id = null)
{
$this->id = $id;
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace x13allegro\Api\Model\Order;
use JsonSerializable;
final class ParcelTrackingNumber implements JsonSerializable
{
/** @var string */
public $carrierId;
/** @var string */
public $waybill;
/** @var string */
public $carrierName;
/** @var LineItem[] */
public $lineItems;
/** @var array */
private $lineItemsCollection = [];
/**
* @param string $id
* @return $this
*/
public function lineItem($id)
{
if (!array_key_exists($id, $this->lineItemsCollection)) {
$this->lineItemsCollection[$id] = new LineItem($id);
}
return $this;
}
/**
* @return array
*/
public function jsonSerialize()
{
return array(
'carrierId' => $this->carrierId,
'waybill' => $this->waybill,
'carrierName' => $this->carrierName,
'lineItems' => array_values($this->lineItemsCollection)
);
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace x13allegro\Api\Model\Order;
final class ShipmentSummary
{
/** @var string */
public $lineItemsSent;
}

View File

@@ -0,0 +1,25 @@
<?php
namespace x13allegro\Api\Model;
use JsonSerializable;
final class Price implements JsonSerializable
{
/** @var float */
public $amount;
/** @var string */
public $currency;
/**
* @return array
*/
public function jsonSerialize()
{
return array(
'amount' => number_format((float)str_replace(',', '.', $this->amount), 2, '.', ''),
'currency' => $this->currency
);
}
}

Some files were not shown because too many files have changed in this diff Show More