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('create', new Action(Request::METHOD_POST, 'price_rules/%s/discount_codes.json', 'discount_code', 'discount_code')); |
33
|
5 |
|
$this->actions->add('createBatch', new Action(Request::METHOD_POST, 'price_rules/%s/batch.json', 'discount_code_creation', 'discount_codes')); |
34
|
5 |
|
$this->actions->add('get', new Action(Request::METHOD_GET, 'price_rules/%s/discount_codes/%s.json', 'discount_code','discount_code')); |
35
|
5 |
|
$this->actions->add('getBatch', new Action(Request::METHOD_GET, 'price_rules/%s/batch/%s.json', 'discount_code_creation', 'discount_code_creation')); |
36
|
5 |
|
$this->actions->add('all', new Action(Request::METHOD_GET, 'price_rules/%s/discount_codes.json', 'discount_codes', 'discount_codes')); |
37
|
5 |
|
$this->actions->add('allBatch', new Action(Request::METHOD_GET, 'price_rules/%s/batch/%s/discount_codes.json', 'discount_codes', 'discount_codes')); |
38
|
5 |
|
$this->actions->add('lookup', new Action(Request::METHOD_GET, 'discount_codes/lookup.json', 'discount_code', 'discount_code')); |
39
|
5 |
|
$this->actions->add('update', new Action(Request::METHOD_PUT, 'price_rules/%s/discount_codes/%s.json', 'discount_code', 'discount_code')); |
40
|
5 |
|
$this->actions->add('delete', new Action(Request::METHOD_DELETE, 'price_rules/%s/discount_codes/%s.json')); |
41
|
5 |
|
} |
42
|
|
|
} |
43
|
|
|
|