[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Simple &charge globalsub always failing.
****** message to minivend-users from Steve Bergman <steve@cx662584-c.okc1.ok.home.com> ******
Sonny Cook wrote:
>
> ****** message to minivend-users from Sonny Cook <sonny@akopia.com> ******
>
> I was beating my head against this very thing last night. Here's what you
> need to know. In profiles.order you need a &charge custom webauthorize.
> This tells IC (MV) which globalsub to use. The return from the new
> globalsub is not just looking for a true value, it's looking for a sneaky
> hash value. For a successful transaction, you'll need to return a hash
> with and 'MStatus' element with the value 'success'. So something like
> this:
> my $result{'MStatus'} = 'success';
> return %result;
Thanks for the help. Unfortunately, still no luck. And now I'm
extremely confused because in going through the source code I have
narrowed the problem down to one line. But what is happenning seems
quite bizzare.
It comes down to this subroutine in Vend/Order.pm:
-------------
sub _charge {
my ($ref, $params, $message) = @_;
::logDebug("called _charge: ref=$ref params=$params message=$message");
my $result;
eval {
$result = charge($params);
};
if($@) {
::logError("Fatal error on charge operation '%s': %s", $params, $@);
$message = "Error on charge operation.";
}
elsif(! $result) {
$message = "Charge operation '$ref->{mv_cyber_mode}' failed" if !
$message;
}
::logDebug("charge result: result=$result params=$params
message=$message");
return ($result, $params, $message);
}
-------------
Here is the output in /tmp/mvdebug:
----
Start DEBUG at Thu Aug 31 08:14:52 2000
Vend::Order:debug: called _charge: ref=HASH(0x83ffa04) params=custom
webauthorize message=
Vend::Order:debug: charge result: result= params=custom webauthorize
message=Charge operation '' failed
----
"$result = charge($params);" executes my globalsub. I know that it runs
because if I print something it shows up in /tmp/mvdebug
Note that $result is false.
My globalsub looks like this:
-----
GlobalSub sub webauthorize { return 1 }
-----
I have tried returning strings, integers, hashes with MStatus element
set to 'success'. No matter what I do, the return result comes up
blank. I've even tried cutting and pasting the test_global_sub from
elsewhere in minivend.cfg and renaming it to webauthorize to eliminate
any chance of a typo. I'm beginning to wonder if I'm losing my mind.
BTW, if I change 'elseif(! $result)' to 'elseif( $result)' then my order
is successful.
Thanks for any help. :-)
-Steve Bergman
steve@uhura.netplus.net
-
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