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/fulfillment |
10
|
|
|
* |
11
|
|
|
* @method create(array $parameters = []) |
12
|
|
|
* @method get(float $parentId, float $childId, array $parameters = []) |
13
|
|
|
* @method all(float $parentId, array $parameters = []) |
14
|
|
|
* @method count(float $parentId) |
15
|
|
|
* @method update(float $parentId, float $childId, array $parameters = []) |
16
|
|
|
* @method complete(float $parentId, float $childId) |
17
|
|
|
* @method open(float $parentId, float $childId) |
18
|
|
|
* @method cancel(float $parentId, float $childId) |
19
|
|
|
* |
20
|
|
|
* @property FulfillmentEvent $events |
21
|
|
|
*/ |
22
|
|
|
class Fulfillment extends AbstractResource implements Resource |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var array |
26
|
|
|
*/ |
27
|
|
|
protected $childResources = [ |
28
|
|
|
'events' => FulfillmentEvent::class, |
29
|
|
|
]; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Fulfillment constructor. |
33
|
|
|
* @param Request $request |
34
|
|
|
*/ |
35
|
5 |
|
public function __construct(Request $request) |
36
|
|
|
{ |
37
|
5 |
|
parent::__construct($request); |
38
|
|
|
|
39
|
5 |
|
$this->actions->add( |
40
|
5 |
|
'create', |
41
|
5 |
|
new Action( |
42
|
5 |
|
Request::METHOD_POST, |
43
|
5 |
|
'orders/%s/fulfillments.json', |
44
|
5 |
|
'fulfillment', |
45
|
5 |
|
'fulfillment' |
46
|
|
|
) |
47
|
|
|
); |
48
|
5 |
|
$this->actions->add( |
49
|
5 |
|
'get', |
50
|
5 |
|
new Action( |
51
|
5 |
|
Request::METHOD_GET, |
52
|
5 |
|
'orders/%s/fulfillments/%s.json', |
53
|
5 |
|
'fulfillment', |
54
|
5 |
|
'fulfillment' |
55
|
|
|
) |
56
|
|
|
); |
57
|
5 |
|
$this->actions->add( |
58
|
5 |
|
'all', |
59
|
5 |
|
new Action( |
60
|
5 |
|
Request::METHOD_GET, |
61
|
5 |
|
'orders/%s/fulfillments.json', |
62
|
5 |
|
'fulfillments', |
63
|
5 |
|
'fulfillments' |
64
|
|
|
) |
65
|
|
|
); |
66
|
5 |
|
$this->actions->add( |
67
|
5 |
|
'count', |
68
|
5 |
|
new Action( |
69
|
5 |
|
Request::METHOD_GET, |
70
|
5 |
|
'orders/%s/fulfillments/count.json', |
71
|
5 |
|
'count', |
72
|
5 |
|
'count' |
73
|
|
|
) |
74
|
|
|
); |
75
|
5 |
|
$this->actions->add( |
76
|
5 |
|
'update', |
77
|
5 |
|
new Action( |
78
|
5 |
|
Request::METHOD_PUT, |
79
|
5 |
|
'orders/%s/fulfillments/%s.json', |
80
|
5 |
|
'fulfillment', |
81
|
5 |
|
'fulfillment' |
82
|
|
|
) |
83
|
|
|
); |
84
|
5 |
|
$this->actions->add( |
85
|
5 |
|
'complete', |
86
|
5 |
|
new Action( |
87
|
5 |
|
Request::METHOD_POST, |
88
|
5 |
|
'orders/%s/fulfillments/%s/complete.json', |
89
|
5 |
|
'fulfillment', |
90
|
5 |
|
'fulfillment' |
91
|
|
|
) |
92
|
|
|
); |
93
|
5 |
|
$this->actions->add( |
94
|
5 |
|
'open', |
95
|
5 |
|
new Action( |
96
|
5 |
|
Request::METHOD_POST, |
97
|
5 |
|
'orders/%s/fulfillments/%s/open.json', |
98
|
5 |
|
'fulfillment', |
99
|
5 |
|
'fulfillment' |
100
|
|
|
) |
101
|
|
|
); |
102
|
5 |
|
$this->actions->add( |
103
|
5 |
|
'cancel', |
104
|
5 |
|
new Action( |
105
|
5 |
|
Request::METHOD_POST, |
106
|
5 |
|
'orders/%s/fulfillments/%s/cancel.json', |
107
|
5 |
|
'fulfillment', |
108
|
5 |
|
'fulfillment' |
109
|
|
|
) |
110
|
|
|
); |
111
|
5 |
|
} |
112
|
|
|
} |
113
|
|
|
|