1
|
|
|
<?php |
2
|
|
|
namespace CodeCloud\Bundle\ShopifyBundle\Api\Endpoint; |
3
|
|
|
|
4
|
|
|
use CodeCloud\Bundle\ShopifyBundle\Api\GenericResource; |
5
|
|
|
use CodeCloud\Bundle\ShopifyBundle\Api\Request\GetJson; |
6
|
|
|
use CodeCloud\Bundle\ShopifyBundle\Api\Request\PostJson; |
7
|
|
|
|
8
|
|
|
class TransactionEndpoint extends AbstractEndpoint |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @param int $orderId |
12
|
|
|
* @param array $query |
13
|
|
|
* @return array|GenericEntity |
|
|
|
|
14
|
|
|
*/ |
15
|
|
|
public function findByOrder($orderId, array $query = array()) |
16
|
|
|
{ |
17
|
|
|
$request = new GetJson('/admin/orders/' . $orderId . '/transactions.json', $query); |
18
|
|
|
$response = $this->send($request); |
19
|
|
|
return $this->createCollection($response->get('transactions')); |
|
|
|
|
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @param int $orderId |
24
|
|
|
* @return int |
25
|
|
|
*/ |
26
|
|
|
public function countByOrder($orderId) |
27
|
|
|
{ |
28
|
|
|
$request = new GetJson('/admin/orders/' . $orderId . '/transactions/count.json'); |
29
|
|
|
$response = $this->send($request); |
30
|
|
|
return $response->get('count'); |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param int $orderId |
35
|
|
|
* @param int $transactionId |
36
|
|
|
* @param array $fields |
37
|
|
|
* @return GenericEntity |
38
|
|
|
*/ |
39
|
|
|
public function findOne($orderId, $transactionId, array $fields = array()) |
40
|
|
|
{ |
41
|
|
|
$params = $fields ? array('fields' => implode(',', $fields)) : array(); |
42
|
|
|
$request = new GetJson('/admin/orders/' . $orderId . '/transactions/' . $transactionId . '.json', $params); |
43
|
|
|
$response = $this->send($request); |
44
|
|
|
return $this->createEntity($response->get('transaction')); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param int $orderId |
49
|
|
|
* @param float|null $amount |
50
|
|
|
*/ |
51
|
|
|
public function capture($orderId, $amount = null) |
52
|
|
|
{ |
53
|
|
|
$params = array('kind' => 'capture'); |
54
|
|
|
|
55
|
|
|
if ($amount) { |
56
|
|
|
$params['amount'] = (float)$amount; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
$request = new PostJson('/admin/orders/' . $orderId . '/transactions.json', array('transaction' => $params)); |
60
|
|
|
$this->send($request); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param int $orderId |
65
|
|
|
* @param GenericResource $transaction |
66
|
|
|
* @return GenericEntity |
67
|
|
|
*/ |
68
|
|
|
public function create($orderId, GenericResource $transaction) |
69
|
|
|
{ |
70
|
|
|
$request = new PostJson('/admin/orders/' . $orderId . '/transactions.json', array( |
71
|
|
|
'transaction' => $transaction->toArray(), |
72
|
|
|
)); |
73
|
|
|
$response = $this->send($request); |
74
|
|
|
|
75
|
|
|
return $this->createEntity($response->get('transaction')); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths