File Coverage

lib/Net/API/Stripe/Billing/Thresholds.pm
Criterion Covered Total %
statement 19 23 82.6
branch n/a
condition n/a
subroutine 7 11 63.6
pod 4 4 100.0
total 30 38 78.9


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Thresholds.pm
3             ## Version v0.101.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2022/10/29
8             ##
9             ##----------------------------------------------------------------------------
10             BEGIN
11             {
12             use strict;
13 2     2   23997844 use warnings;
  2         12  
  2         60  
14 2     2   10 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         56  
15 2     2   9 use vars qw( $VERSION );
  2         4  
  2         10  
16 2     2   136 our( $VERSION ) = 'v0.101.0';
  2         4  
  2         119  
17 2     2   42 };
18              
19             use strict;
20 2     2   11 use warnings;
  2         3  
  2         43  
21 2     2   9  
  2         4  
  2         271  
22              
23 0     0 1   {
24             line_item_ids => { type => "array" },
25 0     0 1   usage_gte => { type => "number" },
26             }, @_ ) ); }
27              
28              
29              
30             1;
31 0     0 1    
32              
33 0     0 1   =encoding utf8
34              
35             =head1 NAME
36              
37             Net::API::Stripe::Billing::Thresholds - A Stripe Billing Thresholds Object
38              
39             =head1 SYNOPSIS
40              
41             my $obj = $subscription->billing_thresholds({
42             amount_gte => 1000,
43             reset_billing_cycle_anchor => $stripe->true,
44             });
45              
46             =head1 VERSION
47              
48             v0.101.0
49              
50             =head1 DESCRIPTION
51              
52             Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
53              
54             =head1 CONSTRUCTOR
55              
56             =head2 new( %ARG )
57              
58             Creates a new L<Net::API::Stripe::Billing::Thresholds> object.
59              
60             =head1 METHODS
61              
62             =head2 amount_gte integer
63              
64             Monetary threshold that triggers the subscription to create an invoice
65              
66             =head2 item_reasons array of hash
67              
68             Indicates which line items triggered a threshold invoice.
69              
70             It has the following properties:
71              
72             =over 4
73              
74             =item C<line_item_ids> string_array
75              
76             The IDs of the line items that triggered the threshold invoice.
77              
78             =item C<usage_gte> integer
79              
80             The quantity threshold boundary that applied to the given line item.
81              
82             =back
83              
84             =head2 reset_billing_cycle_anchor boolean
85              
86             Indicates if the billing_cycle_anchor should be reset when a threshold is reached. If true, billing_cycle_anchor will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be true if the subscription contains items with plans that have aggregate_usage=last_ever.
87              
88             =head2 usage_gte integer
89              
90             The quantity threshold boundary that applied to the given line item.
91              
92             =head1 API SAMPLE
93              
94             {
95             "id": "sub_fake123456789",
96             "object": "subscription",
97             "application_fee_percent": null,
98             "billing_cycle_anchor": 1551492959,
99             "billing_thresholds": null,
100             "cancel_at_period_end": false,
101             "canceled_at": 1555726796,
102             "collection_method": "charge_automatically",
103             "created": 1551492959,
104             "current_period_end": 1556763359,
105             "current_period_start": 1554171359,
106             "customer": "cus_fake123456789",
107             "days_until_due": null,
108             "default_payment_method": null,
109             "default_source": null,
110             "default_tax_rates": [],
111             "discount": null,
112             "ended_at": 1555726796,
113             "items": {
114             "object": "list",
115             "data": [
116             {
117             "id": "si_fake123456789",
118             "object": "subscription_item",
119             "billing_thresholds": null,
120             "created": 1551492959,
121             "metadata": {},
122             "plan": {
123             "id": "professional-monthly-jpy",
124             "object": "plan",
125             "active": true,
126             "aggregate_usage": null,
127             "amount": 8000,
128             "amount_decimal": "8000",
129             "billing_scheme": "per_unit",
130             "created": 1541833564,
131             "currency": "jpy",
132             "interval": "month",
133             "interval_count": 1,
134             "livemode": false,
135             "metadata": {},
136             "nickname": null,
137             "product": "prod_fake123456789",
138             "tiers": null,
139             "tiers_mode": null,
140             "transform_usage": null,
141             "trial_period_days": null,
142             "usage_type": "licensed"
143             },
144             "quantity": 1,
145             "subscription": "sub_fake123456789",
146             "tax_rates": []
147             }
148             ],
149             "has_more": false,
150             "url": "/v1/subscription_items?subscription=sub_fake123456789"
151             },
152             "latest_invoice": "in_fake123456789",
153             "livemode": false,
154             "metadata": {},
155             "next_pending_invoice_item_invoice": null,
156             "pending_invoice_item_interval": null,
157             "pending_setup_intent": null,
158             "plan": {
159             "id": "professional-monthly-jpy",
160             "object": "plan",
161             "active": true,
162             "aggregate_usage": null,
163             "amount": 8000,
164             "amount_decimal": "8000",
165             "billing_scheme": "per_unit",
166             "created": 1541833564,
167             "currency": "jpy",
168             "interval": "month",
169             "interval_count": 1,
170             "livemode": false,
171             "metadata": {},
172             "nickname": null,
173             "product": "prod_fake123456789",
174             "tiers": null,
175             "tiers_mode": null,
176             "transform_usage": null,
177             "trial_period_days": null,
178             "usage_type": "licensed"
179             },
180             "quantity": 1,
181             "start_date": 1551492959,
182             "status": "canceled",
183             "tax_percent": null,
184             "trial_end": null,
185             "trial_start": null
186             }
187              
188             =head1 HISTORY
189              
190             =head2 v0.1
191              
192             Initial version
193              
194             =head1 AUTHOR
195              
196             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
197              
198             =head1 SEE ALSO
199              
200             Stripe API documentation:
201              
202             L<https://stripe.com/docs/api/subscriptions/object>
203              
204             =head1 COPYRIGHT & LICENSE
205              
206             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
207              
208             You can use, copy, modify and redistribute this package and associated
209             files under the same terms as Perl itself.
210              
211             =cut