From 71bc7dda5b9f0d6127e05706186466c58881c8c1 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 28 Feb 2008 00:51:58 +0000 Subject: [PATCH] 0.06! --- Changes | 3 ++ lib/Business/OnlinePayment/TransactionCentral.pm | 2 +- t/bad_card.t | 7 +++-- t/bad_check.t | 7 +++-- t/check.t | 7 +++-- t/credit_card.t | 7 +++-- t/credit_card_fs.t | 7 +++-- t/credit_card_onedigitmonth.t | 7 +++-- t/crypt_bad_card.t | 7 +++-- t/crypt_credit_card.t | 7 +++-- t/lib/test_account.pl | 40 ++++++++++++++++++++++++ t/order_number.t | 7 +++-- t/test_account | 2 ++ 13 files changed, 91 insertions(+), 19 deletions(-) create mode 100644 t/lib/test_account.pl create mode 100644 t/test_account diff --git a/Changes b/Changes index 96b93b0..f28a3ae 100644 --- 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 diff --git a/lib/Business/OnlinePayment/TransactionCentral.pm b/lib/Business/OnlinePayment/TransactionCentral.pm index d510255..fbc2a75 100644 --- a/lib/Business/OnlinePayment/TransactionCentral.pm +++ b/lib/Business/OnlinePayment/TransactionCentral.pm @@ -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 { diff --git a/t/bad_card.t b/t/bad_card.t index aa593bd..2d68880 100644 --- a/t/bad_card.t +++ b/t/bad_card.t @@ -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', diff --git a/t/bad_check.t b/t/bad_check.t index 8d56e55..5152762 100644 --- a/t/bad_check.t +++ b/t/bad_check.t @@ -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', diff --git a/t/check.t b/t/check.t index 7c83d60..4c133c4 100644 --- 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', diff --git a/t/credit_card.t b/t/credit_card.t index eccbf01..d65487b 100644 --- a/t/credit_card.t +++ b/t/credit_card.t @@ -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/credit_card_fs.t b/t/credit_card_fs.t index 8fa2ee2..bf41b03 100644 --- a/t/credit_card_fs.t +++ b/t/credit_card_fs.t @@ -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/credit_card_onedigitmonth.t b/t/credit_card_onedigitmonth.t index 336a9cf..53e9de2 100644 --- a/t/credit_card_onedigitmonth.t +++ b/t/credit_card_onedigitmonth.t @@ -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/crypt_bad_card.t b/t/crypt_bad_card.t index f1b23e6..b750d4b 100644 --- a/t/crypt_bad_card.t +++ b/t/crypt_bad_card.t @@ -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', diff --git a/t/crypt_credit_card.t b/t/crypt_credit_card.t index f813030..ddfed1f 100644 --- a/t/crypt_credit_card.t +++ b/t/crypt_credit_card.t @@ -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 index 0000000..c00b403 --- /dev/null +++ b/t/lib/test_account.pl @@ -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) = ; + 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; diff --git a/t/order_number.t b/t/order_number.t index 9d752a4..f6b2a2c 100644 --- a/t/order_number.t +++ b/t/order_number.t @@ -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 index 0000000..2e7e6e9 --- /dev/null +++ b/t/test_account @@ -0,0 +1,2 @@ +10011 +6BK9JNNR6MQY578Y -- 2.11.0