1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jayS-de <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Request\Orders; |
7
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Common\Context; |
9
|
|
|
use Commercetools\Core\Request\AbstractByIdGetRequest; |
10
|
|
|
use Commercetools\Core\Response\ApiResponseInterface; |
11
|
|
|
use Commercetools\Core\Model\Order\Order; |
12
|
|
|
use Commercetools\Core\Model\MapperInterface; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @package Commercetools\Core\Request\Orders |
16
|
|
|
* @link https://dev.commercetools.com/http-api-projects-orders.html#get-order-by-ordernumber |
17
|
|
|
* @method Order mapResponse(ApiResponseInterface $response) |
18
|
|
|
* @method Order mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) |
19
|
|
|
*/ |
20
|
|
|
class OrderByOrderNumberGetRequest extends AbstractByIdGetRequest |
21
|
|
|
{ |
22
|
|
|
protected $resultClass = Order::class; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @param string $orderNumber |
26
|
|
|
* @param Context $context |
27
|
|
|
*/ |
28
|
1 |
|
public function __construct($orderNumber, Context $context = null) |
29
|
|
|
{ |
30
|
1 |
|
parent::__construct(OrdersEndpoint::endpoint(), $orderNumber, $context); |
31
|
1 |
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param string $orderNumber |
35
|
|
|
* @param Context $context |
36
|
|
|
* @return static |
37
|
|
|
*/ |
38
|
1 |
|
public static function ofOrderNumber($orderNumber, Context $context = null) |
39
|
|
|
{ |
40
|
1 |
|
return new static($orderNumber, $context); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return string |
45
|
|
|
*/ |
46
|
|
|
public function getOrderNumber() |
47
|
|
|
{ |
48
|
|
|
return $this->getId(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param string $orderNumber |
53
|
|
|
* @return $this |
54
|
|
|
*/ |
55
|
|
|
public function setOrderNumber($orderNumber) |
56
|
|
|
{ |
57
|
|
|
return $this->setId($orderNumber); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return string |
62
|
|
|
* @internal |
63
|
|
|
*/ |
64
|
1 |
|
protected function getPath() |
65
|
|
|
{ |
66
|
1 |
|
return (string)$this->getEndpoint() . '/order-number=' . urlencode($this->getId()) . $this->getParamString(); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|