File Coverage

blib/lib/Net/API/Stripe/Connect/ExternalAccount/Card.pm
Criterion Covered Total %
statement 7 44 15.9
branch n/a
condition n/a
subroutine 3 40 7.5
pod 37 37 100.0
total 47 121 38.8


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Connect/ExternalAccount/Card.pm
3             ## Version v0.200.0
4             ## Copyright(c) 2020 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/external_account_cards/object
11             package Net::API::Stripe::Connect::ExternalAccount::Card;
12             BEGIN
13             {
14 1     1   1174 use strict;
  1         2  
  1         28  
15 1     1   18 use parent qw( Net::API::Stripe::Generic );
  1         2  
  1         4  
16 1     1   584 our( $VERSION ) = 'v0.200.0';
17             };
18              
19 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
20              
21 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
22              
23 0     0 1   sub account { return( shift->_set_get_scalar_or_object( 'account', 'Net::API::Stripe::Connect::Account', @_ ) ); }
24              
25 0     0 1   sub address { return( shift->_address_populate( @_ ) ); }
26              
27 0     0 1   sub address_city { return( shift->_set_get_scalar( 'address_city', @_ ) ); }
28              
29 0     0 1   sub address_country { return( shift->_set_get_scalar( 'address_country', @_ ) ); }
30              
31 0     0 1   sub address_line1 { return( shift->_set_get_scalar( 'address_line1', @_ ) ); }
32              
33 0     0 1   sub address_line1_check { return( shift->_set_get_scalar( 'address_line1_check', @_ ) ); }
34              
35 0     0 1   sub address_line2 { return( shift->_set_get_scalar( 'address_line2', @_ ) ); }
36              
37 0     0 1   sub address_state { return( shift->_set_get_scalar( 'address_state', @_ ) ); }
38              
39 0     0 1   sub address_zip { return( shift->_set_get_scalar( 'address_zip', @_ ) ); }
40              
41 0     0 1   sub address_zip_check { return( shift->_set_get_scalar( 'address_zip_check', @_ ) ); }
42              
43 0     0 1   sub available_payout_methods { return( shift->_set_get_array( 'available_payout_methods', @_ ) ); }
44              
45             ## Card brand name, e.g. American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown
46 0     0 1   sub brand { return( shift->_set_get_scalar( 'brand', @_ ) ); }
47              
48 0     0 1   sub checks { return( shift->_set_get_hash( 'checks', @_ ) ) };
49              
50 0     0 1   sub country { return( shift->_set_get_scalar( 'country', @_ ) ); }
51              
52 0     0 1   sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); }
53              
54 0     0 1   sub customer { return( shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ) ); }
55              
56 0     0 1   sub cvc { return( shift->_set_get_scalar( 'cvc', @_ ) ); }
57              
58 0     0 1   sub cvc_check { return( shift->_set_get_scalar( 'cvc_check', @_ ) ); }
59              
60 0     0 1   sub default_for_currency { return( shift->_set_get_scalar( 'default_for_currency', @_ ) ); }
61              
62 0     0 1   sub dynamic_last4 { return( shift->_set_get_scalar( 'dynamic_last4', @_ ) ); }
63              
64 0     0 1   sub exp_month { return( shift->_set_get_number( 'exp_month', @_ ) ); }
65              
66 0     0 1   sub exp_year { return( shift->_set_get_number( 'exp_year', @_ ) ); }
67              
68 0     0 1   sub fingerprint { return( shift->_set_get_scalar( 'fingerprint', @_ ) ); }
69              
70 0     0 1   sub funding { return( shift->_set_get_scalar( 'funding', @_ ) ); }
71              
72 0     0 1   sub generated_from { return( shift->_set_get_object( 'generated_from', 'Net::API::Stripe::Payment::GeneratedFrom', @_ ) ); }
73              
74 0     0 1   sub installments { return( shift->_set_get_object( 'installments', 'Net::API::Stripe::Payment::Installment', @_ ) ); }
75              
76 0     0 1   sub last4 { return( shift->_set_get_scalar( 'last4', @_ ) ); }
77              
78 0     0 1   sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); }
79              
80             ## Cardholder name
81 0     0 1   sub name { return( shift->_set_get_scalar( 'name', @_ ) ); }
82              
83             ## Preview features says Stripe API
84 0     0 1   sub network { return( shift->_set_get_scalar( 'network', @_ ) ); }
85              
86 0     0 1   sub recipient { return( shift->_set_get_scalar_or_object( 'recipient', 'Net::API::Stripe::Connect::Account', @_ ) ); }
87              
88 0     0 1   sub three_d_secure { return( shift->_set_get_hash_as_object( 'three_d_secure', 'Net::API::Stripe::Payment::3DSecure', @_ ) ); }
89              
90 0     0 1   sub three_d_secure_usage { return( shift->_set_get_hash_as_object( 'three_d_secure_usage', 'Net::API::Strip::Payment::3DUsage', @_ ) ); }
91              
92 0     0 1   sub tokenization_method { return( shift->_set_get_scalar( 'tokenization_method', @_ ) ); }
93              
94 0     0 1   sub wallet { return( shift->_set_get_hash_as_object( 'wallet', 'Net::API::Stripe::Payment::Wallet', @_ ) ); }
95              
96             1;
97              
98             __END__
99              
100             =encoding utf8
101              
102             =head1 NAME
103              
104             Net::API::Stripe::Connect::ExternalAccount::Card - A Stripe Card Account Object
105              
106             =head1 SYNOPSIS
107              
108             my $card = $stripe->card({
109             account => 'acct_fake123456789',
110             # Or you can also simply pass a Net::API::Stripe::Address object
111             # address => $address_object
112             address_line1 => '1-2-3 Kudan-Minami, Chiyoda-ku',
113             address_line2 => 'Big bldg. 12F',
114             address_city => 'Tokyo',
115             address_zip => '123-4567',
116             address_country => 'jp',
117             brand => 'visa',
118             country => 'jp',
119             currency => 'jpy',
120             customer => $customer_object,
121             cvc => 123,
122             # Boolean
123             default_for_currency => 1,
124             exp_month => 12,
125             exp_year => 2030,
126             funding => 'debit',
127             metadata => { transaction_id => 123, customer_id => 456 },
128             name => 'John Doe',
129             });
130              
131             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects. For example:
132              
133             my $stripe = Net::API::Stripe->new( conf_file => 'settings.json' ) | die( Net::API::Stripe->error );
134             my $stripe_card = $stripe->cards( create =>
135             {
136             account => 'acct_fake123456789',
137             external_account =>
138             {
139             object => 'card',
140             exp_month => 12,
141             exp_year => 2030,
142             number => '012345678',
143             },
144             default_for_currency => $stripe->true,
145             metadata => { transaction_id => 123, customer_id => 456 },
146             }) || die( $stripe->error );
147              
148             =head1 VERSION
149              
150             v0.200.0
151              
152             =head1 DESCRIPTION
153              
154             These External Accounts are transfer destinations on Account objects for Custom accounts (L<https://stripe.com/docs/connect/custom-accounts>). They can be bank accounts or debit cards.
155              
156             Bank accounts (L<https://stripe.com/docs/api#customer_bank_account_object>) and debit cards (L<https://stripe.com/docs/api#card_object>) can also be used as payment sources on regular charges, and are documented in the links above.
157              
158             =head1 CONSTRUCTOR
159              
160             =over 4
161              
162             =item B<new>( %ARG )
163              
164             Creates a new L<Net::API::Stripe::Connect::ExternalAccount::Card> object.
165             It may also take an hash like arguments, that also are method of the same name.
166              
167             =back
168              
169             =head1 METHODS
170              
171             =over 4
172              
173             =item B<id> string
174              
175             Unique identifier for the object.
176              
177             =item B<object> string, value is "card"
178              
179             String representing the object’s type. Objects of the same type share the same value.
180              
181             =item B<account> custom only string (expandable)
182              
183             The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead.
184              
185             When expanded, this is a L<Net::API::Stripe::Connect::Account> object.
186              
187             =item B<address> L<Net::API::Stripe::Address> object or hash
188              
189             This is a helper method. Provided with either a L<Net::API::Stripe::Address> object or a hash with same properties, this will assign all the address_* properties by calling its method.
190              
191             =item B<address_city> string
192              
193             City/District/Suburb/Town/Village.
194              
195             =item B<address_country> string
196              
197             Billing address country, if provided when creating card.
198              
199             =item B<address_line1> string
200              
201             Address line 1 (Street address/PO Box/Company name).
202              
203             =item B<address_line1_check> string
204              
205             If address_line1 was provided, results of the check: pass, fail, unavailable, or unchecked.
206              
207             =item B<address_line2> string
208              
209             Address line 2 (Apartment/Suite/Unit/Building).
210              
211             =item B<address_state> string
212              
213             State/County/Province/Region.
214              
215             =item B<address_zip> string
216              
217             ZIP or postal code.
218              
219             =item B<address_zip_check> string
220              
221             If address_zip was provided, results of the check: pass, fail, unavailable, or unchecked.
222              
223             =item B<available_payout_methods> array
224              
225             A set of available payout methods for this card. Will be either ["standard"] or ["standard", "instant"]. Only values from this set should be passed as the method when creating a transfer.
226              
227             =item B<brand> string
228              
229             Card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.
230              
231             =item B<checks>
232              
233             =over 8
234              
235             =item I<address_line1_check> string
236              
237             If a address line1 was provided, results of the check, one of ‘pass’, ‘failed’, ‘unavailable’ or ‘unchecked’.
238              
239             =item I<address_postal_code_check> string
240              
241             If a address postal code was provided, results of the check, one of ‘pass’, ‘failed’, ‘unavailable’ or ‘unchecked’.
242              
243             =item I<cvc_check> string
244              
245             If a CVC was provided, results of the check, one of ‘pass’, ‘failed’, ‘unavailable’ or ‘unchecked’.
246              
247             =back
248              
249             =item B<country> string
250              
251             Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you’ve collected.
252              
253             =item B<currency> custom only currency
254              
255             Three-letter ISO code for currency. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency.
256              
257             =item B<customer> string (expandable)
258              
259             The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
260              
261             When expanded, this is a L<Net::API::Stripe::Customer> object.
262              
263             =item B<cvc> string
264              
265             Card security code. Highly recommended to always include this value, but it's required only for accounts based in European countries.
266              
267             This is used when creating a card object on Stripe API. See here: L<https://stripe.com/docs/api/cards/create>
268              
269             =item B<cvc_check> string
270              
271             If a CVC was provided, results of the check: pass, fail, unavailable, or unchecked.
272              
273             =item B<default_for_currency> custom only boolean
274              
275             Whether this card is the default external account for its currency.
276              
277             =item B<dynamic_last4> string
278              
279             (For tokenized numbers only.) The last four digits of the device account number.
280              
281             =item B<exp_month> integer
282              
283             Two-digit number representing the card’s expiration month.
284              
285             =item B<exp_year> integer
286              
287             Four-digit number representing the card’s expiration year.
288              
289             =item B<fingerprint> string
290              
291             Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example.
292              
293             =item B<funding> string
294              
295             Card funding type. Can be credit, debit, prepaid, or unknown.
296              
297             =item B<generated_from> hash
298              
299             Details of the original PaymentMethod that created this object.
300              
301             =item B<installments> hash
302              
303             If present, this is a L<Net::API::Stripe::Payment::Installment> object. As of 2019-02-19, this is only used in Mexico though. See here for more information: L<https://stripe.com/docs/payments/installments>
304              
305             =item B<last4> string
306              
307             The last four digits of the card.
308              
309             =item B<metadata> hash
310              
311             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.
312              
313             =item B<name> string
314              
315             Cardholder name.
316              
317             =item B<network> string preview feature
318              
319             Identifies which network this charge was processed on. Can be amex, diners, discover, interac, jcb, mastercard, unionpay, visa, or unknown.
320              
321             =item B<recipient> string (expandable)
322              
323             The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead.
324              
325             Since 2017, Stripe recipients have been replaced by Stripe accounts: L<https://stripe.com/docs/connect/recipient-account-migrations>
326              
327             So this is a Stripe account id, or if expanded, a L<Net::API::Stripe::Connect::Account> object.
328              
329             =item B<three_d_secure> hash
330              
331             Populated if this transaction used 3D Secure authentication.
332              
333             This is an objectified hash reference, ie its key / value pairs can be accessed as virtual methods. It uses the virtal package L<Net::API::Stripe::Payment::3DSecure>
334              
335             =over 8
336              
337             =item I<authenticated> boolean
338              
339             Whether or not authentication was performed. 3D Secure will succeed without authentication when the card is not enrolled.
340              
341             =item I<succeeded> boolean
342              
343             Whether or not 3D Secure succeeded.
344              
345             =item I<version> string
346              
347             The version of 3D Secure that was used for this payment.
348              
349             =back
350              
351             =item B<three_d_secure_usage> hash
352              
353             Contains details on how this Card maybe be used for 3D Secure authentication.
354              
355             This is a virtual L<Net::API::Strip::Payment::3DUsage> object ie whereby each key can be accessed as methods.
356              
357             =over 8
358              
359             =item B<supported> boolean
360              
361             Whether 3D Secure is supported on this card.
362              
363             =back
364              
365             =item B<tokenization_method> string
366              
367             If the card number is tokenized, this is the method that was used. Can be apple_pay or google_pay.
368              
369             =item B<wallet> hash
370              
371             If this Card is part of a card wallet, this contains the details of the card wallet.
372              
373             If present, this is a virtual package L<Net::API::Stripe::Payment::Wallet> object. The following data structure that can be accessed as chain objects is:
374              
375             =over 4
376              
377             =item B<amex_express_checkout> hash
378              
379             If this is a amex_express_checkout card wallet, this hash contains details about the wallet.
380              
381             No properties set yet in Stripe documentation.
382              
383             =item B<apple_pay> hash
384              
385             If this is a apple_pay card wallet, this hash contains details about the wallet.
386              
387             No properties set yet in Stripe documentation.
388              
389             =item B<dynamic_last4> string
390              
391             (For tokenized numbers only.) The last four digits of the device account number.
392              
393             =item B<google_pay> hash
394              
395             If this is a google_pay card wallet, this hash contains details about the wallet.
396              
397             No properties set yet in Stripe documentation.
398              
399             =item B<masterpass> hash
400              
401             If this is a masterpass card wallet, this hash contains details about the wallet.
402              
403             =over 8
404              
405             =item B<billing_address> hash
406              
407             Owner’s verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
408              
409             =over 12
410              
411             =item B<city> string
412              
413             City/District/Suburb/Town/Village.
414              
415             =item B<country> string
416              
417             2-letter country code.
418              
419             =item B<line1> string
420              
421             Address line 1 (Street address/PO Box/Company name).
422              
423             =item B<line2> string
424              
425             Address line 2 (Apartment/Suite/Unit/Building).
426              
427             =item B<postal_code> string
428              
429             ZIP or postal code.
430              
431             =item B<state> string
432              
433             State/County/Province/Region.
434              
435             =back
436              
437             =item B<email> string
438              
439             Owner’s verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
440              
441             =item B<name> string
442              
443             Owner’s verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
444              
445             =item B<shipping_address> hash
446              
447             Owner’s verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
448              
449             =over 12
450              
451             =item B<city> string
452              
453             City/District/Suburb/Town/Village.
454              
455             =item B<country> string
456              
457             2-letter country code.
458              
459             =item B<line1> string
460              
461             Address line 1 (Street address/PO Box/Company name).
462              
463             =item B<line2> string
464              
465             Address line 2 (Apartment/Suite/Unit/Building).
466              
467             =item B<postal_code> string
468              
469             ZIP or postal code.
470              
471             =item B<state> string
472              
473             State/County/Province/Region.
474              
475             =back
476              
477             =back
478              
479             =item B<samsung_pay> hash
480              
481             If this is a samsung_pay card wallet, this hash contains details about the wallet.
482              
483             No properties set yet in Stripe documentation.
484              
485             =item B<type> string
486              
487             The type of the card wallet, one of amex_express_checkout, apple_pay, google_pay, masterpass, samsung_pay, or visa_checkout. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type.
488              
489             =item B<visa_checkout> hash
490              
491             If this is a visa_checkout card wallet, this hash contains details about the wallet.
492              
493             =over 4
494              
495             =item B<billing_address> hash
496              
497             Owner’s verified billing address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
498              
499             =over 8
500              
501             =item B<city> string
502              
503             City/District/Suburb/Town/Village.
504              
505             =item B<country> string
506              
507             2-letter country code.
508              
509             =item B<line1> string
510              
511             Address line 1 (Street address/PO Box/Company name).
512              
513             =item B<line2> string
514              
515             Address line 2 (Apartment/Suite/Unit/Building).
516              
517             =item B<postal_code> string
518              
519             ZIP or postal code.
520              
521             =item B<state> string
522              
523             State/County/Province/Region.
524              
525             =back
526              
527             =item B<email> string
528              
529             Owner’s verified email. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
530              
531             =item B<name> string
532              
533             Owner’s verified full name. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
534              
535             =item B<shipping_address> hash
536              
537             Owner’s verified shipping address. Values are verified or provided by the wallet directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
538              
539             =over 8
540              
541             =item B<city> string
542              
543             City/District/Suburb/Town/Village.
544              
545             =item B<country> string
546              
547             2-letter country code.
548              
549             =item B<line1> string
550              
551             Address line 1 (Street address/PO Box/Company name).
552              
553             =item B<line2> string
554              
555             Address line 2 (Apartment/Suite/Unit/Building).
556              
557             =item B<postal_code> string
558              
559             ZIP or postal code.
560              
561             =item B<state> string
562              
563             State/County/Province/Region.
564              
565             =back
566              
567             =back
568              
569             =back
570              
571             =back
572              
573             =head1 API SAMPLE
574              
575             {
576             "id": "card_fake123456789",
577             "object": "card",
578             "address_city": null,
579             "address_country": null,
580             "address_line1": null,
581             "address_line1_check": null,
582             "address_line2": null,
583             "address_state": null,
584             "address_zip": null,
585             "address_zip_check": null,
586             "brand": "Visa",
587             "country": "US",
588             "customer": null,
589             "cvc_check": null,
590             "dynamic_last4": null,
591             "exp_month": 8,
592             "exp_year": 2020,
593             "fingerprint": "lkavkajndvkdvnj",
594             "funding": "credit",
595             "last4": "4242",
596             "metadata": {},
597             "name": null,
598             "tokenization_method": null
599             }
600              
601             =head1 HISTORY
602              
603             =head2 v0.1
604              
605             Initial version
606              
607             =head2 v0.2
608              
609             Added the method B<address> to make it easy to pass a L<Net::API::Stripe::Address> object or an hash reference to populate automatically the properties I<address_line1>, I<address_line2>, I<address_city>, I<address_zip> and I<address_country>
610              
611             =head1 STRIPE HISTORY
612              
613             =head2 2018-01-23
614              
615             When being viewed by a platform, cards and bank accounts created on behalf of connected accounts will have a fingerprint that is universal across all connected accounts. For accounts that are not connect platforms, there will be no change.
616              
617             =head1 AUTHOR
618              
619             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
620              
621             =head1 SEE ALSO
622              
623             Stripe API documentation:
624              
625             L<https://stripe.com/docs/api/external_account_cards/object>, L<https://stripe.com/docs/connect/payouts>
626              
627             =head1 COPYRIGHT & LICENSE
628              
629             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
630              
631             You can use, copy, modify and redistribute this package and associated
632             files under the same terms as Perl itself.
633              
634             =cut