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];
}
}