[ic] Re: Authorizenet payment module (modifications)

John Young interchange-users@icdevgroup.org
Wed Jun 4 15:26:01 2003


Philip S. Hempel wrote:

> Only problem is when you have someone with a two line address, causes the line to
> become split. When and address of this form looks like this
> 
> 123 West Maybury
> PO Box 123
> 
> The split then would be on an address line moving all others fields down by one.
> I have test this and found to be true only in this case. The case is even wors when
> both billing and shipping are two line fields.
> This is what I have been trying to get past. I understand the reason behind why
> they gave a character to use for field encap. Not only for the line delim.

Sorry, but I don't believe I understand.  I wasn't aware that 
AuthorizeNet.pm
would even see a two-line address due to the following in Payment.pm:

     if($actual{b_address1}) {
         $actual{b_address} = "$actual{b_address1}";
         $actual{b_address} .=  ", $actual{b_address2}"
             if $actual{b_address2};
     }

Now, IF you used three address blanks on forms, as some do, that would 
require
modification of the logic above.  In any event, I can't understand how you
are getting multiple address lines to the payment gateway.  Are you 
inserting
a linefeed character or something interesting like that?


> The suggestions that were put up erliear work fine if your not concerned about the
> output.
> What my goal is to let the user know why the error so they do not try fixing the
> address when the actual problem is cvv2.
> 
>  If I do not use the error codes releated to cvv2 output and only use the secondary
> response code it would be very generic but I could use it a least to say that it
> is a cvv2 error.

Forgive me if I still don't understand your issue.  I would think
the following logic near the end of AuthorizeNet.pm would do it:

     if ($result{x_response_code} == 1) {
         $result{MStatus} = 'success';
         $result{'order-id'} ||= $opt->{order_id};
     }
     else {
         $result{MStatus} = 'failure';
         delete $result{'order-id'};

         [...AVS error stuff, perhaps...]

         if ($result{x_cvv2_resp_code} eq 'N') {
             my $msg = $opt->{message_cvv2} ||
             q{Sorry, your credit card security code does not match. 
The bank returned the following error: %s};
             $result{MErrMsg} = errmsg($msg, 
$result{x_response_reason_text});
         }

         [... elsif P S U codes with nice messages, plus else with 
catchall...]

     }
#::logDebug(qq{authorizenet result=} . uneval(\%result));
     return (%result);


I'm still not sure if I'm missing something you are saying.  With the logic
above, you can give fairly specific error messages for each type of failure.

Good luck!
John Young
(in digest mode, hence the delays in responding)