File Coverage

lib/Net/API/Stripe/Billing/Invoice/BalanceSettings.pm
Criterion Covered Total %
statement 19 20 95.0
branch n/a
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 27 29 93.1


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Invoice/BalanceSettings.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/03
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             package Net::API::Stripe::Billing::Invoice::BalanceSettings;
11             BEGIN
12             {
13 1     1   1046 use strict;
  1         4  
  1         42  
14 1     1   5 use warnings;
  1         2  
  1         34  
15 1     1   5 use parent qw( Net::API::Stripe::Generic );
  1         1  
  1         8  
16 1     1   74 use vars qw( $VERSION );
  1         3  
  1         51  
17 1     1   18 our( $VERSION ) = 'v0.100.0';
18             };
19              
20 1     1   6 use strict;
  1         5  
  1         29  
21 1     1   6 use warnings;
  1         2  
  1         62  
22              
23 0     0 1   sub consume_applied_balance_on_void { return( shift->_set_get_boolean( 'consume_applied_balance_on_void', @_ ) ); }
24              
25             1;
26              
27             __END__
28              
29             =encoding utf8
30              
31             =head1 NAME
32              
33             Net::API::Stripe::Billing::Invoice::BalanceSettings - A Stripe Customer Invoice Balance Transaction Upon Voiding
34              
35             =head1 SYNOPSIS
36              
37             my $obj = $sub->invoice_customer_balance_settings({
38             # Boolean
39             consume_applied_balance_on_void => 1,
40             });
41              
42             =head1 VERSION
43              
44             v0.100.0
45              
46             =head1 DESCRIPTION
47              
48             This is instantiated by method B<invoice_customer_balance_settings> from L<Net::API::Stripe::Billing::Subscription>
49              
50             =head1 CONSTRUCTOR
51              
52             =head2 new( %ARG )
53              
54             Creates a new L<Net::API::Stripe::Billing::Invoice::BalanceSettings> object.
55             It may also take an hash like arguments, that also are method of the same name.
56              
57             =head1 METHODS
58              
59             =head2 consume_applied_balance_on_void
60              
61             Controls whether a customer balance applied to this invoice should be consumed and not credited or debited back to the customer if voided.
62              
63             Stripe support explained me:
64             "One can void invoices only when they are in either the I<open> or the I<uncollectible> status but never when they are paid status. So voiding an invoice does not result in issuing a credit.
65              
66             When an invoice generated by the subscription is voided, the invoice is treated as zero-value and the customer balance isn't be applied."
67              
68             =head1 API SAMPLE
69              
70             {
71             "id": "sub_fake124567890",
72             "object": "subscription",
73             "application_fee_percent": null,
74             "billing_cycle_anchor": 1572739659,
75             "billing_thresholds": null,
76             "cancel_at_period_end": false,
77             "canceled_at": null,
78             "collection_method": "charge_automatically",
79             "created": 1572739659,
80             "current_period_end": 1575331659,
81             "current_period_start": 1572739659,
82             "customer": "cus_fake124567890",
83             "days_until_due": null,
84             "default_payment_method": null,
85             "default_source": null,
86             "default_tax_rates": [
87              
88             ],
89             "discount": null,
90             "ended_at": null,
91             "invoice_customer_balance_settings": {
92             "consume_applied_balance_on_void": true
93             },
94             "items": {
95             "object": "list",
96             "data": [
97             {
98             "id": "si_fake124567890",
99             "object": "subscription_item",
100             "billing_thresholds": null,
101             "created": 1572739659,
102             "metadata": {
103             },
104             "plan": {
105             "id": "plan_fake124567890",
106             "object": "plan",
107             "active": true,
108             "aggregate_usage": null,
109             "amount": 999,
110             "amount_decimal": "999",
111             "billing_scheme": "per_unit",
112             "created": 1572736765,
113             "currency": "usd",
114             "interval": "month",
115             "interval_count": 1,
116             "livemode": false,
117             "metadata": {
118             },
119             "nickname": null,
120             "product": "prod_fake124567890",
121             "tiers": null,
122             "tiers_mode": null,
123             "transform_usage": null,
124             "trial_period_days": null,
125             "usage_type": "licensed"
126             },
127             "quantity": 1,
128             "subscription": "sub_fake124567890",
129             "tax_rates": [
130              
131             ]
132             }
133             ],
134             "has_more": false,
135             "url": "/v1/subscription_items?subscription=sub_fake124567890"
136             },
137             "latest_invoice": null,
138             "livemode": false,
139             "metadata": {
140             },
141             "next_pending_invoice_item_invoice": null,
142             "pending_invoice_item_interval": null,
143             "pending_setup_intent": null,
144             "plan": {
145             "id": "plan_fake124567890",
146             "object": "plan",
147             "active": true,
148             "aggregate_usage": null,
149             "amount": 999,
150             "amount_decimal": "999",
151             "billing_scheme": "per_unit",
152             "created": 1572736765,
153             "currency": "usd",
154             "interval": "month",
155             "interval_count": 1,
156             "livemode": false,
157             "metadata": {
158             },
159             "nickname": null,
160             "product": "prod_fake124567890",
161             "tiers": null,
162             "tiers_mode": null,
163             "transform_usage": null,
164             "trial_period_days": null,
165             "usage_type": "licensed"
166             },
167             "quantity": 1,
168             "start_date": 1572739659,
169             "status": "active",
170             "tax_percent": null,
171             "trial_end": null,
172             "trial_start": null
173             }
174              
175             =head1 HISTORY
176              
177             =head2 v0.1
178              
179             Initial version
180              
181             =head1 AUTHOR
182              
183             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
184              
185             =head1 SEE ALSO
186              
187             Stripe API documentation:
188              
189             L<https://stripe.com/docs/api/subscriptions/object?lang=node#subscription_object-invoice_customer_balance_settings>, L<https://stripe.com/docs/billing/invoices/workflow#void>, L<https://stripe.com/docs/billing/customer/balance#customer-balance>
190              
191             =head1 COPYRIGHT & LICENSE
192              
193             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
194              
195             You can use, copy, modify and redistribute this package and associated
196             files under the same terms as Perl itself.
197              
198             =cut