Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit d033399

Browse files
author
Jens Schulze
committed
feat(Order): support delivery update actions
Closes #369
1 parent f22bd65 commit d033399

13 files changed

+958
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Model\Message;
7+
8+
use Commercetools\Core\Model\Common\DateTimeDecorator;
9+
use Commercetools\Core\Model\Common\Reference;
10+
use Commercetools\Core\Model\Order\Delivery;
11+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
12+
use DateTime;
13+
14+
/**
15+
* @package Commercetools\Core\Model\Message
16+
* @link https://docs.commercetools.com/http-api-projects-messages.html#deliveryitemsupdated-message
17+
*/
18+
class DeliveryItemsUpdatedMessage extends Message
19+
{
20+
const MESSAGE_TYPE = 'DeliveryItemsUpdated';
21+
22+
public function fieldDefinitions()
23+
{
24+
$definitions = parent::fieldDefinitions();
25+
$definitions['deliveryId'] = [static::TYPE => 'string'];
26+
$definitions['items'] = [static::TYPE => DeliveryItemCollection::class];
27+
28+
return $definitions;
29+
}
30+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Model\Message;
7+
8+
use Commercetools\Core\Model\Common\DateTimeDecorator;
9+
use Commercetools\Core\Model\Common\Reference;
10+
use Commercetools\Core\Model\Order\Delivery;
11+
use DateTime;
12+
13+
/**
14+
* @package Commercetools\Core\Model\Message
15+
* @link https://docs.commercetools.com/http-api-projects-messages.html#deliveryremoved-message
16+
*/
17+
class DeliveryRemovedMessage extends Message
18+
{
19+
const MESSAGE_TYPE = 'DeliveryRemoved';
20+
21+
public function fieldDefinitions()
22+
{
23+
$definitions = parent::fieldDefinitions();
24+
$definitions['delivery'] = [static::TYPE => Delivery::class];
25+
26+
return $definitions;
27+
}
28+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Model\Message;
7+
8+
use Commercetools\Core\Model\Common\DateTimeDecorator;
9+
use Commercetools\Core\Model\Common\Reference;
10+
use Commercetools\Core\Model\Order\Delivery;
11+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
12+
use Commercetools\Core\Model\Order\Parcel;
13+
use DateTime;
14+
15+
/**
16+
* @package Commercetools\Core\Model\Message
17+
* @link https://docs.commercetools.com/http-api-projects-messages.html#parceltrackingdataupdated-message
18+
*/
19+
class ParcelItemsUpdatedMessage extends Message
20+
{
21+
const MESSAGE_TYPE = 'ParcelItemsUpdated';
22+
23+
public function fieldDefinitions()
24+
{
25+
$definitions = parent::fieldDefinitions();
26+
$definitions['deliveryId'] = [static::TYPE => 'string'];
27+
$definitions['parcelId'] = [static::TYPE => 'string'];
28+
$definitions['items'] = [static::TYPE => DeliveryItemCollection::class];
29+
30+
return $definitions;
31+
}
32+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Model\Message;
7+
8+
use Commercetools\Core\Model\Common\DateTimeDecorator;
9+
use Commercetools\Core\Model\Common\Reference;
10+
use Commercetools\Core\Model\Order\Delivery;
11+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
12+
use Commercetools\Core\Model\Order\Parcel;
13+
use Commercetools\Core\Model\Order\ParcelMeasurements;
14+
use DateTime;
15+
16+
/**
17+
* @package Commercetools\Core\Model\Message
18+
* @link https://docs.commercetools.com/http-api-projects-messages.html#parcelmeasurementsupdated-message
19+
*/
20+
class ParcelMeasurementsUpdatedMessage extends Message
21+
{
22+
const MESSAGE_TYPE = 'ParcelMeasurementsUpdated';
23+
24+
public function fieldDefinitions()
25+
{
26+
$definitions = parent::fieldDefinitions();
27+
$definitions['deliveryId'] = [static::TYPE => 'string'];
28+
$definitions['parcelId'] = [static::TYPE => 'string'];
29+
$definitions['measurements'] = [static::TYPE => ParcelMeasurements::class];
30+
31+
return $definitions;
32+
}
33+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Model\Message;
7+
8+
use Commercetools\Core\Model\Common\DateTimeDecorator;
9+
use Commercetools\Core\Model\Common\Reference;
10+
use Commercetools\Core\Model\Order\Delivery;
11+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
12+
use Commercetools\Core\Model\Order\Parcel;
13+
use DateTime;
14+
15+
/**
16+
* @package Commercetools\Core\Model\Message
17+
* @link https://docs.commercetools.com/http-api-projects-messages.html#parcelremovedfromdelivery-message
18+
*/
19+
class ParcelRemovedFromDeliveryMessage extends Message
20+
{
21+
const MESSAGE_TYPE = 'ParcelRemovedFromDelivery';
22+
23+
public function fieldDefinitions()
24+
{
25+
$definitions = parent::fieldDefinitions();
26+
$definitions['deliveryId'] = [static::TYPE => 'string'];
27+
$definitions['parcel'] = [static::TYPE => Parcel::class];
28+
29+
return $definitions;
30+
}
31+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Model\Message;
7+
8+
use Commercetools\Core\Model\Common\DateTimeDecorator;
9+
use Commercetools\Core\Model\Common\Reference;
10+
use Commercetools\Core\Model\Order\Delivery;
11+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
12+
use Commercetools\Core\Model\Order\Parcel;
13+
use Commercetools\Core\Model\Order\TrackingData;
14+
use DateTime;
15+
16+
/**
17+
* @package Commercetools\Core\Model\Message
18+
* @link https://docs.commercetools.com/http-api-projects-messages.html#parceltrackingdataupdated-message
19+
*/
20+
class ParcelTrackingDataUpdatedMessage extends Message
21+
{
22+
const MESSAGE_TYPE = 'ParcelTrackingDataUpdated';
23+
24+
public function fieldDefinitions()
25+
{
26+
$definitions = parent::fieldDefinitions();
27+
$definitions['deliveryId'] = [static::TYPE => 'string'];
28+
$definitions['parcelId'] = [static::TYPE => 'string'];
29+
$definitions['trackingData'] = [static::TYPE => TrackingData::class];
30+
31+
return $definitions;
32+
}
33+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Model\Common\Context;
9+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
10+
use Commercetools\Core\Request\AbstractAction;
11+
12+
/**
13+
* @package Commercetools\Core\Request\Orders\Command
14+
*
15+
* @method string getAction()
16+
* @method OrderRemoveDeliveryAction setAction(string $action = null)
17+
* @method string getDeliveryId()
18+
* @method OrderRemoveDeliveryAction setDeliveryId(string $deliveryId = null)
19+
*/
20+
class OrderRemoveDeliveryAction extends AbstractAction
21+
{
22+
public function fieldDefinitions()
23+
{
24+
return [
25+
'action' => [static::TYPE => 'string'],
26+
'deliveryId' => [static::TYPE => 'string'],
27+
];
28+
}
29+
30+
/**
31+
* @param string $deliveryId
32+
* @param Context|callable $context
33+
* @return OrderRemoveDeliveryAction
34+
*/
35+
public static function ofDelivery($deliveryId, $context = null)
36+
{
37+
return static::of($context)->setDeliveryId($deliveryId);
38+
}
39+
40+
/**
41+
* @param array $data
42+
* @param Context|callable $context
43+
*/
44+
public function __construct(array $data = [], $context = null)
45+
{
46+
parent::__construct($data, $context);
47+
$this->setAction('removeDelivery');
48+
}
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Model\Common\Context;
9+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
10+
use Commercetools\Core\Request\AbstractAction;
11+
12+
/**
13+
* @package Commercetools\Core\Request\Orders\Command
14+
*
15+
* @method string getAction()
16+
* @method OrderRemoveParcelFromDeliveryAction setAction(string $action = null)
17+
* @method string getParcelId()
18+
* @method OrderRemoveParcelFromDeliveryAction setParcelId(string $parcelId = null)
19+
*/
20+
class OrderRemoveParcelFromDeliveryAction extends AbstractAction
21+
{
22+
public function fieldDefinitions()
23+
{
24+
return [
25+
'action' => [static::TYPE => 'string'],
26+
'parcelId' => [static::TYPE => 'string'],
27+
];
28+
}
29+
30+
/**
31+
* @param string $parcelId
32+
* @param Context|callable $context
33+
* @return OrderRemoveParcelFromDeliveryAction
34+
*/
35+
public static function ofParcel($parcelId, $context = null)
36+
{
37+
return static::of($context)->setParcelId($parcelId);
38+
}
39+
40+
/**
41+
* @param array $data
42+
* @param Context|callable $context
43+
*/
44+
public function __construct(array $data = [], $context = null)
45+
{
46+
parent::__construct($data, $context);
47+
$this->setAction('removeParcelFromDelivery');
48+
}
49+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Model\Common\Context;
9+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
10+
use Commercetools\Core\Request\AbstractAction;
11+
12+
/**
13+
* @package Commercetools\Core\Request\Orders\Command
14+
*
15+
* @method string getAction()
16+
* @method OrderSetDeliveryItemsAction setAction(string $action = null)
17+
* @method string getDeliveryId()
18+
* @method OrderSetDeliveryItemsAction setDeliveryId(string $deliveryId = null)
19+
* @method DeliveryItemCollection getItems()
20+
* @method OrderSetDeliveryItemsAction setItems(DeliveryItemCollection $items = null)
21+
*/
22+
class OrderSetDeliveryItemsAction extends AbstractAction
23+
{
24+
public function fieldDefinitions()
25+
{
26+
return [
27+
'action' => [static::TYPE => 'string'],
28+
'deliveryId' => [static::TYPE => 'string'],
29+
'items' => [static::TYPE => DeliveryItemCollection::class]
30+
];
31+
}
32+
33+
/**
34+
* @param string $deliveryId
35+
* @param DeliveryItemCollection $items
36+
* @param Context|callable $context
37+
* @return OrderSetDeliveryItemsAction
38+
*/
39+
public static function ofDeliveryAndItems($deliveryId, DeliveryItemCollection $items, $context = null)
40+
{
41+
return static::of($context)->setDeliveryId($deliveryId)->setItems($items);
42+
}
43+
44+
/**
45+
* @param array $data
46+
* @param Context|callable $context
47+
*/
48+
public function __construct(array $data = [], $context = null)
49+
{
50+
parent::__construct($data, $context);
51+
$this->setAction('setDeliveryItems');
52+
}
53+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* @author @jenschude <[email protected]>
4+
*/
5+
6+
namespace Commercetools\Core\Request\Orders\Command;
7+
8+
use Commercetools\Core\Model\Common\Context;
9+
use Commercetools\Core\Model\Order\DeliveryItemCollection;
10+
use Commercetools\Core\Request\AbstractAction;
11+
12+
/**
13+
* @package Commercetools\Core\Request\Orders\Command
14+
*
15+
* @method string getAction()
16+
* @method OrderSetParcelItemsAction setAction(string $action = null)
17+
* @method string getParcelId()
18+
* @method OrderSetParcelItemsAction setParcelId(string $parcelId = null)
19+
* @method DeliveryItemCollection getItems()
20+
* @method OrderSetParcelItemsAction setItems(DeliveryItemCollection $items = null)
21+
*/
22+
class OrderSetParcelItemsAction extends AbstractAction
23+
{
24+
public function fieldDefinitions()
25+
{
26+
return [
27+
'action' => [static::TYPE => 'string'],
28+
'parcelId' => [static::TYPE => 'string'],
29+
'items' => [static::TYPE => DeliveryItemCollection::class]
30+
];
31+
}
32+
33+
/**
34+
* @param string $parcelId
35+
* @param Context|callable $context
36+
* @return OrderSetParcelItemsAction
37+
*/
38+
public static function ofParcel($parcelId, $context = null)
39+
{
40+
return static::of($context)->setParcelId($parcelId);
41+
}
42+
43+
/**
44+
* @param array $data
45+
* @param Context|callable $context
46+
*/
47+
public function __construct(array $data = [], $context = null)
48+
{
49+
parent::__construct($data, $context);
50+
$this->setAction('setParcelItems');
51+
}
52+
}

0 commit comments

Comments
 (0)