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