- Update for production URL
authorIvan Kohler <ivan@freeside.biz>
Thu, 12 Feb 2015 22:27:41 +0000 (14:27 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 12 Feb 2015 22:27:41 +0000 (14:27 -0800)
        - Use username/password for auth like other B:OP modules
        - Fix tests
        - Remove extraneous extra/ stuff in repo

19 files changed:
Changes
extra/libbusiness-onlinepayment-vsecureprocessing-perl_0.01-1_all.deb [deleted file]
extra/test.pl [deleted file]
lib/Business/OnlinePayment/vSecureProcessing.pm
t/00-load.t [new file with mode: 0644]
t/boilerplate.t [new file with mode: 0644]
t/lib/test_account.pl
t/manifest.t [new file with mode: 0644]
t/pod-coverage.t [new file with mode: 0644]
t/pod.t [new file with mode: 0644]
t/t_00-load.t [deleted file]
t/t_boilerplate.t [deleted file]
t/t_manifest.t [deleted file]
t/t_pod-coverage.t [deleted file]
t/t_pod.t [deleted file]
t/t_transaction.t [deleted file]
t/t_transaction_decline.t [deleted file]
t/transaction.t [new file with mode: 0644]
t/transaction_decline.t [new file with mode: 0644]

diff --git a/Changes b/Changes
index 716346c..7b9cab2 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
 Revision history for Perl module Business::OnlinePayment::vSecureProcessing
 
 Revision history for Perl module Business::OnlinePayment::vSecureProcessing
 
+0.02    Feb 12 2015
+        - Update for production URL
+        - Use username/password for auth like other B:OP modules
+        - Fix tests
+        - Remove extraneous extra/ stuff in repo
+
 0.01    Feb 06 2015
         Initial release.
 
 0.01    Feb 06 2015
         Initial release.
 
diff --git a/extra/libbusiness-onlinepayment-vsecureprocessing-perl_0.01-1_all.deb b/extra/libbusiness-onlinepayment-vsecureprocessing-perl_0.01-1_all.deb
deleted file mode 100644 (file)
index d9edcf2..0000000
Binary files a/extra/libbusiness-onlinepayment-vsecureprocessing-perl_0.01-1_all.deb and /dev/null differ
diff --git a/extra/test.pl b/extra/test.pl
deleted file mode 100755 (executable)
index 50aa857..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/perl -w
-
-#
-# Make sure to copy Business::OnlinePayment::vSecureProcessing into its
-# proper system directory (aka /usr/share/perl5/Business/Onlinepayment)
-#
-
-use strict;
-use Data::Dumper;
-use Business::OnlinePayment;
-
-my %opt = (
-    server =>'dvrotsos2.kattare.com',
-    platform => 'Buypass',
-    gid => '1432479912596791',
-    tid => '01',
-    userid=> 'tom@yiptv.com',
-    port => 443,
-    env => 'test'
-);
-
-my $action = shift || 'Normal Authorization';
-my $auth = shift || '';
-
-
-my %content = (
-    appid          => 'yiptv',
-    action         => $action,
-    auth           => $auth,
-    description    => 'Business::OnlinePayment visa test',
-#    card_number    => '4007000000027',
-    card_number    => '4111111111111111',
-    cvv2           => '111',
-    expiration     => expiration_date(),
-    amount         => '42.24',
-    name           => 'Murphy Law',
-    email          => 'fake@acme.com',
-    address        => '123 Anystreet',
-    zip            => '84058',
-);
-
-main();
-
-sub main {
-    my $transaction = Business::OnlinePayment->new("vSecureProcessing", %opt);
-    
-    print "MAKING PAYMENT\n";
-    ProcessTransaction($transaction);
-    $content{'action'} = 'void';
-    $content{'ref_num'} = $transaction->authorization();
-    $content{'txn_date'} = $transaction->txn_date();
-    $content{'amount'} = $transaction->txn_amount;
-    print "VOIDING PAYMENT\n";
-    ProcessTransaction($transaction);
-    $content{'action'} = 'Normal Authorization';
-    $content{'amount'} = '30.00';
-    print "MAKING PAYMENT\n";
-    ProcessTransaction($transaction);
-    $content{'action'} = 'credit';
-    $content{'ref_num'} = $transaction->authorization;
-    $content{'txn_date'} = $transaction->txn_date;
-    $content{'amount'} = $transaction->txn_amount;
-    print "REFUNDING PAYMENT\n";
-    ProcessTransaction($transaction);
-}
-
-sub ProcessTransaction {
-    my $transaction = shift;
-    #print "Processing transaction with content:\n".Dumper(\%content)."\n";
-    $transaction->content(%content);
-
-    eval { $transaction->submit(); };
-
-    if ( $@ ) {
-    
-    die "Error: $@\n";
-    
-    } else {
-    
-        if ( $transaction->is_success() ) {
-            print "Card processed successfully: ". $transaction->authorization()."\n";
-        } else {
-            print "Card was rejected: ". $transaction->error_message(). "\n";
-        }
-    }
-}
-
-
-sub expiration_date {
-    my($month, $year) = (localtime)[4,5];
-    $month += 1;
-    $year++;       # So we expire next year.
-    $year %= 100;  # y2k?  What's that?
-
-    return sprintf("%02d/%02d", $month, $year);
-}
index 872e4ca..947aaf6 100644 (file)
@@ -1,20 +1,17 @@
 package Business::OnlinePayment::vSecureProcessing;
 
 use strict;
 package Business::OnlinePayment::vSecureProcessing;
 
 use strict;
+use vars qw($VERSION $DEBUG @ISA);
 use Carp;
 use XML::Writer;
 use XML::Simple;
 use Data::Dumper;
 use Carp;
 use XML::Writer;
 use XML::Simple;
 use Data::Dumper;
-
 use Business::OnlinePayment;
 use Business::OnlinePayment::HTTPS;
 use Business::OnlinePayment;
 use Business::OnlinePayment::HTTPS;
-#use Net::SSLeay qw(post_http post_https make_headers make_form);
-use vars qw($VERSION $DEBUG @ISA $me);
 
 @ISA = qw(Business::OnlinePayment::HTTPS);
 
 @ISA = qw(Business::OnlinePayment::HTTPS);
-$DEBUG = 3;
-$VERSION = '0.01';
-$me = 'Business::OnlinePayment::vSecureProcessing';
+$DEBUG = 0;
+$VERSION = '0.02';
 
 # mapping out all possible endpoints
 # but this version will only be building out "charge", "void", & "credit"
 
 # mapping out all possible endpoints
 # but this version will only be building out "charge", "void", & "credit"
@@ -22,17 +19,27 @@ my %payment_actions = (
     'charge' => {
         path      => '/vsg2/processpayment',
         process   => 'ProcessPayment',
     'charge' => {
         path      => '/vsg2/processpayment',
         process   => 'ProcessPayment',
-        fields    => [qw/ Amount Trk1 Trk2 TypeOfSale Cf1 Cf2 Cf AccountNumber ExpirationMonth ExpirationYear Cvv CardHolderFirstName CardHolderLastName AvsZip AvsStreet IndustryType ApplicationId Recurring /]
+        fields    => [qw/
+          Amount Trk1 Trk2 TypeOfSale Cf1 Cf2 Cf AccountNumber
+          ExpirationMonth ExpirationYear Cvv
+          CardHolderFirstName CardHolderLastName AvsZip AvsStreet
+          IndustryType ApplicationId Recurring
+        /],
     },
     'void' => {
         path      => '/vsg2/processvoid',
         process   => 'ProcessVoid',
     },
     'void' => {
         path      => '/vsg2/processvoid',
         process   => 'ProcessVoid',
-        fields    => [qw( Amount AccountNumber ExpirationMonth ExpirationYear ReferenceNumber TransactionDate IndustryType ApplicationId )]
+        fields    => [qw(
+          Amount AccountNumber ExpirationMonth ExpirationYear ReferenceNumber
+          TransactionDate IndustryType ApplicationId
+        )],
     },
     'refund' => {
         path      => '/vsg2/processrefund',
         process   => 'ProcessRefund',
     },
     'refund' => {
         path      => '/vsg2/processrefund',
         process   => 'ProcessRefund',
-        fields    => [qw( Amount AccountNumber ExpirationMonth ExpirationYear ApplicationId )]
+        fields    => [qw(
+          Amount AccountNumber ExpirationMonth ExpirationYear ApplicationId
+        )],
     },
     'authorize' => {
         path      => '/vsg2/processauth',
     },
     'authorize' => {
         path      => '/vsg2/processauth',
@@ -80,27 +87,23 @@ sub set_defaults {
                            result_code
                            error_message
                            server
                            result_code
                            error_message
                            server
-                           port
                            path
                            server_response/;
                            
     # B::OP creates the following accessors:
                            path
                            server_response/;
                            
     # B::OP creates the following accessors:
-    #     server, port, path, test_transaction, transaction_type,
+    #     server, path, test_transaction, transaction_type,
     #     server_response, is_success, authorization,
     #     result_code, error_message,
     
     $self->build_subs(qw/
     #     server_response, is_success, authorization,
     #     result_code, error_message,
     
     $self->build_subs(qw/
-            env platform userid gid tid appid action reference_number cvv_response
-            avs_response risk_score txn_amount txn_date response_code
+            platform tid appid
+            action reference_number cvv_response avs_response response_code
+            risk_score txn_amount txn_date
     /);
     
     $DEBUG = exists($options{debug}) ? $options{debug} : $DEBUG;
     
     /);
     
     $DEBUG = exists($options{debug}) ? $options{debug} : $DEBUG;
     
-    
-    
-    $self->server($options{'server'});
-    
-    $self->gid($options{'gid'});
+    $self->server('svr1.vsecureprocessing.com');
     
     $self->tid($options{'tid'});
     
     
     $self->tid($options{'tid'});
     
@@ -108,13 +111,10 @@ sub set_defaults {
     
     $self->appid($options{'appid'});
     
     
     $self->appid($options{'appid'});
     
-    $self->env((defined($options{'env'})) ? $options{'env'} : 'live'); # 'live'/'test'
-    
     $self->port(443);
     $self->port(443);
+    
 }
 
 }
 
-
-
 sub clean_content {
     my ($self,$content) = @_;
     my %content = $self->content();
 sub clean_content {
     my ($self,$content) = @_;
     my %content = $self->content();
@@ -134,13 +134,19 @@ sub clean_content {
         
         # separate month and year values for expiry_date
         if ( $content{expiration} ) {
         
         # separate month and year values for expiry_date
         if ( $content{expiration} ) {
-            ($content{exp_month}, $content{exp_year}) = split /\//, $content{expiration};
+            ($content{exp_month}, $content{exp_year}) =
+              split /\//, $content{expiration};
             $content{exp_month} = sprintf "%02d", $content{exp_month};
             $content{exp_month} = sprintf "%02d", $content{exp_month};
-            $content{exp_year}  = substr($content{exp_year},0,2) if ($content{exp_year} > 99);
+            $content{exp_year}  = substr($content{exp_year},0,2)
+              if ($content{exp_year} > 99);
         }
         
         }
         
-        if (!$content{'first_name'} || !$content{'last_name'} && $content{'name'}) {
-            ($content{'first_name'}, $content{'last_name'}) = split(' ', $content{'name'}, 2);
+        if (    !$content{'first_name'}
+             || !$content{'last_name'} && $content{'name'}
+           )
+        {
+            ($content{'first_name'}, $content{'last_name'}) =
+              split(' ', $content{'name'}, 2);
         }
         
         if ($content{'address'} =~ m/[\D ]*(\d+)\D/) {
         }
         
         if ($content{'address'} =~ m/[\D ]*(\d+)\D/) {
@@ -155,7 +161,10 @@ sub process_content {
     my $self = shift;
     $self->clean_content();
     my %content = $self->content();
     my $self = shift;
     $self->clean_content();
     my %content = $self->content();
-    $self->action(($action_mapping{lc $content{'action'}}) ? $action_mapping{lc $content{'action'}} : lc $content{'action'});
+    $self->action( ($action_mapping{lc $content{'action'}})
+                     ? $action_mapping{lc $content{'action'}}
+                     : lc $content{'action'}
+                 );
     $self->path($payment_actions{ $self->action }{path})
       unless length($self->path);
     $self->appid($content{appid}) if (!$self->appid && $content{appid});
     $self->path($payment_actions{ $self->action }{path})
       unless length($self->path);
     $self->appid($content{appid}) if (!$self->appid && $content{appid});
@@ -175,6 +184,10 @@ sub submit {
     $self->process_content();
     my %content = $self->content;
     my $action = $self->action();
     $self->process_content();
     my %content = $self->content;
     my $action = $self->action();
+
+    if ( $self->test_transaction ) {
+      $self->server('dvrotsos2.kattare.com');
+    }
     
     my @acceptable_actions = ('charge', 'refund', 'void');
     
     
     my @acceptable_actions = ('charge', 'refund', 'void');
     
@@ -186,9 +199,9 @@ sub submit {
     my $xml_vars = {
         auth => {
             Platform    => $self->platform,
     my $xml_vars = {
         auth => {
             Platform    => $self->platform,
-            UserId      => $self->userid,
-            GID         => $self->gid,
-            Tid         => $self->tid
+            UserId      => $content{'login'},
+            GID         => $content{'password'},
+            Tid         => $self->tid || '01',
         },
         
         payment => {
         },
         
         payment => {
@@ -224,11 +237,14 @@ sub submit {
     # create the list of required fields based on the action
     my @required_fields = qw/ Amount /;
     if ($action eq 'charge') {
     # create the list of required fields based on the action
     my @required_fields = qw/ Amount /;
     if ($action eq 'charge') {
-        push(@required_fields, $_) foreach (qw/ AccountNumber Cvv ExpirationMonth ExpirationYear /);
+        push @required_fields, $_
+          foreach (qw/ AccountNumber Cvv ExpirationMonth ExpirationYear /);
     }elsif ($action eq 'void') {
     }elsif ($action eq 'void') {
-        push(@required_fields, $_) foreach (qw/ ReferenceNumber /);
+        push @required_fields, $_
+          foreach (qw/ ReferenceNumber /);
     }elsif ($action eq 'refund') {
     }elsif ($action eq 'refund') {
-        push(@required_fields, $_) foreach (qw/ Amount AccountNumber ExpirationMonth ExpirationYear /);
+        push @required_fields, $_
+          foreach (qw/ Amount AccountNumber ExpirationMonth ExpirationYear /);
     }
     
     # check the requirements are met.
     }
     
     # check the requirements are met.
@@ -245,10 +261,10 @@ sub submit {
     $process_action = 'Process'.$process_action;
     my $xml_data;
     my $writer = new XML::Writer( OUTPUT      => \$xml_data,
     $process_action = 'Process'.$process_action;
     my $xml_data;
     my $writer = new XML::Writer( OUTPUT      => \$xml_data,
-                                DATA_MODE   => 0,
-                                DATA_INDENT => 0,
-                                ENCODING    => 'utf-8',
-                              );
+                                  DATA_MODE   => 0,
+                                  DATA_INDENT => 0,
+                                  ENCODING    => 'utf-8',
+                                );
     $writer->xmlDecl();
     $writer->startTag('Request');
     $writer->startTag('MerchantData');
     $writer->xmlDecl();
     $writer->startTag('Request');
     $writer->startTag('MerchantData');
@@ -264,7 +280,7 @@ sub submit {
         }else {
             $writer->startTag($key);
             foreach my $key2 (keys %{$xml_vars->{payment}{$key}}) {
         }else {
             $writer->startTag($key);
             foreach my $key2 (keys %{$xml_vars->{payment}{$key}}) {
-                $writer->dataElement( $key2, $xml_vars->{payment}{$key}{$key2} ); 
+              $writer->dataElement( $key2, $xml_vars->{payment}{$key}{$key2} ); 
             }
             $writer->endTag($key);
         }
             }
             $writer->endTag($key);
         }
@@ -291,7 +307,8 @@ sub submit {
     # conform to RFC standards
     $content =~ s/\n/\r\n/gs;
 
     # conform to RFC standards
     $content =~ s/\n/\r\n/gs;
 
-    my ( $page, $server_response, %headers ) = $self->https_post( $opts, $content );
+    my ( $page, $server_response, %headers ) =
+      $self->https_post( $opts, $content );
   
     # store the server response.
     $self->server_response($server_response);
   
     # store the server response.
     $self->server_response($server_response);
@@ -300,9 +317,7 @@ sub submit {
     
     if (!$self->is_success() && !$self->error_message() ) {
         if ( $DEBUG ) {
     
     if (!$self->is_success() && !$self->error_message() ) {
         if ( $DEBUG ) {
-            #additional logging information, possibly too sensitive for an error msg
-            # (vSecureProcessing seems to have a failure mode where they return the full
-            #  original request including card number)
+            #additional logging information, possibly too sensitive for an error
             $self->error_message(
               "(HTTPS response: ".$server_response.") ".
               "(HTTPS headers: ".
             $self->error_message(
               "(HTTPS response: ".$server_response.") ".
               "(HTTPS headers: ".
@@ -348,9 +363,8 @@ sub parse_response {
             $self->error_message('Error '.$response->{ResponseCode}.': '.(exists($response->{Receipt})) ? $response->{Receipt} : '');
         }
         
             $self->error_message('Error '.$response->{ResponseCode}.': '.(exists($response->{Receipt})) ? $response->{Receipt} : '');
         }
         
-    }else {
-        $self->is_success(0);
-        $self->error_message('Error communicating with vSecureProcessing server');
+    } else {
+        die 'Error communicating with vSecureProcessing server';
         return;
     }
     
         return;
     }
     
@@ -368,17 +382,17 @@ Business::OnlinePayment::vSecureProcessing - vSecureProcessing backend for Busin
 
   use Business::OnlinePayment;
   my %processor_info = (
 
   use Business::OnlinePayment;
   my %processor_info = (
-    platform    => '####',
-    gid         => 12345678901234567890,
-    tid         => 01,
-    user_id     => '####',
-    url         => 'www.####.com'
+    platform    => 'vsecure_platform',
+    appid       => 'vsecure_appid',
+    tid         => '54', #optional, defaults to 01
   );
   my $tx =
     new Business::OnlinePayment( "vSecureProcessing", %processor_info);
   $tx->content(
   );
   my $tx =
     new Business::OnlinePayment( "vSecureProcessing", %processor_info);
   $tx->content(
-      appid          => '######',
-      type           => 'VISA',
+      login          => 'vsecure@user.id',
+      password       => '12345678901234567890', #vsecure gid
+
+      type           => 'CC',
       action         => 'Normal Authorization',
       description    => 'Business::OnlinePayment test',
       amount         => '49.95',
       action         => 'Normal Authorization',
       description    => 'Business::OnlinePayment test',
       amount         => '49.95',
@@ -455,7 +469,8 @@ from content(%content):
 
 =head1 COMPATIBILITY
 
 
 =head1 COMPATIBILITY
 
-Business::OnlinePayment::vSecureProcessing uses vSecureProcessing XML Document Version: 140901 (September 1, 2014).
+Business::OnlinePayment::vSecureProcessing uses vSecureProcessing XML Document
+Version: 140901 (September 1, 2014).
 
 See http://www.vsecureprocessing.com/ for more information.
 
 
 See http://www.vsecureprocessing.com/ for more information.
 
@@ -463,7 +478,7 @@ See http://www.vsecureprocessing.com/ for more information.
 
 Original author: Alex Brelsfoard
 
 
 Original author: Alex Brelsfoard
 
-Current maintainer: Alex Brelsfoard
+Current maintainer: Ivan Kohler <ivan-vsecureprocessing@freeside.biz>
 
 =head1 COPYRIGHT
 
 
 =head1 COPYRIGHT
 
@@ -489,4 +504,3 @@ perl(1). L<Business::OnlinePayment>.
 
 =cut
 
 
 =cut
 
-
diff --git a/t/00-load.t b/t/00-load.t
new file mode 100644 (file)
index 0000000..a79fa22
--- /dev/null
@@ -0,0 +1,10 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+    use_ok( 'Business::OnlinePayment::vSecureProcessing' ) || print "Bail out!
+";
+}
+
+diag( "Testing Business::OnlinePayment::vSecureProcessing $Business::OnlinePayment::vSecureProcessing::VERSION, Perl $], $^X" );
diff --git a/t/boilerplate.t b/t/boilerplate.t
new file mode 100644 (file)
index 0000000..50696af
--- /dev/null
@@ -0,0 +1,49 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+sub not_in_file_ok {
+    my ($filename, %regex) = @_;
+    open( my $fh, '<', $filename )
+        or die "couldn't open $filename for reading: $!";
+
+    my %violated;
+
+    while (my $line = <$fh>) {
+        while (my ($desc, $regex) = each %regex) {
+            if ($line =~ $regex) {
+                push @{$violated{$desc}||=[]}, $.;
+            }
+        }
+    }
+
+    if (%violated) {
+        fail("$filename contains boilerplate text");
+        diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
+    } else {
+        pass("$filename contains no boilerplate text");
+    }
+}
+
+sub module_boilerplate_ok {
+    my ($module) = @_;
+    not_in_file_ok($module =>
+        'the great new $MODULENAME'   => qr/ - The great new /,
+        'boilerplate description'     => qr/Quick summary of what the module/,
+        'stub function definition'    => qr/function[12]/,
+    );
+}
+
+  not_in_file_ok(README =>
+    "The README is used..."       => qr/The README is used/,
+    "'version information here'"  => qr/to provide version information/,
+  );
+
+  not_in_file_ok(Changes =>
+    "placeholder date/time"       => qr(Date/time)
+  );
+
+  module_boilerplate_ok('lib/Business/OnlinePayment/vSecureProcessing.pm');
+
index 69f8c89..7b10473 100644 (file)
@@ -2,14 +2,11 @@
 sub test_account {
     # fill all these fields in to test out transactions
     my %opts = (
 sub test_account {
     # fill all these fields in to test out transactions
     my %opts = (
-        server =>'', # be sure to leave out the 'https://'
+        login    => '', #userid
+        password => '', #gid
         platform => '',
         platform => '',
-        gid => '',
-        tid => '',
-        userid=> 'name@server.com',
-        port => 443,
-        env => 'test',
         appid => ''
         appid => ''
+        #tid => '',
     );
 
     return %opts;
     );
 
     return %opts;
diff --git a/t/manifest.t b/t/manifest.t
new file mode 100644 (file)
index 0000000..45eb83f
--- /dev/null
@@ -0,0 +1,13 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+unless ( $ENV{RELEASE_TESTING} ) {
+    plan( skip_all => "Author tests not required for installation" );
+}
+
+eval "use Test::CheckManifest 0.9";
+plan skip_all => "Test::CheckManifest 0.9 required" if $@;
+ok_manifest();
diff --git a/t/pod-coverage.t b/t/pod-coverage.t
new file mode 100644 (file)
index 0000000..c021dd4
--- /dev/null
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More skip_all => "don't care about POD coverage right now";
+
+# Ensure a recent version of Test::Pod::Coverage
+my $min_tpc = 1.08;
+eval "use Test::Pod::Coverage $min_tpc";
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
+    if $@;
+
+# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
+# but older versions don't recognize some common documentation styles
+my $min_pc = 0.18;
+eval "use Pod::Coverage $min_pc";
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
+    if $@;
+
+all_pod_coverage_ok();
diff --git a/t/pod.t b/t/pod.t
new file mode 100644 (file)
index 0000000..ee8b18a
--- /dev/null
+++ b/t/pod.t
@@ -0,0 +1,12 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();
diff --git a/t/t_00-load.t b/t/t_00-load.t
deleted file mode 100644 (file)
index a79fa22..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!perl -T
-
-use Test::More tests => 1;
-
-BEGIN {
-    use_ok( 'Business::OnlinePayment::vSecureProcessing' ) || print "Bail out!
-";
-}
-
-diag( "Testing Business::OnlinePayment::vSecureProcessing $Business::OnlinePayment::vSecureProcessing::VERSION, Perl $], $^X" );
diff --git a/t/t_boilerplate.t b/t/t_boilerplate.t
deleted file mode 100644 (file)
index 50696af..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#!perl -T
-
-use strict;
-use warnings;
-use Test::More tests => 3;
-
-sub not_in_file_ok {
-    my ($filename, %regex) = @_;
-    open( my $fh, '<', $filename )
-        or die "couldn't open $filename for reading: $!";
-
-    my %violated;
-
-    while (my $line = <$fh>) {
-        while (my ($desc, $regex) = each %regex) {
-            if ($line =~ $regex) {
-                push @{$violated{$desc}||=[]}, $.;
-            }
-        }
-    }
-
-    if (%violated) {
-        fail("$filename contains boilerplate text");
-        diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
-    } else {
-        pass("$filename contains no boilerplate text");
-    }
-}
-
-sub module_boilerplate_ok {
-    my ($module) = @_;
-    not_in_file_ok($module =>
-        'the great new $MODULENAME'   => qr/ - The great new /,
-        'boilerplate description'     => qr/Quick summary of what the module/,
-        'stub function definition'    => qr/function[12]/,
-    );
-}
-
-  not_in_file_ok(README =>
-    "The README is used..."       => qr/The README is used/,
-    "'version information here'"  => qr/to provide version information/,
-  );
-
-  not_in_file_ok(Changes =>
-    "placeholder date/time"       => qr(Date/time)
-  );
-
-  module_boilerplate_ok('lib/Business/OnlinePayment/vSecureProcessing.pm');
-
diff --git a/t/t_manifest.t b/t/t_manifest.t
deleted file mode 100644 (file)
index 45eb83f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!perl -T
-
-use strict;
-use warnings;
-use Test::More;
-
-unless ( $ENV{RELEASE_TESTING} ) {
-    plan( skip_all => "Author tests not required for installation" );
-}
-
-eval "use Test::CheckManifest 0.9";
-plan skip_all => "Test::CheckManifest 0.9 required" if $@;
-ok_manifest();
diff --git a/t/t_pod-coverage.t b/t/t_pod-coverage.t
deleted file mode 100644 (file)
index c021dd4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-use strict;
-use warnings;
-use Test::More skip_all => "don't care about POD coverage right now";
-
-# Ensure a recent version of Test::Pod::Coverage
-my $min_tpc = 1.08;
-eval "use Test::Pod::Coverage $min_tpc";
-plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
-    if $@;
-
-# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
-# but older versions don't recognize some common documentation styles
-my $min_pc = 0.18;
-eval "use Pod::Coverage $min_pc";
-plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
-    if $@;
-
-all_pod_coverage_ok();
diff --git a/t/t_pod.t b/t/t_pod.t
deleted file mode 100644 (file)
index ee8b18a..0000000
--- a/t/t_pod.t
+++ /dev/null
@@ -1,12 +0,0 @@
-#!perl -T
-
-use strict;
-use warnings;
-use Test::More;
-
-# Ensure a recent version of Test::Pod
-my $min_tp = 1.22;
-eval "use Test::Pod $min_tp";
-plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
-
-all_pod_files_ok();
diff --git a/t/t_transaction.t b/t/t_transaction.t
deleted file mode 100644 (file)
index 897e6f7..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use POSIX qw(strftime);
-use Test::More;
-use Business::OnlinePayment;
-require "t/lib/test_account.pl";
-
-my %opts = test_account('card');
-
-if (!$opts{'gid'} || !$opts{'appid'}) {
-  plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.",
-  1;
-  exit(0);
-}
-
-plan tests => 2;
-
-###
-# Purchase
-###
-my %content = (
-    appid          => $opts{'appid'},
-    action         => 'Normal Authorization',
-    description    => 'Business::OnlinePayment visa test',
-    card_number    => '4111111111111111',
-    cvv2           => '111',
-    expiration     => expiration_date(),
-    amount         => '24.42',
-    name           => 'Murphy Law',
-    email          => 'fake@acme.com',
-    address        => '123 Anystreet',
-    zip            => '84058',
-);
-
-my $tx = new Business::OnlinePayment( 'vSecureProcessing', \%opts );
-
-$tx->content( %content,
-              action => 'Normal Authorization' );
-
-$tx->test_transaction(1);
-
-$tx->submit;
-
-is( $tx->is_success, 1, 'purchase' )
-  or diag('Gateway error: '. $tx->error_message);
-
-###
-# Refund
-###
-my $auth = $tx->authorization;
-$tx = new Business::OnlinePayment( 'vSecureProcessing' );
-$tx->content( %content,
-              action => 'Credit',
-              authorization => $auth );
-$tx->test_transaction(1);
-
-$tx->submit;
-
-is( $tx->is_success, 1, 'refund' )
-  or diag('Gateway error: '. $tx->error_message);
-
-1;
diff --git a/t/t_transaction_decline.t b/t/t_transaction_decline.t
deleted file mode 100644 (file)
index 2e15eb2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use POSIX qw(strftime);
-use Test::More;
-use Business::OnlinePayment;
-require "t/lib/test_account.pl";
-
-my %opts = test_account('card');
-
-if (!$opts{'gid'} || !$opts{'appid'}) {
-  plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.",
-  1;
-  exit(0);
-}
-
-plan tests => 2;
-my %content = (
-    appid          => $opts{'appid'},
-    action         => 'Normal Authorization',
-    description    => 'Business::OnlinePayment visa test',
-    card_number    => '4111111111111112', # trigger failure
-    cvv2           => '111',
-    expiration     => expiration_date(),
-    amount         => '24.42',
-    name           => 'Murphy Law',
-    email          => 'fake@acme.com',
-    address        => '123 Anystreet',
-    zip            => '84058',
-);
-
-my $tx = new Business::OnlinePayment( 'vSecureProcessing', \%opts );
-
-$tx->content( %content );
-
-$tx->test_transaction(1);
-
-$tx->submit;
-
-is( $tx->is_success, 0, 'declined purchase')
-  or diag('Test transaction should have failed, but succeeded');
-is( $tx->failure_status, 'nsf', 'failure status' )
-  or diag('Failure status reported as '.$tx->failure_status);
-
-1;
diff --git a/t/transaction.t b/t/transaction.t
new file mode 100644 (file)
index 0000000..087bd02
--- /dev/null
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use POSIX qw(strftime);
+use Test::More;
+use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+
+my %opts = test_account('card');
+
+if (!$opts{'login'} || !$opts{'password'}) {
+  plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.",
+  1;
+  exit(0);
+}
+
+plan tests => 2;
+
+###
+# Purchase
+###
+my %content = (
+    login          => delete($opts{'login'}),
+    password       => delete($opts{'password'}),
+    action         => 'Normal Authorization',
+    description    => 'Business::OnlinePayment visa test',
+    card_number    => '4111111111111111',
+    cvv2           => '111',
+    expiration     => expiration_date(),
+    amount         => '24.42',
+    name           => 'Murphy Law',
+    email          => 'fake@acme.com',
+    address        => '123 Anystreet',
+    zip            => '84058',
+);
+
+my $tx = new Business::OnlinePayment( 'vSecureProcessing', %opts );
+
+$tx->content( %content );
+
+$tx->test_transaction(1);
+
+$tx->submit;
+
+is( $tx->is_success, 1, 'purchase' )
+  or diag('Gateway error: '. $tx->error_message);
+
+###
+# Refund
+###
+my $auth = $tx->authorization;
+$tx = new Business::OnlinePayment( 'vSecureProcessing', %opts );
+$tx->content( %content,
+              action => 'Credit',
+              authorization => $auth );
+$tx->test_transaction(1);
+
+$tx->submit;
+
+is( $tx->is_success, 1, 'refund' )
+  or diag('Gateway error: '. $tx->error_message);
+
+1;
diff --git a/t/transaction_decline.t b/t/transaction_decline.t
new file mode 100644 (file)
index 0000000..5f85874
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use POSIX qw(strftime);
+use Test::More;
+use Business::OnlinePayment;
+require "t/lib/test_account.pl";
+
+my %opts = test_account('card');
+
+if (!$opts{'login'} || !$opts{'password'}) {
+  plan skip_all => "no test credentials provided; fill out t/lib/test_account.pl to test communication with the gateway.",
+  1;
+  exit(0);
+}
+
+plan tests => 1; #2;
+my %content = (
+    login          => delete $opts{'login'},
+    password       => delete $opts{'password'},
+    action         => 'Normal Authorization',
+    description    => 'Business::OnlinePayment visa test',
+    card_number    => '4111111111111112', # trigger failure
+    cvv2           => '111',
+    expiration     => expiration_date(),
+    amount         => '24.42',
+    name           => 'Murphy Law',
+    email          => 'fake@acme.com',
+    address        => '123 Anystreet',
+    zip            => '84058',
+);
+
+my $tx = new Business::OnlinePayment( 'vSecureProcessing', %opts );
+
+$tx->content( %content );
+
+$tx->test_transaction(1);
+
+$tx->submit;
+
+is( $tx->is_success, 0, 'declined purchase')
+  or diag('Test transaction should have failed, but succeeded');
+#is( $tx->failure_status, 'nsf', 'failure status' )
+#  or diag('Failure status reported as '.$tx->failure_status);
+
+1;