[ic] mv_credit_card_reference

Ed LaFrance interchange-users@interchange.redhat.com
Tue Feb 19 12:04:51 2002


Quoting Mike Heins <mheins@redhat.com>:

> Quoting Javier Martin (martin@trymedia.com):
> > Hi Mike,
> > 
> > May I follow up this conversation from long, long ago (2001-05-10).
> Here you
> > said:
> > 
> > > 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.
> > 
> > 
> > Now I have some doubts about this. The question is: should the return
> value
> > of &calc terminate the profile if it is non-true? In my experience
> the
> > results of &calc are always ignored. Look at Order.pm, sub
> check_order,
> > lines 904-905 (IC 4.8.3):
> > 
> > 
> >   ($val, $var, $message) = do_check(...);
> >   next if ! $var;
> > 
> > 
> > This means that the results of every pragma/check are ignored unless
> they
> > return something in the 2nd position of the return array. Looking at
> the
> > tag_calc code, I see that it always returns scalar!
> 
> You are absolutely correct. Oh, how I wish I had written that code
> just
> one year after I did! Or fixed it back when it wouldn't have caused
> so many problems.
> 
> > 
> > So, what should be the good behavior of &calc=return 0;? To cause or
> not to
> > cause profile failure?
> > 
> 
> Hmm. At this point I would say that you should have to return(undef, 0)
> to
> explicitly cause a failure. Anything else might cause systems to
> break.

There is actually some documentation on this in the current dist docs 
directory, in the ic_ecommerce file. I don't know why it has not been added to 
the online docs at the dev site, but Mike Heins recently posted an html build 
somewhere up there, and since I am working on the file I have one here:

http://www.insitehosting.com/icdocs/ic_ecommerce.html

Take a look at the topic 'Advanced Multi-level Order Pages', near the bottom is 
a section on custom order checks, which discusses the format for return values.

- Ed L.


===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================