File Coverage

blib/lib/Net/API/Stripe/Connect/TopUp.pm
Criterion Covered Total %
statement 7 23 30.4
branch n/a
condition n/a
subroutine 3 19 15.7
pod 16 16 100.0
total 26 58 44.8


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