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
|
|
|
* Creating an Application Fee Refund. |
91
|
|
|
* |
92
|
|
|
* @link https://stripe.com/docs/api/php#create_fee_refund |
93
|
|
|
* |
94
|
|
|
* @param array|null $params |
95
|
|
|
* @param array|string|null $options |
96
|
|
|
* |
97
|
|
|
* @return self |
98
|
|
|
*/ |
99
|
|
|
public function refund($params = [], $options = null) |
100
|
|
|
{ |
101
|
|
|
$this->refunds->create($params, $options); |
102
|
|
|
$this->refresh(); |
103
|
|
|
|
104
|
|
|
return $this; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Create a refund. |
109
|
|
|
* |
110
|
|
|
* @param string $id |
111
|
|
|
* @param array|null $params |
112
|
|
|
* @param array|string|null $options |
113
|
|
|
* |
114
|
|
|
* @return \Arcanedev\Stripe\Resources\ApplicationFeeRefund |
115
|
|
|
*/ |
116
|
2 |
|
public static function createRefund($id, $params = null, $options = null) |
117
|
|
|
{ |
118
|
2 |
|
return self::createNestedResource($id, static::PATH_REFUNDS, $params, $options); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Retrieve a refund. |
123
|
|
|
* |
124
|
|
|
* @param string $id |
125
|
|
|
* @param string $refundId |
126
|
|
|
* @param array|null $params |
127
|
|
|
* @param array|string|null $options |
128
|
|
|
* |
129
|
|
|
* @return \Arcanedev\Stripe\Resources\ApplicationFeeRefund |
130
|
|
|
*/ |
131
|
2 |
|
public static function retrieveRefund($id, $refundId, $params = null, $options = null) |
132
|
|
|
{ |
133
|
2 |
|
return self::retrieveNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $options); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Update a refund. |
138
|
|
|
* |
139
|
|
|
* @param string $id |
140
|
|
|
* @param string $refundId |
141
|
|
|
* @param array|null $params |
142
|
|
|
* @param array|string|null $options |
143
|
|
|
* |
144
|
|
|
* @return \Arcanedev\Stripe\Resources\ApplicationFeeRefund |
145
|
|
|
*/ |
146
|
2 |
|
public static function updateRefund($id, $refundId, $params = null, $options = null) |
147
|
|
|
{ |
148
|
2 |
|
return self::updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $options); |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* Get all the refund. |
153
|
|
|
* |
154
|
|
|
* @param string $id |
155
|
|
|
* @param array|null $params |
156
|
|
|
* @param array|string|null $options |
157
|
|
|
* |
158
|
|
|
* @return \Arcanedev\Stripe\Collection |
159
|
|
|
*/ |
160
|
2 |
|
public static function allRefunds($id, $params = null, $options = null) |
161
|
|
|
{ |
162
|
2 |
|
return self::allNestedResources($id, static::PATH_REFUNDS, $params, $options); |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
|