|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ShopifyClient\Resource; |
|
4
|
|
|
|
|
5
|
|
|
use ShopifyClient\Action\Action; |
|
6
|
|
|
use ShopifyClient\Request; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* https://help.shopify.com/api/reference/order |
|
10
|
|
|
* |
|
11
|
|
|
* @method create(array $parameters = []) |
|
12
|
|
|
* @method get(float $parentId) |
|
13
|
|
|
* @method all(array $parameters = []) |
|
14
|
|
|
* @method count(array $parameters = []) |
|
15
|
|
|
* @method update(float $parentId, array $parameters = []) |
|
16
|
|
|
* @method open(float $parentId) |
|
17
|
|
|
* @method close(float $parentId) |
|
18
|
|
|
* @method cancel(float $parentId) |
|
19
|
|
|
* @method delete(float $parentId) |
|
20
|
|
|
* |
|
21
|
|
|
* @property OrderMetaField $metafields |
|
22
|
|
|
* @property OrderRisk $risks |
|
23
|
|
|
* @property Fulfillment $fulfillments |
|
24
|
|
|
*/ |
|
25
|
|
|
class Order extends AbstractResource implements Resource |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* @var array |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $childResources = [ |
|
31
|
|
|
'metafields' => OrderMetaField::class, |
|
32
|
|
|
'risks' => OrderRisk::class, |
|
33
|
|
|
'fulfillments' => Fulfillment::class, |
|
34
|
|
|
]; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Order constructor. |
|
38
|
|
|
* @param Request $request |
|
39
|
|
|
*/ |
|
40
|
5 |
|
public function __construct(Request $request) |
|
41
|
|
|
{ |
|
42
|
5 |
|
parent::__construct($request); |
|
43
|
|
|
|
|
44
|
5 |
|
$this->actions->add('create', new Action(Request::METHOD_POST, 'orders.json', 'order', 'order')); |
|
45
|
5 |
|
$this->actions->add('get', new Action(Request::METHOD_GET, 'orders/%s.json', 'order', 'order')); |
|
46
|
5 |
|
$this->actions->add('all', new Action(Request::METHOD_GET, 'orders.json', 'orders', 'orders')); |
|
47
|
5 |
|
$this->actions->add('count', new Action(Request::METHOD_GET, 'orders/count.json', 'count', 'count')); |
|
48
|
5 |
|
$this->actions->add('update', new Action(Request::METHOD_PUT, 'orders/%s.json', 'order', 'order')); |
|
49
|
5 |
|
$this->actions->add('open', new Action(Request::METHOD_POST, 'orders/%s/open.json', 'order', 'order')); |
|
50
|
5 |
|
$this->actions->add('close', new Action(Request::METHOD_POST, 'orders/%s/close.json', 'order', 'order')); |
|
51
|
5 |
|
$this->actions->add('cancel', new Action(Request::METHOD_POST, 'orders/%s/cancel.json', 'order', 'order')); |
|
52
|
5 |
|
$this->actions->add('delete', new Action(Request::METHOD_DELETE, 'orders/%s.json')); |
|
53
|
5 |
|
} |
|
54
|
|
|
|
|
55
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|