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\TrackingData; |
10
|
|
|
use Commercetools\Core\Request\AbstractAction; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @package Commercetools\Core\Request\Orders\Command |
14
|
|
|
* |
15
|
|
|
* @method string getAction() |
16
|
|
|
* @method OrderSetParcelTrackingDataAction setAction(string $action = null) |
17
|
|
|
* @method string getParcelId() |
18
|
|
|
* @method OrderSetParcelTrackingDataAction setParcelId(string $parcelId = null) |
19
|
|
|
* @method TrackingData getTrackingData() |
20
|
|
|
* @method OrderSetParcelTrackingDataAction setTrackingData(TrackingData $trackingData = null) |
21
|
|
|
*/ |
22
|
|
|
class OrderSetParcelTrackingDataAction extends AbstractAction |
23
|
|
|
{ |
24
|
2 |
|
public function fieldDefinitions() |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
2 |
|
'action' => [static::TYPE => 'string'], |
28
|
2 |
|
'parcelId' => [static::TYPE => 'string'], |
29
|
2 |
|
'trackingData' => [static::TYPE => TrackingData::class] |
30
|
|
|
]; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param string $parcelId |
35
|
|
|
* @param Context|callable $context |
36
|
|
|
* @return OrderSetParcelTrackingDataAction |
37
|
|
|
*/ |
38
|
1 |
|
public static function ofParcel($parcelId, $context = null) |
39
|
|
|
{ |
40
|
1 |
|
return static::of($context)->setParcelId($parcelId); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param array $data |
45
|
|
|
* @param Context|callable $context |
46
|
|
|
*/ |
47
|
2 |
|
public function __construct(array $data = [], $context = null) |
48
|
|
|
{ |
49
|
2 |
|
parent::__construct($data, $context); |
50
|
2 |
|
$this->setAction('setParcelTrackingData'); |
51
|
2 |
|
} |
52
|
|
|
} |
53
|
|
|
|