[ic] global subs and "&charge", revisited

josh simpson naugahyde@earthlink.net
Thu, 05 Oct 2000 15:49:18 -0400


Hey all,
   Sorry for the potential redundancy of this msg, but I'm having very
little luck with
the minivend list archives @ minivend.com -- the search engine is
totally screwy,
& really ought to be fixed, imho.  A search tells me that there have
been threads on
this topic in the last few months, but none of the search returned links
to those msgs
work.  Can't find 'em in my emails of the list digest either, but I
could swear I saw these
somewhere. Anyhow ...
    In short, I am about to try to implement a custom order route & card
processing scheme,
and I need to know if the following comments, appended to the Order
Process/Advanced
Multi-level Order Pages doc by Steve Bergman in September, are accurate
...
He says :
                    The info on &charge is quite incorrect. Your global
sub must return a perl
                     hash, e.g. %result, which contains at least the
following elements: MStatus
                     order-id MStatus must equal "success" and order-id
must be non-null.
                     Otherwise the &charge operation will fail. e.g. the
following greatly
                     oversimplified global sub would always succeed:
------- GlobalSub <<EOS
                     sub webauthorize { my %result = ( "MStatus" =>
"success", "order-id" =>
                     "00001", ); #my %result = ( "MStatus" => "success",
); return %result; } EOS
                     --------- I hope this saves someone else hours of
grief. ;-)

Is this true and/or complete?  I wonder if returns/re-credits work
similarly?  Could someone clarify please?

Also, in a different vein, do GlobalSubs called called on a page with
[perl subs=1]&mysubroutine[/perl]
accept arguments/references the same way that perl subroutine calls
normally do?  I want to pass a number
of form values from the checkout page to my subroutine, and my
impression is this could be done w/

    &mysubroutine($Value=>customer,$Value=>whatever, etc.)

or perhaps just by passing the entire hash  %Values, which should get
flattened into an array of scalars
that I can pick apart with $_[0], $_[1], etc. inside the subroutine.
Obviously, I'm just learing Perl, but perhaps
someone can tell me how far off-base I am!

Thanks,
Josh Simpson