|
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
|
|
|
|
|
7
|
|
|
class TransactionEndpoint extends AbstractEndpoint |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* @param int $orderId |
|
11
|
|
|
* @param array $query |
|
12
|
|
|
* @return array|GenericEntity |
|
|
|
|
|
|
13
|
|
|
*/ |
|
14
|
|
|
public function findByOrder($orderId, array $query = array()) |
|
15
|
|
|
{ |
|
16
|
|
|
$request = new GetJson('/admin/orders/' . $orderId . '/transactions.json', $query); |
|
17
|
|
|
$response = $this->send($request); |
|
18
|
|
|
return $this->createCollection($response->get('transactions')); |
|
|
|
|
|
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @param int $orderId |
|
23
|
|
|
* @return int |
|
24
|
|
|
*/ |
|
25
|
|
|
public function countByOrder($orderId) |
|
26
|
|
|
{ |
|
27
|
|
|
$request = new GetJson('/admin/orders/' . $orderId . '/transactions/count.json'); |
|
28
|
|
|
$response = $this->send($request); |
|
29
|
|
|
return $response->get('count'); |
|
|
|
|
|
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @param int $orderId |
|
34
|
|
|
* @param int $transactionId |
|
35
|
|
|
* @param array $fields |
|
36
|
|
|
* @return GenericEntity |
|
37
|
|
|
*/ |
|
38
|
|
|
public function findOne($orderId, $transactionId, array $fields = array()) |
|
39
|
|
|
{ |
|
40
|
|
|
$params = $fields ? array('fields' => implode(',', $fields)) : array(); |
|
41
|
|
|
$request = new GetJson('/admin/orders/' . $orderId . '/transactions/' . $transactionId . '.json', $params); |
|
42
|
|
|
$response = $this->send($request); |
|
43
|
|
|
return $this->createEntity($response->get('transaction')); |
|
|
|
|
|
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @param int $orderId |
|
48
|
|
|
* @param float|null $amount |
|
49
|
|
|
*/ |
|
50
|
|
|
public function capture($orderId, $amount = null) |
|
51
|
|
|
{ |
|
52
|
|
|
$params = array('kind' => 'capture'); |
|
53
|
|
|
|
|
54
|
|
|
if ($amount) { |
|
55
|
|
|
$params['amount'] = (float)$amount; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
$request = new PostJson('/admin/orders/' . $orderId . '/transactions.json', array('transaction' => $params)); |
|
59
|
|
|
$this->send($request); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
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