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