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