[ic] Changing as subroutine
Mike Heins
interchange-users@icdevgroup.org
Wed Feb 26 11:32:01 2003
Quoting Howard Lowndes (lannet@lannet.com.au):
> On Tue, 25 Feb 2003, ACforSale Inc Sales Team wrote:
>
> > On Behalf Of Howard Lowndes
> > I need to change the subroutine guess_cc_type in the Vend::Order module
> > to
> > include another selector for Australian Bankcard.
> >
> > Is it just a case of copying the (modified) subroutine into
> > interchange.cfg as a GlobalSub or into catalog.cfg as a Sub (and
> > restarting Interchange of course), or is there more to setting up
> > GlobalSub and Sub; IOW do I have to do other things to the subroutine?
> >
> > I find the doco at 4.1 in the template guide is a bit esoteric.
>
> 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' }
Added -- thanks.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.513.523.7621 <mike@perusion.com>
Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer