From: ivan Date: Wed, 2 May 2007 01:32:31 +0000 (+0000) Subject: - Update for new test account. X-Git-Tag: BUSINESS_ONLINEPAYMENT_LINKPOINT_0_08~1 X-Git-Url: http://git.freeside.biz/gitweb/?p=Business-OnlinePayment-LinkPoint.git;a=commitdiff_plain;h=196db498d6a75d4a772946049fbaee6b4700dd85 - Update for new test account. - Add "cargs" argument including "-k" when in test mode. - Move tests from t2/ and have them actually work out of the box. - get rid of old Exporter / AutoLoader cruft - patch from Mark D. Anderson : - addrnum should be first digit string, not first word - avoid uninitialized variable warnings in lpperl due to webspace and debug - Map customer_ip, customer_id, invoice_number and description fields - Pass email, company, fax fields - Set lpperl debug if our $DEBUG is set - Better/supplimental download link for lpperl.pm --- diff --git a/Changes b/Changes index dad4d99..f59fd60 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,19 @@ Revision history for Perl extension Business::OnlinePayment::LinkPoint. -0.08 Thu May 1 21:26:05 2007 UTC +0.08 Tue May 1 18:26:15 PDT 2007 - Improve error message for declined checks. + - Update for new test account. + - Add "cargs" argument including "-k" when in test mode. + - Move tests from t2/ and have them actually work out of the box. + - get rid of old Exporter / AutoLoader cruft + - patch from Mark D. Anderson : + - addrnum should be first digit string, not first word + - avoid uninitialized variable warnings in lpperl due to webspace and + debug + - Map customer_ip, customer_id, invoice_number and description fields + - Pass email, company, fax fields + - Set lpperl debug if our $DEBUG is set + - Better/supplimental download link for lpperl.pm 0.07 Thu Apr 6 18:27:32 2007 UTC - Add account type mapping diff --git a/LinkPoint.pm b/LinkPoint.pm index 84ea74e..70b6253 100644 --- a/LinkPoint.pm +++ b/LinkPoint.pm @@ -1,18 +1,11 @@ package Business::OnlinePayment::LinkPoint; -# $Id: LinkPoint.pm,v 1.28 2007-05-01 21:37:17 jeff Exp $ - use strict; use vars qw($VERSION @ISA $DEBUG @EXPORT @EXPORT_OK); use Carp qw(croak); -use AutoLoader; use Business::OnlinePayment; -require Exporter; - -@ISA = qw(Exporter AutoLoader Business::OnlinePayment); -@EXPORT = qw(); -@EXPORT_OK = qw(); +@ISA = qw(Business::OnlinePayment); $VERSION = '0.08'; $DEBUG = 0; @@ -130,7 +123,7 @@ sub submit { $month = '0'. $month if $month =~ /^\d$/; } - $content{'address'} =~ /^(\S+)\s/; + $content{'address'} =~ /^(\d+)\s/; my $addrnum = $1; my $result = $content{'result'}; @@ -152,13 +145,21 @@ sub submit { #storename => \( $self->storename ), configfile => \( $self->storename ), keyfile => \( $self->keyfile ), - addrnum => \$addrnum, + + chargetotal => 'amount', result => \$result, + addrnum => \$addrnum, + oid => 'order_number', + ip => 'customer_ip', + userid => 'customer_id', + ponumber => 'invoice_number', + comments => 'description', + #reference_number => 'reference_number', + cardnumber => 'card_number', cardexpmonth => \$month, cardexpyear => \$year, - chargetotal => 'amount', - oid => 'order_number', + bankname => 'bank_name', bankstate => 'bank_state', routing => 'routing_code', @@ -185,7 +186,7 @@ sub submit { host port configfile keyfile result chargetotal cardnumber cardexpmonth cardexpyear - name email phone addrnum city state zip country + name company email phone fax addrnum city state zip country oid dl dlstate routing account accounttype bankname bankstate name void @@ -200,14 +201,20 @@ sub submit { if ( $DEBUG ) { warn "$_ => $post_data{$_}\n" foreach keys %post_data; + $post_data{debug} = 'true'; } - my %response; + $post_data{'cargs'} = '-k -m 300 -s -S' if $self->test_transaction; + + # avoid some uninitialized warnings in lpperl.pm + foreach (qw(webspace debug debugging)) { $post_data{$_} ||= '' } + + #my %response; #{ # local($^W)=0; # %response = $lperl->$action(\%post_data); #} - %response = $lperl->curl_process(\%post_data); + my %response = $lperl->curl_process(\%post_data); if ( $DEBUG ) { warn "$_ => $response{$_}\n" for keys %response; @@ -222,9 +229,11 @@ sub submit { } else { $self->is_success(0); $self->result_code(''); - $response{'r_error'} =~/\S/ - ? $self->error_message($response{'r_error'}) - : $self->error_message($response{'r_approved'}); # no r_error for checks + if ( $response{'r_error'} =~ /\S/ ) { + $self->error_message($response{'r_error'}); + } else { + $self->error_message($response{'r_approved'}); # no r_error for checks + } } } @@ -279,8 +288,10 @@ For detailed information see L. =head1 COMPATIBILITY -This module implements an interface to the LinkPoint Perl Wrapper +This module implements an interface to the LinkPoint Perl Wrapper "lpperl", +which you need to download and install separately. http://www.linkpoint.com/product_solutions/internet/lperl/lperl_main.html +http://www.linkpoint.com/viewcart/down_index.htm Versions 0.4 and on of this module support the LinkPoint Perl Wrapper version 3.5. @@ -291,6 +302,10 @@ Versions 0.4 and on of this module support the LinkPoint Perl Wrapper version Ivan Kohler +Contributions from Mark D. Anderson + +Echeck work by Jeff Finucane + Based on Busienss::OnlinePayment::AuthorizeNet written by Jason Kohles. =head1 SEE ALSO diff --git a/README b/README index d288ba1..b845688 100644 --- a/README +++ b/README @@ -1,4 +1,5 @@ Copyright (c) 2002 Ivan Kohler +Copyright (c) 2007 Freeside Internet Services, Inc. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. @@ -7,12 +8,10 @@ backend module for LinkPoint. It is only useful if you have a merchant account with LinkPoint (Cardservice): http://www.linkpoint.com/ and the "LinkPoint Perl Wrapper": http://www.linkpoint.com/product_solutions/internet/lperl/lperl_main.html +http://www.linkpoint.com/viewcart/down_index.htm It is based on Business::OnlinePayment::AuthorizeNet written by Jason Kohles. -There are additional tests in t2/ that may be useful to you once you have a -store number and key file. - Ivan Kohler Business::OnlinePayment is a generic interface for processing payments through diff --git a/t/bad_auth.t b/t/bad_auth.t new file mode 100644 index 0000000..8369a9f --- /dev/null +++ b/t/bad_auth.t @@ -0,0 +1,42 @@ +BEGIN { $| = 1; print "1..1\n"; } + +use Business::OnlinePayment; + +my $tx = new Business::OnlinePayment("LinkPoint", + 'storename' => '1909796604', + 'keyfile' => './test.pem', + 'server' => 'staging.linkpt.net', +); + +$tx->content( + type => 'VISA', + action => 'Normal Authorization', + description => 'Business::OnlinePayment::LinkPoint visa test', + amount => '0.01', + first_name => 'Tofu', + last_name => 'Beast', + address => '123 Anystreet', + city => 'Anywhere', + state => 'UT', + zip => '84058', + country => 'US', + email => 'ivan-linkpoint@420.am', + card_number => '4007000000027', + expiration => '12/2008', + result => 'DECLINE', +); + +$tx->test_transaction(1); + +$tx->submit(); + +if($tx->is_success()) { + print "not ok 1\n"; + $auth = $tx->authorization; + warn "********* $auth ***********\n"; +} else { + print "ok 1\n"; + #warn '***** '. $tx->error_message. " *****\n"; + exit; +} + diff --git a/t/credit_card.t b/t/credit_card.t new file mode 100644 index 0000000..1aaf3ea --- /dev/null +++ b/t/credit_card.t @@ -0,0 +1,41 @@ +BEGIN { $| = 1; print "1..1\n"; } + +use Business::OnlinePayment; + +my $tx = new Business::OnlinePayment("LinkPoint", + 'storename' => '1909796604', + 'keyfile' => './test.pem', + 'server' => 'staging.linkpt.net', +); + +$tx->content( + type => 'VISA', + action => 'Normal Authorization', + description => 'Business::OnlinePayment::LinkPoint visa test', + amount => '0.01', + first_name => 'Tofu', + last_name => 'Beast', + address => '123 Anystreet', + city => 'Anywhere', + state => 'UT', + zip => '84058', + country => 'US', + email => 'ivan-linkpoint@420.am', + card_number => '4007000000027', + expiration => '12/2008', +); + +$tx->test_transaction(1); + +$tx->submit(); + +if($tx->is_success()) { + print "ok 1\n"; + #$auth = $tx->authorization; + #warn "********* $auth ***********\n"; +} else { + print "not ok 1\n"; + warn '***** '. $tx->error_message. " *****\n"; + exit; +} + diff --git a/t/echeck.t b/t/echeck.t new file mode 100644 index 0000000..7a52c25 --- /dev/null +++ b/t/echeck.t @@ -0,0 +1,50 @@ +BEGIN { $| = 1; print "1..1\n"; } + +$no_echeck_tests = + "Skipped: Linkpoint doesn't provide a way to test echecks\n"; +warn $no_echeck_tests; +print "ok 1 # $no_echeck_tests"; +exit; + +use Business::OnlinePayment; + +my $tx = new Business::OnlinePayment("LinkPoint", + 'storename' => '1909796604', + 'keyfile' => './test.pem', + 'server' => 'staging.linkpt.net', +); + +$tx->content( + type => 'ECHECK', + action => 'Normal Authorization', + description => 'Business::OnlinePayment::LinkPoint echeck test', + amount => '0.01', + first_name => 'Tofu', + last_name => 'Beast', + address => '123 Anystreet', + city => 'Anywhere', + state => 'UT', + zip => '84058', + country => 'US', + email => 'ivan-linkpoint@420.am', + account_number => '0027', + account_type => 'Personal Checking', + routing_code => '400700000', + bank_name => 'SomeBank', + bank_state => 'UT', +); + +$tx->test_transaction(1); + +$tx->submit(); + +if($tx->is_success()) { + print "ok 1\n"; + #$auth = $tx->authorization; + #warn "********* $auth ***********\n"; +} else { + print "not ok 1\n"; + warn '***** '. $tx->error_message. " *****\n"; + exit; +} + diff --git a/t/load.t b/t/load.t new file mode 100644 index 0000000..ac1adbd --- /dev/null +++ b/t/load.t @@ -0,0 +1,5 @@ +BEGIN { $| = 1; print "1..1\n"; } +END {print "not ok 1\n" unless $loaded;} +use Business::OnlinePayment::LinkPoint; +$loaded = 1; +print "ok 1\n"; diff --git a/t2/bad_auth.t b/t2/bad_auth.t deleted file mode 100644 index 689b0cc..0000000 --- a/t2/bad_auth.t +++ /dev/null @@ -1,41 +0,0 @@ -BEGIN { $| = 1; print "1..1\n"; } - -use Business::OnlinePayment; - -my $tx = new Business::OnlinePayment("LinkPoint", - 'storename' => '1909922411', - 'keyfile' => './test.pem', -); - -$tx->content( - type => 'VISA', - action => 'Normal Authorization', - description => 'Business::OnlinePayment::LinkPoint visa test', - amount => '0.01', - first_name => 'Tofu', - last_name => 'Beast', - address => '123 Anystreet', - city => 'Anywhere', - state => 'UT', - zip => '84058', - country => 'US', - email => 'ivan-linkpoint@420.am', - card_number => '4007000000027', - expiration => '12/2008', - result => 'DECLINE', -); - -$tx->test_transaction(1); - -$tx->submit(); - -if($tx->is_success()) { - print "not ok 1\n"; - $auth = $tx->authorization; - warn "********* $auth ***********\n"; -} else { - print "ok 1\n"; - warn '***** '. $tx->error_message. " *****\n"; - exit; -} - diff --git a/t2/credit_card.t b/t2/credit_card.t deleted file mode 100644 index 0748c6a..0000000 --- a/t2/credit_card.t +++ /dev/null @@ -1,40 +0,0 @@ -BEGIN { $| = 1; print "1..1\n"; } - -use Business::OnlinePayment; - -my $tx = new Business::OnlinePayment("LinkPoint", - 'storename' => '1909922411', - 'keyfile' => './test.pem', -); - -$tx->content( - type => 'VISA', - action => 'Normal Authorization', - description => 'Business::OnlinePayment::LinkPoint visa test', - amount => '0.01', - first_name => 'Tofu', - last_name => 'Beast', - address => '123 Anystreet', - city => 'Anywhere', - state => 'UT', - zip => '84058', - country => 'US', - email => 'ivan-linkpoint@420.am', - card_number => '4007000000027', - expiration => '12/2008', -); - -$tx->test_transaction(1); - -$tx->submit(); - -if($tx->is_success()) { - print "ok 1\n"; - $auth = $tx->authorization; - warn "********* $auth ***********\n"; -} else { - print "not ok 1\n"; - warn '***** '. $tx->error_message. " *****\n"; - exit; -} - diff --git a/t2/echeck.t b/t2/echeck.t deleted file mode 100644 index 24dca67..0000000 --- a/t2/echeck.t +++ /dev/null @@ -1,43 +0,0 @@ -BEGIN { $| = 1; print "1..1\n"; } - -use Business::OnlinePayment; - -my $tx = new Business::OnlinePayment("LinkPoint", - 'storename' => '1909922411', - 'keyfile' => './test.pem', -); - -$tx->content( - type => 'CHECK', - action => 'Normal Authorization', - description => 'Business::OnlinePayment::LinkPoint visa test', - amount => '0.01', - first_name => 'Tofu', - last_name => 'Beast', - address => '123 Anystreet', - city => 'Anywhere', - state => 'UT', - zip => '84058', - country => 'US', - email => 'ivan-linkpoint@420.am', - account_number => '0027', - account_type => 'Personal Checking', - routing_code => '400700000', - bank_name => 'SomeBank', - bank_state => 'UT', -); - -$tx->test_transaction(1); - -$tx->submit(); - -if($tx->is_success()) { - print "ok 1\n"; - $auth = $tx->authorization; - warn "********* $auth ***********\n"; -} else { - print "not ok 1\n"; - warn '***** '. $tx->error_message. " *****\n"; - exit; -} - diff --git a/t2/load.t b/t2/load.t deleted file mode 100644 index ac1adbd..0000000 --- a/t2/load.t +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { $| = 1; print "1..1\n"; } -END {print "not ok 1\n" unless $loaded;} -use Business::OnlinePayment::LinkPoint; -$loaded = 1; -print "ok 1\n"; diff --git a/test.pem b/test.pem index b704754..0d3d81e 100644 --- a/test.pem +++ b/test.pem @@ -1,30 +1,32 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQDMuGGy905tleY6aAAQXp2ZaWNrQOunSowlue9LC4k/cBdtwTJ3 -cvpzMAN5680x/TcyNTOtcj9OPE4nrhxJqTqSR1Rri04XVy/f+8qZujXXesrnRmVx -N83LxtqhP5dH7uNgs/apbXr0wfx/Aq42Odax6toKlEo8NvnJ5u86ZSNKoQIDAQAB -AoGBAIIXUQ5XFWGR9gF7gT7lwSRx0hmf4aAnQTPgGe4IYKkNY/X85UL+r6RvCGZ7 -r6Nqk562LCa2CQCAVfHlNFiiz3Js2zOJamA37tlv6+pVc1OhZH0Xjd/vsoRvFXW6 -LNoQ62SYImVvbeetk6pI0ghHXBES1QQi18uuhK6y5Ks+EXABAkEA+6pA2x8lhIj1 -VBMnLj5JnNBKZcJmtWp5iE0vhOhoOirH2FiqZ0kGL1em/iTGpwxFGhje4paZsans -/o3Nm2Ig4QJBANA/Hp+43K/54Y2Cci6L1sRFcanZMx6OnsozqvK9mcdNAIyYz4uj -pUEHBnyGen6KS9/AuN4+XtojlZrFlYnbocECQE+/CGQm/3165Lpqg0zdAfiF7D1I -l8E+5xnw03D7MCPWcJM2rXCjLCmOTeVUg/plIfR+EwqcDEHHBck36AIn2yECQGVq -F9PZB0B8BKgRmuGoIFM9Lnl02TxMYHBAcUP9qeIxUc8mrAxpCZV9gl8qboUpfIHf -LSiuXysEoVraVlTorQECQBYWeK4mfSRwofWimMtVv1a2YqPOf6vA57knBU2gPS2g -rTrt7S0WmQvAwrKN5nd25XNOeVKPPbTFd2NQr5GSN3s= +-----BEGIN RSA PRIVATE KEY----- +MIICWwIBAAKBgQC/119qB6Q7lnVfCEGUHCrhhRNIBsmu4i4iQkR9P+G7hzVLrr/8 ++2xvUZ3D89wFxA2+rYwEcAGz73J2EQR8NPSRsTSW0c9HJEw5bAhistev8o8ZTyg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