File Coverage

blib/lib/Net/API/Stripe/Order/Item.pm
Criterion Covered Total %
statement 7 14 50.0
branch n/a
condition n/a
subroutine 3 10 30.0
pod 7 7 100.0
total 17 31 54.8


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