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