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