1 package Business::OnlinePayment::LinkPoint;
3 # $Id: LinkPoint.pm,v 1.1 2002-02-15 01:19:27 ivan Exp $
6 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
9 use Business::OnlinePayment;
11 use lperl; #lperl.pm from Linkpoint.
15 @ISA = qw(Exporter AutoLoader Business::OnlinePayment);
23 #$self->server('staging.linkpt.net');
24 $self->server('secure.linkpt.net');
32 my %content = $self->content();
35 my %actions = ('normal authorization' => 'ApproveSale',
36 'authorization only' => 'CapturePayment',
37 'credit' => 'ReturnOrder',
38 'post authorization' => 'BillOrders',
40 $content{'action'} = $actions{lc($content{'action'})} || $content{'action'};
42 # stuff it back into %content
43 $self->content(%content);
49 my %content = $self->content();
51 $content{$map{$_}} = $content{$_};
53 $self->content(%content);
58 my %content = $self->content();
60 # warn "$_ = ". ( ref($map{$_})
62 # : $content{$map{$_}} ). "\n";
63 $content{$_} = ref($map{$_})
67 $self->content(%content);
71 my($self,@fields) = @_;
73 my %content = $self->content();
75 foreach( grep defined $content{$_}, @fields) { $new{$_} = $content{$_}; }
85 my %content = $self->content;
88 unless ( $content{action} eq 'BillOrders' ) {
90 if ( $self->transaction_type() =~
91 /^(cc|visa|mastercard|american express|discover)$/i
94 Carp::croak("LinkPoint can't handle transaction type: ".
95 $self->transaction_type());
98 $content{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
99 or croak "unparsable expiration $content{expiration}";
101 ( $month, $year ) = ( $1, $2 );
102 $month = '0'. $month if $month =~ /^\d$/;
103 $year += 2000 if $year < 2000; #not y4k safe, oh shit
106 $content{'address'} =~ /^(\S+)\s/;
109 $self->server('staging.linkpt.net') if $self->test_transaction;
111 $self->revmap_fields(
112 hostname => \( $self->server ),
113 port => \( $self->port ),
114 storename => \( $self->storename ),
115 keyfile => \( $self->keyfile ),
116 addrnum => \$addrnum,
118 cardNumber => 'card_number',
119 cardExpMonth => \$month,
120 cardExpYear => \$year,
123 my $lperl = new LPERL
129 my $action = $content{action};
131 $self->required_fields(qw/
132 hostname port storename keyfile amount cardNumber cardExpMonth cardExpYear
135 my %post_data = $self->get_fields(qw/
136 hostname port storename keyfile
138 amount cardNumber cardExpMonth cardExpYear
139 name email phone address city state zip country
142 print "$_ => $post_data{$_}\n" foreach keys %post_data;
145 my %response = $lperl->$action(\%post_data);
147 if ( $response{'statusCode'} == 0 ) {
148 $self->is_success(0);
149 $self->result_code('');
150 $self->error_message($response{'statusMessage'});
152 $self->is_success(1);
153 $self->result_code($response{'AVCCode'});
154 $self->authorization($response{'trackingID'});
155 # $self->order_number($response{'neworderID'});
165 Business::OnlinePayment::LinkPoint - LinkPoint backend for Business::OnlinePayment
169 use Business::OnlinePayment;
171 my $tx = new Business::OnlinePayment( 'LinkPoint',
172 'storename' => 'your_store_number',
173 'keyfile' => '/path/to/keyfile.pem',
174 'lbin' => '/path/to/binary/lbin',
175 'tmp' => '/secure/tmp', # a secure tmp directory
180 action => 'Normal Authorization',
181 description => 'Business::OnlinePayment test',
183 invoice_number => '100100',
184 customer_id => 'jsk',
185 name => 'Jason Kohles',
186 address => '123 Anystreet',
190 email => 'ivan-linkpoint@420.am',
191 card_number => '4007000000027',
192 expiration => '09/99',
196 if($tx->is_success()) {
197 print "Card processed successfully: ".$tx->authorization."\n";
199 print "Card was rejected: ".$tx->error_message."\n";
202 =head1 SUPPORTED TRANSACTION TYPES
204 =head2 Visa, MasterCard, American Express, JCB, Discover/Novus, Carte blanche/Diners Club
208 For detailed information see L<Business::OnlinePayment>.
212 This module implements an interface to the LinkPoint Perl Wrapper
213 http://www.linkpoint.com/product_solutions/internet/inet_index.html
219 Ivan Kohler <ivan-linkpoint@420.am>
221 Based on Busienss::OnlinePayment::AuthorizeNet written by Jason Kohles.
225 perl(1). L<Business::OnlinePayment>.