File Coverage

lib/Net/API/Stripe/Treasury/Transaction.pm
Criterion Covered Total %
statement 7 22 31.8
branch n/a
condition n/a
subroutine 3 18 16.6
pod 15 15 100.0
total 25 55 45.4


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Treasury/Transaction.pm
3             ## Version v0.1.0
4             ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2022/10/29
7             ## Modified 2022/10/29
8             ##
9             ##----------------------------------------------------------------------------
10             package Net::API::Stripe::Treasury::Transaction;
11             BEGIN
12             {
13 2     2   20986328 use strict;
  2         16  
  2         73  
14 2     2   18 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         12  
15 2     2   1029 our( $VERSION ) = 'v0.1.0';
16             };
17              
18 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
19              
20 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
21              
22 0     0 1   sub amount { return( shift->_set_get_number( 'amount', @_ ) ); }
23              
24 0     0 1   sub balance_impact { return( shift->_set_get_class( 'balance_impact',
25             {
26             cash => { type => "number" },
27             inbound_pending => { type => "number" },
28             outbound_pending => { type => "number" },
29             }, @_ ) ); }
30              
31 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
32              
33 0     0 1   sub currency { return( shift->_set_get_number( 'currency', @_ ) ); }
34              
35 0     0 1   sub description { return( shift->_set_get_scalar( 'description', @_ ) ); }
36              
37 0     0 1   sub entries { return( shift->_set_get_object( 'entries', 'Net::API::Stripe::List', @_ ) ); }
38              
39 0     0 1   sub financial_account { return( shift->_set_get_scalar( 'financial_account', @_ ) ); }
40              
41 0     0 1   sub flow { return( shift->_set_get_scalar( 'flow', @_ ) ); }
42              
43 0     0 1   sub flow_details { return( shift->_set_get_class( 'flow_details',
44             {
45             credit_reversal => {
46             package => "Net::API::Stripe::Treasury::CreditReversal",
47             type => "object",
48             },
49             debit_reversal => {
50             package => "Net::API::Stripe::Treasury::DebitReversal",
51             type => "object",
52             },
53             inbound_transfer => {
54             package => "Net::API::Stripe::Treasury::InboundTransfer",
55             type => "object",
56             },
57             issuing_authorization => { type => "hash" },
58             outbound_payment => {
59             package => "Net::API::Stripe::Treasury::OutboundPayment",
60             type => "object",
61             },
62             outbound_transfer => {
63             package => "Net::API::Stripe::Treasury::OutboundTransfer",
64             type => "object",
65             },
66             received_credit => {
67             package => "Net::API::Stripe::Treasury::ReceivedCredit",
68             type => "object",
69             },
70             received_debit => {
71             package => "Net::API::Stripe::Treasury::ReceivedDebit",
72             type => "object",
73             },
74             type => { type => "scalar" },
75             }, @_ ) ); }
76              
77 0     0 1   sub flow_type { return( shift->_set_get_scalar( 'flow_type', @_ ) ); }
78              
79 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
80              
81 0     0 1   sub status { return( shift->_set_get_scalar( 'status', @_ ) ); }
82              
83 0     0 1   sub status_transitions { return( shift->_set_get_class( 'status_transitions',
84             {
85             posted_at => { type => "datetime" },
86             void_at => { type => "datetime" },
87             }, @_ ) ); }
88              
89             1;
90             # NOTE: POD
91             __END__
92              
93             =encoding utf8
94              
95             =head1 NAME
96              
97             Net::API::Stripe::Treasury::Transaction - The Transaction object
98              
99             =head1 SYNOPSIS
100              
101             =head1 VERSION
102              
103             v0.1.0
104              
105             =head1 DESCRIPTION
106              
107             Transactions represent changes to a L<FinancialAccount's|https://stripe.com/docs/api/treasury/financial_accounts> balance.
108              
109             =head1 METHODS
110              
111             =head2 id string
112              
113             Unique identifier for the object.
114              
115             =head2 object string
116              
117             String representing the object's type. Objects of the same type share the same value.
118              
119             =head2 amount integer
120              
121             Amount (in cents) transferred.
122              
123             =head2 balance_impact hash
124              
125             The change made to each of the FinancialAccount's sub-balances by the Transaction.
126              
127             It has the following properties:
128              
129             =over 4
130              
131             =item C<cash> integer
132              
133             The change made to funds the user can spend right now.
134              
135             =item C<inbound_pending> integer
136              
137             The change made to funds that are not spendable yet, but will become available at a later time.
138              
139             =item C<outbound_pending> integer
140              
141             The change made to funds in the account, but not spendable because they are being held for pending outbound flows.
142              
143             =back
144              
145             =head2 created timestamp
146              
147             Time at which the object was created. Measured in seconds since the Unix epoch.
148              
149             =head2 currency currency
150              
151             Three-letter L<ISO currency code|https://www.iso.org/iso-4217-currency-codes.html>, in lowercase. Must be a L<supported currency|https://stripe.com/docs/currencies>.
152              
153             =head2 description string
154              
155             An arbitrary string attached to the object. Often useful for displaying to users.
156              
157             =head2 entries object
158              
159             A list of TransactionEntries that are part of this Transaction. This cannot be expanded in any list endpoints.
160              
161             This is a L<Net::API::Stripe::List> object.
162              
163             =head2 financial_account string
164              
165             The FinancialAccount associated with this object.
166              
167             =head2 flow string
168              
169             ID of the flow that created the Transaction.
170              
171             =head2 flow_details hash
172              
173             Details of the flow that created the Transaction.
174              
175             It has the following properties:
176              
177             =over 4
178              
179             =item C<credit_reversal> hash
180              
181             The CreditReversal object associated with the Transaction. Set if C<type=credit_reversal>.
182              
183             When expanded, this is a L<Net::API::Stripe::Treasury::CreditReversal> object.
184              
185             =item C<debit_reversal> hash
186              
187             The DebitReversal object associated with the Transaction. Set if C<type=debit_reversal>.
188              
189             When expanded, this is a L<Net::API::Stripe::Treasury::DebitReversal> object.
190              
191             =item C<inbound_transfer> hash
192              
193             The InboundTransfer object associated with the Transaction. Set if C<type=inbound_transfer>.
194              
195             When expanded, this is a L<Net::API::Stripe::Treasury::InboundTransfer> object.
196              
197             =item C<issuing_authorization> hash
198              
199             The Issuing authorization object associated with the Transaction. Set if C<type=issuing_authorization>.
200              
201             =item C<outbound_payment> hash
202              
203             The OutboundPayment object associated with the Transaction. Set if C<type=outbound_payment>.
204              
205             When expanded, this is a L<Net::API::Stripe::Treasury::OutboundPayment> object.
206              
207             =item C<outbound_transfer> hash
208              
209             The OutboundTransfer object associated with the Transaction. Set if C<type=outbound_transfer>.
210              
211             When expanded, this is a L<Net::API::Stripe::Treasury::OutboundTransfer> object.
212              
213             =item C<received_credit> hash
214              
215             The ReceivedCredit object associated with the Transaction. Set if C<type=received_credit>.
216              
217             When expanded, this is a L<Net::API::Stripe::Treasury::ReceivedCredit> object.
218              
219             =item C<received_debit> hash
220              
221             The ReceivedDebit object associated with the Transaction. Set if C<type=received_debit>.
222              
223             When expanded, this is a L<Net::API::Stripe::Treasury::ReceivedDebit> object.
224              
225             =item C<type> string
226              
227             Type of the flow that created the Transaction. Set to the same value as C<flow_type>.
228              
229             =back
230              
231             =head2 flow_type string
232              
233             Type of the flow that created the Transaction.
234              
235             =head2 livemode boolean
236              
237             Has the value C<true> if the object exists in live mode or the value C<false> if the object exists in test mode.
238              
239             =head2 status string
240              
241             Status of the Transaction.
242              
243             =head2 status_transitions hash
244              
245             Hash containing timestamps of when the object transitioned to a particular C<status>.
246              
247             It has the following properties:
248              
249             =over 4
250              
251             =item C<posted_at> timestamp
252              
253             Timestamp describing when the Transaction changed status to C<posted>.
254              
255             =item C<void_at> timestamp
256              
257             Timestamp describing when the Transaction changed status to C<void>.
258              
259             =back
260              
261             =head1 API SAMPLE
262              
263             [
264             {
265             "amount" : "-100",
266             "balance_impact" : {
267             "cash" : "-100",
268             "inbound_pending" : "0",
269             "outbound_pending" : "100"
270             },
271             "created" : "1662261085",
272             "currency" : "usd",
273             "description" : "Jane Austen (6789) | Outbound transfer | transfer",
274             "financial_account" : "fa_1Le9F32eZvKYlo2CjbQcDQUE",
275             "flow" : "obt_1Le9F32eZvKYlo2CPQD5jo2F",
276             "flow_type" : "outbound_transfer",
277             "id" : "trxn_1Le9F32eZvKYlo2C2dtkse82",
278             "livemode" : 0,
279             "object" : "treasury.transaction",
280             "status" : "open",
281             "status_transitions" : {
282             "posted_at" : null,
283             "void_at" : null
284             }
285             }
286             ]
287              
288             =head1 HISTORY
289              
290             =head2 v0.1.0
291              
292             Initial version
293              
294             =head1 AUTHOR
295              
296             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
297              
298             =head1 SEE ALSO
299              
300             L<Stripe API documentation|https://stripe.com/docs/api/treasury/transactions>
301              
302             =head1 COPYRIGHT & LICENSE
303              
304             Copyright (c) 2019-2022 DEGUEST Pte. Ltd.
305              
306             You can use, copy, modify and redistribute this package and associated
307             files under the same terms as Perl itself.
308              
309             =cut