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