From d27fd82bcafba39c54c9354fe3fd9a18506d5d3d Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 5 Sep 2007 00:16:46 +0000 Subject: [PATCH] Add Irish Laser card, thanks to Eoin Redmond for the heads-up --- BINS | 5 ++++- Changes | 1 + CreditCard.pm | 6 +++++- test.pl | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/BINS b/BINS index 12475f0..e2c97aa 100644 --- a/BINS +++ b/BINS @@ -63,4 +63,7 @@ # # Please ensure that your POS terminals, websites and any pertinent # internal systems can accept these new IINs. - +# +# from http://en.wikipedia.org/wiki/Laser_(debit_card)#Technical +# Laser cards are prefixed with either "6304", "6706", "6771" or "6709", and +# may be between 16 and 19 characters in length. diff --git a/Changes b/Changes index 36a83a4..3dd4173 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ Revision history for Perl extension Business::CreditCard. 0.31 unreleased - Add LICENSE section to POD documentation - Add META.yml to MANIFEST + - Add Irish Laser card, thanks to Eoin Redmond for the heads-up. 0.30 Mon Dec 18 23:24:25 PST 2006 - back after two and a half years; happy hanukkah! diff --git a/CreditCard.pm b/CreditCard.pm index 426af19..dda6f3d 100644 --- a/CreditCard.pm +++ b/CreditCard.pm @@ -49,6 +49,7 @@ Possible return values are: Switch Solo China Union Pay + Laser Unknown "Not a credit card" is returned on obviously invalid data values. @@ -83,7 +84,7 @@ in the US and Canada. You can change this to return the type the card should be treated as in a different country by setting C<$Business::OnlinePayment::Country> to your two-letter country code. This is probably what you want to determine if you accept the card, or which -merchant agreement is is processed through. +merchant agreement it is processed through. You can also set C<$Business::OnlinePayment::Country> to a false value such as the empty string to return the "base" card type. This is probably only @@ -184,6 +185,9 @@ sub cardtype { return "China Union Pay" if $number =~ /^622[\dx]{13}$/o; + return "Laser" + if $number =~ /^6(304|7(06|09|71))[\dx]{12,15}$/o; + return "Unknown"; } diff --git a/test.pl b/test.pl index 72dd975..f1ff8da 100644 --- a/test.pl +++ b/test.pl @@ -50,6 +50,7 @@ sub test_card_identification{ '4111xxxxxxxxxxxx' => 'VISA card', '6599xxxxxxxxxxxx' => 'Discover card', '6222xxxxxxxxxxxx' => 'Discover card', #China Union Pay + '6304980000000000004' => 'Laser', ); while( my ($k, $v)=each(%test_table) ){ if(cardtype($k) ne $v){ -- 2.11.0