[ic] guess_cc_type(), does the 'test way' need to be changed ?

Mike Heins mike at perusion.com
Wed Sep 14 08:30:16 EDT 2005


Quoting ns (linux at post10.tele.dk):
> Hi, this is mostly for brainstorming...
> 
> I did observe that Mike have changed the guess_cc_type() function to 
> cover more cards.
> 
> Because we (here in DK) can charge different fees for different CC card, 
> like :
> 
> - danish issued CC ( fee 1.95 + 0.1 %)
> - danish issued visa electron (1.95 + 1.25)
> - international issued CC's (1.95 + 5.5%)
> 
> Due to this I did contact our national clearing house, and after 'some' 
> dialog I got a 5 pages listening of prefixes for different CC numbers. 
> allthough a lot of them is really local cc cards (like shell or ikea 
> cards), it gives some challenges to pick out the segments for the dk 
> issued cards.
> 
> 
> Eg. Danish issued Visa Electron is prefixed/segmented as following (and 
> can be between 13 & 19 digits long)
> 402620
> 405245
> 405266 - 405277
> 405832 - 405839
> 405860
> 405864
> 405934
> 406432 - 406438
> 406443
> 417500 ? 417536
> 417538 ? 417548
> 417550 ? 417599
> 417600 - 417603
> 
> JBC is : 3528 - 3589 (I can not confirm the prefix 1800 & 2131 for JBC, 
> can any of you ?)
> 
> and so on (DK issued MC is 38 lines long...)
> 
> So, I was thinking of a new way to make this CC tests, like a lookup in 
> a table, but due to the use of prefixes like 405833 is also 'coveret' by 
> the rule /^4(?:\d{12}|\d{15})$/ , I can not se a 'easy' way to make 
> another way to make the test, else than expanging the existing routine..

If I were to pick a way to change the source to do this, I would put at
the top of the routine:

    if(my $subname = $Vend::Cfg->{SpecialSub}{guess_cc}) {
        my $sub = $Vend::Cfg->{Sub}{$subname} || $Global::GlobalSub->{$subname};
        my $guess;
        if( $sub and $guess = $sub->($ccnum) ) {
            return $guess;
        }
    }

That would allow you to put your own routine before the existing one
and 
-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer


More information about the interchange-users mailing list