1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
*/ |
4
|
|
|
|
5
|
|
|
namespace Commercetools\Core\Request\Carts\Command; |
6
|
|
|
|
7
|
|
|
use Commercetools\Core\Model\Cart\ItemShippingDetailsDraft; |
8
|
|
|
use Commercetools\Core\Model\Common\Context; |
9
|
|
|
use Commercetools\Core\Request\AbstractAction; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @package Commercetools\Core\Request\Carts\Command |
13
|
|
|
* @link https://docs.commercetools.com/http-api-projects-carts.html#set-customlineitemshippingdetails |
14
|
|
|
* @method string getAction() |
15
|
|
|
* @method CartSetCustomLineItemShippingDetailsAction setAction(string $action = null) |
16
|
|
|
* @method string getCustomLineItemId() |
17
|
|
|
* @method CartSetCustomLineItemShippingDetailsAction setCustomLineItemId(string $customLineItemId = null) |
18
|
|
|
* @method ItemShippingDetailsDraft getShippingDetails() |
19
|
|
|
* @codingStandardsIgnoreStart |
20
|
|
|
* @method CartSetCustomLineItemShippingDetailsAction setShippingDetails(ItemShippingDetailsDraft $shippingDetails = null) |
21
|
|
|
* @codingStandardsIgnoreEnd |
22
|
|
|
*/ |
23
|
|
|
class CartSetCustomLineItemShippingDetailsAction extends AbstractAction |
24
|
|
|
{ |
25
|
6 |
|
public function fieldDefinitions() |
26
|
|
|
{ |
27
|
|
|
return [ |
28
|
6 |
|
'action' => [static::TYPE => 'string'], |
29
|
6 |
|
'customLineItemId' => [static::TYPE => 'string'], |
30
|
6 |
|
'shippingDetails' => [static::TYPE => ItemShippingDetailsDraft::class], |
31
|
|
|
]; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param array $data |
36
|
|
|
* @param Context|callable $context |
37
|
|
|
*/ |
38
|
6 |
|
public function __construct(array $data = [], $context = null) |
39
|
|
|
{ |
40
|
6 |
|
parent::__construct($data, $context); |
41
|
6 |
|
$this->setAction('setCustomLineItemShippingDetails'); |
42
|
6 |
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param $customLineItemId |
46
|
|
|
* @param ItemShippingDetailsDraft $itemShippingDetailsDraft |
47
|
|
|
* @param Context|callable $context |
48
|
|
|
* @return CartSetCustomLineItemShippingDetailsAction |
49
|
|
|
*/ |
50
|
2 |
|
public static function ofCustomLineItemIdAndShippingDetails( |
51
|
|
|
$customLineItemId, |
52
|
|
|
ItemShippingDetailsDraft $itemShippingDetailsDraft, |
53
|
|
|
$context = null |
54
|
|
|
) { |
55
|
2 |
|
return static::of($context) |
56
|
2 |
|
->setCustomLineItemId($customLineItemId) |
57
|
2 |
|
->setShippingDetails($itemShippingDetailsDraft); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|