1 | <?php |
||
2 | |||
3 | namespace Srmklive\Chargify\Traits\ChargifyAPI; |
||
4 | |||
5 | trait Transactions |
||
6 | { |
||
7 | /** |
||
8 | * List transactions for a ChargifyClient site. |
||
9 | * |
||
10 | * @param int $page |
||
11 | * @param int $per_page |
||
12 | * @param string $order_by |
||
13 | * |
||
14 | * @return array |
||
15 | */ |
||
16 | public function transactions_for_site($page = 1, $per_page = 200, $order_by = 'created_at'): array |
||
17 | { |
||
18 | $this->apiEndPoint = "/transactions.json?page={$page}&per_page={$per_page}&order_by={$order_by}"; |
||
19 | |||
20 | $this->verb = 'get'; |
||
21 | |||
22 | return $this->doChargifyRequest(); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
23 | } |
||
24 | |||
25 | /** |
||
26 | * List details for a transactions. |
||
27 | * |
||
28 | * @param int $transaction_id |
||
29 | * @param int $page |
||
30 | * @param int $per_page |
||
31 | * |
||
32 | * @return array |
||
33 | */ |
||
34 | public function transaction_details($transaction_id, $page = 1, $per_page = 200): array |
||
35 | { |
||
36 | $this->apiEndPoint = "/transactions/{$transaction_id}.json?page={$page}&per_page={$per_page}"; |
||
37 | |||
38 | $this->verb = 'get'; |
||
39 | |||
40 | return $this->doChargifyRequest(); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * List transactions for a subscription. |
||
45 | * |
||
46 | * @param int $subscription_id |
||
47 | * @param int $page |
||
48 | * @param int $per_page |
||
49 | * |
||
50 | * @return array |
||
51 | */ |
||
52 | public function transactions_for_subscription($subscription_id, $page = 1, $per_page = 200): array |
||
53 | { |
||
54 | $this->apiEndPoint = "/subscriptions/{$subscription_id}/transactions.json?page={$page}&per_page={$per_page}"; |
||
55 | |||
56 | $this->verb = 'get'; |
||
57 | |||
58 | return $this->doChargifyRequest(); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * List transactions for a ChargifyClient site. |
||
63 | * |
||
64 | * @return array |
||
65 | */ |
||
66 | public function transactions_count(): array |
||
67 | { |
||
68 | $this->apiEndPoint = '/transactions/count.json'; |
||
69 | |||
70 | $this->verb = 'get'; |
||
71 | |||
72 | return $this->doChargifyRequest(); |
||
73 | } |
||
74 | } |
||
75 |