line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/List/Item.pm |
3
|
|
|
|
|
|
|
## Version v0.2.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2019 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2019/11/02 |
7
|
|
|
|
|
|
|
## Modified 2022/10/29 |
8
|
|
|
|
|
|
|
## |
9
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
10
|
|
|
|
|
|
|
package Net::API::Stripe::List::Item; |
11
|
|
|
|
|
|
|
BEGIN |
12
|
|
|
|
|
|
|
{ |
13
|
3
|
|
|
3
|
|
21258522
|
use strict; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
95
|
|
14
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
89
|
|
15
|
3
|
|
|
3
|
|
18
|
use parent qw( Net::API::Stripe::Generic ); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
18
|
|
16
|
3
|
|
|
3
|
|
244
|
use vars qw( $VERSION ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
184
|
|
17
|
3
|
|
|
3
|
|
64
|
our( $VERSION ) = 'v0.2.0'; |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
61
|
|
21
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1029
|
|
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
1
|
|
sub id { return( shift->_set_get_scalar( 'id', @_ ) ); } |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
|
sub object { return( shift->_set_get_scalar( 'object', @_ ) ); } |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
0
|
|
sub adjustable_quantity { return( shift->_set_get_class( 'adjustable_quantity', |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
enabled => { type => "boolean" }, |
30
|
|
|
|
|
|
|
maximum => { type => "integer" }, |
31
|
|
|
|
|
|
|
minimum => { type => "integer" }, |
32
|
|
|
|
|
|
|
}, @_ ) ); } |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
1
|
|
sub amount { return( shift->_set_get_number( 'amount', @_ ) ); } |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
sub amount_discount { return( shift->_set_get_number( 'amount_discount', @_ ) ); } |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
1
|
|
sub amount_subtotal { return( shift->_set_get_number( 'amount_subtotal', @_ ) ); } |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
1
|
|
sub amount_tax { return( shift->_set_get_number( 'amount_tax', @_ ) ); } |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
|
sub amount_total { return( shift->_set_get_number( 'amount_total', @_ ) ); } |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); } |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
0
|
1
|
|
sub description { return( shift->_set_get_scalar( 'description', @_ ) ); } |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
1
|
|
sub discounts { return( shift->_set_get_class( 'discounts', |
49
|
|
|
|
|
|
|
{ |
50
|
|
|
|
|
|
|
amount => { type => 'integer' }, |
51
|
|
|
|
|
|
|
discount => { package => 'Net::API::Stripe::Billing::Discount' }, |
52
|
|
|
|
|
|
|
}, @_ ) ); } |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
1
|
|
sub price { return( shift->_set_get_scalar_or_object( 'price', 'Net::API::Stripe::Price', @_ ) ); } |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
0
|
1
|
|
sub quantity { return( shift->_set_get_number( 'quantity', @_ ) ); } |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
1
|
|
sub taxes { return( shift->_set_get_class( 'taxes', |
59
|
|
|
|
|
|
|
{ |
60
|
|
|
|
|
|
|
amount => { type => 'integer' }, |
61
|
|
|
|
|
|
|
rate => { package => 'Net::API::Stripe::Tax::Rate' }, |
62
|
|
|
|
|
|
|
}, @_ ) ); } |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
0
|
1
|
|
sub type { return( shift->_set_get_scalar( 'type', @_ ) ); } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=encoding utf8 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NAME |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Net::API::Stripe::List::Item - A Stripe Payment Link Item |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SYNOPSIS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my $item = $stripe->payment_link->line_items([ |
79
|
|
|
|
|
|
|
{ |
80
|
|
|
|
|
|
|
object => 'list', |
81
|
|
|
|
|
|
|
data => |
82
|
|
|
|
|
|
|
{ |
83
|
|
|
|
|
|
|
amount_subtotal => 2000, |
84
|
|
|
|
|
|
|
amount_total => 2200, |
85
|
|
|
|
|
|
|
currency => 'jpy', |
86
|
|
|
|
|
|
|
description => 'Some item', |
87
|
|
|
|
|
|
|
discounts => 0, |
88
|
|
|
|
|
|
|
price => |
89
|
|
|
|
|
|
|
{ |
90
|
|
|
|
|
|
|
id => $price_id, |
91
|
|
|
|
|
|
|
object => 'price', |
92
|
|
|
|
|
|
|
active => $stripe->true, |
93
|
|
|
|
|
|
|
billing_scheme => 'per_unit', |
94
|
|
|
|
|
|
|
created => $timestamp, |
95
|
|
|
|
|
|
|
currency => 'JPY', |
96
|
|
|
|
|
|
|
livemode => $stripe->true, |
97
|
|
|
|
|
|
|
lookup_key => $key, |
98
|
|
|
|
|
|
|
metadata => { customer => 123 }, |
99
|
|
|
|
|
|
|
nickname => $nickname, |
100
|
|
|
|
|
|
|
product => $product_id, |
101
|
|
|
|
|
|
|
recurring => |
102
|
|
|
|
|
|
|
{ |
103
|
|
|
|
|
|
|
aggregate_usage => 'sum', |
104
|
|
|
|
|
|
|
interval => 'month', |
105
|
|
|
|
|
|
|
interval_count => 'month', |
106
|
|
|
|
|
|
|
usage_type => 'licensed', |
107
|
|
|
|
|
|
|
}, |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
tax_behavior => 'recurring', |
110
|
|
|
|
|
|
|
tiers => |
111
|
|
|
|
|
|
|
{ |
112
|
|
|
|
|
|
|
flat_amount => 10000, |
113
|
|
|
|
|
|
|
flat_amount_decimal => 10000, |
114
|
|
|
|
|
|
|
unit_amount => 1000, |
115
|
|
|
|
|
|
|
unit_amount_decimal => 1000, |
116
|
|
|
|
|
|
|
up_to => $value, |
117
|
|
|
|
|
|
|
}, |
118
|
|
|
|
|
|
|
tiers_mode => 'graduated', |
119
|
|
|
|
|
|
|
transform_quantity => |
120
|
|
|
|
|
|
|
{ |
121
|
|
|
|
|
|
|
divide_by => $value, |
122
|
|
|
|
|
|
|
round => 'up', |
123
|
|
|
|
|
|
|
}, |
124
|
|
|
|
|
|
|
type => 'recurring', |
125
|
|
|
|
|
|
|
unit_amount => 10000, |
126
|
|
|
|
|
|
|
unit_amount_decimal => 500, |
127
|
|
|
|
|
|
|
}, |
128
|
|
|
|
|
|
|
quantity => 2, |
129
|
|
|
|
|
|
|
taxes => |
130
|
|
|
|
|
|
|
{ |
131
|
|
|
|
|
|
|
amount => 200, |
132
|
|
|
|
|
|
|
rate => $rate_id, |
133
|
|
|
|
|
|
|
}, |
134
|
|
|
|
|
|
|
}, |
135
|
|
|
|
|
|
|
has_more => $stripe->true, |
136
|
|
|
|
|
|
|
url => 'https://buy.stripe.com/test_1234567890qwertyuiop', |
137
|
|
|
|
|
|
|
}]); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 VERSION |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
v0.2.0 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 DESCRIPTION |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
The line items representing what is being sold. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This field is not included by default. To include it in the response, expand the line_items field. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This is used by: |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=over 4 |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item L<Net::API::Stripe::Payment::Link> object and called from the method B<line_items> |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item L<Net::API::Stripe::Order::Item> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=back |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 new |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::List::Item> object. |
164
|
|
|
|
|
|
|
It may also take an hash like arguments, that also are method of the same name. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 METHODS |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 id string |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Unique identifier for the object. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 object string, value is "item" |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
String representing the object’s type. Objects of the same type share the same value. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 amount integer |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the line item. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 amount_discount integer |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 amount_subtotal integer |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Total before any discounts or taxes are applied. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 amount_tax integer |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 amount_total integer |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Total after discounts and taxes. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 currency currency |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Three-letter ISO currency code, in lowercase. Must be a supported currency. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 description string |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 discounts array of hashes expandable |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
The discounts applied to the line item. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
This field is not included by default. To include it in the response, expand the discounts field. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=over 4 |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item amount integer |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
The amount discounted. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item discount hash, discount object |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
The discount applied. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=back |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head2 price hash |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
The price used to generate the line item. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 quantity positive integer or zero |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
The quantity of products being purchased. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head2 taxes array of hashes expandable |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
The taxes applied to the line item. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This field is not included by default. To include it in the response, expand the taxes field. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=over 4 |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=item amount integer |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Amount of tax applied for this rate. |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=item rate hash |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
The tax rate id or hash applied. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=back |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head2 type string |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
The type of line item. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head1 API SAMPLE |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
{ |
251
|
|
|
|
|
|
|
"id": "li_1234567890qwertyuiop", |
252
|
|
|
|
|
|
|
"object": "item", |
253
|
|
|
|
|
|
|
"amount_subtotal": 0, |
254
|
|
|
|
|
|
|
"amount_total": 0, |
255
|
|
|
|
|
|
|
"currency": "jpy", |
256
|
|
|
|
|
|
|
"description": "テスト5円", |
257
|
|
|
|
|
|
|
"price": { |
258
|
|
|
|
|
|
|
"id": "price_1234567890qwertyuiop", |
259
|
|
|
|
|
|
|
"object": "price", |
260
|
|
|
|
|
|
|
"active": true, |
261
|
|
|
|
|
|
|
"billing_scheme": "per_unit", |
262
|
|
|
|
|
|
|
"created": 1634704866, |
263
|
|
|
|
|
|
|
"currency": "jpy", |
264
|
|
|
|
|
|
|
"livemode": false, |
265
|
|
|
|
|
|
|
"lookup_key": null, |
266
|
|
|
|
|
|
|
"metadata": {}, |
267
|
|
|
|
|
|
|
"nickname": null, |
268
|
|
|
|
|
|
|
"product": "prod_1234567890qwertyuiop", |
269
|
|
|
|
|
|
|
"recurring": null, |
270
|
|
|
|
|
|
|
"tax_behavior": "unspecified", |
271
|
|
|
|
|
|
|
"tiers_mode": null, |
272
|
|
|
|
|
|
|
"transform_quantity": null, |
273
|
|
|
|
|
|
|
"type": "one_time", |
274
|
|
|
|
|
|
|
"unit_amount": 5, |
275
|
|
|
|
|
|
|
"unit_amount_decimal": "5" |
276
|
|
|
|
|
|
|
}, |
277
|
|
|
|
|
|
|
"quantity": 1 |
278
|
|
|
|
|
|
|
} |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
{ |
281
|
|
|
|
|
|
|
"id": "il_1234567890qwertyuiop", |
282
|
|
|
|
|
|
|
"object": "line_item", |
283
|
|
|
|
|
|
|
"amount": 5, |
284
|
|
|
|
|
|
|
"currency": "jpy", |
285
|
|
|
|
|
|
|
"description": "My First Invoice Item (created for API docs)", |
286
|
|
|
|
|
|
|
"discount_amounts": [], |
287
|
|
|
|
|
|
|
"discountable": true, |
288
|
|
|
|
|
|
|
"discounts": [], |
289
|
|
|
|
|
|
|
"invoice_item": "ii_1234567890qwertyuiop", |
290
|
|
|
|
|
|
|
"livemode": false, |
291
|
|
|
|
|
|
|
"metadata": {}, |
292
|
|
|
|
|
|
|
"period": { |
293
|
|
|
|
|
|
|
"end": 1643371794, |
294
|
|
|
|
|
|
|
"start": 1643371794 |
295
|
|
|
|
|
|
|
}, |
296
|
|
|
|
|
|
|
"price": { |
297
|
|
|
|
|
|
|
"id": "price_1234567890qwertyuiop", |
298
|
|
|
|
|
|
|
"object": "price", |
299
|
|
|
|
|
|
|
"active": true, |
300
|
|
|
|
|
|
|
"billing_scheme": "per_unit", |
301
|
|
|
|
|
|
|
"created": 1634704866, |
302
|
|
|
|
|
|
|
"currency": "jpy", |
303
|
|
|
|
|
|
|
"livemode": false, |
304
|
|
|
|
|
|
|
"lookup_key": null, |
305
|
|
|
|
|
|
|
"metadata": {}, |
306
|
|
|
|
|
|
|
"nickname": null, |
307
|
|
|
|
|
|
|
"product": "prod_1234567890qwertyuiop", |
308
|
|
|
|
|
|
|
"recurring": null, |
309
|
|
|
|
|
|
|
"tax_behavior": "unspecified", |
310
|
|
|
|
|
|
|
"tiers_mode": null, |
311
|
|
|
|
|
|
|
"transform_quantity": null, |
312
|
|
|
|
|
|
|
"type": "one_time", |
313
|
|
|
|
|
|
|
"unit_amount": 5, |
314
|
|
|
|
|
|
|
"unit_amount_decimal": "5" |
315
|
|
|
|
|
|
|
}, |
316
|
|
|
|
|
|
|
"proration": false, |
317
|
|
|
|
|
|
|
"quantity": 1, |
318
|
|
|
|
|
|
|
"subscription": null, |
319
|
|
|
|
|
|
|
"tax_amounts": [], |
320
|
|
|
|
|
|
|
"tax_rates": [], |
321
|
|
|
|
|
|
|
"type": "invoiceitem" |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=head1 HISTORY |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
=head2 v0.1.0 |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
Initial version |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=head1 AUTHOR |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=head1 SEE ALSO |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
Stripe API documentation: |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
L<https://stripe.com/docs/api> |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
L<Invoice line item|https://stripe.com/docs/api/invoices/object#invoice_object-lines> |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
347
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=cut |
350
|
|
|
|
|
|
|
|