File Coverage

lib/Net/API/Stripe/Balance.pm
Criterion Covered Total %
statement 19 26 73.0
branch n/a
condition n/a
subroutine 7 14 50.0
pod 7 7 100.0
total 33 47 70.2


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Balance.pm
3             ## Version v0.101.0
4             ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/11/15
8             ## All rights reserved
9             ##
10             ## This program is free software; you can redistribute it and/or modify it
11             ## under the same terms as Perl itself.
12             ##----------------------------------------------------------------------------
13             ## https://stripe.com/docs/api/balance/balance_object
14             package Net::API::Stripe::Balance;
15             BEGIN
16             {
17 2     2   21157135 use strict;
  2         16  
  2         59  
18 2     2   11 use warnings;
  2         3  
  2         61  
19 2     2   10 use parent qw( Net::API::Stripe::Generic );
  2         5  
  2         10  
20 2     2   155 use vars qw( $VERSION );
  2         4  
  2         114  
21 2     2   37 our( $VERSION ) = 'v0.101.0';
22             };
23              
24 2     2   10 use strict;
  2         3  
  2         37  
25 2     2   11 use warnings;
  2         3  
  2         368  
26              
27 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
28              
29             ## Array of Net::API::Stripe::Connect::Transfer
30 0     0 1   sub available { return( shift->_set_get_object_array( 'available', 'Net::API::Stripe::Connect::Transfer', @_ ) ); }
31              
32             ## Array of Net::API::Stripe::Balance::ConnectReserved
33 0     0 1   sub connect_reserved { return( shift->_set_get_object_array( 'connect_reserved', 'Net::API::Stripe::Balance::ConnectReserved', @_ ) ); }
34              
35 0     0 1   sub instant_available { return( shift->_set_get_object_array( 'instant_available', 'Net::API::Stripe::Balance::Pending', @_ ) ); }
36              
37 0     0 1   sub issuing { return( shift->_set_get_class( 'issuing',
38             {
39             available => { type => 'object', package => 'Net::API::Stripe::Balance::Pending' },
40             }, @_ ) ); }
41              
42 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
43              
44             # Array of Net::API::Stripe::Balance::Pending
45 0     0 1   sub pending { return( shift->_set_get_object_array( 'pending', 'Net::API::Stripe::Balance::Pending', @_ ) ); }
46              
47             1;
48              
49             __END__
50              
51             =encoding utf8
52              
53             =head1 NAME
54              
55             Net::API::Stripe::Balance - The Balance object
56              
57             =head1 SYNOPSIS
58              
59             my $object = $stripe->balances( 'retrieve' ) || die( $stripe->error );
60              
61             =head1 VERSION
62              
63             v0.101.0
64              
65             =head1 DESCRIPTION
66              
67             This is an object representing your Stripe balance. You can retrieve it to see the balance currently on your Stripe account.
68              
69             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).
70              
71             The available and pending amounts for each currency are broken down further by payment source types.
72              
73             =head1 CONSTRUCTOR
74              
75             =head2 new( %ARG )
76              
77             Creates a new L<Net::API::Stripe::Balance> object.
78              
79             =head1 METHODS
80              
81             =head2 object string, value is "balance"
82              
83             String representing the object’s type. Objects of the same type share the same value.
84              
85             =head2 available array of L<Net::API::Stripe::Connect::Transfer>
86              
87             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.
88              
89             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.
90              
91             =head2 amount integer
92              
93             Balance amount.
94              
95             =head2 currency currency
96              
97             Three-letter ISO currency code, in lowercase. Must be a supported currency.
98              
99             =head2 source_types hash
100              
101             Breakdown of balance by source types.
102              
103             =over 4
104              
105             =item I<bank_account> integer
106              
107             Amount for bank account.
108              
109             =item I<card> integer
110              
111             Amount for card.
112              
113             =back
114              
115             =head2 connect_reserved array of L<Net::API::Stripe::Balance::ConnectReserved> objects.
116              
117             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.
118              
119             =over 4
120              
121             =item I<amount> integer
122              
123             Balance amount.
124              
125             =item I<currency> currency
126              
127             Three-letter ISO currency code, in lowercase. Must be a supported currency.
128              
129             =item I<source_types> hash
130              
131             Breakdown of balance by source types.
132              
133             =back
134              
135             =head2 instant_available array of hashes
136              
137             Funds that can be paid out using Instant Payouts.
138              
139             This is a L<Net::API::Stripe::Balance::Pending> object.
140              
141             It contains the following properties:
142              
143             =over 4
144              
145             =item I<amount> integer
146              
147             Balance amount.
148              
149             =item I<currency> number
150              
151             Three-letter ISO currency code, in lowercase. Must be a supported currency.
152              
153             =item I<source_types> hash
154              
155             Breakdown of balance by source types.
156              
157             It contains the following sub properties:
158              
159             =over 8
160              
161             =item I<bank_account> integer
162              
163             Amount for bank account.
164              
165             =item I<card> integer
166              
167             Amount for card.
168              
169             =item I<fpx> integer
170              
171             Amount for FPX.
172              
173             =back
174              
175             =back
176              
177             =head2 issuing hash
178              
179             Funds that can be spent on your Issued Cards.
180              
181             It has the following properties:
182              
183             =over 4
184              
185             =item I<available> array
186              
187             Funds that are available for use.
188              
189             When expanded, this is a L<Net::API::Stripe::Balance::Pending> object.
190              
191             It has the following properties:
192              
193             =over 8
194              
195             =item I<amount> integer
196              
197             Balance amount.
198              
199             =item I<currency> number
200              
201             Three-letter ISO currency code, in lowercase. Must be a supported currency.
202              
203             =item I<source_types> hash
204              
205             Breakdown of balance by source types.
206              
207             It contains the following sub properties:
208              
209             =over 12
210              
211             =item I<bank_account> integer
212              
213             Amount for bank account.
214              
215             =item I<card> integer
216              
217             Amount for card.
218              
219             =item I<fpx> integer
220              
221             Amount for FPX.
222              
223             =back
224              
225             =back
226              
227             =back
228              
229             =head2 livemode boolean
230              
231             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
232              
233             =head2 pending array of L<Net::API::Stripe::Balance::Pending> objects.
234              
235             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.
236              
237             =over 4
238              
239             =item I<amount> integer
240              
241             Balance amount.
242              
243             =item I<currency> currency
244              
245             Three-letter ISO currency code, in lowercase. Must be a supported currency.
246              
247             =item I<source_types> hash
248              
249             Breakdown of balance by source types.
250              
251             =back
252              
253             =head1 API SAMPLE
254              
255             {
256             "object": "balance",
257             "available": [
258             {
259             "amount": 0,
260             "currency": "jpy",
261             "source_types": {
262             "card": 0
263             }
264             }
265             ],
266             "connect_reserved": [
267             {
268             "amount": 0,
269             "currency": "jpy"
270             }
271             ],
272             "livemode": false,
273             "pending": [
274             {
275             "amount": 7712,
276             "currency": "jpy",
277             "source_types": {
278             "card": 7712
279             }
280             }
281             ]
282             }
283              
284             =head1 HISTORY
285              
286             =head2 v0.100.0
287              
288             Initial version
289              
290             =head1 AUTHOR
291              
292             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
293              
294             =head1 SEE ALSO
295              
296             L<https://stripe.com/docs/api/balance>, L<https://stripe.com/docs/connect/account-balances>
297              
298             =head1 COPYRIGHT & LICENSE
299              
300             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
301              
302             You can use, copy, modify and redistribute this package and associated
303             files under the same terms as Perl itself.
304              
305             =cut