File Coverage

lib/Net/API/Stripe/Billing/CreditNote/LineItem.pm
Criterion Covered Total %
statement 19 35 54.2
branch n/a
condition n/a
subroutine 7 23 30.4
pod 16 16 100.0
total 42 74 56.7


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/CreditNote/LineItem.pm
3             ## Version v0.101.0
4             ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2020/01/25
7             ## Modified 2022/10/29
8             ## All rights reserved
9             ##
10             ## This program is free software; you can redistribute it and/or modify it
11             ## under the same terms as Perl itself.
12             ##----------------------------------------------------------------------------
13             package Net::API::Stripe::Billing::CreditNote::LineItem;
14             BEGIN
15             {
16 2     2   21269066 use strict;
  2         16  
  2         61  
17 2     2   18 use warnings;
  2         4  
  2         58  
18 2     2   12 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         10  
19 2     2   147 use vars qw( $VERSION );
  2         4  
  2         140  
20 2     2   40 our( $VERSION ) = 'v0.101.0';
21             };
22              
23 2     2   11 use strict;
  2         5  
  2         37  
24 2     2   9 use warnings;
  2         4  
  2         724  
25              
26 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
27              
28 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
29              
30 0     0 1   sub amount { return( shift->_set_get_number( 'amount', @_ ) ); }
31              
32 0     0 1   sub amount_excluding_tax { return( shift->_set_get_number( 'amount_excluding_tax', @_ ) ); }
33              
34 0     0 1   sub description { return( shift->_set_get_scalar( 'description', @_ ) ); }
35              
36 0     0 1   sub discount_amount { return( shift->_set_get_number( 'discount_amount', @_ ) ); }
37              
38 0     0 1   sub discount_amounts { return( shift->_set_get_class_array( 'discount_amounts', {
39             amount => { type => "number" },
40             discount => { type => "scalar" },
41             }, @_ ) ); }
42              
43 0     0 1   sub invoice_line_item { return( shift->_set_get_scalar( 'invoice_line_item', @_ ) ); }
44              
45 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
46              
47 0     0 1   sub quantity { return( shift->_set_get_number( 'quantity', @_ ) ); }
48              
49             sub tax_amounts
50             {
51 0     0 1   return( shift->_set_get_class_array( 'tax_amounts',
52             {
53             amount => { type => 'number' },
54             inclusive => { type => 'boolean' },
55             tax_rate => { type => 'scalar_or_object', class => 'Net::API::Stripe::Tax::Rate' },
56             }, @_ ) );
57             }
58              
59 0     0 1   sub tax_rates { return( shift->_set_get_object_array( 'tax_rates', 'Net::API::Stripe::Tax::Rate', @_ ) ); }
60              
61 0     0 1   sub type { return( shift->_set_get_scalar( 'type', @_ ) ); }
62              
63 0     0 1   sub unit_amount { return( shift->_set_get_number( 'unit_amount', @_ ) ); }
64              
65 0     0 1   sub unit_amount_decimal { return( shift->_set_get_number( 'unit_amount_decimal', @_ ) ); }
66              
67 0     0 1   sub unit_amount_excluding_tax { return( shift->_set_get_number( 'unit_amount_excluding_tax', @_ ) ); }
68              
69             1;
70              
71             __END__
72              
73             =encoding utf8
74              
75             =head1 NAME
76              
77             Net::API::Stripe::Billing::CreditNote::LineItem - Stripe API Credit note Line Item Object
78              
79             =head1 SYNOPSIS
80              
81             my $line = $stripe->credit_note_line_item({
82             amount => 10000,
83             description => 'Product return credit note',
84             livemode => $stripe->false,
85             quantity => 2,
86             type => 'custom_line_item',
87             });
88              
89             =head1 VERSION
90              
91             v0.101.0
92              
93             =head1 DESCRIPTION
94              
95             my $credit_line = $stripe->credit_note_line_item({
96             amount => 2000,
97             description => 'Credit note line text',
98             discount_amount => 500,
99             quantity => 2,
100             type => 'invoice_line_item',
101             });
102              
103             =head1 CONSTRUCTOR
104              
105             =head2 new( %arg )
106              
107             Creates a new L<Net::API::Stripe::Billing::CreditNote::LineItem> object
108              
109             =head1 METHODS
110              
111             =head2 id string
112              
113             Unique identifier for the object.
114              
115             =head2 object string, value is "credit_note_line_item"
116              
117             String representing the object’s type. Objects of the same type share the same value.
118              
119             =head2 amount integer
120              
121             The integer amount in JPY representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
122              
123             =head2 amount_excluding_tax integer
124              
125             The integer amount in JPY representing the amount being credited for this line item, excluding all tax and discounts.
126              
127             =head2 description string
128              
129             Description of the item being credited.
130              
131             =head2 discount_amount integer
132              
133             The integer amount in JPY representing the discount being credited for this line item.
134              
135             =head2 discount_amounts array of hash
136              
137             The amount of discount calculated per discount for this line item
138              
139             It has the following properties:
140              
141             =over 4
142              
143             =item I<amount> integer
144              
145             The amount, in JPY, of the discount.
146              
147             =item I<discount> string
148              
149             The discount that was applied to get this discount amount.
150              
151             =back
152              
153             =head2 invoice_line_item string
154              
155             ID of the invoice line item being credited
156              
157             =head2 livemode boolean
158              
159             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
160              
161             =head2 quantity integer
162              
163             The number of units of product being credited.
164              
165             =head2 tax_amounts array of objects
166              
167             The amount of tax calculated per tax rate for this line item.
168              
169             This is a dynamic class with the following properties:
170              
171             =over 4
172              
173             =item I<amount> integer
174              
175             The amount, in JPY, of the tax.
176              
177             =item I<inclusive> boolean
178              
179             Whether this tax amount is inclusive or exclusive.
180              
181             =item I<tax_rate> string expandable
182              
183             The tax rate that was applied to get this tax amount.
184              
185             When expanded, this is a L<Net::API::Stripe::Tax::Rate> object.
186              
187             =back
188              
189             =head2 tax_rates array of L<Net::API::Stripe::Tax::Rate> objects
190              
191             The tax rates which apply to the line item.
192              
193             =head2 type string
194              
195             The type of the credit note line item, one of C<custom_line_item> or C<invoice_line_item>. When the type is C<invoice_line_item> there is an additional C<invoice_line_item> property on the resource the value of which is the id of the credited line item on the invoice.
196              
197             =head2 unit_amount integer
198              
199             The cost of each unit of product being credited.
200              
201             =head2 unit_amount_decimal decimal string
202              
203             Same as unit_amount, but contains a decimal value with at most 12 decimal places.
204              
205             =head2 unit_amount_excluding_tax decimal_string
206              
207             The amount in JPY representing the unit amount being credited for this line item, excluding all tax and discounts.
208              
209             =head1 API SAMPLE
210              
211             {
212             "id": "cnli_fake124567890",
213             "object": "credit_note_line_item",
214             "amount": 1000,
215             "description": "My First Invoice Item (created for API docs)",
216             "discount_amount": 0,
217             "invoice_line_item": "il_fake124567890",
218             "livemode": false,
219             "quantity": 1,
220             "tax_amounts": [],
221             "tax_rates": [],
222             "type": "invoice_line_item",
223             "unit_amount": null,
224             "unit_amount_decimal": null
225             }
226              
227             =head1 HISTORY
228              
229             =head2 v0.100.0
230              
231             Initial version
232              
233             =head1 STRIPE HISTORY
234              
235             =head2 2019-12-03
236              
237             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.
238              
239             =over 4
240              
241             =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.
242              
243             =item * For lines with type=invoiceitem, use the invoice_item field to reference or update the originating Invoice Item object.
244              
245             =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.
246              
247             =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.
248              
249             =back
250              
251             =head1 AUTHOR
252              
253             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
254              
255             =head1 SEE ALSO
256              
257             L<https://stripe.com/docs/api/credit_notes/line_item>
258              
259             =head1 COPYRIGHT & LICENSE
260              
261             Copyright (c) 2020-2020 DEGUEST Pte. Ltd.
262              
263             All rights reserved
264              
265             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
266              
267             =cut