File Coverage

lib/Net/API/Stripe/Issuing/Card.pm
Criterion Covered Total %
statement 19 46 41.3
branch n/a
condition n/a
subroutine 7 34 20.5
pod 27 27 100.0
total 53 107 49.5


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/usr/local/src/perl/Net-API-Stripe/lib/Net/API/Stripe/Issuing/Card.pm
3             ## Version v0.202.0
4             ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2022/10/29
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/cards/object
14             BEGIN
15             {
16             use strict;
17 2     2   24822792 use warnings;
  2         17  
  2         62  
18 2     2   11 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         61  
19 2     2   11 use vars qw( $VERSION );
  2         4  
  2         10  
20 2     2   153 our( $VERSION ) = 'v0.202.0';
  2         5  
  2         143  
21 2     2   38 };
22              
23             use strict;
24 2     2   11 use warnings;
  2         4  
  2         56  
25 2     2   11  
  2         7  
  2         1372  
26              
27 0     0 1    
28              
29 0     0 1    
30              
31 0     0 1    
32              
33 0     0 1    
34              
35 0     0 1    
36              
37 0     0 1    
38              
39 0     0 1    
40              
41 0     0 1    
42              
43 0     0 1    
44              
45 0     0 1    
46              
47 0     0 1    
48              
49 0     0 1   {
50             return( shift->_set_get_class( 'spending_controls',
51 0     0 1   {
52             allowed_categories => { type => 'array' },
53 0     0 1   blocked_categories => { type => 'array' },
54             spending_limits =>
55 0     0 1   {
56             type => 'class', definition =>
57 0     0 1   {
58             amount => { type => 'number' },
59 0     0 1   categories => { type => 'array' },
60             interval => { type => 'scalar' },
61 0     0 1   }
62             },
63 0     0 1   spending_limits_currency => { type => 'scalar' },
64             }, @_ ) );
65 0     0 1   }
66              
67 0     0 1    
68              
69 0     0 1   {
70             apple_pay => {
71 0     0 1   definition => {
72             eligible => { type => "boolean" },
73             ineligible_reason => { type => "scalar" },
74             },
75 0     0 1   type => "class",
76             },
77             google_pay => {
78             definition => {
79             eligible => { type => "boolean" },
80             ineligible_reason => { type => "scalar" },
81             },
82             type => "class",
83             },
84             primary_account_identifier => { type => "scalar" },
85             }, @_ ) ); }
86              
87             1;
88              
89              
90             =encoding utf8
91              
92 0     0 1   =head1 NAME
93              
94 0     0 1   Net::API::Stripe::Issuing::Card - A Stripe Issued Card Object
95              
96 0     0 1   =head1 SYNOPSIS
97              
98             my $card = $stripe->card({
99             authorization_controls => $authorization_controls_objet,
100             brand => 'visa',
101             cardholder => $cardholder_object,
102             currency => 'jpy',
103             exp_month => 12,
104             exp_year => 2030,
105             last4 => 123,
106             metadata => { transaction_id => 123 },
107             name => 'John Doe',
108             replacement_for => $card_object,
109             replacement_reason => 'loss',
110             shipping => $address_object,
111             status => 'active',
112             type => 'physical',
113             });
114              
115             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
116              
117             =head1 VERSION
118              
119             v0.202.0
120              
121             =head1 DESCRIPTION
122              
123             You can create physical or virtual cards that are issued to cardholders.
124              
125             This Module bears some resemblance with L<Net::API::Stripe::Connect::ExternalAccount::Card>, but is quite different, so it stands on its own.
126              
127             =head1 CONSTRUCTOR
128              
129             =head2 new( %ARG )
130              
131             Creates a new L<Net::API::Stripe::Issuing::Card> object.
132             It may also take an hash like arguments, that also are method of the same name.
133              
134             =head1 METHODS
135              
136             =head2 id string
137              
138             Unique identifier for the object.
139              
140             =head2 object string, value is "issuing.card"
141              
142             String representing the object’s type. Objects of the same type share the same value.
143              
144             =head2 authorization_controls hash
145              
146             Spending rules that give you some control over how your cards can be used. Refer to L<Stripe's authorizations documentation|https://stripe.com/docs/issuing/purchases/authorizations> for more details.
147              
148             This is a L<Net::API::Stripe::Issuing::Card::AuthorizationsControl> object.
149              
150             =head2 brand string
151              
152             The brand of the card.
153              
154             =head2 cancellation_reason string
155              
156             The reason why the card was canceled.
157              
158             =head2 cardholder hash
159              
160             The Cardholder object to which the card belongs.
161              
162             This is a L<Net::API::Stripe::Issuing::Card::Holder> object.
163              
164             =head2 created timestamp
165              
166             Time at which the object was created. Measured in seconds since the Unix epoch.
167              
168             =head2 currency currency
169              
170             Three-letter ISO currency code, in lowercase. Must be a supported currency.
171              
172             =head2 cvc string
173              
174             The card's CVC. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with [the `expand` parameter](/docs/api/expanding_objects). Additionally, it's only available via the L<"Retrieve a card" endpoint|https://stripe.com/docs/api/issuing/cards/retrieve>, not via "List all cards" or any other endpoint.
175              
176             =head2 exp_month integer
177              
178             The expiration month of the card.
179              
180             =head2 exp_year integer
181              
182             The expiration year of the card.
183              
184             =head2 expires_after_days integer
185              
186             The number of calendar days before an OXXO invoice expires. For example, if you create an OXXO invoice on Monday and you set expiresI<after>days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time.
187              
188             =head2 last4 string
189              
190             The last 4 digits of the card number.
191              
192             =head2 livemode boolean
193              
194             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
195              
196             =head2 metadata hash
197              
198             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.
199              
200             =head2 name string
201              
202             The name of the cardholder, printed on the card.
203              
204             =head2 number string
205              
206             The full unredacted card number. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with [the `expand` parameter](/docs/api/expanding_objects). Additionally, it's only available via the ["Retrieve a card" endpoint](/docs/api/issuing/cards/retrieve), not via "List all cards" or any other endpoint.
207              
208             =head2 pin hash
209              
210             Metadata about the PIN on the card.
211              
212             This is a virtual L<Net::API::Stripe::Issuing::Card::PinInfo> object.
213              
214             It contains the following property:
215              
216             =over 4
217              
218             =item I<status> string
219              
220             The status of the pin. One of blocked or active.
221              
222             =back
223              
224             =head2 replaced_by expandable
225              
226             The latest card that replaces this card, if any.
227              
228             When expanded this is an L<Net::API::Stripe::Issuing::Card> object.
229              
230             =head2 replacement_for string (expandable)
231              
232             The card this card replaces, if any. When expanded, this is a L<Net::API::Stripe::Issuing::Card> object.
233              
234             =head2 replacement_reason string
235              
236             Why the card that this card replaces (if any) needed to be replaced. One of damage, expiration, loss, or theft.
237              
238             =head2 setup_future_usage string
239              
240             Indicates that you intend to make future payments with this PaymentIntent's payment method.
241              
242             Providing this parameter will L<attach the payment method|https://stripe.com/docs/payments/save-during-payment> to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be L<attached|https://stripe.com/docs/api/payment_methods/attach> to a Customer after the transaction completes.
243              
244             When processing card payments, Stripe also uses C<setup_future_usage> to dynamically optimize your payment flow and comply with regional legislation and network rules, such as L<SCA|https://stripe.com/docs/strong-customer-authentication>.
245              
246             =head2 shipping hash
247              
248             Where and how the card will be shipped.
249              
250             This is a L<Net::API::Stripe::Shipping> object.
251              
252             =head2 spending_controls hash
253              
254             This is a hash whose properties are accessible as a dynamic class methods
255              
256             =over 4
257              
258             =item I<amount> positive integer
259              
260             Maximum amount allowed to spend per time interval.
261              
262             =item I<categories> array
263              
264             Array of strings containing categories on which to apply the spending limit. Leave this blank to limit all charges.
265              
266             =item I<interval> enum
267              
268             The time interval or event with which to apply this spending limit towards.
269              
270             =over 8
271              
272             =item I<per_authorization>
273              
274             A maximum amount for each authorization.
275              
276             =item I<daily>
277              
278             A maximum within a day. A day start at midnight UTC.
279              
280             =item I<weekly>
281              
282             A maximum within a week. The first day of a week is Monday.
283              
284             =item I<monthly>
285              
286             A maximum within a month. Starts on the first of that month.
287              
288             =item I<yearly>
289              
290             A maximum amount within a year. Starts January 1st.
291              
292             =item I<all_time>
293              
294             A maximum amount for all transactions.
295              
296             =back
297              
298             =item I<spending_limits_currency> currency
299              
300             Currency for the amounts within spending_limits. Locked to the currency of the card.
301              
302             =back
303              
304             =head2 status string
305              
306             One of active, inactive, canceled, lost, or stolen.
307              
308             =head2 type string
309              
310             One of virtual or physical.
311              
312             =head2 wallets hash
313              
314             Information relating to digital wallets (like Apple Pay and Google Pay).
315              
316             It has the following properties:
317              
318             =over 4
319              
320             =item C<apple_pay> hash
321              
322             Apple Pay Details
323              
324             =over 8
325              
326             =item C<eligible> boolean
327              
328             Apple Pay Eligibility
329              
330             =item C<ineligible_reason> string
331              
332             Reason the card is ineligible for Apple Pay
333              
334              
335             =back
336              
337             =item C<google_pay> hash
338              
339             Google Pay Details
340              
341             =over 8
342              
343             =item C<eligible> boolean
344              
345             Google Pay Eligibility
346              
347             =item C<ineligible_reason> string
348              
349             Reason the card is ineligible for Google Pay
350              
351              
352             =back
353              
354             =item C<primary_account_identifier> string
355              
356             Unique identifier for a card used with digital wallets
357              
358             =back
359              
360             =head1 API SAMPLE
361              
362             {
363             "id": "ic_fake123456789",
364             "object": "issuing.card",
365             "authorization_controls": {
366             "allowed_categories": null,
367             "blocked_categories": null,
368             "currency": "usd",
369             "max_amount": 10000,
370             "max_approvals": 1,
371             "spending_limits": [],
372             "spending_limits_currency": null
373             },
374             "brand": "Visa",
375             "cardholder": {
376             "id": "ich_fake123456789",
377             "object": "issuing.cardholder",
378             "authorization_controls": {
379             "allowed_categories": [],
380             "blocked_categories": [],
381             "spending_limits": [],
382             "spending_limits_currency": null
383             },
384             "billing": {
385             "address": {
386             "city": "Beverly Hills",
387             "country": "US",
388             "line1": "123 Fake St",
389             "line2": "Apt 3",
390             "postal_code": "90210",
391             "state": "CA"
392             },
393             "name": "Jenny Rosen"
394             },
395             "company": null,
396             "created": 1540111055,
397             "email": "jenny@example.com",
398             "individual": null,
399             "is_default": false,
400             "livemode": false,
401             "metadata": {},
402             "name": "Jenny Rosen",
403             "phone_number": "+18008675309",
404             "requirements": {
405             "disabled_reason": null,
406             "past_due": []
407             },
408             "status": "active",
409             "type": "individual"
410             },
411             "created": 1571480456,
412             "currency": "usd",
413             "exp_month": 8,
414             "exp_year": 2020,
415             "last4": "4242",
416             "livemode": false,
417             "metadata": {},
418             "name": "Jenny Rosen",
419             "pin": null,
420             "replacement_for": null,
421             "replacement_reason": null,
422             "shipping": null,
423             "status": "active",
424             "type": "physical"
425             }
426              
427             =head1 HISTORY
428              
429             =head2 v0.1
430              
431             Initial version
432              
433             =head2 v0.2
434              
435             Added method L</"spending_controls"> that was added on Stripe api.
436              
437             =head1 AUTHOR
438              
439             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
440              
441             =head1 SEE ALSO
442              
443             Stripe API documentation:
444              
445             L<https://stripe.com/docs/api/issuing/cards>
446              
447             =head1 COPYRIGHT & LICENSE
448              
449             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
450              
451             You can use, copy, modify and redistribute this package and associated
452             files under the same terms as Perl itself.
453              
454             =cut