File Coverage

lib/Net/API/Stripe/Cash/Transaction.pm
Criterion Covered Total %
statement 19 32 59.3
branch n/a
condition n/a
subroutine 7 20 35.0
pod 13 13 100.0
total 39 65 60.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Cash/Transaction.pm
3             ## Version v0.1.0
4             ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2022/07/06
7             ## Modified 2022/07/06
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             package Net::API::Stripe::Cash::Transaction;
14             BEGIN
15             {
16 2     2   21336195 use strict;
  2         12  
  2         62  
17 2     2   10 use warnings;
  2         4  
  2         58  
18 2     2   12 use parent qw( Net::API::Stripe::Generic );
  2         5  
  2         14  
19 2     2   142 use vars qw( $VERSION );
  2         5  
  2         105  
20 2     2   49 our $VERSION = 'v0.1.0';
21             };
22              
23 2     2   11 use strict;
  2         5  
  2         36  
24 2     2   9 use warnings;
  2         5  
  2         645  
25              
26 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
27              
28 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
29              
30             sub applied_to_payment
31             {
32 0     0 1   return( shift->_set_get_class( 'settings',
33             {
34             payment_intent => { type => 'scalar_or_object', package => 'Net::API::Stripe::Payment::Intent' },
35             }, @_ ) );
36             }
37              
38 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
39              
40 0     0 1   sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); }
41              
42 0     0 1   sub customer { return( shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ) ); }
43              
44 0     0 1   sub ending_balance { return( shift->_set_get_number( 'ending_balance', @_ ) ); }
45              
46             sub funded
47             {
48 0     0 1   return( shift->_set_get_class( 'funded',
49             {
50             bank_transfer => { type => 'class', definition =>
51             {
52             eu_bank_transfer => { type => 'class', definition =>
53             {
54             bic => { type => 'string' },
55             iban_last4 => { type => 'string' },
56             sender_name => { type => 'string' },
57             }},
58             reference => { type => 'string' },
59             type => { type => 'string' },
60             }},
61             }, @_ ) );
62             }
63              
64 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
65              
66 0     0 1   sub net_amount { return( shift->_set_get_number( 'net_amount', @_ ) ); }
67              
68             sub refunded_from_payment
69             {
70 0     0 1   return( shift->_set_get_class( 'refunded_from_payment',
71             {
72             refund => { type => 'scalar_or_object', package => 'Net::API::Stripe::Refund' },
73             }, @_ ) );
74             }
75              
76 0     0 1   sub type { return( shift->_set_get_scalar( 'type', @_ ) ); }
77              
78             sub unapplied_from_payment
79             {
80 0     0 1   return( shift->_set_get_class( 'unapplied_from_payment',
81             {
82             payment_intent => { type => 'scalar_or_object', package => 'Net::API::Stripe::Payment::Intent' },
83             }, @_ ) );
84             }
85              
86             1;
87             # NOTE: POD
88             __END__
89              
90             =encoding utf-8
91              
92             =head1 NAME
93              
94             Net::API::Stripe::Cash::Transaction - Stripe API
95              
96             =head1 SYNOPSIS
97              
98             use Net::API::Stripe::Cash::Transaction;
99             my $this = Net::API::Stripe::Cash::Transaction->new || die( Net::API::Stripe::Cash::Transaction->error, "\n" );
100              
101             =head1 VERSION
102              
103             v0.1.0
104              
105             =head1 DESCRIPTION
106              
107             =head1 METHODS
108              
109             =head2 id
110              
111             String
112              
113             Unique identifier for the object.
114              
115             Object string, value is "customer_cash_balance_transaction"
116              
117             String representing the object’s type. Objects of the same type share the same value.
118              
119             =head2 applied_to_payment
120              
121             Hash
122              
123             If this is a type=applied_to_payment transaction, contains information about how funds were applied.
124              
125             =over 4
126              
127             =item * C<payment_intent>
128              
129             String
130              
131             Expandable
132              
133             The Payment Intent that funds were applied to.
134              
135             =back
136              
137             =head2 created timestamp
138              
139             Time at which the object was created. Measured in seconds since the Unix epoch.
140              
141             =head2 currency string
142              
143             Three-letter ISO currency code, in lowercase. Must be a supported currency.
144              
145             =head2 customer string
146              
147             Expandable
148              
149             The customer whose available cash balance changed as a result of this transaction.
150              
151             =head2 ending_balance integer
152              
153             The total available cash balance for the specified currency after this transaction was applied. Represented in the smallest currency unit.
154              
155             =head2 funded
156              
157             Hash
158              
159             If this is a type=funded transaction, contains information about the funding.
160              
161             =over 4
162              
163             =item * C<bank_transfer>
164              
165             Hash
166              
167             Information about the bank transfer that funded the customer’s cash balance.
168              
169             =over 8
170              
171             =item * C<eu_bank_transfer>
172              
173             Hash
174              
175             EU-specific details of the bank transfer.
176              
177             =over 12
178              
179             =item * C<bic>
180              
181             String
182              
183             The BIC of the bank of the sender of the funding.
184              
185             =item * C<iban_last4>
186              
187             String
188              
189             The last 4 digits of the IBAN of the sender of the funding.
190              
191             =item * C<sender_name>
192              
193             String
194              
195             The full name of the sender, as supplied by the sending bank.
196              
197             =back
198              
199             =item * C<reference>
200              
201             String
202              
203             The user-supplied reference field on the bank transfer.
204              
205             =item * C<type>
206              
207             String
208              
209             The funding method type used to fund the customer balance. Permitted values include: us_bank_account, eu_bank_account, id_bank_account, gb_bank_account, jp_bank_account, mx_bank_account, eu_bank_transfer, gb_bank_transfer, id_bank_transfer, jp_bank_transfer, mx_bank_transfer, or us_bank_transfer.
210              
211             =back
212              
213             =back
214              
215             =head2 livemode boolean
216              
217             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
218              
219             =head2 net_amount integer
220              
221             The amount by which the cash balance changed, represented in the smallest currency unit. A positive value represents funds being added to the cash balance, a negative value represents funds being removed from the cash balance.
222              
223             =head2 refunded_from_payment
224              
225             Hash
226              
227             If this is a type=refunded_from_payment transaction, contains information about the source of the refund.
228              
229             =over 4
230              
231             =item * C<refund>
232              
233             String. Expandable
234              
235             The Refund that moved these funds into the customer’s cash balance.
236              
237             =back
238              
239             =head2 type string
240              
241             The type of the cash balance transaction. One of adjustment, applied_to_invoice, credit_note, initial, invoice_too_large, invoice_too_small, migration, unspent_receiver_credit, or unapplied_from_invoice. New types may be added in future. See Customer Balances to learn more about these types.
242              
243             =head2 unapplied_from_payment
244              
245             Hash
246              
247             If this is a type=unapplied_from_payment transaction, contains information about how funds were unapplied.
248              
249             =over 4
250              
251             =item * C<payment_intent>
252              
253             String. Expandable
254              
255             The Payment Intent that funds were unapplied from.
256              
257             =back
258              
259             =head1 API SAMPLE
260              
261             {
262             "id": "ccsbtxn_1LIVZqCeyNCl6fY2APWGE8ro",
263             "object": "customer_cash_balance_transaction",
264             "created": 1657103726,
265             "currency": "jpy",
266             "customer": "cus_AODr7KhjWjH7Yk",
267             "ending_balance": 10000,
268             "funded": {
269             "bank_transfer": {
270             "reference": null,
271             "type": "jp_bank_transfer"
272             }
273             },
274             "livemode": false,
275             "net_amount": 5000,
276             "type": "funded"
277             }
278             =head1 AUTHOR
279              
280             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
281              
282             =head1 SEE ALSO
283              
284             Stripe API documentation:
285              
286             L<https://stripe.com/docs/api/cash_balance_transactions/object>
287              
288             =head1 COPYRIGHT & LICENSE
289              
290             Copyright(c) 2022 DEGUEST Pte. Ltd.
291              
292             All rights reserved
293             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
294              
295             =cut