[ic] mv_credit_card_reference

Javier Martin interchange-users@interchange.redhat.com
Fri Oct 5 14:39:00 2001


Mike Heins said...

> Quoting Javier Martin (martin@trymedia.com):
> > IC 4.8.2, quick question:
> > 
> > I wish to do the following in my order profile:
> > 
> > 
> > >>>>>>>>>>>>
> > 
> > &credit_card=standard keep
> > 
> > [perl]
> >    # do something with $::Values->{mv_credit_card_reference};
> > [/perl]
> > 
> > >>>>>>>>>>>>
> > 
> > 
> > As far as I know the &credit_card pragma takes the credit card 
> info held in
> > the variables mv_credit_card_number, mv_credit_card_exp_month, etc.
> > validates them and then places a shortened version of the CC in 
> the variable
> > mv_credit_card_reference. I would like to use this variable from a perl
> > portion of code right after the pragma, but the variable 
> appears empty. Is
> > it that [perl]...[/perl] is evaluated BEFORE the execution of 
> &credit_card?
> > 
> 
> Yes.
> 
> If you want to do it inline, i.e. after the &credit_card, do:
> 
> &calc=<<EOF
>     # do something with $::Values->{mv_credit_card_reference};
> EOF
> 
> Make sure that returns a true value, otherwise the profile will
> fail. You would be required to set any errors in $Session->{errors}
> yourself.
> 
> If you need to open any tables, make sure you put a
> 
>     [perl tables="table"][/perl]
> 
> somewhere in the profile so you won't error out during run of
> tag_data or such.


Thanks a lot Mike. I solved it by calling:

  my $cc_ref = (Vend::Order::encrypt_standard_cc($CGI, 1)) [6]

from [perl], but &calc looks cleaner because I'm validating the CC twice...


Javier