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