2 use Test::More tests => 1;
3 use Business::CreditCard;
5 ok( test_card_identification() );
7 sub test_card_identification {
9 # For the curious the table of test number aren't real credit card
10 # in fact they won't validate but they do obey the rule for the
11 # cardtype table to identify the card type.
14 '5212345678901234' => 'MasterCard',
15 '5512345678901234' => 'MasterCard',
16 '2512345678901234' => 'MasterCard',
17 '4123456789012' => 'VISA card',
18 '4929492492497' => 'VISA card',
19 '4512345678901234' => 'VISA card',
20 '341234567890123' => 'American Express card',
21 '371234567890123' => 'American Express card',
22 #'36123456789012' => "Diner's Club/Carte Blanche",
23 #'36123456789012' => 'MasterCard',
24 '36123456789012' => 'Discover card',
25 '201412345678901' => 'enRoute',
26 '214912345678901' => 'enRoute',
27 '6011123456789012' => 'Discover card',
28 '3123456789012345' => 'JCB',
29 '213112345678901' => 'JCB',
30 '180012345678901' => 'JCB',
31 '1800123456789012' => 'Unknown',
32 '312345678901234' => 'Unknown',
33 '4111xxxxxxxxxxxx' => 'VISA card',
34 '6599xxxxxxxxxxxx' => 'Discover card',
35 '6222xxxxxxxxxxxx' => 'Discover card', #China Union Pay
36 '6304980000000000004' => 'Laser',
37 '6499xxxxxxxxxxxx' => 'Discover card',
38 '5610xxxxxxxxxxxx' => 'BankCard',
39 '6250xxxxxxxxxxxx' => 'Discover card', #China Union Pay
40 '6280xxxxxxxxxxxx' => 'Discover card', #China Union Pay
41 '12345678' => 'Isracard',
42 '123456780' => 'Isracard',
44 while( my ($k, $v)=each(%test_table) ){
45 if(cardtype($k) ne $v){
46 warn "Card $k - should be $v but cardtype returns ". cardtype($k). "\n";