1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jenschude <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Request\Orders; |
7
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Common\Context; |
9
|
|
|
use Commercetools\Core\Request\AbstractUpdateRequest; |
10
|
|
|
use Commercetools\Core\Model\Order\Order; |
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\Orders |
18
|
|
|
* @link https://docs.commercetools.com/http-api-projects-orders.html#update-order-by-ordernumber |
19
|
|
|
* @method Order mapResponse(ApiResponseInterface $response) |
20
|
|
|
* @method Order mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) |
21
|
|
|
* @method OrderUpdateByOrderNumberRequest|InStoreRequestDecorator inStore($storeKey) |
22
|
|
|
*/ |
23
|
|
|
class OrderUpdateByOrderNumberRequest extends AbstractUpdateRequest |
24
|
|
|
{ |
25
|
|
|
use InStoreTrait; |
26
|
|
|
|
27
|
|
|
protected $resultClass = Order::class; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param string $orderNumber |
31
|
|
|
* @param int $version |
32
|
|
|
* @param array $actions |
33
|
|
|
* @param Context $context |
34
|
|
|
*/ |
35
|
|
|
public function __construct($orderNumber, $version, array $actions = [], Context $context = null) |
36
|
|
|
{ |
37
|
|
|
parent::__construct(OrdersEndpoint::endpoint(), $orderNumber, $version, $actions, $context); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param string $orderNumber |
42
|
|
|
* @param int $version |
43
|
|
|
* @param Context $context |
44
|
|
|
* @return static |
45
|
|
|
*/ |
46
|
|
|
public static function ofOrderNumberAndVersion($orderNumber, $version, Context $context = null) |
47
|
|
|
{ |
48
|
|
|
return new static($orderNumber, $version, [], $context); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return string |
53
|
|
|
*/ |
54
|
|
|
public function getOrderNumber() |
55
|
|
|
{ |
56
|
|
|
return $this->getId(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param string $orderNumber |
61
|
|
|
* @return $this |
62
|
|
|
*/ |
63
|
|
|
public function setOrderNumber($orderNumber) |
64
|
|
|
{ |
65
|
|
|
return $this->setId($orderNumber); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return string |
70
|
|
|
* @internal |
71
|
|
|
*/ |
72
|
|
|
protected function getPath() |
73
|
|
|
{ |
74
|
|
|
return (string)$this->getEndpoint() . '/order-number=' . urlencode($this->getId()) . $this->getParamString(); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|