Re: Modifications for Authorize.Net

From: Victor Alexander Debuque (victor@koo.com)
Date: Sat Dec 15 2001 - 19:58:28 EST


Hi Travis,

I'm no Perl guru, but we're using this module successfully (but with
version 2.4, not 2.45), so let me take a stab:

> --
> if ( $REG_SYSTEM{ F_CHARGE_CC } ) {
>  
>     $cc_processor = $REG_SYSTEM{ CC_PROCESSOR };
>     if ( not $cc_processor or not exists $CC_CONFIG{ $cc_processor } ) {
>         error_out( "Credit card processor error" );
>     exit;
>     }
>  
>     $cc_module = $CC_CONFIG{ $cc_processor }{ module };
>     eval "require $cc_module";
>     if ( $@ ) {
>         error_out( "could not load $cc_module" );
>     exit;
>     }
>  
>     import $cc_module qw( auth capture );
>     ...
> --
>  
> For some reason the second part of the second IF statement (not exists
> $CC_CONFIG{ $cc_processor }) will not validate.  In my OpenSRS.conf, I
> have the following:
>  
> --
> ## Added to %REG_SYSTEM
>  
> CC_PROCESSOR    => "AuthorizeNet",             # CC processor
> F_USE_AVS       => 1,                                     # use AVS
> check or not
> AVS_ACCEPT      => 'PAWXYZ',                       # accept these AVS
> codes
> DOMAIN_YR_PRICE => { new => 20.00,            # USD for new domain/year
>                                       transfer => 20.00,       # USD
> for xfer domain/year
>                                     },
>  
> And then added:
>  
> %CC_CONFIG = (
>     AuthorizeNet => {
>         module => 'AuthorizeNet',
>         host => 'secure.authorize.net',
>         port => '443',
>         script => '/gateway/transact.dll',
>         login => 'MyLogin',  # XXX insert your AuthorizeNet login here
>     },
> );

The above all look fine to me, and are almost exactly the same as our
settings.

> Can anyone see why those variables aren't getting passed correctly? 
> When I take out the second part of the IF statement, it will go through
> and get stuck on trying to get the module.  And just so you know, I am
> using %CC_CONFIG at the top of my reg_system.cgi:
>  
> use vars qw(
>             %in $cgi $path_templates %actions $action %CC_CONFIG
> %cc_types $XML_
> Client
>             %contact_keys %data %cc_mons @cc_types
>            );
> (      %in, $cgi, $path_templates, %actions, $action, %cc_mons,
> %CC_CONFIG, %cc_
> types, $XML_Client,
>         %contact_keys, %data ) = ();

Again, I'm no Perl expert, but when you do this, aren't you in effect
setting $CC_CONFIG to an empty hash (or nil)? Depends though if you're
doing this before reading in the config file. We've put %CC_CONFIG in
the use vars statement at the top of our OpenSRS.conf and it works fine.
I don't know if this is your problem though.

Hope this helps,

Victor



This archive was generated by hypermail 2.1.3 : Tue Oct 19 2004 - 23:36:52 EDT