File Coverage

blib/lib/Net/API/Stripe/Billing/Invoice/LineItem.pm
Criterion Covered Total %
statement 7 27 25.9
branch n/a
condition n/a
subroutine 3 23 13.0
pod 20 20 100.0
total 30 70 42.8


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Invoice/LineItem.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <@sitael.tokyo.deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/invoices/line_item
11             package Net::API::Stripe::Billing::Invoice::LineItem;
12             BEGIN
13             {
14 1     1   835 use strict;
  1         3  
  1         28  
15 1     1   4 use parent qw( Net::API::Stripe::Generic );
  1         2  
  1         5  
16 1     1   323 our( $VERSION ) = 'v0.100.0';
17             };
18              
19 0     0 1   sub id { shift->_set_get_scalar( 'id', @_ ); }
20              
21 0     0 1   sub object { shift->_set_get_scalar( 'object', @_ ); }
22              
23 0     0 1   sub amount { shift->_set_get_number( 'amount', @_ ); }
24              
25 0     0 1   sub currency { shift->_set_get_scalar( 'currency', @_ ); }
26              
27 0     0 1   sub description { shift->_set_get_scalar( 'description', @_ ); }
28              
29 0     0 1   sub discountable { shift->_set_get_boolean( 'discountable', @_ ); }
30              
31 0     0 1   sub invoice_item { shift->_set_get_scalar( 'invoice_item', @_ ); }
32              
33 0     0 1   sub livemode { shift->_set_get_boolean( 'livemode', @_ ); }
34              
35 0     0 1   sub metadata { shift->_set_get_hash( 'metadata', @_ ); }
36              
37 0     0 1   sub period { shift->_set_get_object( 'period', 'Net::API::Stripe::Billing::Invoice::Period', @_ ); }
38              
39 0     0 1   sub plan { shift->_set_get_object( 'plan', 'Net::API::Stripe::Billing::Plan', @_ ); }
40              
41 0     0 1   sub proration { shift->_set_get_boolean( 'proration', @_ ); }
42              
43 0     0 1   sub quantity { shift->_set_get_number( 'quantity', @_ ); }
44              
45 0     0 1   sub subscription { shift->_set_get_scalar( 'subscription', @_ ); }
46              
47 0     0 1   sub subscription_item { shift->_set_get_scalar( 'subscription_item', @_ ); }
48              
49 0     0 1   sub tax_amounts { return( shift->_set_get_object_array( 'tax_amounts', 'Net::API::Stripe::Billing::Invoice::TaxAmount', @_ ) ); }
50              
51 0     0 1   sub tax_rates { return( shift->_set_get_object_array( 'tax_rates', 'Net::API::Stripe::Tax::Rate', @_ ) ); }
52              
53             ## The source type: invoiceitem or subscription
54 0     0 1   sub type { shift->_set_get_scalar( 'type', @_ ); }
55              
56 0     0 1   sub unified_proration { return( shift->_set_get_scalar( 'unified_proration', @_ ) ); }
57              
58 0     0 1   sub unique_id { return( shift->_set_get_scalar( 'unique_id', @_ ) ); }
59              
60             1;
61              
62             __END__
63              
64             =encoding utf8
65              
66             =head1 NAME
67              
68             Net::API::Stripe::Billing::Invoice::LineItem - A Stripe Invoice Line Item Object
69              
70             =head1 SYNOPSIS
71              
72             my $line_item = $stripe->invoice_line_item({
73             amount => 2000,
74             currency => 'jpy',
75             description 'Professional service work',
76             discountable => 0,
77             metadata => { transaction_id => 1212, customer_id => 987 },
78             plan => $plan_object,
79             proration => 0,
80             quantity => 7,
81             subscription => 'sub_fake123456789',
82             type => 'subscription',
83             });
84              
85             =head1 VERSION
86              
87             v0.100.0
88              
89             =head1 DESCRIPTION
90              
91             This is a Stripe L<Net::API::Stripe::Billing::Invoice::LineItem> object as documented here: L<https://stripe.com/docs/api/invoices/line_item>
92              
93             =head1 CONSTRUCTOR
94              
95             =over 4
96              
97             =item B<new>( %ARG )
98              
99             Creates a new L<Net::API::Stripe::Billing::Invoice::LineItem> object.
100              
101             =back
102              
103             =head1 METHODS
104              
105             =over 4
106              
107             =item B<id> string
108              
109             Unique identifier for the object.
110              
111             =item B<object> string, value is "line_item"
112              
113             String representing the object’s type. Objects of the same type share the same value.
114              
115             =item B<amount> integer
116              
117             The amount, in JPY.
118              
119             =item B<currency> currency
120              
121             Three-letter ISO currency code, in lowercase. Must be a supported currency.
122              
123             =item B<description> string
124              
125             An arbitrary string attached to the object. Often useful for displaying to users.
126              
127             =item B<discountable> boolean
128              
129             If true, discounts will apply to this line item. Always false for prorations.
130              
131             =item B<invoice_item> string
132              
133             =item B<livemode> boolean
134              
135             Whether this is a test line item.
136              
137             =item B<metadata> hash
138              
139             Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with type=subscription this will reflect the metadata of the subscription that caused the line item to be created.
140              
141             =item B<period> hash
142              
143             The timespan covered by this invoice item.
144              
145             This is a L<Net::API::Stripe::Billing::Invoice::Period> object.
146              
147             =item B<plan> hash, plan object
148              
149             The plan of the subscription, if the line item is a subscription or a proration.
150              
151             This is a L<Net::API::Stripe::Billing::Plan> object.
152              
153             =item B<proration> boolean
154              
155             Whether this is a proration.
156              
157             =item B<quantity> integer
158              
159             The quantity of the subscription, if the line item is a subscription or a proration.
160              
161             =item B<subscription> string
162              
163             The subscription that the invoice item pertains to, if any.
164              
165             =item B<subscription_item> string
166              
167             The subscription item that generated this invoice item. Left empty if the line item is not an explicit result of a subscription.
168              
169             =item B<tax_amounts> array of hashes
170              
171             The amount of tax calculated per tax rate for this line item
172              
173             This is an array of L<Net::API::Stripe::Billing::Invoice::TaxAmount> objects.
174              
175             =item B<tax_rates> array of hashes
176              
177             The tax rates which apply to the line item.
178              
179             This is an array of L<Net::API::Stripe::Tax::Rate> objects.
180              
181             =item B<type> string
182              
183             A string identifying the type of the source of this line item, either an invoiceitem or a subscription.
184              
185             =item B<unified_proration> boolean
186              
187             For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item.
188              
189             =back
190              
191             =head1 API SAMPLE
192              
193             {
194             "id": "ii_fake123456789",
195             "object": "line_item",
196             "amount": -2000,
197             "currency": "jpy",
198             "description": "Unused time on Provider, Inc entrepreneur monthly membership after 02 Mar 2019",
199             "discountable": false,
200             "invoice_item": "ii_fake123456789",
201             "livemode": false,
202             "metadata": {},
203             "period": {
204             "end": 1554171359,
205             "start": 1551493020
206             },
207             "plan": {
208             "id": "entrepreneur-monthly-jpy",
209             "object": "plan",
210             "active": true,
211             "aggregate_usage": null,
212             "amount": 2000,
213             "amount_decimal": "2000",
214             "billing_scheme": "per_unit",
215             "created": 1541833424,
216             "currency": "jpy",
217             "interval": "month",
218             "interval_count": 1,
219             "livemode": false,
220             "metadata": {},
221             "nickname": null,
222             "product": "prod_fake123456789",
223             "tiers": null,
224             "tiers_mode": null,
225             "transform_usage": null,
226             "trial_period_days": null,
227             "usage_type": "licensed"
228             },
229             "proration": true,
230             "quantity": 1,
231             "subscription": "sub_fake123456789",
232             "subscription_item": "si_fake123456789",
233             "tax_amounts": [],
234             "tax_rates": [],
235             "type": "invoiceitem"
236             }
237              
238             =head1 HISTORY
239              
240             =head2 v0.1
241              
242             Initial version
243              
244             =head1 STRIPE HISTORY
245              
246             =head2 2019-12-03
247              
248             The id field of all invoice line items have changed and are now prefixed with il_. The new id has consistent prefixes across all line items, is globally unique, and can be used for pagination.
249              
250             =over 4
251              
252             =item You can no longer use the prefix of the id to determine the source of the line item. Instead use the type field for this purpose.
253              
254             =item For lines with type=invoiceitem, use the invoice_item field to reference or update the originating Invoice Item object.
255              
256             =item The Invoice Line Item object on earlier API versions also have a unique_id field to be used for migrating internal references before upgrading to this version.
257              
258             =item When setting a tax rate to individual line items, use the new id. Users on earlier API versions can pass in either a line item id or unique_id.
259              
260             =back
261              
262             =head1 AUTHOR
263              
264             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
265              
266             =head1 SEE ALSO
267              
268             Stripe API documentation:
269              
270             L<https://stripe.com/docs/api/invoices/line_item>
271              
272             =head1 COPYRIGHT & LICENSE
273              
274             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
275              
276             You can use, copy, modify and redistribute this package and associated
277             files under the same terms as Perl itself.
278              
279             =cut