File Coverage

blib/lib/Net/API/Stripe/Balance.pm
Criterion Covered Total %
statement 7 12 58.3
branch n/a
condition n/a
subroutine 3 8 37.5
pod 5 5 100.0
total 15 25 60.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Balance.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <@sitael.tokyo.deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/balance/balance_object
11             package Net::API::Stripe::Balance;
12             BEGIN
13             {
14 1     1   800 use strict;
  1         2  
  1         28  
15 1     1   5 use parent qw( Net::API::Stripe::Generic );
  1         2  
  1         4  
16 1     1   149 our( $VERSION ) = 'v0.100.0';
17             };
18              
19 0     0 1   sub object { shift->_set_get_scalar( 'object', @_ ); }
20              
21             ## Array of Net::API::Stripe::Connect::Transfer
22 0     0 1   sub available { shift->_set_get_object_array( 'available', 'Net::API::Stripe::Connect::Transfer', @_ ); }
23              
24             ## Array of Net::API::Stripe::Balance::ConnectReserved
25 0     0 1   sub connect_reserved { shift->_set_get_object_array( 'connect_reserved', 'Net::API::Stripe::Balance::ConnectReserved', @_ ); }
26              
27 0     0 1   sub livemode { shift->_set_get_boolean( 'livemode', @_ ); }
28              
29             ## Array of Net::API::Stripe::Balance::Pending
30 0     0 1   sub pending { shift->_set_get_object_array( 'pending', 'Net::API::Stripe::Balance::Pending', @_ ); }
31              
32             1;
33              
34             __END__
35              
36             =encoding utf8
37              
38             =head1 NAME
39              
40             Net::API::Stripe::Balance - The Balance object
41              
42             =head1 SYNOPSIS
43              
44             my $object = $stripe->balances( 'retrieve' ) || die( $stripe->error );
45              
46             =head1 VERSION
47              
48             v0.100.0
49              
50             =head1 DESCRIPTION
51              
52             This is an object representing your Stripe balance. You can retrieve it to see the balance currently on your Stripe account.
53              
54             You can also retrieve the balance history, which contains a list of transactions (L<https://stripe.com/docs/reporting/balance-transaction-types>) that contributed to the balance (charges, payouts, and so forth).
55              
56             The available and pending amounts for each currency are broken down further by payment source types.
57              
58             =head1 CONSTRUCTOR
59              
60             =over 4
61              
62             =item B<new>( %ARG )
63              
64             Creates a new L<Net::API::Stripe::Balance> object.
65              
66             =back
67              
68             =head1 METHODS
69              
70             =over 4
71              
72             =item B<object> string, value is "balance"
73              
74             String representing the object’s type. Objects of the same type share the same value.
75              
76             =item B<available> array of L<Net::API::Stripe::Connect::Transfer>
77              
78             Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the Transfers API or Payouts API. The available balance for each currency and payment type can be found in the source_types property.
79              
80             Currently this is an array of L<Net::API::Stripe::Connect::Transfer>, but I am considering revising that in light of the documentation of the Stripe API.
81              
82             =over 8
83              
84             =item B<amount> integer
85              
86             Balance amount.
87              
88             =item B<currency> currency
89              
90             Three-letter ISO currency code, in lowercase. Must be a supported currency.
91              
92             =item B<source_types> hash
93              
94             Breakdown of balance by source types.
95              
96             =over 12
97              
98             =item I<bank_account> integer
99              
100             Amount for bank account.
101              
102             =item I<card> integer
103              
104             Amount for card.
105              
106             =back
107              
108             =back
109              
110             =item B<connect_reserved> array of L<Net::API::Stripe::Balance::ConnectReserved> objects.
111              
112             Funds held due to negative balances on connected Custom accounts. The connect reserve balance for each currency and payment type can be found in the source_types property.
113              
114             =over 8
115              
116             =item B<amount> integer
117              
118             Balance amount.
119              
120             =item B<currency> currency
121              
122             Three-letter ISO currency code, in lowercase. Must be a supported currency.
123              
124             =item B<source_types> hash
125              
126             Breakdown of balance by source types.
127              
128             =back
129              
130             =item B<livemode> boolean
131              
132             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
133              
134             =item B<pending> array of L<Net::API::Stripe::Balance::Pending> objects.
135              
136             Funds that are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the source_types property.
137              
138             =over 8
139              
140             =item B<amount> integer
141              
142             Balance amount.
143              
144             =item B<currency> currency
145              
146             Three-letter ISO currency code, in lowercase. Must be a supported currency.
147              
148             =item B<source_types> hash
149              
150             Breakdown of balance by source types.
151              
152             =back
153              
154             =back
155              
156             =head1 API SAMPLE
157              
158             {
159             "object": "balance",
160             "available": [
161             {
162             "amount": 0,
163             "currency": "jpy",
164             "source_types": {
165             "card": 0
166             }
167             }
168             ],
169             "connect_reserved": [
170             {
171             "amount": 0,
172             "currency": "jpy"
173             }
174             ],
175             "livemode": false,
176             "pending": [
177             {
178             "amount": 7712,
179             "currency": "jpy",
180             "source_types": {
181             "card": 7712
182             }
183             }
184             ]
185             }
186              
187             =head1 HISTORY
188              
189             =head2 v0.1
190              
191             Initial version
192              
193             =head1 AUTHOR
194              
195             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
196              
197             =head1 SEE ALSO
198              
199             L<https://stripe.com/docs/api/balance>, L<https://stripe.com/docs/connect/account-balances>
200              
201             =head1 COPYRIGHT & LICENSE
202              
203             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
204              
205             You can use, copy, modify and redistribute this package and associated
206             files under the same terms as Perl itself.
207              
208             =cut