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