File Coverage

blib/lib/Net/API/Stripe/Connect/Transfer.pm
Criterion Covered Total %
statement 7 25 28.0
branch n/a
condition n/a
subroutine 3 21 14.2
pod 18 18 100.0
total 28 64 43.7


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Connect/Transfer.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <@sitael.tokyo.deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/transfers
11             package Net::API::Stripe::Connect::Transfer;
12             BEGIN
13             {
14 1     1   852 use strict;
  1         2  
  1         29  
15 1     1   4 use parent qw( Net::API::Stripe::Generic );
  1         3  
  1         5  
16 1     1   303 our( $VERSION ) = 'v0.100.0';
17             };
18              
19 0     0 1   sub id { shift->_set_get_scalar( 'id', @_ ); }
20              
21 0     0 1   sub object { shift->_set_get_scalar( 'object', @_ ); }
22              
23 0     0 1   sub amount { shift->_set_get_number( 'amount', @_ ); }
24              
25 0     0 1   sub amount_reversed { shift->_set_get_number( 'amount_reversed', @_ ); }
26              
27 0     0 1   sub balance_transaction { shift->_set_get_scalar_or_object( 'balance_transaction', 'Net::API::Stripe::Balance::Transaction', @_ ); }
28              
29 0     0 1   sub created { shift->_set_get_datetime( 'created', @_ ); }
30              
31 0     0 1   sub currency { shift->_set_get_scalar( 'currency', @_ ); }
32              
33 0     0 1   sub description { shift->_set_get_scalar( 'description', @_ ); }
34              
35 0     0 1   sub destination { shift->_set_get_scalar_or_object( 'destination', 'Net::API::Stripe::Connect::Account', @_ ); }
36              
37 0     0 1   sub destination_payment { shift->_set_get_scalar_or_object( 'destination_payment', 'Net::API::Stripe::Connect::Transfer', @_ ); }
38              
39 0     0 1   sub livemode { shift->_set_get_boolean( 'livemode', @_ ); }
40              
41 0     0 1   sub metadata { shift->_set_get_hash( 'metadata', @_ ); }
42              
43 0     0 1   sub reversals { shift->_set_get_object( 'reversals', 'Net::API::Stripe::Connect::Transfer::Reversals', @_ ); }
44              
45 0     0 1   sub reversed { shift->_set_get_boolean( 'reversed', @_ ); }
46              
47 0     0 1   sub source_transaction { shift->_set_get_scalar_or_object( 'source_transaction', 'Net::API::Stripe::Charge', @_ ); }
48              
49             ## As reference in the example data here https://stripe.com/docs/api/balance/balance_object
50 0     0 1   sub source_type { shift->_set_get_scalar( 'source_type', @_ ); }
51              
52 0     0 1   sub source_types { shift->_set_get_hash( 'source_types', @_ ); }
53              
54 0     0 1   sub transfer_group { shift->_set_get_scalar( 'transfer_group', @_ ); }
55              
56             1;
57              
58             __END__
59              
60             =encoding utf8
61              
62             =head1 NAME
63              
64             Net::API::Stripe::Connect::Transfer - A Stripe Account-to-Account Transfer Object
65              
66             =head1 SYNOPSIS
67              
68             my $trans = $stripe->transfer({
69             amount => 2000,
70             currency => 'jpy',
71             description => 'Campaign contribution payment',
72             destination => $account_object,
73             metadata => { transaction_id => 123 },
74             });
75              
76             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
77              
78             =head1 VERSION
79              
80             v0.100.0
81              
82             =head1 DESCRIPTION
83              
84             A Transfer object is created when you move funds between Stripe accounts as part of Connect.
85              
86             Before April 6, 2017, transfers also represented movement of funds from a Stripe account to a card or bank account. This behavior has since been split out into a Payout object (L<Net::API::Stripe::Payout> / L<https://stripe.com/docs/api/transfers#payout_object>), with corresponding payout endpoints. For more information, read about the transfer/payout split (L<https://stripe.com/docs/transfer-payout-split>).
87              
88             =head1 CONSTRUCTOR
89              
90             =over 4
91              
92             =item B<new>( %ARG )
93              
94             Creates a new L<Net::API::Stripe::Connect::Transfer> object.
95             It may also take an hash like arguments, that also are method of the same name.
96              
97             =back
98              
99             =head1 METHODS
100              
101             =over 4
102              
103             =item B<id> string
104              
105             Unique identifier for the object.
106              
107             =item B<object> string, value is "transfer"
108              
109             String representing the object’s type. Objects of the same type share the same value.
110              
111             =item B<amount> integer
112              
113             Amount in JPY to be transferred.
114              
115             =item B<amount_reversed> integer
116              
117             Amount in JPY reversed (can be less than the amount attribute on the transfer if a partial reversal was issued).
118              
119             =item B<balance_transaction> string (expandable)
120              
121             Balance transaction that describes the impact of this transfer on your account balance.
122              
123             When expanded, this is a L<Net::API::Stripe::Balance::Transaction> object.
124              
125             =item B<created> timestamp
126              
127             Time that this record of the transfer was first created.
128              
129             =item B<currency> currency
130              
131             Three-letter ISO currency code, in lowercase. Must be a supported currency.
132              
133             =item B<description> string
134              
135             An arbitrary string attached to the object. Often useful for displaying to users.
136              
137             =item B<destination> string (expandable)
138              
139             ID of the Stripe account the transfer was sent to.
140              
141             When expanded, this is a L<Net::API::Stripe::Connect::Account> object.
142              
143             =item B<destination_payment> string (expandable)
144              
145             If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer.
146              
147             When expanded, this is a L<Net::API::Stripe::Connect::Transfer> object.
148              
149             =item B<livemode> boolean
150              
151             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
152              
153             =item B<metadata> hash
154              
155             A set of key-value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format.
156              
157             =item B<reversals> list
158              
159             A list of reversals that have been applied to the transfer.
160              
161             This is a L<Net::API::Stripe::Connect::Transfer::Reversals> object.
162              
163             =item B<reversed> boolean
164              
165             Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false.
166              
167             =item B<source_transaction> string (expandable)
168              
169             ID of the charge or payment that was used to fund the transfer. If null, the transfer was funded from the available balance.
170              
171             When expanded, this is a L<Net::API::Stripe::Charge> object.
172              
173             =item B<source_type> string
174              
175             The source balance this transfer came from. One of card or bank_account.
176              
177             =item B<source_types> hash
178              
179             This is undocumented, but found in Stripe API response.
180              
181             =item B<transfer_group> string
182              
183             A string that identifies this transaction as part of a group. See the Connect documentation for details.
184              
185             =back
186              
187             =head1 API SAMPLE
188              
189             {
190             "id": "tr_fake123456789",
191             "object": "transfer",
192             "amount": 1100,
193             "amount_reversed": 0,
194             "balance_transaction": "txn_fake123456789",
195             "created": 1571197172,
196             "currency": "jpy",
197             "description": null,
198             "destination": "acct_fake123456789",
199             "destination_payment": "py_fake123456789",
200             "livemode": false,
201             "metadata": {},
202             "reversals": {
203             "object": "list",
204             "data": [],
205             "has_more": false,
206             "url": "/v1/transfers/tr_fake123456789/reversals"
207             },
208             "reversed": false,
209             "source_transaction": null,
210             "source_type": "card",
211             "transfer_group": null
212             }
213              
214             =head1 HISTORY
215              
216             =head2 v0.1
217              
218             Initial version
219              
220             =head1 STRIPE HISTORY
221              
222             =head2 2017-04-06
223              
224             Splits the Transfer object into Payout and Transfer. The Payout object represents money moving from a Stripe account to an external account (bank or debit card). The Transfer object now only represents money moving between Stripe accounts on a Connect platform. For more details, see L<https://stripe.com/docs/transfer-payout-split>.
225              
226             =head1 AUTHOR
227              
228             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
229              
230             =head1 SEE ALSO
231              
232             Stripe API documentation:
233              
234             L<https://stripe.com/docs/api/transfers>, L<https://stripe.com/docs/connect/charges-transfers>
235              
236             =head1 COPYRIGHT & LICENSE
237              
238             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
239              
240             You can use, copy, modify and redistribute this package and associated
241             files under the same terms as Perl itself.
242              
243             =cut