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