File Coverage

lib/Net/API/Stripe/Connect/Transfer.pm
Criterion Covered Total %
statement 19 37 51.3
branch n/a
condition n/a
subroutine 7 25 28.0
pod 18 18 100.0
total 44 80 55.0


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