[ic] Changing as subroutine

Kevin Walsh interchange-users@icdevgroup.org
Wed Feb 26 12:44:04 2003


Howard Lowndes [lannet@lannet.com.au] wrote:
> I didn't get any success in setting up a replacement subroutine so I had 
> to settle for mod'ng the Vend::Order module to suit Australian Bankcard.  
> Here are the changes for what they are worth:
> 
> sub guess_cc_type {
>         my ($ccnum) = @_;
>         $ccnum =~ s/\D+//g;
> 
>         # based on logic by Karl Moore from http://www.vb-world.net/tips/tip509.html
>         # Australian Bankcard added by Howard Lowndes http://lannet.com.au
>         if ($ccnum eq '')                                       { '' }
>         elsif ($ccnum =~ /^4(?:\d{12}|\d{15})$/)                { 'visa' }
>         elsif ($ccnum =~ /^56\d{14}$/)                          { 'bankcard' }
>
I think the above regex may need to be changed to this:

    /^5610\d{12}$/

As far as I can tell, the Australian BankCard prefix is 5610, rather
than just 56.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/