File Coverage

lib/Net/API/Stripe/Issuing/Authorization.pm
Criterion Covered Total %
statement 19 49 38.7
branch n/a
condition n/a
subroutine 7 37 18.9
pod 30 30 100.0
total 56 116 48.2


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/usr/local/src/perl/Net-API-Stripe/lib/Net/API/Stripe/Issuing/Authorization.pm
3             ## Version v0.101.0
4             ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/11/16
8             ## All rights reserved
9             ##
10             ## This program is free software; you can redistribute it and/or modify it
11             ## under the same terms as Perl itself.
12             ##----------------------------------------------------------------------------
13             ## https://stripe.com/docs/api/issuing/authorizations/object
14             BEGIN
15             {
16             use strict;
17 2     2   24172795 use warnings;
  2         12  
  2         62  
18 2     2   10 use parent qw( Net::API::Stripe::Generic );
  2         3  
  2         59  
19 2     2   10 use vars qw( $VERSION );
  2         4  
  2         11  
20 2     2   138 our( $VERSION ) = 'v0.101.0';
  2         6  
  2         152  
21 2     2   50 };
22              
23             use strict;
24 2     2   13 use warnings;
  2         3  
  2         40  
25 2     2   9  
  2         4  
  2         1414  
26              
27 0     0 1    
28              
29 0     0 1   { atm_fee => { type => "number" } }, @_ ) ); }
30              
31 0     0 1    
32              
33 0     0 1    
34              
35              
36 0     0 1    
37              
38 0     0 1    
39              
40 0     0 1    
41              
42 0     0 1    
43              
44 0     0 1    
45              
46 0     0 1    
47              
48 0     0 1    
49              
50 0     0 1   {
51             amount => { type => "number" },
52 0     0 1   amount_details => { definition => { atm_fee => { type => "number" } }, type => "class" },
53             currency => { type => "number" },
54 0     0 1   is_amount_controllable => { type => "boolean" },
55             merchant_amount => { type => "number" },
56 0     0 1   merchant_currency => { type => "number" },
57             }, @_ ) ); }
58 0     0 1    
59              
60 0     0 1    
61              
62 0     0 1    
63              
64 0     0 1    
65             1;
66 0     0 1    
67              
68 0     0 1   =encoding utf8
69              
70 0     0 1   =head1 NAME
71              
72 0     0 1   Net::API::Stripe::Issuing::Authorization - A Stripe Issued Authorization Object
73              
74 0     0 1   =head1 SYNOPSIS
75              
76             my $auth = $stripe->authorization({
77             approved => $stripe->true,
78             authorization_method => 'online',
79             authorized_amount => 2000,
80             authorized_currency => 'jpy',
81             balance_transactions =>
82             [
83             {
84 0     0 1   amount => 2000,
85             authorization => $authorization_object,
86 0     0 1   card => $card_object,
87             cardholder => $cardholder_object,
88 0     0 1   currency => 'jpy',
89             merchant_amount => 2000,
90 0     0 1   merchant_currency => 'jpy',
91             merchant_data => $merchant_data_object,
92 0     0 1   metadata => { transaction_id => 123 },
93             type => 'capture',
94 0     0 1   },
95             ],
96             card => $card_object,
97             cardholder => $cardholder_object,
98             created => '2020-04-12T04:07:30',
99             held_amount => 2000,
100             held_currency => 'jpy',
101             is_held_amount_controllable => $stripe->true,
102             merchant_data => $merchant_data_object,
103             metadata => { transaction_id => 123 },
104             pending_authorized_amount => 2000,
105             pending_held_amount => 2000,
106             request_history => [ $request_history_obj1, $request_history_obj2 ],
107             status => 'pending',
108             transactions => [ $transactions_obj1, $transactions_obj2, $transactions_obj3 ],
109             verification_data => $verification_data_object,
110             wallet_provider => undef,
111             });
112              
113             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
114              
115             =head1 VERSION
116              
117             v0.101.0
118              
119             =head1 DESCRIPTION
120              
121             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.
122              
123             =head1 CONSTRUCTOR
124              
125             =head2 new( %ARG )
126              
127             Creates a new L<Net::API::Stripe::Issuing::Authorization> object.
128              
129             =head1 METHODS
130              
131             =head2 id string
132              
133             Unique identifier for the object.
134              
135             =head2 object string, value is "issuing.authorization"
136              
137             String representing the object’s type. Objects of the same type share the same value.
138              
139             =head2 amount integer
140              
141             The total amount that was authorized or rejected. This amount is in the card's currency and in the L<smallest currency unit|https://stripe.com/docs/currencies#zero-decimal>.
142              
143             =head2 amount_details hash
144              
145             Detailed breakdown of amount components. These amounts are denominated in `currency` and in the L<smallest currency unit|https://stripe.com/docs/currencies#zero-decimal>.
146              
147             It has the following properties:
148              
149             =over 4
150              
151             =item I<atm_fee> integer
152              
153             The fee charged by the ATM for the cash withdrawal.
154              
155             =back
156              
157             =head2 approved boolean
158              
159             Whether the authorization has been approved.
160              
161             =head2 authorization_method string
162              
163             How the card details were provided. One of chip, contactless, keyed_in, online, or swipe.
164              
165             =head2 authorized_amount integer
166              
167             The amount that has been authorized. This will be 0 when the object is created, and increase after it has been approved.
168              
169             =head2 authorized_currency currency
170              
171             The currency that was presented to the cardholder for the authorization. Three-letter ISO currency code, in lowercase. Must be a supported currency.
172              
173             =head2 balance_transactions array, contains: balance_transaction object
174              
175             This is an array of L<Net::API::Stripe::Balance::Transaction> objects.
176              
177             =head2 card hash
178              
179             This is a L<Net::API::Stripe::Issuing::Card> object.
180              
181             =head2 cardholder string (expandable)
182              
183             The cardholder to whom this authorization belongs.
184              
185             When expanded, this is a L<Net::API::Stripe::Issuing::Card::Holder> object.
186              
187             =head2 created timestamp
188              
189             Time at which the object was created. Measured in seconds since the Unix epoch.
190              
191             =head2 currency currency
192              
193             Three-letter L<ISO currency code|https://www.iso.org/iso-4217-currency-codes.html>, in lowercase. Must be a L<supported currency|https://stripe.com/docs/currencies>.
194              
195             =head2 held_amount integer
196              
197             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.
198              
199             =head2 held_currency currency
200              
201             The currency of the held amount. This will always be the card currency.
202              
203             =head2 is_held_amount_controllable boolean
204              
205             Deprecated as of L<2020-04-15|https://github.com/stripe/stripe-java/pull/1009>
206              
207             =head2 livemode boolean
208              
209             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
210              
211             =head2 merchant_amount integer
212              
213             The total amount that was authorized or rejected. This amount is in the `merchant_currency` and in the L<smallest currency unit|https://stripe.com/docs/currencies#zero-decimal>.
214              
215             =head2 merchant_currency currency
216              
217             The currency that was presented to the cardholder for the authorization. Three-letter L<ISO currency code|https://www.iso.org/iso-4217-currency-codes.html>, in lowercase. Must be a L<supported currency|https://stripe.com/docs/currencies>.
218              
219             =head2 merchant_data hash
220              
221             This is a L<Net::API::Stripe::Issuing::MerchantData> object.
222              
223             =head2 metadata hash
224              
225             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.
226              
227             =head2 pending_authorized_amount integer
228              
229             The amount the user is requesting to be authorized. This field will only be non-zero during an issuing.authorization.request webhook.
230              
231             =head2 pending_held_amount integer
232              
233             The additional amount Stripe will hold if the authorization is approved. This field will only be non-zero during an issuing.authorization.request webhook.
234              
235             =head2 pending_request hash
236              
237             The pending authorization request. This field will only be non-null during an C<issuing_authorization.request> webhook.
238              
239             It has the following properties:
240              
241             =over 4
242              
243             =item I<amount> integer
244              
245             The additional amount Stripe will hold if the authorization is approved, in the card's L<currency|https://stripe.com/docs/api#issuing_authorization_object-pending-request-currency> and in the [smallest currency unit](/docs/currencies#zero-decimal).
246              
247             =item I<amount_details> hash
248              
249             Detailed breakdown of amount components. These amounts are denominated in C<currency> and in the L<smallest currency unit|https://stripe.com/docs/currencies#zero-decimal>.
250              
251             =over 8
252              
253             =item I<atm_fee> integer
254              
255             The fee charged by the ATM for the cash withdrawal.
256              
257             =back
258              
259             =item I<currency> currency
260              
261             Three-letter L<ISO currency code|https://www.iso.org/iso-4217-currency-codes.html>, in lowercase. Must be a L<supported currency|https://stripe.com/docs/currencies>.
262              
263             =item I<is_amount_controllable> boolean
264              
265             If set C<true>, you may provide L<amount|https://stripe.com/docs/api/issuing/authorizations/approve#approve_issuing_authorization-amount> to control how much to hold for the authorization.
266              
267             =item I<merchant_amount> integer
268              
269             The amount the merchant is requesting to be authorized in the C<merchant_currency>. The amount is in the L<smallest currency unit|https://stripe.com/docs/currencies#zero-decimal>.
270              
271             =item I<merchant_currency> currency
272              
273             The local currency the merchant is requesting to authorize.
274              
275             =back
276              
277             =head2 request_history array of hashes
278              
279             This is an array of L<Net::API::Stripe::Issuing::Authorization::RequestHistory> objects.
280              
281             =head2 status string
282              
283             One of pending, reversed, or closed.
284              
285             =head2 transactions array of hashes
286              
287             This is an array of L<Net::API::Stripe::Issuing::Authorization::Transaction> objects.
288              
289             =head2 verification_data hash
290              
291             This is a L<Net::API::Stripe::Issuing::Authorization::VerificationData> object.
292              
293             =head2 wallet string
294              
295             What, if any, digital wallet was used for this authorization. One of `apple_pay`, `google_pay`, or `samsung_pay`.
296              
297             =head2 wallet_provider string
298              
299             What, if any, digital wallet was used for this authorization. One of apple_pay, google_pay, or samsung_pay.
300              
301             =head1 API SAMPLE
302              
303             {
304             "id": "iauth_fake123456789",
305             "object": "issuing.authorization",
306             "approved": true,
307             "authorization_method": "online",
308             "authorized_amount": 500,
309             "authorized_currency": "usd",
310             "balance_transactions": [],
311             "card": null,
312             "cardholder": null,
313             "created": 1540642827,
314             "held_amount": 0,
315             "held_currency": "usd",
316             "is_held_amount_controllable": false,
317             "livemode": false,
318             "merchant_data": {
319             "category": "taxicabs_limousines",
320             "city": "San Francisco",
321             "country": "US",
322             "name": "Rocket Rides",
323             "network_id": "1234567890",
324             "postal_code": "94107",
325             "state": "CA",
326             "url": null
327             },
328             "metadata": {},
329             "pending_authorized_amount": 0,
330             "pending_held_amount": 0,
331             "request_history": [],
332             "status": "reversed",
333             "transactions": [
334             {
335             "id": "ipi_fake123456789",
336             "object": "issuing.transaction",
337             "amount": -100,
338             "authorization": "iauth_fake123456789",
339             "balance_transaction": null,
340             "card": "ic_fake123456789",
341             "cardholder": null,
342             "created": 1540642827,
343             "currency": "usd",
344             "dispute": null,
345             "livemode": false,
346             "merchant_amount": null,
347             "merchant_currency": null,
348             "merchant_data": {
349             "category": "taxicabs_limousines",
350             "city": "San Francisco",
351             "country": "US",
352             "name": "Rocket Rides",
353             "network_id": "1234567890",
354             "postal_code": "94107",
355             "state": "CA",
356             "url": null
357             },
358             "metadata": {},
359             "type": "capture"
360             },
361             {
362             "id": "ipi_fake123456789",
363             "object": "issuing.transaction",
364             "amount": -100,
365             "authorization": "iauth_fake123456789",
366             "balance_transaction": null,
367             "card": "ic_fake123456789",
368             "cardholder": null,
369             "created": 1540642827,
370             "currency": "usd",
371             "dispute": null,
372             "livemode": false,
373             "merchant_amount": null,
374             "merchant_currency": null,
375             "merchant_data": {
376             "category": "taxicabs_limousines",
377             "city": "San Francisco",
378             "country": "US",
379             "name": "Rocket Rides",
380             "network_id": "1234567890",
381             "postal_code": "94107",
382             "state": "CA",
383             "url": null
384             },
385             "metadata": {},
386             "type": "capture"
387             }
388             ],
389             "verification_data": {
390             "address_line1_check": "not_provided",
391             "address_zip_check": "match",
392             "authentication": "none",
393             "cvc_check": "match"
394             },
395             "wallet_provider": null
396             }
397              
398             =head1 HISTORY
399              
400             =head2 v0.1
401              
402             Initial version
403              
404             =head1 AUTHOR
405              
406             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
407              
408             =head1 SEE ALSO
409              
410             Stripe API documentation:
411              
412             L<https://stripe.com/docs/api/issuing/authorizations>, L<https://stripe.com/docs/issuing/authorizations>
413              
414             =head1 COPYRIGHT & LICENSE
415              
416             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
417              
418             You can use, copy, modify and redistribute this package and associated
419             files under the same terms as Perl itself.
420              
421             =cut