[ic] Re: payment module authorizenet (modifications)

John Young interchange-users@icdevgroup.org
Fri May 23 17:10:06 2003


Philip S. Hempel wrote:

> I am using 4.9.7 daily
> 
> I am working on the authorizenet payment module and I am running into a
> few glitches. 
> 
> I added to the module support for using the transid as per one of the
> messages in the mailing list. This worked out great no problems.
> 
> OK, I want to add cvv2 support and that seemed to be  as simple as doing
> a remap.
> 
> I placed mv_credit_card_cvv2 and a form on the checkout and that worked
> fine. I do an order and the encrypted card that is emailed get the cvv2
> number.
> Ok for the remap I placed the 
> x_Card_Code => $actual->{mv_credit_card_cvv2}
> 
> x_Card_Code does not map. 
> 
> So I do some digging and I decide to try something different, I put in
> my checkout "my_card_code" and replace all of the above with this
> variable. I then put in Payment.pm the my_card_code and then test.
> 
> Changing the above works for some reason. 
> I also notice that mv_order_number is not remapped. I am thinking that
> this has something to do with the same problem.
> 
> I am far from knowing perl so most of the things going on in the module
> I do not understand.
> 
> I think I understand how cvv2 works, the "mv_credit_card_cvv2" gets
> mapped by IC into "cvv2" in the Order.pm. The cvv2 then is used by
> Payment.pm to be processed by whatever payment type it is. 
> 
> My confusion comes when I use any other variable and add it to
> Payment.pm it works just fine. 
> 
> What am I seeing or doing that is incorrect? 
> Also I have been trying to find the "'Payment Settings' heading in the
> Interchange documentation" to learn something about the remapping of
> these variables.

You shouldn't have to modify Payment.pm.  If you are modifying
AuthorizeNet.pm anyway (which it needs) consider adding x_cvv2_resp_code
to %result_map (between lines 400-450) as shown:

              pop.avs_code          x_avs_code
              pop.avs_zip           x_zip
              pop.avs_addr          x_address
+            pop.cvv2_resp_code    x_cvv2_resp_code
      /
      );

And then a few lines after that in the @result:

                         x_avs_code
                         x_trans_id
+                       x_cvv2_resp_code
                 /
                 }
Quite a few things could be added to @result (x_invoice_num
through x_md5_hash).  I'm looking at code from 1.5 months ago.
AuthorizeNet.pm had some changes applied by Jon a day or two ago,
so I might be a little off.

You could also check the response:
     if ($result{x_cvv2_resp_code} eq 'N') {
        my $msg = $opt->{message_cvv2} ||
           q{Blah, blah, blah  The bank returned the following error: %s};
        $result{MErrMsg} = errmsg($msg, $result{x_response_reason_text});
     } elsif ($result{x_cvv2_resp_code} eq 'P') {
     ...etc.

Version needs to be 3.1 (I'm guessing you've already done that)
    x_Version       => '3.1',

x_ADC_Delim_Character might need changing (not for CVV2, but for expanded
use).  If so, that requires coordination with your AuthorizeNet account
settings modification of the split for @result.

It sounds like you are really close to having it working.  It's not
too tough to do.  You can always turn on debugging and add something like:
::logDebug(qq{authorizenet 
response_reason_text=$result{x_response_reason_text} response_code: 
result{x_response_code} avs_code=$result{x_avs_code} 
cvv2_resp_code=$result{x_cvv2_resp_code}});


Good luck,
John Young