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