|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author @jenschude <[email protected]> |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Request\Me; |
|
7
|
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Cart\Cart; |
|
9
|
|
|
use Commercetools\Core\Model\Common\Context; |
|
10
|
|
|
use Commercetools\Core\Request\AbstractUpdateRequest; |
|
11
|
|
|
use Commercetools\Core\Request\InStores\InStoreRequestDecorator; |
|
12
|
|
|
use Commercetools\Core\Request\InStores\InStoreTrait; |
|
13
|
|
|
use Commercetools\Core\Response\ApiResponseInterface; |
|
14
|
|
|
use Commercetools\Core\Model\MapperInterface; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @package Commercetools\Core\Request\Me |
|
18
|
|
|
* @link https://docs.commercetools.com/http-api-projects-me-carts.html#update-cart |
|
19
|
|
|
* @method Cart mapResponse(ApiResponseInterface $response) |
|
20
|
|
|
* @method Cart mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) |
|
21
|
|
|
* @method MeCartUpdateRequest|InStoreRequestDecorator inStore($storeKey) |
|
22
|
|
|
*/ |
|
23
|
|
|
class MeCartUpdateRequest extends AbstractUpdateRequest |
|
24
|
|
|
{ |
|
25
|
|
|
use InStoreTrait; |
|
26
|
|
|
|
|
27
|
|
|
protected $resultClass = Cart::class; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @param string $id |
|
31
|
|
|
* @param int $version |
|
32
|
|
|
* @param array $actions |
|
33
|
|
|
* @param Context $context |
|
34
|
|
|
*/ |
|
35
|
1 |
|
public function __construct($id, $version, array $actions = [], Context $context = null) |
|
36
|
|
|
{ |
|
37
|
1 |
|
parent::__construct(MeCartsEndpoint::endpoint(), $id, $version, $actions, $context); |
|
38
|
1 |
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param string $id |
|
42
|
|
|
* @param int $version |
|
43
|
|
|
* @param Context $context |
|
44
|
|
|
* @return static |
|
45
|
|
|
*/ |
|
46
|
1 |
|
public static function ofIdAndVersion($id, $version, Context $context = null) |
|
47
|
|
|
{ |
|
48
|
1 |
|
return new static($id, $version, [], $context); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|