0.06! Business_OnlinePayment_TransactionCentral_0_06
authorivan <ivan>
Thu, 28 Feb 2008 00:51:58 +0000 (00:51 +0000)
committerivan <ivan>
Thu, 28 Feb 2008 00:51:58 +0000 (00:51 +0000)
13 files changed:
Changes
lib/Business/OnlinePayment/TransactionCentral.pm
t/bad_card.t
t/bad_check.t
t/check.t
t/credit_card.t
t/credit_card_fs.t
t/credit_card_onedigitmonth.t
t/crypt_bad_card.t
t/crypt_credit_card.t
t/lib/test_account.pl [new file with mode: 0644]
t/order_number.t
t/test_account [new file with mode: 0644]

diff --git a/Changes b/Changes
index 96b93b0..f28a3ae 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Perl extension Business::OnlinePayment::TransactionCentral.
 
+0.06  Wed Feb 27 16:49:17 PST 2008
+        - update tests with new regkey for TC test account
+
 0.05  Wed Nov 14 13:26:38 PST 2007
         - add email->Email mapping
 
index d510255..fbc2a75 100644 (file)
@@ -8,7 +8,7 @@ use Business::OnlinePayment::HTTPS 0.02;
 use vars qw($VERSION @ISA $DEBUG);
 
 @ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.05';
+$VERSION = '0.06';
 $DEBUG = 0;
 
 sub set_defaults {
index aa593bd..2d68880 100644 (file)
@@ -10,6 +10,9 @@ if ( $@ ) {
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $tx = new Business::OnlinePayment("TransactionCentral");
 
 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
@@ -19,8 +22,8 @@ $Business::OnlinePayment::TransactionCentral::DEBUG = 1;
 
 $tx->content(
     type           => 'VISA',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     amount         => '32.32',
     #card_number    => '4012000000001',
index 8d56e55..5152762 100644 (file)
@@ -9,12 +9,15 @@ BEGIN { $| = 1; print "1..1\n"; }
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $ctx = new Business::OnlinePayment("TransactionCentral");
 
 $ctx->content(
     type           => 'ECHECK',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     amount         => '49.95',
     invoice_number => '100100',
index 7c83d60..4c133c4 100644 (file)
--- a/t/check.t
+++ b/t/check.t
@@ -2,6 +2,9 @@ BEGIN { $| = 1; print "1..1\n"; }
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $ctx = Business::OnlinePayment->new("TransactionCentral");
 
 #$Business::OnlinePayment::TransactionCentral::DEBUG = 1;
@@ -9,8 +12,8 @@ my $ctx = Business::OnlinePayment->new("TransactionCentral");
 
 $ctx->content(
     type           => 'CHECK',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     amount         => '49.95',
     invoice_number => '100100',
index eccbf01..d65487b 100644 (file)
@@ -7,6 +7,9 @@ if ( $@ ) {
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $tx = new Business::OnlinePayment("TransactionCentral");
 
 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
@@ -16,8 +19,8 @@ my $tx = new Business::OnlinePayment("TransactionCentral");
 
 $tx->content(
     type           => 'VISA',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     description    => 'Business::OnlinePayment::TransactionCentral test',
     amount         => '32',
index 8fa2ee2..bf41b03 100644 (file)
@@ -7,6 +7,9 @@ if ( $@ ) {
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $tx = new Business::OnlinePayment("TransactionCentral");
 
 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
@@ -16,8 +19,8 @@ my $tx = new Business::OnlinePayment("TransactionCentral");
 
 $tx->content(
     type           => 'VISA',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     description    => 'Business::OnlinePayment::TransactionCentral test',
     amount         => '32',
index 336a9cf..53e9de2 100644 (file)
@@ -7,6 +7,9 @@ if ( $@ ) {
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $tx = new Business::OnlinePayment("TransactionCentral");
 
 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
@@ -16,8 +19,8 @@ my $tx = new Business::OnlinePayment("TransactionCentral");
 
 $tx->content(
     type           => 'VISA',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     description    => 'Business::OnlinePayment::TransactionCentral test',
     amount         => '32',
index f1b23e6..b750d4b 100644 (file)
@@ -14,12 +14,15 @@ if ( $@ ) {
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $tx = new Business::OnlinePayment("TransactionCentral");
 
 $tx->content(
     type           => 'VISA',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     amount         => '32.32',
     #card_number    => '4012000000001',
index f813030..ddfed1f 100644 (file)
@@ -11,6 +11,9 @@ if ( $@ ) {
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $tx = new Business::OnlinePayment("TransactionCentral");
 
 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
@@ -20,8 +23,8 @@ my $tx = new Business::OnlinePayment("TransactionCentral");
 
 $tx->content(
     type           => 'VISA',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     description    => 'Business::OnlinePayment::TransactionCentral test',
     amount         => '54.01',
diff --git a/t/lib/test_account.pl b/t/lib/test_account.pl
new file mode 100644 (file)
index 0000000..c00b403
--- /dev/null
@@ -0,0 +1,40 @@
+sub test_account_or_skip {
+    my $suffix = shift;
+    my($login, $password) = test_account($suffix);
+
+    unless( defined $login ) {
+        #plan skip_all => "No test account";
+        #not (yet?) using Test::More
+        print "ok 1 # Skipped: No test account\n";
+        exit;
+    }
+
+    return($login, $password);
+}
+
+sub test_account {
+    my $suffix = shift || '';
+    $suffix = "_$suffix" if $suffix;
+    open TEST_ACCOUNT, "t/test_account$suffix" or return;
+    my($login, $password) = <TEST_ACCOUNT>;
+    chomp $login;
+    chomp $password;
+
+    return($login, $password);
+}
+
+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);
+}
+
+sub tomorrow {
+    my($day, $month, $year) = (localtime(time+86400))[3..5];
+    return sprintf("%04d-%02d-%02d", $year+1900, ++$month, $day);
+}
+
+1;
index 9d752a4..f6b2a2c 100644 (file)
@@ -7,6 +7,9 @@ if ( $@ ) {
 
 use Business::OnlinePayment;
 
+require "t/lib/test_account.pl";
+my($login, $regkey) = test_account_or_skip();
+
 my $tx = new Business::OnlinePayment("TransactionCentral");
 
 #$Business::OnlinePayment::HTTPS::DEBUG = 1;
@@ -16,8 +19,8 @@ my $tx = new Business::OnlinePayment("TransactionCentral");
 
 $tx->content(
     type           => 'VISA',
-    login          => '10011',
-    password       => 'KK48NPYEJHMAH6DK', #regkey
+    login          => $login,
+    password       => $regkey,
     action         => 'Normal Authorization',
     description    => 'Business::OnlinePayment::TransactionCentral test',
     amount         => '32',
diff --git a/t/test_account b/t/test_account
new file mode 100644 (file)
index 0000000..2e7e6e9
--- /dev/null
@@ -0,0 +1,2 @@
+10011
+6BK9JNNR6MQY578Y