MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Calling a Perl subroutine from within a checkout profile.



******    message to minivend-users from "Gerard Olszowiec" <gerard@entitysoftware.com>     ******

Hi All:

My exasperation level is at an all-time high at the moment.  I can't get
sometime as simple as a sub call -- a sub that I know works -- to return a
result in a checkout profile.  My Perl needs some help.  Can someone help?

What I have is a 2-page checkout where the credit card authorization is
processed on the second page.  The credit card interface is custom made for
a service that is not supported by MV 3.08.  I have tested every piece
individually, so I know they all work separately.  The problem is I can't
get the global sub I wrote 'cc_auth' to return a result -- any result --
when I call it from within the profile.  ('cc_auth' currently doesn't accept
arguments, it always returns a hardcoded "APPROVED" or "DECLINED" result,
depending on what I am testing.)  I know the sub works because I am able to
display the expected results on the screen with

[perl arg=sub interpolate=1]cc_auth[/perl]

But, I want to assign the results to a variable within the checkout profile.
The 2nd page profile looks like this:

[set receipt_profile]
[perl values config]
# $cc_auth_results = "APPROVED,T000001,240343,240343         \$1.00,0000";
# $cc_auth_results = "DECLINED,T000001,,INVALID ACCOUNT     ,0363";
$cc_auth_results = &cc_auth();

($cc_auth_status, $cc_ref_no, $cc_auth_no) = split(',', $cc_auth_results);
$cc_auth_ok = ($cc_auth_status =~ /^APPROVED$/);

if (!$cc_auth_ok)
{
    $cc_auth_no = $cc_auth_status;
}

$out = <<EOF;
&set = mv_cc_auth_declined  $cc_auth_ok
&set = credit_card_auth_results $cc_auth_results
&set = credit_card_auth_code $cc_auth_no
&set = credit_card_auth_status $cc_auth_status
EOF
return $out;
[/perl]

&fatal=yes
&final=yes
[/set]

If I test this profile with either the APPROVED or DECLINED test code above,
I get the desired results; if APPROVED the reciept is displayed, otherwise
needfield.html displays my custom error message indicating that there is
somethng wrong with the cc info entered.  However, when I try
$cc_auth_results = &cc_auth(); or any variation with 'my', '&' and '()',
$cc_auth_results retains the value of the last transaction.  Even if I did
something like:

$cc_auth_results = "DECLINED,T000001,,INVALID ACCOUNT     ,0363";
$cc_auth_results = &cc_auth();

the $cc_auth_results retains the last transaction results, which isn't the
DECLINE test line above.  Additionally, when I use $cc_auth_results =
&cc_auth(); the above code

$cc_auth_ok = ($cc_auth_status =~ /^APPROVED$/);

always seems to succeed, even if $cc_auth_results is "DECLINED,..."  leading
to a reciept being printed with "DECLINED" sometimes in the authorization
results area.  Not exactly what the merchant wants to see.  8-)

Am I doing something blatantly wrong here with the sub call, or is the sub
call messing up the memory space of $cc_auth_results and subsequently the
pattern match?

help!


Cheers,
Gerard
------------------------------
Gerard Olszowiec
Entity Software
902.455.7216
gerard@entitysoftware.com
www.entitysoftware.com

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: