1
|
|
|
<?php |
2
|
|
|
namespace CodeCloud\Bundle\ShopifyBundle\Api\Endpoint; |
3
|
|
|
|
4
|
|
|
use CodeCloud\Bundle\ShopifyBundle\Api\Request\GetJson; |
5
|
|
|
use CodeCloud\Bundle\ShopifyBundle\Api\Request\PostJson; |
6
|
|
|
use CodeCloud\Bundle\ShopifyBundle\Api\GenericResource; |
7
|
|
|
|
8
|
|
|
class ApplicationChargeEndpoint extends AbstractEndpoint |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @param array $query |
12
|
|
|
* @return GenericResource[] |
13
|
|
|
*/ |
14
|
|
|
public function findAll(array $query = array()) |
15
|
|
|
{ |
16
|
|
|
$request = new GetJson('/admin/application_charges.json', $query); |
17
|
|
|
$response = $this->send($request); |
18
|
|
|
return $this->createCollection($response->get('application_charges')); |
|
|
|
|
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param int $applicationChargeId |
23
|
|
|
* @return GenericResource |
24
|
|
|
*/ |
25
|
|
|
public function findOne($applicationChargeId) |
26
|
|
|
{ |
27
|
|
|
$request = new GetJson('/admin/application_charges/' . $applicationChargeId . '.json'); |
28
|
|
|
$response = $this->send($request); |
29
|
|
|
return $this->createEntity($response->get('application_charge')); |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param GenericResource $applicationCharge |
34
|
|
|
* @return GenericResource |
35
|
|
|
*/ |
36
|
|
|
public function create(GenericResource $applicationCharge) |
37
|
|
|
{ |
38
|
|
|
$request = new PostJson('/admin/application_charges.json', array('application_charge' => $applicationCharge->toArray())); |
39
|
|
|
$response = $this->send($request); |
40
|
|
|
return $this->createEntity($response->get('application_charge')); |
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param int $applicationChargeId |
45
|
|
|
*/ |
46
|
|
|
public function activate($applicationChargeId) |
47
|
|
|
{ |
48
|
|
|
$request = new PostJson('/admin/application_charges/' . $applicationChargeId . '/activate.json', null); |
49
|
|
|
$this->send($request); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|