File Coverage

blib/lib/Net/API/Stripe/Issuing/Authorization.pm
Criterion Covered Total %
statement 7 30 23.3
branch n/a
condition n/a
subroutine 3 26 11.5
pod 23 23 100.0
total 33 79 41.7


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Issuing/Authorization.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/issuing/authorizations/object
11             package Net::API::Stripe::Issuing::Authorization;
12             BEGIN
13             {
14 1     1   827 use strict;
  1         2  
  1         28  
15 1     1   5 use parent qw( Net::API::Stripe::Generic );
  1         3  
  1         4  
16 1     1   377 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 approved { shift->_set_get_boolean( 'approved', @_ ); }
24              
25 0     0 1   sub authorization_method { shift->_set_get_scalar( 'authorization_method', @_ ); }
26              
27 0     0 1   sub authorized_amount { shift->_set_get_number( 'authorized_amount', @_ ); }
28              
29 0     0 1   sub authorized_currency { shift->_set_get_scalar( 'authorized_currency', @_ ); }
30              
31 0     0 1   sub balance_transactions { shift->_set_get_object_array( 'balance_transactions', 'Net::API::Stripe::Balance::Transaction', @_ ); }
32              
33 0     0 1   sub card { shift->_set_get_object( 'card', 'Net::API::Stripe::Issuing::Card', @_ ); }
34              
35 0     0 1   sub cardholder { shift->_set_get_scalar_or_object( 'cardholder', 'Net::API::Stripe::Issuing::Card::Holder', @_ ); }
36              
37 0     0 1   sub created { shift->_set_get_datetime( 'created', @_ ); }
38              
39 0     0 1   sub held_amount { shift->_set_get_number( 'held_amount', @_ ); }
40              
41 0     0 1   sub held_currency { shift->_set_get_number( 'held_currency', @_ ); }
42              
43 0     0 1   sub is_held_amount_controllable { shift->_set_get_boolean( 'is_held_amount_controllable', @_ ); }
44              
45 0     0 1   sub livemode { shift->_set_get_boolean( 'livemode', @_ ); }
46              
47 0     0 1   sub merchant_data { shift->_set_get_object( 'merchant_data', 'Net::API::Stripe::Issuing::MerchantData', @_ ); }
48              
49 0     0 1   sub metadata { shift->_set_get_hash( 'metadata', @_ ); }
50              
51 0     0 1   sub pending_authorized_amount { shift->_set_get_number( 'pending_authorized_amount', @_ ); }
52              
53 0     0 1   sub pending_held_amount { shift->_set_get_number( 'pending_held_amount', @_ ); }
54              
55 0     0 1   sub request_history { shift->_set_get_object_array( 'request_history', 'Net::API::Stripe::Issuing::Authorization::RequestHistory', @_ ); }
56              
57 0     0 1   sub status { shift->_set_get_scalar( 'status', @_ ); }
58              
59 0     0 1   sub transactions { shift->_set_get_object_array( 'transactions', 'Net::API::Stripe::Issuing::Authorization::Transaction', @_ ); }
60              
61 0     0 1   sub verification_data { shift->_set_get_object( 'verification_data', 'Net::API::Stripe::Issuing::Authorization::VerificationData', @_ ); }
62              
63 0     0 1   sub wallet_provider { return( shift->_set_get_scalar( 'wallet_provider', @_ ) ); }
64              
65             1;
66              
67             __END__
68              
69             =encoding utf8
70              
71             =head1 NAME
72              
73             Net::API::Stripe::Issuing::Authorization - A Stripe Issued Authorization Object
74              
75             =head1 SYNOPSIS
76              
77             my $auth = $stripe->authorization({
78             approved => $stripe->true,
79             authorization_method => 'online',
80             authorized_amount => 2000,
81             authorized_currency => 'jpy',
82             balance_transactions =>
83             [
84             {
85             amount => 2000,
86             authorization => $authorization_object,
87             card => $card_object,
88             cardholder => $cardholder_object,
89             currency => 'jpy',
90             merchant_amount => 2000,
91             merchant_currency => 'jpy',
92             merchant_data => $merchant_data_object,
93             metadata => { transaction_id => 123 },
94             type => 'capture',
95             },
96             ],
97             card => $card_object,
98             cardholder => $cardholder_object,
99             created => '2020-04-12T04:07:30',
100             held_amount => 2000,
101             held_currency => 'jpy',
102             is_held_amount_controllable => $stripe->true,
103             merchant_data => $merchant_data_object,
104             metadata => { transaction_id => 123 },
105             pending_authorized_amount => 2000,
106             pending_held_amount => 2000,
107             request_history => [ $request_history_obj1, $request_history_obj2 ],
108             status => 'pending',
109             transactions => [ $transactions_obj1, $transactions_obj2, $transactions_obj3 ],
110             verification_data => $verification_data_object,
111             wallet_provider => undef,
112             });
113              
114             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
115              
116             =head1 VERSION
117              
118             v0.100.0
119              
120             =head1 DESCRIPTION
121              
122             When an issued card is used to make a purchase, an Issuing Authorization object is created. Authorisations (L<https://stripe.com/docs/issuing/authorizations>) must be approved for the purchase to be completed successfully.
123              
124             =head1 CONSTRUCTOR
125              
126             =over 4
127              
128             =item B<new>( %ARG )
129              
130             Creates a new L<Net::API::Stripe::Issuing::Authorization> object.
131              
132             =back
133              
134             =head1 METHODS
135              
136             =over 4
137              
138             =item B<id> string
139              
140             Unique identifier for the object.
141              
142             =item B<object> string, value is "issuing.authorization"
143              
144             String representing the object’s type. Objects of the same type share the same value.
145              
146             =item B<approved> boolean
147              
148             Whether the authorization has been approved.
149              
150             =item B<authorization_method> string
151              
152             How the card details were provided. One of chip, contactless, keyed_in, online, or swipe.
153              
154             =item B<authorized_amount> integer
155              
156             The amount that has been authorized. This will be 0 when the object is created, and increase after it has been approved.
157              
158             =item B<authorized_currency> currency
159              
160             The currency that was presented to the cardholder for the authorization. Three-letter ISO currency code, in lowercase. Must be a supported currency.
161              
162             =item B<balance_transactions> array, contains: balance_transaction object
163              
164             This is an array of L<Net::API::Stripe::Balance::Transaction> objects.
165              
166             =item B<card> hash
167              
168             This is a L<Net::API::Stripe::Issuing::Card> object.
169              
170             =item B<cardholder> string (expandable)
171              
172             The cardholder to whom this authorization belongs.
173              
174             When expanded, this is a L<Net::API::Stripe::Issuing::Card::Holder> object.
175              
176             =item B<created> timestamp
177              
178             Time at which the object was created. Measured in seconds since the Unix epoch.
179              
180             =item B<held_amount> integer
181              
182             The amount the authorization is expected to be in held_currency. When Stripe holds funds from you, this is the amount reserved for the authorization. This will be 0 when the object is created, and increase after it has been approved. For multi-currency transactions, held_amount can be used to determine the expected exchange rate.
183              
184             =item B<held_currency> currency
185              
186             The currency of the held amount. This will always be the card currency.
187              
188             =item B<is_held_amount_controllable> boolean
189              
190             =item B<livemode> boolean
191              
192             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
193              
194             =item B<merchant_data> hash
195              
196             This is a L<Net::API::Stripe::Issuing::MerchantData> object.
197              
198             =item B<metadata> hash
199              
200             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.
201              
202             =item B<pending_authorized_amount> integer
203              
204             The amount the user is requesting to be authorized. This field will only be non-zero during an issuing.authorization.request webhook.
205              
206             =item B<pending_held_amount> integer
207              
208             The additional amount Stripe will hold if the authorization is approved. This field will only be non-zero during an issuing.authorization.request webhook.
209              
210             =item B<request_history> array of hashes
211              
212             This is an array of L<Net::API::Stripe::Issuing::Authorization::RequestHistory> objects.
213              
214             =item B<status> string
215              
216             One of pending, reversed, or closed.
217              
218             =item B<transactions> array of hashes
219              
220             This is an array of L<Net::API::Stripe::Issuing::Authorization::Transaction> objects.
221              
222             =item B<verification_data> hash
223              
224             This is a L<Net::API::Stripe::Issuing::Authorization::VerificationData> object.
225              
226             =item B<wallet_provider> string
227              
228             What, if any, digital wallet was used for this authorization. One of apple_pay, google_pay, or samsung_pay.
229              
230             =back
231              
232             =head1 API SAMPLE
233              
234             {
235             "id": "iauth_fake123456789",
236             "object": "issuing.authorization",
237             "approved": true,
238             "authorization_method": "online",
239             "authorized_amount": 500,
240             "authorized_currency": "usd",
241             "balance_transactions": [],
242             "card": null,
243             "cardholder": null,
244             "created": 1540642827,
245             "held_amount": 0,
246             "held_currency": "usd",
247             "is_held_amount_controllable": false,
248             "livemode": false,
249             "merchant_data": {
250             "category": "taxicabs_limousines",
251             "city": "San Francisco",
252             "country": "US",
253             "name": "Rocket Rides",
254             "network_id": "1234567890",
255             "postal_code": "94107",
256             "state": "CA",
257             "url": null
258             },
259             "metadata": {},
260             "pending_authorized_amount": 0,
261             "pending_held_amount": 0,
262             "request_history": [],
263             "status": "reversed",
264             "transactions": [
265             {
266             "id": "ipi_fake123456789",
267             "object": "issuing.transaction",
268             "amount": -100,
269             "authorization": "iauth_fake123456789",
270             "balance_transaction": null,
271             "card": "ic_fake123456789",
272             "cardholder": null,
273             "created": 1540642827,
274             "currency": "usd",
275             "dispute": null,
276             "livemode": false,
277             "merchant_amount": null,
278             "merchant_currency": null,
279             "merchant_data": {
280             "category": "taxicabs_limousines",
281             "city": "San Francisco",
282             "country": "US",
283             "name": "Rocket Rides",
284             "network_id": "1234567890",
285             "postal_code": "94107",
286             "state": "CA",
287             "url": null
288             },
289             "metadata": {},
290             "type": "capture"
291             },
292             {
293             "id": "ipi_fake123456789",
294             "object": "issuing.transaction",
295             "amount": -100,
296             "authorization": "iauth_fake123456789",
297             "balance_transaction": null,
298             "card": "ic_fake123456789",
299             "cardholder": null,
300             "created": 1540642827,
301             "currency": "usd",
302             "dispute": null,
303             "livemode": false,
304             "merchant_amount": null,
305             "merchant_currency": null,
306             "merchant_data": {
307             "category": "taxicabs_limousines",
308             "city": "San Francisco",
309             "country": "US",
310             "name": "Rocket Rides",
311             "network_id": "1234567890",
312             "postal_code": "94107",
313             "state": "CA",
314             "url": null
315             },
316             "metadata": {},
317             "type": "capture"
318             }
319             ],
320             "verification_data": {
321             "address_line1_check": "not_provided",
322             "address_zip_check": "match",
323             "authentication": "none",
324             "cvc_check": "match"
325             },
326             "wallet_provider": null
327             }
328              
329             =head1 HISTORY
330              
331             =head2 v0.1
332              
333             Initial version
334              
335             =head1 AUTHOR
336              
337             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
338              
339             =head1 SEE ALSO
340              
341             Stripe API documentation:
342              
343             L<https://stripe.com/docs/api/issuing/authorizations>, L<https://stripe.com/docs/issuing/authorizations>
344              
345             =head1 COPYRIGHT & LICENSE
346              
347             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
348              
349             You can use, copy, modify and redistribute this package and associated
350             files under the same terms as Perl itself.
351              
352             =cut