libbusiness-onlinepayment-tclink-perl-1.03/0040755000175000017500000000000007620021607020473 5ustar wittenwittenlibbusiness-onlinepayment-tclink-perl-1.03/Makefile.PL0100644000175000017500000000105507472252105022447 0ustar wittenwittenuse ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Business::OnlinePayment::TCLink', 'VERSION_FROM' => 'TCLink.pm', # finds $VERSION 'AUTHOR' => 'Dan Helfman ', #'NORECURS' => 1, # dont descend into subdirectories 'PREREQ_PM' => { 'Net::TCLink' => 0, 'Business::OnlinePayment' => 0, }, #'dist' => {CI => 'ci -l'}, ); libbusiness-onlinepayment-tclink-perl-1.03/Changes0100644000175000017500000000101407607625351021772 0ustar wittenwittenRevision history for Perl extension Business::OnlinePayment::TCLink. 1.03 Fri Jan 10 12:19:12 PST 2003 - now returns error_message with more useful messages 1.02 Mon Nov 4 15:39:38 PST 2002 - bug fix so that ach/echeck transactions will work (thanks Ivan) 1.01 Mon May 20 12:54:45 PDT 2002 - added generic "CC" credit card type - order_number bug fixes - now strips non-digits from certain fields - prepends a "0" to expiration field if necessary 1.00 Mon May 20 12:54:45 PDT 2002 - original version libbusiness-onlinepayment-tclink-perl-1.03/MANIFEST0100644000175000017500000000007607607626114021635 0ustar wittenwittenTCLink.pm Changes MANIFEST Makefile.PL README README.freeside libbusiness-onlinepayment-tclink-perl-1.03/README.freeside0100644000175000017500000000550307607625117023153 0ustar wittenwitten Business::OnlinePayment::TCLink v1.03 Freeside Integration Copyright (C) TrustCommerce 2002 http://www.trustcommerce.com developer@trustcommerce.com January 10, 2003 I. DESCRIPTION Business::OnlinePayment::TCLink Module is a TrustCommerce payment module for use with any e-commerce system that supports the Perl Business::OnlinePayment API. This document describes using the module with the the Freeside open-source billing and account administration package, available here: http://www.sisd.com/freeside/ II. INSTALLATION First, install Freeside and configure it, as per the Freeside documentation. Then follow the instructions in README for Business::OnlinePayment::TCLink to install it as root. III. CONFIGURATION Login to the Freeside web interface. Click on "Sysadmin" at the top, and then click on "View/Edit invoice events". Select the "Batch card" invoice event, which causes customer credit card transactions to be run as a batch at the end of the day. Click "Disabled" and then "Apply changes", because we want to do real-time credit card transactions. Click "Add invoice event" and add an event called "Business::OnlinePayment". Under "Action", select "Run card with a Business::OnlinePayment realtime gateway", and then click "Add invoice event." Now transactions should be run through the Business::OnlinePayment gateway that you configure. To select TCLink as the gateway, go to the main menu, click on "Sysadmin", and then on "Configuration". Click "Edit Configuration". Scroll down to the "Billing configuration options". Take a look at the business-onlinepayment setting. The first line of the text area should be "TCLink". The second line should be your TrustCommerce customer ID, the third your TrustCommerce password, and the fourth line should be the type of action to run, such as "Authorization Only" (which is a TrustCommerce preauth) or "Normal authorization" (which is a TrustCommerce sale). Here is an example: TCLink 99999 password Authorization Only When you're done, click "Apply changes". Now you should be fully configured for using TCLink. Note that more detailed Freeside billing information is available at: http://www.sisd.com/freeside/devdocs/billing.html IV. USAGE Using the TCLink payment module via Freeside is as easy as performing a real-time credit card transaction through the Freeside web interface. Try out a test transaction, and then login to the TrustCommerce Vault to ensure that the transaction went through correctly. If at any time you would like to change the settings for this module, proceed to the billing configuration options on the configuration page as described above, and then alter any of the settings that you desire. libbusiness-onlinepayment-tclink-perl-1.03/README0100644000175000017500000000455707607625055021377 0ustar wittenwitten Business::OnlinePayment::TCLink v1.03 copyright (C) TrustCommerce 2002 All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. http://www.trustcommerce.com developer@trustcommerce.com January 10, 2003 I. DESCRIPTION This is Business::OnlinePayment::TCLink, a Business::OnlinePayment backend module for TrustCommerce. It is only useful if you have an account with TrustCommerce: http://www.trustcommerce.com Dan Helfman is the author. The module is derived from code by Jason Kohles and Ivan Kohler. Email developer@trustcommerce.com for help with using this module. Business::OnlinePayment is a generic interface for processing payments through online credit card processors, online check acceptance houses, etc. (If you like buzzwords, call it an "multiplatform ecommerce-enabling middleware solution"). II. BUILD First, follow the instructions in the Net::TCLink Perl package (distributed separately) to install it as root. The package is availble at: http://trustcommerce.com/tclink.html To build Business::OnlinePayment::TCLink, you need only execute the following two commands: $ perl Makefile.PL $ make III. INSTALLATION If you wish to install globally (recommended), execute the following command as root: # make install If you do not have root priviledges on the machine, or do not wish to install Business::OnlinePayment::TCLink globally, you may still load the module manually from the blib directory where it is built. Assuming the name of your test script is test.pl, use the following command line: $ perl -Iblib/arch -Iblib/lib test.pl You may wish to change "blib/arch" and "blib/lib" to be the full path to those locations, so that you may execute the command anywhere. Or, you may insert the following code at the top of your script: use lib "blib/lib"; use lib "blib/arch"; Again, you may prefer to use the full path name here. IV. USAGE The perldoc documentation contains usage information and some example code. Access it as follows: $ perldoc Business::OnlinePayment::TCLink Information on integrating this module with the Freeside billing and account administration package is available in README.freeside. libbusiness-onlinepayment-tclink-perl-1.03/TCLink.pm0100644000175000017500000001635307607624772022203 0ustar wittenwittenpackage Business::OnlinePayment::TCLink; use strict; use Net::TCLink; use Business::OnlinePayment; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; @ISA = qw(Exporter AutoLoader Business::OnlinePayment); @EXPORT = qw(); @EXPORT_OK = qw(); $VERSION = '1.03'; sub set_defaults { my $self = shift; # this module uses Net::TCLink for connections to the payment gateway $self->server(''); $self->port(''); $self->path(''); $self->build_subs('order_number'); } sub map_fields { my($self) = @_; my %content = $self->content(); # ACTION MAP my %actions = ('normal authorization' => 'sale', 'authorization only' => 'preauth', 'credit' => 'credit', 'post authorization' => 'postauth', ); $content{'action'} = $actions{lc($content{'action'})} || $content{'action'}; # TYPE MAP my %types = ('visa' => 'cc', 'mastercard' => 'cc', 'american express' => 'cc', 'discover' => 'cc', 'novus' => 'cc', "diner's club" => 'cc', 'carte blanche' => 'cc', 'japan card' => 'cc', 'enroute' => 'cc', 'cc' => 'cc', 'check' => 'ach', ); $content{'type'} = $types{lc($content{'type'})} || $content{'type'}; $self->transaction_type($content{'type'}); # stuff it back into %content $self->content(%content); } sub remap_fields { my($self,%map) = @_; my %content = $self->content(); foreach(keys %map) { $content{$map{$_}} = $content{$_}; } $self->content(%content); } sub get_fields { my($self,@fields) = @_; my %content = $self->content(); my %new = (); foreach( grep defined $content{$_}, @fields) { $new{$_} = $content{$_}; } return %new; } sub submit { my($self) = @_; $self->map_fields(); $self->remap_fields( type => 'media', login => 'custid', password => 'password', action => 'action', amount => 'amount', first_name => 'first_name', last_name => 'last_name', address => 'address1', city => 'city', state => 'state', zip => 'zip', card_number => 'cc', expiration => 'exp', account_number => 'account', routing_code => 'routing', country => 'country', phone => 'phone', email => 'email', order_number => 'transid' ); if($self->transaction_type() eq "ach") { $self->required_fields(qw/type login password action amount first_name last_name account_number routing_code/); } elsif($self->transaction_type() eq 'cc' ) { if ( $self->{_content}->{action} eq 'postauth' ) { $self->required_fields(qw/login password action amount order_number card_number expiration/); } else { $self->required_fields(qw/login password action amount first_name last_name card_number expiration/); } } else { Carp::croak("TrustCommerce can't handle transaction type: ". $self->transaction_type()); } my %params = $self->get_fields(qw/media custid password action amount first_name last_name address1 city state zip cc exp account routing country phone email transid/); $params{'demo'} = $self->test_transaction() ? 'y' : 'n'; $params{'avs'} = $self->require_avs() ? 'y' : 'n'; $params{'name'} = $params{'first_name'} . ' ' . $params{'last_name'}; delete $params{'first_name'}; delete $params{'last_name'}; $params{'amount'} =~ s/\D//g; # strip non-digits $params{'cc'} =~ s/\D//g; $params{'exp'} =~ s/\D//g; $params{'exp'} = '0' . $params{'exp'} if length($params{'exp'}) == 3; my %results = Net::TCLink::send(\%params); if($results{'status'} eq 'approved' or $results{'status'} eq 'accepted') { $self->is_success(1); $self->result_code($results{'status'}); $self->authorization($results{'avs'}); $self->order_number($results{'transid'}); } else { $self->is_success(0); $self->result_code($results{'status'}); my $error; if ($results{'status'} eq 'decline') { if ($results{'declinetype'} eq 'carderror') { $error = 'The credit card number is invalid.'; } else { $error = 'The credit card transaction was declined.'; } } elsif ($results{'status'} eq 'baddata') { $error = 'The transaction data is invalid.'; } elsif ($results{'status'} eq 'error') { $error = 'There was a network failure during processing.'; } $self->error_message($error); } } 1; __END__ =head1 NAME Business::OnlinePayment::TCLink - TrustCommerce backend for Business::OnlinePayment =head1 SYNOPSIS use Business::OnlinePayment; my $tx = new Business::OnlinePayment("TCLink"); $tx->content( type => 'VISA', login => '99999', password => '', action => 'Normal Authorization', amount => '49.95', first_name => 'Dan', last_name => 'Helfman', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', card_number => '4111111111111111', expiration => '09/05', ); $tx->submit(); if($tx->is_success()) { print "Card processed successfully: ".$tx->authorization."\n"; } else { print "Card was rejected: ".$tx->error_message."\n"; } =head1 SUPPORTED TRANSACTION TYPES =head2 Visa, MasterCard, American Express, Discover, Novus, Diner's Club, Carte Blanche, Japan Card, Enroute, CC Content required: type, login, password, action, amount, first_name, last_name, card_number, expiration. =head2 Check Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code. =head1 DESCRIPTION For detailed information see L. =head1 NOTE To settle an authorization-only transaction (where you set action to 'Authorization Only'), submit the transaction id code in the field "order_number" with the action set to "Post Authorization". You can get the transaction id from the authorization by calling the order_number method on the object returned from the authorization. You must also submit the amount field with a value less than or equal to the amount specified in the original authorization. =head1 COMPATIBILITY This module relies on L for interacting with the TrustCommerce payment engine. See http://www.trustcommerce.com/tclink.html for details. =head1 AUTHOR Dan Helfman Derived from code by Jason Kohles and Ivan Kohler. =head1 SEE ALSO perl(1). L. L. =cut libbusiness-onlinepayment-tclink-perl-1.03/build-stamp0100644000175000017500000000000007561603745022637 0ustar wittenwittenlibbusiness-onlinepayment-tclink-perl-1.03/Business-OnlinePayment-TCLink-1.03/0040755000175000017500000000000007607626075026566 5ustar wittenwittenlibbusiness-onlinepayment-tclink-perl-1.03/Business-OnlinePayment-TCLink-1.03/Changes0100644000175000017500000000101407607625771030054 0ustar wittenwittenRevision history for Perl extension Business::OnlinePayment::TCLink. 1.03 Fri Jan 10 12:19:12 PST 2003 - now returns error_message with more useful messages 1.02 Mon Nov 4 15:39:38 PST 2002 - bug fix so that ach/echeck transactions will work (thanks Ivan) 1.01 Mon May 20 12:54:45 PDT 2002 - added generic "CC" credit card type - order_number bug fixes - now strips non-digits from certain fields - prepends a "0" to expiration field if necessary 1.00 Mon May 20 12:54:45 PDT 2002 - original version libbusiness-onlinepayment-tclink-perl-1.03/Business-OnlinePayment-TCLink-1.03/MANIFEST0100644000175000017500000000007607607626033027711 0ustar wittenwittenTCLink.pm Changes MANIFEST Makefile.PL README README.freeside libbusiness-onlinepayment-tclink-perl-1.03/Business-OnlinePayment-TCLink-1.03/Makefile.PL0100644000175000017500000000105507607625771030540 0ustar wittenwittenuse ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Business::OnlinePayment::TCLink', 'VERSION_FROM' => 'TCLink.pm', # finds $VERSION 'AUTHOR' => 'Dan Helfman ', #'NORECURS' => 1, # dont descend into subdirectories 'PREREQ_PM' => { 'Net::TCLink' => 0, 'Business::OnlinePayment' => 0, }, #'dist' => {CI => 'ci -l'}, ); libbusiness-onlinepayment-tclink-perl-1.03/Business-OnlinePayment-TCLink-1.03/README0100644000175000017500000000455707607625771027460 0ustar wittenwitten Business::OnlinePayment::TCLink v1.03 copyright (C) TrustCommerce 2002 All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. http://www.trustcommerce.com developer@trustcommerce.com January 10, 2003 I. DESCRIPTION This is Business::OnlinePayment::TCLink, a Business::OnlinePayment backend module for TrustCommerce. It is only useful if you have an account with TrustCommerce: http://www.trustcommerce.com Dan Helfman is the author. The module is derived from code by Jason Kohles and Ivan Kohler. Email developer@trustcommerce.com for help with using this module. Business::OnlinePayment is a generic interface for processing payments through online credit card processors, online check acceptance houses, etc. (If you like buzzwords, call it an "multiplatform ecommerce-enabling middleware solution"). II. BUILD First, follow the instructions in the Net::TCLink Perl package (distributed separately) to install it as root. The package is availble at: http://trustcommerce.com/tclink.html To build Business::OnlinePayment::TCLink, you need only execute the following two commands: $ perl Makefile.PL $ make III. INSTALLATION If you wish to install globally (recommended), execute the following command as root: # make install If you do not have root priviledges on the machine, or do not wish to install Business::OnlinePayment::TCLink globally, you may still load the module manually from the blib directory where it is built. Assuming the name of your test script is test.pl, use the following command line: $ perl -Iblib/arch -Iblib/lib test.pl You may wish to change "blib/arch" and "blib/lib" to be the full path to those locations, so that you may execute the command anywhere. Or, you may insert the following code at the top of your script: use lib "blib/lib"; use lib "blib/arch"; Again, you may prefer to use the full path name here. IV. USAGE The perldoc documentation contains usage information and some example code. Access it as follows: $ perldoc Business::OnlinePayment::TCLink Information on integrating this module with the Freeside billing and account administration package is available in README.freeside. libbusiness-onlinepayment-tclink-perl-1.03/Business-OnlinePayment-TCLink-1.03/README.freeside0100644000175000017500000000550307607625771031235 0ustar wittenwitten Business::OnlinePayment::TCLink v1.03 Freeside Integration Copyright (C) TrustCommerce 2002 http://www.trustcommerce.com developer@trustcommerce.com January 10, 2003 I. DESCRIPTION Business::OnlinePayment::TCLink Module is a TrustCommerce payment module for use with any e-commerce system that supports the Perl Business::OnlinePayment API. This document describes using the module with the the Freeside open-source billing and account administration package, available here: http://www.sisd.com/freeside/ II. INSTALLATION First, install Freeside and configure it, as per the Freeside documentation. Then follow the instructions in README for Business::OnlinePayment::TCLink to install it as root. III. CONFIGURATION Login to the Freeside web interface. Click on "Sysadmin" at the top, and then click on "View/Edit invoice events". Select the "Batch card" invoice event, which causes customer credit card transactions to be run as a batch at the end of the day. Click "Disabled" and then "Apply changes", because we want to do real-time credit card transactions. Click "Add invoice event" and add an event called "Business::OnlinePayment". Under "Action", select "Run card with a Business::OnlinePayment realtime gateway", and then click "Add invoice event." Now transactions should be run through the Business::OnlinePayment gateway that you configure. To select TCLink as the gateway, go to the main menu, click on "Sysadmin", and then on "Configuration". Click "Edit Configuration". Scroll down to the "Billing configuration options". Take a look at the business-onlinepayment setting. The first line of the text area should be "TCLink". The second line should be your TrustCommerce customer ID, the third your TrustCommerce password, and the fourth line should be the type of action to run, such as "Authorization Only" (which is a TrustCommerce preauth) or "Normal authorization" (which is a TrustCommerce sale). Here is an example: TCLink 99999 password Authorization Only When you're done, click "Apply changes". Now you should be fully configured for using TCLink. Note that more detailed Freeside billing information is available at: http://www.sisd.com/freeside/devdocs/billing.html IV. USAGE Using the TCLink payment module via Freeside is as easy as performing a real-time credit card transaction through the Freeside web interface. Try out a test transaction, and then login to the TrustCommerce Vault to ensure that the transaction went through correctly. If at any time you would like to change the settings for this module, proceed to the billing configuration options on the configuration page as described above, and then alter any of the settings that you desire. libbusiness-onlinepayment-tclink-perl-1.03/Business-OnlinePayment-TCLink-1.03/TCLink.pm0100644000175000017500000001635307607625771030257 0ustar wittenwittenpackage Business::OnlinePayment::TCLink; use strict; use Net::TCLink; use Business::OnlinePayment; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; @ISA = qw(Exporter AutoLoader Business::OnlinePayment); @EXPORT = qw(); @EXPORT_OK = qw(); $VERSION = '1.03'; sub set_defaults { my $self = shift; # this module uses Net::TCLink for connections to the payment gateway $self->server(''); $self->port(''); $self->path(''); $self->build_subs('order_number'); } sub map_fields { my($self) = @_; my %content = $self->content(); # ACTION MAP my %actions = ('normal authorization' => 'sale', 'authorization only' => 'preauth', 'credit' => 'credit', 'post authorization' => 'postauth', ); $content{'action'} = $actions{lc($content{'action'})} || $content{'action'}; # TYPE MAP my %types = ('visa' => 'cc', 'mastercard' => 'cc', 'american express' => 'cc', 'discover' => 'cc', 'novus' => 'cc', "diner's club" => 'cc', 'carte blanche' => 'cc', 'japan card' => 'cc', 'enroute' => 'cc', 'cc' => 'cc', 'check' => 'ach', ); $content{'type'} = $types{lc($content{'type'})} || $content{'type'}; $self->transaction_type($content{'type'}); # stuff it back into %content $self->content(%content); } sub remap_fields { my($self,%map) = @_; my %content = $self->content(); foreach(keys %map) { $content{$map{$_}} = $content{$_}; } $self->content(%content); } sub get_fields { my($self,@fields) = @_; my %content = $self->content(); my %new = (); foreach( grep defined $content{$_}, @fields) { $new{$_} = $content{$_}; } return %new; } sub submit { my($self) = @_; $self->map_fields(); $self->remap_fields( type => 'media', login => 'custid', password => 'password', action => 'action', amount => 'amount', first_name => 'first_name', last_name => 'last_name', address => 'address1', city => 'city', state => 'state', zip => 'zip', card_number => 'cc', expiration => 'exp', account_number => 'account', routing_code => 'routing', country => 'country', phone => 'phone', email => 'email', order_number => 'transid' ); if($self->transaction_type() eq "ach") { $self->required_fields(qw/type login password action amount first_name last_name account_number routing_code/); } elsif($self->transaction_type() eq 'cc' ) { if ( $self->{_content}->{action} eq 'postauth' ) { $self->required_fields(qw/login password action amount order_number card_number expiration/); } else { $self->required_fields(qw/login password action amount first_name last_name card_number expiration/); } } else { Carp::croak("TrustCommerce can't handle transaction type: ". $self->transaction_type()); } my %params = $self->get_fields(qw/media custid password action amount first_name last_name address1 city state zip cc exp account routing country phone email transid/); $params{'demo'} = $self->test_transaction() ? 'y' : 'n'; $params{'avs'} = $self->require_avs() ? 'y' : 'n'; $params{'name'} = $params{'first_name'} . ' ' . $params{'last_name'}; delete $params{'first_name'}; delete $params{'last_name'}; $params{'amount'} =~ s/\D//g; # strip non-digits $params{'cc'} =~ s/\D//g; $params{'exp'} =~ s/\D//g; $params{'exp'} = '0' . $params{'exp'} if length($params{'exp'}) == 3; my %results = Net::TCLink::send(\%params); if($results{'status'} eq 'approved' or $results{'status'} eq 'accepted') { $self->is_success(1); $self->result_code($results{'status'}); $self->authorization($results{'avs'}); $self->order_number($results{'transid'}); } else { $self->is_success(0); $self->result_code($results{'status'}); my $error; if ($results{'status'} eq 'decline') { if ($results{'declinetype'} eq 'carderror') { $error = 'The credit card number is invalid.'; } else { $error = 'The credit card transaction was declined.'; } } elsif ($results{'status'} eq 'baddata') { $error = 'The transaction data is invalid.'; } elsif ($results{'status'} eq 'error') { $error = 'There was a network failure during processing.'; } $self->error_message($error); } } 1; __END__ =head1 NAME Business::OnlinePayment::TCLink - TrustCommerce backend for Business::OnlinePayment =head1 SYNOPSIS use Business::OnlinePayment; my $tx = new Business::OnlinePayment("TCLink"); $tx->content( type => 'VISA', login => '99999', password => '', action => 'Normal Authorization', amount => '49.95', first_name => 'Dan', last_name => 'Helfman', address => '123 Anystreet', city => 'Anywhere', state => 'UT', zip => '84058', card_number => '4111111111111111', expiration => '09/05', ); $tx->submit(); if($tx->is_success()) { print "Card processed successfully: ".$tx->authorization."\n"; } else { print "Card was rejected: ".$tx->error_message."\n"; } =head1 SUPPORTED TRANSACTION TYPES =head2 Visa, MasterCard, American Express, Discover, Novus, Diner's Club, Carte Blanche, Japan Card, Enroute, CC Content required: type, login, password, action, amount, first_name, last_name, card_number, expiration. =head2 Check Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code. =head1 DESCRIPTION For detailed information see L. =head1 NOTE To settle an authorization-only transaction (where you set action to 'Authorization Only'), submit the transaction id code in the field "order_number" with the action set to "Post Authorization". You can get the transaction id from the authorization by calling the order_number method on the object returned from the authorization. You must also submit the amount field with a value less than or equal to the amount specified in the original authorization. =head1 COMPATIBILITY This module relies on L for interacting with the TrustCommerce payment engine. See http://www.trustcommerce.com/tclink.html for details. =head1 AUTHOR Dan Helfman Derived from code by Jason Kohles and Ivan Kohler. =head1 SEE ALSO perl(1). L. L. =cut