|
1
|
|
|
<?php namespace Arcanedev\Stripe\Resources; |
|
2
|
|
|
|
|
3
|
|
|
use Arcanedev\Stripe\Contracts\Resources\ApplicationFeeInterface; |
|
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 ApplicationFeeInterface |
|
29
|
|
|
{ |
|
30
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
31
|
|
|
| Main Functions |
|
32
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
33
|
|
|
*/ |
|
34
|
|
|
/** |
|
35
|
|
|
* This is a special case because the application fee endpoint has an |
|
36
|
|
|
* underscore in it. The parent `className` function strips underscores. |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $class |
|
39
|
|
|
* |
|
40
|
|
|
* @return string |
|
41
|
|
|
*/ |
|
42
|
5 |
|
public static function className($class = '') |
|
43
|
|
|
{ |
|
44
|
5 |
|
return parent::className(); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
48
|
|
|
| CRUD Functions |
|
49
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
50
|
|
|
*/ |
|
51
|
|
|
/** |
|
52
|
|
|
* Retrieving an Application Fee. |
|
53
|
|
|
* |
|
54
|
|
|
* @link https://stripe.com/docs/api/php#retrieve_application_fee |
|
55
|
|
|
* |
|
56
|
|
|
* @param string $id |
|
57
|
|
|
* @param array|string|null $options |
|
58
|
|
|
* |
|
59
|
|
|
* @return self |
|
60
|
|
|
*/ |
|
61
|
|
|
public static function retrieve($id, $options = null) |
|
62
|
|
|
{ |
|
63
|
|
|
return self::scopedRetrieve($id, $options); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* List all Application Fees. |
|
68
|
|
|
* @link https://stripe.com/docs/api/php#list_application_fees |
|
69
|
|
|
* |
|
70
|
|
|
* @param array $params |
|
71
|
|
|
* @param array|string|null $options |
|
72
|
|
|
* |
|
73
|
|
|
* @return \Arcanedev\Stripe\Collection|array |
|
74
|
|
|
*/ |
|
75
|
5 |
|
public static function all($params = [], $options = null) |
|
76
|
|
|
{ |
|
77
|
5 |
|
return self::scopedAll($params, $options); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Update an Application Fee. |
|
82
|
|
|
* |
|
83
|
|
|
* @param string $id |
|
84
|
|
|
* @param array|null $params |
|
85
|
|
|
* @param array|string|null $options |
|
86
|
|
|
* |
|
87
|
|
|
* @return self |
|
88
|
|
|
*/ |
|
89
|
|
|
public static function update($id, $params = [], $options = null) |
|
90
|
|
|
{ |
|
91
|
|
|
return self::scopedUpdate($id, $params, $options); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Creating an Application Fee Refund. |
|
96
|
|
|
* |
|
97
|
|
|
* @link https://stripe.com/docs/api/php#create_fee_refund |
|
98
|
|
|
* |
|
99
|
|
|
* @param array|null $params |
|
100
|
|
|
* @param array|string|null $options |
|
101
|
|
|
* |
|
102
|
|
|
* @return self |
|
103
|
|
|
*/ |
|
104
|
|
|
public function refund($params = [], $options = null) |
|
105
|
|
|
{ |
|
106
|
|
|
$this->refunds->create($params, $options); |
|
|
|
|
|
|
107
|
|
|
$this->refresh(); |
|
108
|
|
|
|
|
109
|
|
|
return $this; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.