1
|
|
|
<?php namespace Arcanedev\Stripe\Resources; |
2
|
|
|
|
3
|
|
|
use Arcanedev\Stripe\Contracts\Resources\Plan as PlanContract; |
4
|
|
|
use Arcanedev\Stripe\StripeResource; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* Class Plan |
8
|
|
|
* |
9
|
|
|
* @package Arcanedev\Stripe\Resources |
10
|
|
|
* @author ARCANEDEV <[email protected]> |
11
|
|
|
* @link https://stripe.com/docs/api/php#plan_object |
12
|
|
|
* |
13
|
|
|
* @property string id |
14
|
|
|
* @property string object // 'plan' |
15
|
|
|
* @property int amount |
16
|
|
|
* @property int created // timestamp |
17
|
|
|
* @property int currency |
18
|
|
|
* @property string interval // 'day', 'week', 'month' or 'year' |
19
|
|
|
* @property int interval_count |
20
|
|
|
* @property bool livemode |
21
|
|
|
* @property \Arcanedev\Stripe\AttachedObject metadata |
22
|
|
|
* @property string name |
23
|
|
|
* @property int trial_period_days |
24
|
|
|
* @property string statement_descriptor |
25
|
|
|
*/ |
26
|
|
|
class Plan extends StripeResource implements PlanContract |
27
|
|
|
{ |
28
|
|
|
/* ------------------------------------------------------------------------------------------------ |
29
|
|
|
| Main Functions |
30
|
|
|
| ------------------------------------------------------------------------------------------------ |
31
|
|
|
*/ |
32
|
|
|
/** |
33
|
|
|
* List all Plans. |
34
|
|
|
* @link https://stripe.com/docs/api/php#list_plans |
35
|
|
|
* |
36
|
|
|
* @param array|null $params |
37
|
|
|
* @param array|string|null $options |
38
|
|
|
* |
39
|
|
|
* @return \Arcanedev\Stripe\Collection|array |
40
|
|
|
*/ |
41
|
2 |
|
public static function all($params = [], $options = null) |
42
|
|
|
{ |
43
|
2 |
|
return self::scopedAll($params, $options); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Retrieve a Plan. |
48
|
|
|
* @link https://stripe.com/docs/api/php#retrieve_plan |
49
|
|
|
* |
50
|
|
|
* @param string $id |
51
|
|
|
* @param array|string|null $options |
52
|
|
|
* |
53
|
|
|
* @return self |
54
|
|
|
*/ |
55
|
28 |
|
public static function retrieve($id, $options = null) |
56
|
|
|
{ |
57
|
28 |
|
return self::scopedRetrieve($id, $options); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Create a Plan. |
62
|
|
|
* @link https://stripe.com/docs/api/php#create_plan |
63
|
|
|
* |
64
|
|
|
* @param array|null $params |
65
|
|
|
* @param array|string|null $options |
66
|
|
|
* |
67
|
|
|
* @return self|array |
68
|
|
|
*/ |
69
|
28 |
|
public static function create($params = [], $options = null) |
70
|
|
|
{ |
71
|
28 |
|
return self::scopedCreate($params, $options); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Update a Plan. |
76
|
|
|
* @link https://stripe.com/docs/api/php#update_plan |
77
|
|
|
* |
78
|
|
|
* @param string $id |
79
|
|
|
* @param array|null $params |
80
|
|
|
* @param array|string|null $options |
81
|
|
|
* |
82
|
|
|
* @return self |
83
|
|
|
*/ |
84
|
2 |
|
public static function update($id, $params = [], $options = null) |
85
|
|
|
{ |
86
|
2 |
|
return self::scopedUpdate($id, $params, $options); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Update/Save a Plan. |
91
|
|
|
* @link https://stripe.com/docs/api/php#update_plan |
92
|
|
|
* |
93
|
|
|
* @param array|string|null $options |
94
|
|
|
* |
95
|
|
|
* @return self |
96
|
|
|
*/ |
97
|
2 |
|
public function save($options = null) |
98
|
|
|
{ |
99
|
2 |
|
return self::scopedSave($options); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Delete a plan. |
104
|
|
|
* @link https://stripe.com/docs/api/php#delete_plan |
105
|
|
|
* |
106
|
|
|
* @param array|null $params |
107
|
|
|
* @param array|string|null $options |
108
|
|
|
* |
109
|
|
|
* @return self |
110
|
|
|
*/ |
111
|
2 |
|
public function delete($params = [], $options = null) |
112
|
|
|
{ |
113
|
2 |
|
return self::scopedDelete($params, $options); |
114
|
|
|
} |
115
|
|
|
} |
116
|
|
|
|