File Coverage

lib/Net/API/Stripe/Balance/Transaction.pm
Criterion Covered Total %
statement 19 35 54.2
branch n/a
condition n/a
subroutine 7 23 30.4
pod 15 16 93.7
total 41 74 55.4


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Balance/Transaction.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_transaction
14             package Net::API::Stripe::Balance::Transaction;
15             BEGIN
16             {
17 2     2   21177062 use strict;
  2         13  
  2         62  
18 2     2   11 use warnings;
  2         4  
  2         73  
19 2     2   12 use parent qw( Net::API::Stripe::Generic );
  2         3  
  2         9  
20 2     2   148 use vars qw( $VERSION );
  2         4  
  2         125  
21 2     2   35 our( $VERSION ) = 'v0.101.0';
22             };
23              
24 2     2   11 use strict;
  2         3  
  2         35  
25 2     2   10 use warnings;
  2         4  
  2         702  
26              
27 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
28              
29 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
30              
31 0     0 1   sub amount { return( shift->_set_get_number( 'amount', @_ ) ); }
32              
33 0     0 1   sub available_on { return( shift->_set_get_datetime( 'available_on', @_ ) ); }
34              
35 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
36              
37 0     0 1   sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); }
38              
39 0     0 1   sub description { return( shift->_set_get_scalar( 'description', @_ ) ); }
40              
41 0     0 1   sub exchange_rate { return( shift->_set_get_number( 'exchange_rate', @_ ) ); }
42              
43 0     0 0   sub fee { return( shift->_set_get_number( 'fee', @_ ) ); }
44              
45             ## Array of Net::API::Stripe::Balance::Transaction::FeeDetails
46 0     0 1   sub fee_details { return( shift->_set_get_object_array( 'fee_details', 'Net::API::Stripe::Balance::Transaction::FeeDetails', @_ ) ); }
47              
48 0     0 1   sub net { return( shift->_set_get_number( 'net', @_ ) ); }
49              
50 0     0 1   sub reporting_category { return( shift->_set_get_scalar( 'reporting_category', @_ ) ); }
51              
52 0     0 1   sub source { return( shift->_set_get_scalar_or_object_variant( 'source', @_ ) ); }
53              
54 0     0 1   sub sourced_transfers { return( shift->_set_get_object( 'sourced_transfers', 'Net::API::Stripe::List', @_ ) ); }
55              
56 0     0 1   sub status { return( shift->_set_get_scalar( 'status', @_ ) ); }
57              
58 0     0 1   sub type { return( shift->_set_get_scalar( 'type', @_ ) ); }
59              
60             1;
61              
62             __END__
63              
64             =encoding utf8
65              
66             =head1 NAME
67              
68             Net::API::Stripe::Balance::Transaction - The Balance Transaction object
69              
70             =head1 SYNOPSIS
71              
72             my $bt = $stripe->balance_transactions({
73             amount => 2000,
74             # or we could also use a unix timestamp
75             available_on => '2019-08-15',
76             currency => 'jpy',
77             description => 'Customer account credit',
78             fee_details => Net::API::Stripe::Balance::Transaction::FeeDetails->new({
79             amount => 40,
80             currency => 'eur',
81             description => 'Some transaction',
82             type => 'application_fee',
83             }),
84             net => 1960,
85             status => 'available',
86             type => 'application_fee',
87             }) || die( $stripe->error );
88              
89             =head1 VERSION
90              
91             v0.101.0
92              
93             =head1 DESCRIPTION
94              
95             Balance transactions represent funds moving through your Stripe account. They're created for every type of transaction that comes into or flows out of your Stripe account balance.
96              
97             =head1 CONSTRUCTOR
98              
99             =head2 new( %ARG )
100              
101             Creates a new L<Net::API::Stripe::Balance::Transaction> object
102              
103             =head1 METHODS
104              
105             =head2 id string
106              
107             Unique identifier for the object.
108              
109             =head2 object string, value is "balance_transaction"
110              
111             String representing the object’s type. Objects of the same type share the same value.
112              
113             =head2 amount integer
114              
115             Gross amount of the transaction, in JPY.
116              
117             =head2 available_on timestamp
118              
119             The date the transaction’s net funds will become available in the Stripe balance.
120              
121             =head2 created timestamp
122              
123             Time at which the object was created. Measured in seconds since the Unix epoch.
124              
125             =head2 currency currency
126              
127             Three-letter ISO currency code, in lowercase. Must be a supported currency (L<https://stripe.com/docs/currencies>).
128              
129             =head2 description string
130              
131             An arbitrary string attached to the object. Often useful for displaying to users.
132              
133             =head2 exchange_rate decimal
134              
135             fee integer
136              
137             Fees (in JPY) paid for this transaction.
138              
139             =head2 fee_details array of L<Net::API::Stripe::Balance::Transaction::FeeDetails> objects
140              
141             Detailed breakdown of fees (in JPY) paid for this transaction.
142              
143             =over 4
144              
145             =item I<amount> integer
146              
147             Amount of the fee, in cents.
148              
149             =item I<application> string
150              
151             =item I<currency> currency
152              
153             Three-letter ISO currency code, in lowercase. Must be a supported currency.
154              
155             =item I<description> string
156              
157             An arbitrary string attached to the object. Often useful for displaying to users.
158              
159             =item I<type> string
160              
161             Type of the fee, one of: application_fee, stripe_fee or tax.
162              
163             =back
164              
165             =head2 net integer
166              
167             Net amount of the transaction, in JPY.
168              
169             =head2 reporting_category string
170              
171             L<Learn more|https://stripe.com/docs/reports/reporting-categories> about how reporting categories can help you understand balance transactions from an accounting perspective.
172              
173             =head2 source string (expandable)
174              
175             The Stripe object to which this transaction is related.
176              
177             For example, a charge object. This is managed with L<Net::API::Stripe::Generic/"_set_get_scalar_or_object_variant"> method. It will check if this is a hash, array or string, and will find out the proper associated class by peeking into the data.
178              
179             =head2 sourced_transfers array
180              
181             This is a list of object, but according to Stripe and its support, it is deprecated.
182              
183             The "sourced_transfers parameters used to include any charges or ACH payments to which the balance transfer relates and provide a link back to the 'source' of the balance transaction."
184              
185             See L<https://stripe.com/docs/upgrades#2017-01-27>
186              
187             =head2 status string
188              
189             If the transaction’s net funds are available in the Stripe balance yet. Either available or pending.
190              
191             =head2 type string
192              
193             Transaction type:
194              
195             =over 4
196              
197             =item I<adjustment>
198              
199             =item I<advance>
200              
201             =item I<advance_funding>
202              
203             =item I<application_fee>
204              
205             =item I<application_fee_refund>
206              
207             =item I<charge>
208              
209             =item I<connect_collection_transfer>
210              
211             =item I<issuing_authorization_hold>
212              
213             =item I<issuing_authorization_release>
214              
215             =item I<issuing_transaction>
216              
217             =item I<payment>
218              
219             =item I<payment_failure_refund>
220              
221             =item I<payment_refund>
222              
223             =item I<payout>
224              
225             =item I<payout_cancel>
226              
227             =item I<payout_failure>
228              
229             =item I<refund>
230              
231             =item I<refund_failure>
232              
233             =item I<reserve_transaction>
234              
235             =item I<reserved_funds>
236              
237             =item I<stripe_fee>
238              
239             =item I<stripe_fx_fee>
240              
241             =item I<tax_fee>
242              
243             =item I<topup>
244              
245             =item I<topup_reversal>
246              
247             =item I<transfer>
248              
249             =item I<transfer_cancel>
250              
251             =item I<transfer_failure>
252              
253             =item I<transfer_refund>
254              
255             =back
256              
257             =head1 API SAMPLE
258              
259             {
260             "id": "txn_fake1234567890",
261             "object": "balance_transaction",
262             "amount": 8000,
263             "available_on": 1571443200,
264             "created": 1571128827,
265             "currency": "jpy",
266             "description": "Invoice 409CD54-0039",
267             "exchange_rate": null,
268             "fee": 288,
269             "fee_details": [
270             {
271             "amount": 288,
272             "application": null,
273             "currency": "jpy",
274             "description": "Stripe processing fees",
275             "type": "stripe_fee"
276             }
277             ],
278             "net": 7712,
279             "source": "ch_fake1234567890",
280             "status": "pending",
281             "type": "charge"
282             }
283              
284             =head1 HISTORY
285              
286             =head2 v0.1
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             Stripe API documentation:
297              
298             L<https://stripe.com/docs/api/balance_transactions>, L<https://stripe.com/docs/reports/balance-transaction-types>
299              
300             =head1 COPYRIGHT & LICENSE
301              
302             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
303              
304             You can use, copy, modify and redistribute this package and associated
305             files under the same terms as Perl itself.
306              
307             =cut