Skip Menu |

This queue is for tickets about the Business-OnlinePayment-AuthorizeNet CPAN distribution.

Report information
The Basics
Id: 6761
Status: resolved
Priority: 0/
Queue: Business-OnlinePayment-AuthorizeNet

People
Owner: ivan-pause [...] 420.am
Requestors: tjmather [...] maxmind.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Feature Addition fields cvv2_response and cavv_response plus capture example
This patch adds a couple of features, and also adds some documentation ChangeLog: Added cvv2_response and cavv_response to get the cvv2 and cavv response codes back from authorize.net. Added example of how to capture a transaction to the synopsis. Added example of how to get the avs_code, cvv2_response, and cavv_response from the response
--- /tmp/AuthorizeNet.pm.old Fri Jun 25 16:56:22 2004 +++ /usr/local/lib/perl5/site_perl/5.8.0/Business/OnlinePayment/AuthorizeNet.pm Fri Jun 25 21:43:09 2004 @@ -21,7 +21,7 @@ $self->port('443'); $self->path('/gateway/transact.dll'); - $self->build_subs(qw(order_number md5 avs_code)); + $self->build_subs(qw(order_number md5 avs_code cvv2_response cavv_response)); } sub map_fields { @@ -184,6 +184,8 @@ $self->avs_code($col[5]); $self->order_number($col[6]); $self->md5($col[37]); + $self->cvv2_response($col[38]); + $self->cavv_response($col[39]); if($col[0] eq "1" ) { # Authorized/Pending/Test $self->is_success(1); $self->result_code($col[0]); @@ -216,12 +218,16 @@ use Business::OnlinePayment; + # Two step transaction, authorization and capture. + # If you don't need to review order before capture, you can + # process in one step by setting action to 'Normal Authorization' + my $tx = new Business::OnlinePayment("AuthorizeNet"); $tx->content( type => 'VISA', login => 'testdrive', password => '', - action => 'Normal Authorization', + action => 'Authorization Only', description => 'Business::OnlinePayment test', amount => '49.95', invoice_number => '100100', @@ -240,7 +246,33 @@ $tx->submit(); if($tx->is_success()) { - print "Card processed successfully: ".$tx->authorization."\n"; + # get information about authorization + $authorization = $tx->authorization + $ordernum = $tx->order_number; + $avs_code = $tx->avs_code; # AVS Response Code + $cvv2_response = $tx->cvv2_response; # Card Code (CVV2/CVC2/CID) Response Code + $cavv_response = $tx->cavv_response; # Cardholder Authentication Verification Value (CAVV) Response Code + + # now capture transaction (not necessary if action is 'Normal Authorization') + my $capture = new Business::OnlinePayment("AuthorizeNet"); + + $capture->content( + type => 'CC', + action => 'Post Authorization', + login => 'YOURLOGIN + password => 'YOURPASSWORD', + order_number => $ordernum, + amount => '49.95', + ); + + $capture->submit(); + + if($capture->is_success()) { + print "Card captured successfully: ".$capture->authorization."\n"; + } else { + print "Card was rejected: ".$capture->error_message."\n"; + } + } else { print "Card was rejected: ".$tx->error_message."\n"; }
fixed in 3.14 (uploaded on sep 21 but still not available as an RT keyword)