File Coverage

lib/Net/API/Stripe/Order/Item.pm
Criterion Covered Total %
statement 19 20 95.0
branch n/a
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 27 29 93.1


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Order/Item.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/order_items/object
11             BEGIN
12             {
13             use strict;
14 1     1   1002 use warnings;
  1         2  
  1         32  
15 1     1   5 use parent qw( Net::API::Stripe::List::Item );
  1         2  
  1         31  
16 1     1   6 use vars qw( $VERSION );
  1         1  
  1         6  
17 1     1   75 our( $VERSION ) = 'v0.100.0';
  1         5  
  1         47  
18 1     1   22 };
19              
20             use strict;
21 1     1   5 use warnings;
  1         2  
  1         34  
22 1     1   7  
  1         3  
  1         62  
23              
24 0     0 1   1;
25              
26              
27             =encoding utf8
28              
29             =head1 NAME
30              
31             Net::API::Stripe::Order::Item - A Stripe Order Item Object
32              
33             =head1 SYNOPSIS
34              
35             my $item = $stripe->order_item({
36             amount => 2000,
37             currency => 'jpy',
38             description => 'Onsite support service',
39             parent => $order_object,
40             # hours
41             quantity => 200,
42             type => 'sku',
43             });
44              
45             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
46              
47             It inherits from L<Net::API::Stripe::List::Item>
48              
49             =head1 VERSION
50              
51             v0.100.0
52              
53             =head1 DESCRIPTION
54              
55             A representation of the constituent items of any given order. Can be used to represent SKUs, shipping costs, or taxes owed on the order.
56              
57             =head1 CONSTRUCTOR
58              
59             =head2 new( %ARG )
60              
61             Creates a new L<Net::API::Stripe::Order::Item> object.
62             It may also take an hash like arguments, that also are method of the same name.
63              
64             =head1 METHODS
65              
66             =head2 object string, value is "order_item"
67              
68             String representing the object’s type. Objects of the same type share the same value.
69              
70             =head2 amount integer
71              
72             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.
73              
74             =head2 currency currency
75              
76             Three-letter ISO currency code, in lowercase. Must be a supported currency.
77              
78             =head2 description string
79              
80             Description of the line item, meant to be displayable to the user (e.g., "Express shipping").
81              
82             =head2 parent string (expandable) discount or sku
83              
84             The ID of the associated object for this line item. Expandable if not null (e.g., expandable to a SKU).
85              
86             When expanded, this is a L<Net::API::Stripe::Order> object.
87              
88             =head2 quantity positive integer
89              
90             A positive integer representing the number of instances of parent that are included in this order item. Applicable/present only if type is sku.
91              
92             =head2 type string
93              
94             The type of line item. One of sku, tax, shipping, or discount.
95              
96             =head1 API SAMPLE
97              
98             {
99             "object": "order_item",
100             "amount": 1500,
101             "currency": "jpy",
102             "description": "T-shirt",
103             "parent": "sk_fake123456789",
104             "quantity": null,
105             "type": "sku"
106             }
107              
108             =head1 HISTORY
109              
110             =head2 v0.1
111              
112             Initial version
113              
114             =head1 AUTHOR
115              
116             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
117              
118             =head1 SEE ALSO
119              
120             L<Stripe API documentation|https://stripe.com/docs/api/order_items>, L<List item|Net::API::Stripe::List::Item>
121              
122             =head1 COPYRIGHT & LICENSE
123              
124             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
125              
126             You can use, copy, modify and redistribute this package and associated
127             files under the same terms as Perl itself.
128              
129             =cut