File Coverage

lib/Net/API/Stripe/Connect/TopUp.pm
Criterion Covered Total %
statement 19 35 54.2
branch n/a
condition n/a
subroutine 7 23 30.4
pod 16 16 100.0
total 42 74 56.7


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Connect/TopUp.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/topups
11             BEGIN
12             {
13             use strict;
14 2     2   23947330 use warnings;
  2         13  
  2         108  
15 2     2   12 use parent qw( Net::API::Stripe::Generic );
  2         5  
  2         63  
16 2     2   10 use vars qw( $VERSION );
  2         6  
  2         16  
17 2     2   157 our( $VERSION ) = 'v0.100.0';
  2         4  
  2         122  
18 2     2   38 };
19              
20             use strict;
21 2     2   12 use warnings;
  2         6  
  2         37  
22 2     2   10  
  2         4  
  2         617  
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   ## Does not seem to be documented in the Stripe API, although it showed up in its response json
39              
40 0     0 1   1;
41              
42 0     0 1    
43             =encoding utf8
44 0     0 1    
45             =head1 NAME
46 0     0 1    
47             Net::API::Stripe::Connect::TopUp - An Stripe Top-up Object
48 0     0 1    
49             =head1 SYNOPSIS
50 0     0 1    
51             my $topup = $stripe->topup({
52 0     0 1   amount => 2000,
53             currency => 'usd',
54             description => 'Adding fund for Q2 2020',
55 0     0 1   metadata => { transaction_id => 123 },
56             source => $source_object,
57             statement_descriptor => 'Fund transfer to Stripe for Q2 2020',
58             });
59              
60             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
61              
62             =head1 VERSION
63              
64             v0.100.0
65              
66             =head1 DESCRIPTION
67              
68             To top up your Stripe balance, you create a top-up object. You can retrieve individual top-ups, as well as list all top-ups. Top-ups are identified by a unique, random ID.
69              
70             =head1 CONSTRUCTOR
71              
72             =head2 new( %ARG )
73              
74             Creates a new L<Net::API::Stripe::Connect::TopUp> object.
75             It may also take an hash like arguments, that also are method of the same name.
76              
77             =head1 METHODS
78              
79             =head2 id string
80              
81             Unique identifier for the object.
82              
83             =head2 object string, value is "topup"
84              
85             String representing the object’s type. Objects of the same type share the same value.
86              
87             =head2 amount integer
88              
89             Amount transferred.
90              
91             =head2 balance_transaction string (expandable)
92              
93             ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up.
94              
95             When expanded, this is a L<Net::API::Stripe::Balance::Transaction> object.
96              
97             =head2 created timestamp
98              
99             Time at which the object was created. Measured in seconds since the Unix epoch.
100              
101             =head2 currency string
102              
103             Three-letter ISO currency code, in lowercase. Must be a supported currency.
104              
105             =head2 description string
106              
107             An arbitrary string attached to the object. Often useful for displaying to users.
108              
109             =head2 expected_availability_date integer
110              
111             Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up.
112              
113             =head2 failure_code string
114              
115             Error code explaining reason for top-up failure if available (see the errors section for a list of codes).
116              
117             =head2 failure_message string
118              
119             Message to user further explaining reason for top-up failure if available.
120              
121             =head2 livemode boolean
122              
123             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
124              
125             =head2 metadata hash
126              
127             Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
128              
129             =head2 source hash, source object
130              
131             For most Stripe users, the source of every top-up is a bank account. This hash is then the source object describing that bank account.
132              
133             This is a L<Net::API::Stripe::Payment::Source> object.
134              
135             =head2 statement_descriptor string
136              
137             Extra information about a top-up. This will appear on your source’s bank statement. It must contain at least one letter.
138              
139             =head2 status string
140              
141             The status of the top-up is either canceled, failed, pending, reversed, or succeeded.
142             transfer_group string
143              
144             A string that identifies this top-up as part of a group.
145              
146             =head2 transfer_group
147              
148             Undocumented in Stripe API, but found in its response json data. See example API sample below.
149              
150             =head1 API SAMPLE
151              
152             {
153             "id": "tu_fake123456789",
154             "object": "topup",
155             "amount": 1000,
156             "balance_transaction": null,
157             "created": 123456789,
158             "currency": "jpy",
159             "description": "Top-up description",
160             "expected_availability_date": 123456789,
161             "failure_code": null,
162             "failure_message": null,
163             "livemode": false,
164             "metadata": {
165             "order_id": "12345678"
166             },
167             "source": {
168             "id": "src_fake123456789",
169             "object": "source",
170             "ach_debit": {
171             "country": "US",
172             "type": "individual",
173             "routing_number": "110000000",
174             "bank_name": "STRIPE TEST BANK",
175             "fingerprint": "5Wh4KBcfDrz5IOnx",
176             "last4": "6789"
177             },
178             "amount": null,
179             "client_secret": "src_client_secret_fake123456789",
180             "created": 1571480456,
181             "currency": "jpy",
182             "flow": "code_verification",
183             "livemode": false,
184             "metadata": {},
185             "owner": {
186             "address": null,
187             "email": "jenny.rosen@example.com",
188             "name": "Jenny Rosen",
189             "phone": null,
190             "verified_address": null,
191             "verified_email": null,
192             "verified_name": null,
193             "verified_phone": null
194             },
195             "statement_descriptor": null,
196             "status": "pending",
197             "type": "ach_debit",
198             "usage": "reusable"
199             },
200             "statement_descriptor": null,
201             "status": "pending",
202             "transfer_group": null
203             }
204              
205             =head1 HISTORY
206              
207             =head2 v0.1
208              
209             Initial version
210              
211             =head1 AUTHOR
212              
213             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
214              
215             =head1 SEE ALSO
216              
217             Stripe API documentation:
218              
219             L<https://stripe.com/docs/api/topups>, L<https://stripe.com/docs/connect/top-ups>
220              
221             =head1 COPYRIGHT & LICENSE
222              
223             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
224              
225             You can use, copy, modify and redistribute this package and associated
226             files under the same terms as Perl itself.
227              
228             =cut