|
1
|
|
|
<?php namespace Arcanedev\Stripe\Resources; |
|
2
|
|
|
|
|
3
|
|
|
use Arcanedev\Stripe\Contracts\Resources\InvoiceItem as InvoiceItemContract; |
|
4
|
|
|
use Arcanedev\Stripe\StripeResource; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* Class InvoiceItem |
|
8
|
|
|
* |
|
9
|
|
|
* @package Arcanedev\Stripe\Resources |
|
10
|
|
|
* @author ARCANEDEV <[email protected]> |
|
11
|
|
|
* @link https://stripe.com/docs/api/php#invoiceitem_object |
|
12
|
|
|
* |
|
13
|
|
|
* @property string id |
|
14
|
|
|
* @property string object // 'invoiceitem' |
|
15
|
|
|
* @property int amount |
|
16
|
|
|
* @property string currency |
|
17
|
|
|
* @property string customer |
|
18
|
|
|
* @property int date // timestamp |
|
19
|
|
|
* @property string description |
|
20
|
|
|
* @property bool discountable |
|
21
|
|
|
* @property string invoice |
|
22
|
|
|
* @property bool livemode |
|
23
|
|
|
* @property \Arcanedev\Stripe\AttachedObject metadata |
|
24
|
|
|
* @property \Arcanedev\Stripe\StripeObject period |
|
25
|
|
|
* @property \Arcanedev\Stripe\Resources\Plan plan |
|
26
|
|
|
* @property bool proration |
|
27
|
|
|
* @property int quantity |
|
28
|
|
|
* @property string subscription |
|
29
|
|
|
*/ |
|
30
|
|
|
class InvoiceItem extends StripeResource implements InvoiceItemContract |
|
31
|
|
|
{ |
|
32
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
33
|
|
|
| Getters & Setters |
|
34
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
35
|
|
|
*/ |
|
36
|
|
|
/** |
|
37
|
|
|
* Get the endpoint URL for the given class. |
|
38
|
|
|
* |
|
39
|
|
|
* @param string $class |
|
40
|
|
|
* |
|
41
|
|
|
* @return string |
|
42
|
|
|
*/ |
|
43
|
30 |
|
public static function classUrl($class = '') |
|
44
|
|
|
{ |
|
45
|
30 |
|
return '/v1/invoiceitems'; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/* ------------------------------------------------------------------------------------------------ |
|
49
|
|
|
| Main Functions |
|
50
|
|
|
| ------------------------------------------------------------------------------------------------ |
|
51
|
|
|
*/ |
|
52
|
|
|
/** |
|
53
|
|
|
* List all Invoice Items. |
|
54
|
|
|
* @link https://stripe.com/docs/api/php#list_invoiceitems |
|
55
|
|
|
* |
|
56
|
|
|
* @param array $params |
|
57
|
|
|
* @param array|string|null $options |
|
58
|
|
|
* |
|
59
|
|
|
* @return \Arcanedev\Stripe\Collection|array |
|
60
|
|
|
*/ |
|
61
|
4 |
|
public static function all($params = [], $options = null) |
|
62
|
|
|
{ |
|
63
|
4 |
|
return self::scopedAll($params, $options); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Retrieve an Invoice Item. |
|
68
|
|
|
* @link https://stripe.com/docs/api/php#retrieve_invoiceitem |
|
69
|
|
|
* |
|
70
|
|
|
* @param string $id |
|
71
|
|
|
* @param array|string|null $options |
|
72
|
|
|
* |
|
73
|
|
|
* @return self |
|
74
|
|
|
*/ |
|
75
|
2 |
|
public static function retrieve($id, $options = null) |
|
76
|
|
|
{ |
|
77
|
2 |
|
return self::scopedRetrieve($id, $options); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Create an Invoice Item. |
|
82
|
|
|
* @link https://stripe.com/docs/api/php#create_invoiceitem |
|
83
|
|
|
* |
|
84
|
|
|
* @param array $params |
|
85
|
|
|
* @param array|string|null $options |
|
86
|
|
|
* |
|
87
|
|
|
* @return self|array |
|
88
|
|
|
*/ |
|
89
|
28 |
|
public static function create($params = [], $options = null) |
|
90
|
|
|
{ |
|
91
|
28 |
|
return self::scopedCreate($params, $options); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Update an Invoice Item. |
|
96
|
|
|
* @link https://stripe.com/docs/api/php#update_invoiceitem |
|
97
|
|
|
* |
|
98
|
|
|
* @param string $id |
|
99
|
|
|
* @param array|null $params |
|
100
|
|
|
* @param array|string|null $options |
|
101
|
|
|
* |
|
102
|
|
|
* @return self |
|
103
|
|
|
*/ |
|
104
|
2 |
|
public static function update($id, $params = [], $options = null) |
|
105
|
|
|
{ |
|
106
|
2 |
|
return self::scopedUpdate($id, $params, $options); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Update/Save an Invoice Item. |
|
111
|
|
|
* @link https://stripe.com/docs/api/php#update_invoiceitem |
|
112
|
|
|
* |
|
113
|
|
|
* @param array|string|null $options |
|
114
|
|
|
* |
|
115
|
|
|
* @return self |
|
116
|
|
|
*/ |
|
117
|
2 |
|
public function save($options = null) |
|
118
|
|
|
{ |
|
119
|
2 |
|
return self::scopedSave($options); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* Delete an Invoice Item |
|
124
|
|
|
* @link https://stripe.com/docs/api/php#delete_invoiceitem |
|
125
|
|
|
* |
|
126
|
|
|
* @param array $params |
|
127
|
|
|
* @param array|string|null $options |
|
128
|
|
|
* |
|
129
|
|
|
* @return self |
|
130
|
|
|
*/ |
|
131
|
2 |
|
public function delete($params = [], $options = null) |
|
132
|
|
|
{ |
|
133
|
2 |
|
return self::scopedDelete($params, $options); |
|
134
|
|
|
} |
|
135
|
|
|
} |
|
136
|
|
|
|