File Coverage

lib/Net/API/Stripe/Shipping/Rate.pm
Criterion Covered Total %
statement 19 31 61.2
branch n/a
condition n/a
subroutine 7 19 36.8
pod 12 12 100.0
total 38 62 61.2


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Shipping/Rate
3             ## Version v0.1.0
4             ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2022/01/24
7             ## Modified 2022/01/24
8             ##
9             ##----------------------------------------------------------------------------
10             package Net::API::Stripe::Shipping::Rate;
11             BEGIN
12             {
13 2     2   21271253 use strict;
  2         18  
  2         68  
14 2     2   10 use warnings;
  2         6  
  2         62  
15 2     2   12 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         11  
16 2     2   149 use vars qw( $VERSION );
  2         7  
  2         142  
17 2     2   49 our( $VERSION ) = 'v0.1.0';
18             };
19              
20 2     2   10 use strict;
  2         6  
  2         56  
21 2     2   11 use warnings;
  2         9  
  2         716  
22              
23 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
24              
25 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
26              
27 0     0 1   sub active { return( shift->_set_get_boolean( 'active', @_ ) ); }
28              
29 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
30              
31 0     0 1   sub delivery_estimate { return( shift->_set_get_class( 'delivery_estimate',
32             {
33             maximum => {
34             definition => { unit => { type => "scalar" }, value => { type => "number" } },
35             type => "class",
36             },
37             minimum => {
38             definition => { unit => { type => "scalar" }, value => { type => "number" } },
39             type => "class",
40             },
41             }, @_ ) ); }
42              
43 0     0 1   sub display_name { return( shift->_set_get_scalar( 'display_name', @_ ) ); }
44              
45 0     0 1   sub fixed_amount { return( shift->_set_get_object( 'fixed_amount', 'Net::API::Stripe::Balance::ConnectReserved', @_ ) ); }
46              
47 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
48              
49 0     0 1   sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); }
50              
51 0     0 1   sub tax_behavior { return( shift->_set_get_scalar( 'tax_behavior', @_ ) ); }
52              
53 0     0 1   sub tax_code { return( shift->_set_get_scalar_or_object( 'tax_code', '', @_ ) ); }
54              
55 0     0 1   sub type { return( shift->_set_get_scalar( 'type', @_ ) ); }
56              
57             1;
58             # NOTE: POD
59             __END__
60              
61             =encoding utf8
62              
63             =head1 NAME
64              
65             Net::API::Stripe::Shipping::Rate - The shipping rate object
66              
67             =head1 SYNOPSIS
68              
69             =head1 VERSION
70              
71             v0.1.0
72              
73             =head1 DESCRIPTION
74              
75             Shipping rates describe the price of shipping presented to your customers and can be applied to L<Checkout Sessions|Checkout Sessions> to collect shipping costs.
76              
77             =head1 METHODS
78              
79             =head2 id string
80              
81             Unique identifier for the object.
82              
83             =head2 object string
84              
85             String representing the object's type. Objects of the same type share the same value.
86              
87             =head2 active boolean
88              
89             Whether the shipping rate can be used for new purchases. Defaults to C<true>.
90              
91             =head2 created timestamp
92              
93             Time at which the object was created. Measured in seconds since the Unix epoch.
94              
95             =head2 delivery_estimate hash
96              
97             The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
98              
99             It has the following properties:
100              
101             =over 4
102              
103             =item I<maximum> hash
104              
105             The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
106              
107             =over 8
108              
109             =item I<unit> string
110              
111             A unit of time.
112              
113             =item I<value> integer
114              
115             Must be greater than 0.
116              
117             =back
118              
119             =item I<minimum> hash
120              
121             The lower bound of the estimated range. If empty, represents no lower bound.
122              
123             =over 8
124              
125             =item I<unit> string
126              
127             A unit of time.
128              
129             =item I<value> integer
130              
131             Must be greater than 0.
132              
133             =back
134              
135              
136             =back
137              
138             =head2 display_name string
139              
140             The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
141              
142             =head2 fixed_amount object
143              
144             Describes a fixed amount to charge for shipping. Must be present if type is C<fixed_amount>.
145              
146             This is a L<Net::API::Stripe::Balance::ConnectReserved> object.
147              
148             =head2 livemode boolean
149              
150             Has the value C<true> if the object exists in live mode or the value C<false> if the object exists in test mode.
151              
152             =head2 metadata hash
153              
154             Set of L<key-value pairs|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.
155              
156             =head2 tax_behavior string
157              
158             Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of C<inclusive>, C<exclusive>, or C<unspecified>.
159              
160             =head2 tax_code expandable
161              
162             A L<tax code|tax code> ID. The Shipping tax code is C<txcd_92010001>.
163              
164             When expanded this is an L<Net::API::Stripe::Product::TaxCode> object.
165              
166             =head2 type string
167              
168             The type of calculation to use on the shipping rate. Can only be C<fixed_amount> for now.
169              
170             =head1 API SAMPLE
171              
172             {
173             "id": "shr_1KJGon2eZvKYlo2C3Hc5P110",
174             "object": "shipping_rate",
175             "active": true,
176             "created": 1642508985,
177             "delivery_estimate": null,
178             "display_name": "Ground shipping",
179             "fixed_amount": {
180             "amount": 500,
181             "currency": "usd"
182             },
183             "livemode": false,
184             "metadata": {
185             },
186             "tax_behavior": "unspecified",
187             "tax_code": null,
188             "type": "fixed_amount"
189             }
190              
191             =head1 HISTORY
192              
193             =head2 v0.1.0
194              
195             Initial version
196              
197             =head1 AUTHOR
198              
199             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
200              
201             =head1 SEE ALSO
202              
203             L<Stripe API documentation|https://stripe.com/docs/api#shipping_rate_object>
204              
205             =head1 COPYRIGHT & LICENSE
206              
207             Copyright (c) 2019-2022 DEGUEST Pte. Ltd.
208              
209             You can use, copy, modify and redistribute this package and associated
210             files under the same terms as Perl itself.
211              
212             =cut