|
1
|
|
|
<?php namespace Arcanedev\Stripe\Resources; |
|
2
|
|
|
|
|
3
|
|
|
use Arcanedev\Stripe\Contracts\Resources\ApplicationFee as ApplicationFeeContract; |
|
4
|
|
|
use Arcanedev\Stripe\StripeResource; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* Class ApplicationFee |
|
8
|
|
|
* |
|
9
|
|
|
* @package Arcanedev\Stripe\Resources |
|
10
|
|
|
* @author ARCANEDEV <[email protected]> |
|
11
|
|
|
* @link https://stripe.com/docs/api/php#application_fees |
|
12
|
|
|
* |
|
13
|
|
|
* @property string id |
|
14
|
|
|
* @property string object // "application_fee" |
|
15
|
|
|
* @property string account |
|
16
|
|
|
* @property int amount |
|
17
|
|
|
* @property int amount_refunded |
|
18
|
|
|
* @property string application |
|
19
|
|
|
* @property string balance_transaction |
|
20
|
|
|
* @property string charge |
|
21
|
|
|
* @property int created // timestamp |
|
22
|
|
|
* @property string currency |
|
23
|
|
|
* @property bool livemode |
|
24
|
|
|
* @property string originating_transaction |
|
25
|
|
|
* @property bool refunded |
|
26
|
|
|
* @property \Arcanedev\Stripe\Collection refunds |
|
27
|
|
|
*/ |
|
28
|
|
|
class ApplicationFee extends StripeResource implements ApplicationFeeContract |
|
29
|
|
|
{ |
|
30
|
|
|
/* ----------------------------------------------------------------- |
|
31
|
|
|
| Constants |
|
32
|
|
|
| ----------------------------------------------------------------- |
|
33
|
|
|
*/ |
|
34
|
|
|
|
|
35
|
|
|
const PATH_REFUNDS = '/refunds'; |
|
36
|
|
|
|
|
37
|
|
|
/* ----------------------------------------------------------------- |
|
38
|
|
|
| Getters & Setters |
|
39
|
|
|
| ----------------------------------------------------------------- |
|
40
|
|
|
*/ |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* This is a special case because the application fee endpoint has an |
|
44
|
|
|
* underscore in it. The parent `className` function strips underscores. |
|
45
|
|
|
* |
|
46
|
|
|
* @param string $class |
|
47
|
|
|
* |
|
48
|
|
|
* @return string |
|
49
|
|
|
*/ |
|
50
|
2 |
|
public static function className($class = '') |
|
51
|
|
|
{ |
|
52
|
2 |
|
return parent::className(); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/* ----------------------------------------------------------------- |
|
56
|
|
|
| Main Methods |
|
57
|
|
|
| ----------------------------------------------------------------- |
|
58
|
|
|
*/ |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* List all Application Fees. |
|
62
|
|
|
* @link https://stripe.com/docs/api/php#list_application_fees |
|
63
|
|
|
* |
|
64
|
|
|
* @param array $params |
|
65
|
|
|
* @param array|string|null $options |
|
66
|
|
|
* |
|
67
|
|
|
* @return \Arcanedev\Stripe\Collection|array |
|
68
|
|
|
*/ |
|
69
|
2 |
|
public static function all($params = [], $options = null) |
|
70
|
|
|
{ |
|
71
|
2 |
|
return self::scopedAll($params, $options); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Retrieving an Application Fee. |
|
76
|
|
|
* |
|
77
|
|
|
* @link https://stripe.com/docs/api/php#retrieve_application_fee |
|
78
|
|
|
* |
|
79
|
|
|
* @param string $id |
|
80
|
|
|
* @param array|string|null $options |
|
81
|
|
|
* |
|
82
|
|
|
* @return self |
|
83
|
|
|
*/ |
|
84
|
|
|
public static function retrieve($id, $options = null) |
|
85
|
|
|
{ |
|
86
|
|
|
return self::scopedRetrieve($id, $options); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Update an Application Fee. |
|
91
|
|
|
* |
|
92
|
|
|
* @param string $id |
|
93
|
|
|
* @param array|null $params |
|
94
|
|
|
* @param array|string|null $options |
|
95
|
|
|
* |
|
96
|
|
|
* @return self |
|
97
|
|
|
*/ |
|
98
|
|
|
public static function update($id, $params = [], $options = null) |
|
99
|
|
|
{ |
|
100
|
|
|
return self::scopedUpdate($id, $params, $options); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Creating an Application Fee Refund. |
|
105
|
|
|
* |
|
106
|
|
|
* @link https://stripe.com/docs/api/php#create_fee_refund |
|
107
|
|
|
* |
|
108
|
|
|
* @param array|null $params |
|
109
|
|
|
* @param array|string|null $options |
|
110
|
|
|
* |
|
111
|
|
|
* @return self |
|
112
|
|
|
*/ |
|
113
|
|
|
public function refund($params = [], $options = null) |
|
114
|
|
|
{ |
|
115
|
|
|
$this->refunds->create($params, $options); |
|
116
|
|
|
$this->refresh(); |
|
117
|
|
|
|
|
118
|
|
|
return $this; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* Create a refund. |
|
123
|
|
|
* |
|
124
|
|
|
* @param string $id |
|
125
|
|
|
* @param array|null $params |
|
126
|
|
|
* @param array|string|null $options |
|
127
|
|
|
* |
|
128
|
|
|
* @return \Arcanedev\Stripe\Resources\ApplicationFeeRefund |
|
129
|
|
|
*/ |
|
130
|
2 |
|
public static function createRefund($id, $params = null, $options = null) |
|
131
|
|
|
{ |
|
132
|
2 |
|
return self::createNestedResource($id, static::PATH_REFUNDS, $params, $options); |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Retrieve a refund. |
|
137
|
|
|
* |
|
138
|
|
|
* @param string $id |
|
139
|
|
|
* @param string $refundId |
|
140
|
|
|
* @param array|null $params |
|
141
|
|
|
* @param array|string|null $options |
|
142
|
|
|
* |
|
143
|
|
|
* @return \Arcanedev\Stripe\Resources\ApplicationFeeRefund |
|
144
|
|
|
*/ |
|
145
|
2 |
|
public static function retrieveRefund($id, $refundId, $params = null, $options = null) |
|
146
|
|
|
{ |
|
147
|
2 |
|
return self::retrieveNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $options); |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* Update a refund. |
|
152
|
|
|
* |
|
153
|
|
|
* @param string $id |
|
154
|
|
|
* @param string $refundId |
|
155
|
|
|
* @param array|null $params |
|
156
|
|
|
* @param array|string|null $options |
|
157
|
|
|
* |
|
158
|
|
|
* @return \Arcanedev\Stripe\Resources\ApplicationFeeRefund |
|
159
|
|
|
*/ |
|
160
|
2 |
|
public static function updateRefund($id, $refundId, $params = null, $options = null) |
|
161
|
|
|
{ |
|
162
|
2 |
|
return self::updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $options); |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* Get all the refund. |
|
167
|
|
|
* |
|
168
|
|
|
* @param string $id |
|
169
|
|
|
* @param array|null $params |
|
170
|
|
|
* @param array|string|null $options |
|
171
|
|
|
* |
|
172
|
|
|
* @return \Arcanedev\Stripe\Collection |
|
173
|
|
|
*/ |
|
174
|
2 |
|
public static function allRefunds($id, $params = null, $options = null) |
|
175
|
|
|
{ |
|
176
|
2 |
|
return self::allNestedResources($id, static::PATH_REFUNDS, $params, $options); |
|
177
|
|
|
} |
|
178
|
|
|
} |
|
179
|
|
|
|