File Coverage

lib/Net/API/Stripe/Billing/Quote.pm
Criterion Covered Total %
statement 19 54 35.1
branch n/a
condition n/a
subroutine 7 42 16.6
pod 33 35 94.2
total 59 131 45.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Quote
3             ## Version v0.2.0
4             ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2022/01/24
7             ## Modified 2022/10/29
8             ##
9             ##----------------------------------------------------------------------------
10             BEGIN
11             {
12             use strict;
13 2     2   24129937 use warnings;
  2         19  
  2         60  
14 2     2   10 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         62  
15 2     2   11 use vars qw( $VERSION );
  2         4  
  2         11  
16 2     2   139 our( $VERSION ) = 'v0.2.0';
  2         5  
  2         114  
17 2     2   37 };
18              
19             use strict;
20 2     2   10 use warnings;
  2         6  
  2         36  
21 2     2   9  
  2         5  
  2         1817  
22              
23 0     0 1    
24              
25 0     0 1    
26              
27 0     0 1    
28              
29 0     0 1   {
30             enabled => { type => "boolean" },
31 0     0 0   status => { type => "scalar" },
32             }, @_ ) ); }
33 0     0 1    
34              
35 0     0 1   {
36             recurring => { package => "Net::API::Stripe::Checkout::Session", type => "object" },
37 0     0 1   upfront => { package => "Net::API::Stripe::Checkout::Session", type => "object" },
38             }, @_ ) ); }
39              
40              
41              
42              
43 0     0 1    
44              
45 0     0 1    
46              
47              
48             {
49             is_revision => { type => "boolean" },
50             quote => {
51 0     0 1   package => "Net::API::Stripe::Billing::Quote",
52             type => "scalar_or_object",
53 0     0 1   },
54             }, @_ ) ); }
55 0     0 1    
56              
57 0     0 1    
58              
59 0     0 1    
60              
61 0     0 1    
62              
63 0     0 1    
64              
65 0     0 1   {
66             accepted_at => { type => "datetime" },
67 0     0 1   canceled_at => { type => "datetime" },
68             finalized_at => { type => "datetime" },
69             }, @_ ) ); }
70              
71              
72              
73              
74              
75             {
76 0     0 1   amount_discount => { type => "number" },
77             amount_shipping => { type => "number" },
78 0     0 1   amount_tax => { type => "number" },
79             breakdown => {
80 0     0 1   definition => {
81             discounts => {
82 0     0 1   definition =>
83             {
84 0     0 1   amount => { type => "number" },
85             discount => { package => "Net::API::Stripe::Billing::Discount", type => "object" }
86 0     0 1   },
87             type => "class_array",
88 0     0 1   },
89             taxes => {
90 0     0 1   definition => {
91             amount => { type => "number" },
92 0     0 1   rate => { package => "Net::API::Stripe::Tax::Rate", type => "object" },
93             },
94 0     0 1   type => "class_array",
95             },
96             },
97             type => "class",
98             },
99             }, @_ ) ); }
100              
101 0     0 1    
102             1;
103 0     0 1    
104              
105 0     0 1   =encoding utf8
106              
107 0     0 0   =head1 NAME
108              
109 0     0 1   Net::API::Stripe::Billing::Quote - The quote object
110              
111             =head1 SYNOPSIS
112              
113             =head1 VERSION
114              
115             v0.2.0
116              
117             =head1 DESCRIPTION
118              
119             A Quote is a way to model prices that you'd like to provide to a customer.
120             Once accepted, it will automatically create an invoice, subscription or subscription schedule.
121              
122             =head1 METHODS
123              
124             =head2 id string
125              
126             Unique identifier for the object.
127              
128             =head2 object string
129              
130             String representing the object's type. Objects of the same type share the same value.
131              
132             =head2 amount_subtotal integer
133              
134             Total before any discounts or taxes are applied.
135              
136 0     0 1   =head2 amount_total integer
137              
138             Total after discounts and taxes are applied.
139              
140             =head2 application_fee_amount integer
141              
142             The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote.
143              
144             =head2 application_fee_percent decimal
145              
146             A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote.
147              
148             =head2 automatic_tax hash
149              
150             Settings for automatic tax lookup for this quote and resulting invoices and subscriptions.
151              
152             It has the following properties:
153              
154             =over 4
155              
156             =item I<enabled> boolean
157              
158             Automatically calculate taxes
159              
160             =item I<status> string
161              
162             The status of the most recent automated tax calculation for this quote.
163              
164              
165             =back
166              
167             =head2 collection_method string
168              
169             Either C<charge_automatically>, or C<send_invoice>. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. Defaults to C<charge_automatically>.
170              
171             =head2 computed hash
172              
173             The definitive totals and line items for the quote, computed based on your inputted line items as well as other configuration such as trials. Used for rendering the quote to your customer.
174              
175             It has the following properties:
176              
177             =over 4
178              
179             =item I<recurring> hash
180              
181             The definitive totals and line items the customer will be charged on a recurring basis. Takes into account the line items with recurring prices and discounts with C<duration=forever> coupons only. Defaults to C<null> if no inputted line items with recurring prices.
182              
183             When expanded, this is a L<Net::API::Stripe::Checkout::Session> object.
184              
185             =item I<upfront> hash
186              
187             The definitive upfront totals and line items the customer will be charged on the first invoice.
188              
189             When expanded, this is a L<Net::API::Stripe::Checkout::Session> object.
190              
191              
192             =back
193              
194             =head2 created timestamp
195              
196             Time at which the object was created. Measured in seconds since the Unix epoch.
197              
198             =head2 currency string
199              
200             Three-letter L<ISO currency code|ISO currency code>, in lowercase. Must be a L<supported currency|supported currency>.
201              
202             =head2 customer expandable
203              
204             The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
205              
206             When expanded this is an L<Net::API::Stripe::Customer> object.
207              
208             =head2 default_tax_rates expandable
209              
210             The tax rates applied to this quote.
211              
212             When expanded this is an L<Net::API::Stripe::Tax::Rate> object.
213              
214             =head2 description string
215              
216             A description that will be displayed on the quote PDF.
217              
218             =head2 discounts expandable
219              
220             The discounts applied to this quote.
221              
222             When expanded this is an L<Net::API::Stripe::Billing::Discount> object.
223              
224             =head2 expires_at timestamp
225              
226             The date on which the quote will be canceled if in C<open> or C<draft> status. Measured in seconds since the Unix epoch.
227              
228             =head2 footer string
229              
230             A footer that will be displayed on the quote PDF.
231              
232             =head2 from_quote hash
233              
234             Details of the quote that was cloned. See the L<cloning documentation|cloning documentation> for more details.
235              
236             It has the following properties:
237              
238             =over 4
239              
240             =item I<is_revision> boolean
241              
242             Whether this quote is a revision of a different quote.
243              
244             =item I<quote> string expandable
245              
246             The quote that was cloned.
247              
248             When expanded this is an L<Net::API::Stripe::Billing::Quote> object.
249              
250              
251             =back
252              
253             =head2 header string
254              
255             A header that will be displayed on the quote PDF.
256              
257             =head2 invoice expandable
258              
259             The invoice that was created from this quote.
260              
261             When expanded this is an L<Net::API::Stripe::Billing::Invoice> object.
262              
263             =head2 invoice_settings object
264              
265             All invoices will be billed using the specified settings.
266              
267             This is a L<Net::API::Stripe::Billing::Subscription> object.
268              
269             =head2 line_items object
270              
271             A list of items the customer is being quoted for.
272              
273             This is a L<Net::API::Stripe::List> object.
274              
275             =head2 livemode boolean
276              
277             Has the value C<true> if the object exists in live mode or the value C<false> if the object exists in test mode.
278              
279             =head2 metadata hash
280              
281             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.
282              
283             =head2 number string
284              
285             A unique number that identifies this particular quote. This number is assigned once the quote is L<finalized|finalized>.
286              
287             =head2 on_behalf_of expandable
288              
289             The account on behalf of which to charge. See the L<Connect documentation|Connect documentation> for details.
290              
291             When expanded this is an L<Net::API::Stripe::Connect::Account> object.
292              
293             =head2 status string
294              
295             The status of the quote.
296              
297             =head2 status_transitions hash
298              
299             The timestamps of which the quote transitioned to a new status.
300              
301             It has the following properties:
302              
303             =over 4
304              
305             =item I<accepted_at> timestamp
306              
307             The time that the quote was accepted. Measured in seconds since Unix epoch.
308              
309             =item I<canceled_at> timestamp
310              
311             The time that the quote was canceled. Measured in seconds since Unix epoch.
312              
313             =item I<finalized_at> timestamp
314              
315             The time that the quote was finalized. Measured in seconds since Unix epoch.
316              
317              
318             =back
319              
320             =head2 subscription expandable
321              
322             The subscription that was created or updated from this quote.
323              
324             When expanded this is an L<Net::API::Stripe::Billing::Subscription> object.
325              
326             =head2 subscription_data object
327              
328             When creating a subscription or subscription schedule, the specified configuration data will be used. There must be at least one line item with a recurring price for a subscription or subscription schedule to be created.
329              
330             This is a L<Net::API::Stripe::Billing::Subscription> object.
331              
332             =head2 subscription_schedule expandable
333              
334             The subscription schedule that was created or updated from this quote.
335              
336             When expanded this is an L<Net::API::Stripe::Billing::Subscription::Schedule> object.
337              
338             =head2 total_details hash
339              
340             Tax and discount details for the computed total amount.
341              
342             It has the following properties:
343              
344             =over 4
345              
346             =item I<amount_discount> integer
347              
348             This is the sum of all the line item discounts.
349              
350             =item I<amount_shipping> integer
351              
352             This is the sum of all the line item shipping amounts.
353              
354             =item I<amount_tax> integer
355              
356             This is the sum of all the line item tax amounts.
357              
358             =item I<breakdown> hash
359              
360             Breakdown of individual tax and discount amounts that add up to the totals.
361              
362             =over 8
363              
364             =item I<discounts> array
365              
366             The aggregated line item discounts.
367              
368             =over 12
369              
370             =item I<amount> integer
371              
372             The amount discounted.
373              
374             =item I<discount> hash
375              
376             The discount applied.
377              
378             =back
379              
380             =item I<taxes> array
381              
382             The aggregated line item tax amounts by rate.
383              
384             =over 12
385              
386             =item I<amount> integer
387              
388             Amount of tax applied for this rate.
389              
390             =item I<rate> hash
391              
392             The tax rate applied.
393              
394             When expanded, this is a L<Net::API::Stripe::Billing::Quote> object.
395              
396             =back
397              
398             =back
399              
400              
401             =back
402              
403             =head2 transfer_data object
404              
405             The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices.
406              
407             This is a L<Net::API::Stripe::Charge> object.
408              
409             =head1 API SAMPLE
410              
411             {
412             "id": "qt_1KJGon2eZvKYlo2CYE6HxURp",
413             "object": "quote",
414             "amount_subtotal": 0,
415             "amount_total": 0,
416             "application_fee_amount": null,
417             "application_fee_percent": null,
418             "automatic_tax": {
419             "enabled": false,
420             "status": null
421             },
422             "collection_method": "charge_automatically",
423             "computed": {
424             "recurring": null,
425             "upfront": {
426             "amount_subtotal": 0,
427             "amount_total": 0,
428             "total_details": {
429             "amount_discount": 0,
430             "amount_shipping": 0,
431             "amount_tax": 0
432             }
433             }
434             },
435             "created": 1642508985,
436             "currency": "usd",
437             "customer": "cus_AJ6yY15pe9xOZe",
438             "default_tax_rates": [
439            
440             ],
441             "description": null,
442             "discounts": [
443            
444             ],
445             "expires_at": 1645100985,
446             "footer": null,
447             "from_quote": null,
448             "header": null,
449             "invoice": null,
450             "invoice_settings": {
451             "days_until_due": null
452             },
453             "livemode": false,
454             "metadata": {
455             },
456             "number": null,
457             "on_behalf_of": null,
458             "status": "draft",
459             "status_transitions": {
460             "accepted_at": null,
461             "canceled_at": null,
462             "finalized_at": null
463             },
464             "subscription": null,
465             "subscription_data": {
466             "effective_date": null,
467             "trial_period_days": null
468             },
469             "subscription_schedule": null,
470             "total_details": {
471             "amount_discount": 0,
472             "amount_shipping": 0,
473             "amount_tax": 0
474             },
475             "transfer_data": null
476             }
477              
478             =head1 HISTORY
479              
480             =head2 v0.1.0
481              
482             Initial version
483              
484             =head1 AUTHOR
485              
486             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
487              
488             =head1 SEE ALSO
489              
490             L<Stripe API documentation|https://stripe.com/docs/api#quote_object>
491              
492             =head1 COPYRIGHT & LICENSE
493              
494             Copyright (c) 2019-2022 DEGUEST Pte. Ltd.
495              
496             You can use, copy, modify and redistribute this package and associated
497             files under the same terms as Perl itself.
498              
499             =cut